:root {
    --breez-blue: #124e91;
    --breez-blue-deep: #0a3a6e;
    --breez-blue-soft: #e8f1fa;
    --breez-blue-mid: #3a7cc0;
    --ink: #1a2332;
    --ink-muted: #5c6b7a;
    --line: rgba(18, 78, 145, 0.12);
    --surface: rgba(255, 255, 255, 0.86);
    --surface-solid: #ffffff;
    --danger: #c62828;
    --radius: 12px;
    --font: "Manrope", "Segoe UI", sans-serif;
    --shadow: 0 12px 40px rgba(10, 58, 110, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body.docs-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 8% -10%, rgba(58, 124, 192, 0.22), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(18, 78, 145, 0.14), transparent 50%),
        linear-gradient(165deg, #f4f7fb 0%, #e9eef5 45%, #f7f9fc 100%);
    background-attachment: fixed;
}

.docs-shell {
    width: min(1440px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    animation: docs-rise 0.45s ease both;
}

.docs-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
}

.docs-brand__mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--breez-blue-mid), var(--breez-blue-deep));
    display: grid;
    place-items: center;
    box-shadow: 0 8px 20px rgba(18, 78, 145, 0.25);
}

.docs-brand__mark img {
    width: 26px;
    height: 26px;
    filter: brightness(0) invert(1);
}

.docs-brand__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.docs-brand__name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--breez-blue-deep);
    line-height: 1.2;
}

.docs-brand__sub {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}

.docs-panel {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: docs-rise 0.55s ease 0.05s both;
}

.docs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem 1.25rem;
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(232, 241, 250, 0.45));
}

.docs-toolbar > nav {
    flex: 1 1 auto;
    min-width: 0;
}

.docs-toolbar__aside {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    flex: 0 1 auto;
}

.docs-download--toolbar {
    flex: 0 0 auto;
}

.docs-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
}

.docs-breadcrumb li {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--ink-muted);
    max-width: 100%;
}

.docs-breadcrumb li + li::before {
    content: "";
    display: inline-block;
    width: 0.35rem;
    height: 0.35rem;
    margin: 0 0.55rem;
    border-right: 1.5px solid var(--ink-muted);
    border-top: 1.5px solid var(--ink-muted);
    transform: rotate(45deg);
    opacity: 0.55;
    flex: 0 0 auto;
}

.docs-breadcrumb a {
    color: var(--breez-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.docs-breadcrumb a:hover {
    color: var(--breez-blue-deep);
}

.docs-breadcrumb .is-active {
    color: var(--ink);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(520px, 55vw);
}

.docs-breadcrumb__home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    background: var(--breez-blue-soft);
    color: var(--breez-blue);
}

.docs-breadcrumb__home:hover {
    background: #d7e7f6;
}

.docs-search {
    display: flex;
    align-items: stretch;
    flex: 0 0 280px;
    margin-left: auto;
}

.docs-search .searchTerm {
    flex: 1;
    height: 2.4rem;
    border: 1px solid var(--line);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 0 0.85rem;
    outline: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    background: var(--surface-solid);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.docs-search .searchTerm::placeholder {
    color: #8a9aab;
}

.docs-search .searchTerm:focus {
    border-color: var(--breez-blue-mid);
    box-shadow: 0 0 0 3px rgba(18, 78, 145, 0.12);
}

.docs-search .searchButton {
    width: 2.6rem;
    border: 1px solid var(--breez-blue);
    border-radius: 0 8px 8px 0;
    background: var(--breez-blue);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.docs-search .searchButton svg {
    display: block;
}

.docs-search .searchButton:hover {
    background: var(--breez-blue-deep);
}

.docs-table-wrap {
    overflow-x: auto;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.docs-table thead th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}

.docs-table tbody tr {
    transition: background 0.15s ease;
}

.docs-table tbody tr:hover {
    background: rgba(232, 241, 250, 0.65);
}

.docs-table tbody td {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
    vertical-align: middle;
}

.docs-table tbody tr:last-child td {
    border-bottom: none;
}

.docs-table__name {
    min-width: 240px;
}

.docs-table__meta {
    width: 8rem;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.docs-table__actions {
    width: 11rem;
    white-space: nowrap;
}

.docs-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-solid);
    color: var(--breez-blue);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.docs-download:hover {
    background: var(--breez-blue-soft);
    border-color: rgba(18, 78, 145, 0.28);
    color: var(--breez-blue-deep);
}

.docs-download svg {
    flex: 0 0 auto;
}

.docs-item {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    max-width: 100%;
}

.docs-item:hover {
    color: var(--breez-blue);
}

.docs-item:hover .docs-item__icon {
    transform: translateY(-1px);
    background: #d7e7f6;
}

.docs-item__icon {
    flex: 0 0 auto;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--breez-blue-soft);
    color: var(--breez-blue);
    transition: transform 0.18s ease, background 0.18s ease;
}

.docs-item__icon--file {
    background: #eef2f6;
    color: var(--breez-blue-deep);
}

.docs-item__icon--image {
    background: #eef6ff;
    color: #1565c0;
}

.docs-item__icon--pdf {
    background: #fdecea;
    color: #c62828;
}

.docs-item__icon--zip {
    background: #fff4e5;
    color: #ef6c00;
}

.docs-item__icon--excel {
    background: #e8f5e9;
    color: #2e7d32;
}

.docs-item__icon--powerpoint {
    background: #fbe9e7;
    color: #d84315;
}

.docs-item__icon--word {
    background: #e3f2fd;
    color: #1565c0;
}

.docs-item__icon--up {
    background: transparent;
    border: 1px dashed var(--line);
    color: var(--ink-muted);
}

.docs-item__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-item__thumb-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 6px;
    overflow: hidden;
    background: #eef2f6;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.docs-item__thumb {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.docs-item__thumb-wrap.is-loaded .docs-item__thumb {
    opacity: 1;
}

.docs-item:hover .docs-item__thumb-wrap {
    transform: translateY(-1px);
    border-color: rgba(18, 78, 145, 0.28);
}

@keyframes docs-skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.docs-thumb-skeleton {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(90deg, #e4ebf3 0%, #f4f7fb 42%, #e4ebf3 84%);
    background-size: 200% 100%;
    animation: docs-skeleton-shimmer 1.15s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

[data-thumb-frame].is-loaded .docs-thumb-skeleton,
[data-thumb-frame].is-error .docs-thumb-skeleton {
    opacity: 0;
    animation: none;
}

[data-thumb-frame].is-error {
    background: #eef2f6;
}

.docs-view-toggle {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-solid);
    flex: 0 0 auto;
}

.docs-view-toggle__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.4rem 0.7rem;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.docs-view-toggle__btn + .docs-view-toggle__btn {
    border-left: 1px solid var(--line);
}

.docs-view-toggle__btn[aria-pressed="true"] {
    background: var(--breez-blue-soft);
    color: var(--breez-blue-deep);
}

.docs-view-toggle__btn:hover {
    color: var(--breez-blue);
}

.docs-listing {
    position: relative;
}

.docs-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 0.85rem;
    padding: 1rem 1.15rem 1.25rem;
}

.docs-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-solid);
    padding: 0.55rem;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

.docs-tile:hover {
    border-color: rgba(18, 78, 145, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(10, 58, 110, 0.08);
    color: var(--breez-blue-deep);
}

.docs-tile__preview {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(160deg, #eef4fa, #e4ebf3);
    display: grid;
    place-items: center;
    color: var(--breez-blue);
}

.docs-tile__preview img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f7f9fc;
    display: block;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.docs-tile__preview.is-loaded img {
    opacity: 1;
}

.docs-tile--dir .docs-tile__preview {
    background: var(--breez-blue-soft);
}

.docs-tile--up .docs-tile__preview {
    background: transparent;
    border: 1px dashed var(--line);
    color: var(--ink-muted);
}

.docs-tile__name {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ## Папки: имя всегда целиком, с переносом */
.docs-tile--dir .docs-tile__name {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.docs-tile__actions {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 3;
}

.docs-tile__dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    color: var(--breez-blue);
    cursor: pointer;
    opacity: 1;
    box-shadow: 0 1px 4px rgba(10, 58, 110, 0.12);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.docs-tile__dl:hover,
.docs-tile__dl:focus {
    background: var(--breez-blue-soft);
    border-color: rgba(18, 78, 145, 0.28);
    outline: none;
}

html[data-view-mode="table"] body [data-view-panel="tiles"],
body[data-view-mode="table"] [data-view-panel="tiles"],
html[data-view-mode="tiles"] body [data-view-panel="table"],
body[data-view-mode="tiles"] [data-view-panel="table"] {
    display: none !important;
}

html[data-view-mode="tiles"] body [data-view-panel="tiles"],
body[data-view-mode="tiles"] [data-view-panel="tiles"] {
    display: grid !important;
}

.docs-empty-cell {
    color: #b0bac5;
}

.no-results {
    display: none;
    margin: 0;
    padding: 2rem 1.15rem;
    text-align: center;
    color: var(--danger);
    font-weight: 600;
}

@keyframes docs-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .docs-shell {
        width: calc(100% - 1.25rem);
        padding-top: 1rem;
    }

    .docs-header {
        margin-bottom: 1rem;
    }

    .docs-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .docs-toolbar__aside {
        width: 100%;
    }

    .docs-search {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }

    .docs-view-toggle {
        width: 100%;
    }

    .docs-view-toggle__btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .docs-table__meta {
        display: none;
    }

    .docs-tiles {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: 0.85rem;
    }

    .docs-tile__dl {
        opacity: 1;
    }
}
