:root {
    font: 15px/1.55 system-ui, sans-serif;
    color: #1d342e;
    overflow-wrap: anywhere;
    background: #f3f6f3;
    --green: #165b47;
    --line: #dce6df;
    --muted: #526760;
}
* { box-sizing: border-box; }
body { margin: 0; }
.header { min-height: 72px; padding: 14px clamp(16px, 4vw, 56px); background: #103d31; color: white; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 28px; }
.brand { font-size: 1.12rem; letter-spacing: -.025em; }
.brand strong { color: #bce2ba; }
.header nav { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-left: auto; }
.header a { color: white; }
.page { max-width: 1540px; margin: auto; padding: clamp(14px, 3vw, 36px); }
.workspace { display: grid; align-items: start; }
.card, dialog { background: white; border: 1px solid var(--line); border-radius: 16px; padding: clamp(16px, 2vw, 28px); }
.sidebar { overflow-wrap: anywhere; padding: 16px; }
.narrow, .login { max-width: 720px; margin: 0 auto; }
.login { max-width: 425px; margin-top: 6vh; }
h1, h2 { line-height: 1.2; overflow-wrap: anywhere; letter-spacing: -.025em; }
h1 { margin: 10px 0 20px; font-size: clamp(1.55rem, 4vw, 2.18rem); }
h2 { font-size: 1.15rem; }
a, .link-button { color: var(--green); font-weight: 650; text-decoration: none; }
a:hover, .link-button:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #a26b14; outline-offset: 3px; }
.tree { list-style: none; padding-inline-start: clamp(5px, 1.4vw, 14px); margin: 2px 0; }
.tree .tree .tree .tree .tree .tree .tree .tree { padding-inline-start: 0; }
.tree summary { cursor: pointer; padding: 3px 0; }
[aria-current="page"] { background: #e5f2e9; border-radius: 5px; padding: 3px 5px; }
.crumbs,.toolbar,.inline,.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.crumbs { overflow-wrap: anywhere; }
.toolbar { margin: 10px 0 16px; }
.preview .toolbar, .narrow > .toolbar { justify-content: space-between; }
.pagination { margin-top: 16px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stack > button { justify-self: start; }
label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
[hidden] { display: none !important; }
button, input, select, textarea, .button { font: inherit; border-radius: 8px; padding: 8px 12px; }
input, select, textarea { border: 1px solid #afc0b6; background: white; color: inherit; min-width: 0; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
button, .button { border: 1px solid var(--green); background: var(--green); color: white; font-weight: 650; cursor: pointer; }
.secondary { color: var(--green); background: #edf5ef; border-color: #c7dbcf; }
.danger { background: #fff3ef; color: #892a22; border-color: #eaccc8; }
.link-button { background: transparent; border: 0; padding: 0; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: #f3f7f4; }
.filename { overflow-wrap: anywhere; }

.actions a { margin-right: 10px; }
.empty, .muted { color: var(--muted); }
.empty { padding-block: 18px; }
.notice { background: #e4f4e9; padding: 12px 16px; border-radius: 8px; margin: 0 0 12px; }
.error { background: #fde8e4; padding-inline-start: 34px; }
dialog { width: min(480px, 92vw); max-height: calc(100dvh - 24px); overflow: auto; }
dialog::backdrop { background: #0c2a22a6; }
.document-list { list-style: none; padding: 0; }
.document-list li { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.preview { max-width: 1100px; margin: 0 auto; }
.preview iframe { width: 100%; height: 72vh; border: 1px solid var(--line); }
.preview img { display: block; max-width: 100%; max-height: 75vh; margin: auto; object-fit: contain; }
.page-size { margin-left: auto; }
.actions .link-button + .link-button { margin-left: 10px; }
.delete-link { color: #892a22; }

.folder-panel > summary {
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 8px 0;
}
.folder-tree { max-height: 60vh; overflow: auto; padding: 3px; }

@media (max-width: 820px) {
    .header { gap: 4px 12px; }
    .header .brand { flex: 1; min-width: 0; overflow-wrap: anywhere; }
    .header nav { order: 1; flex: 1 0 100%; margin-left: 0; gap: 0 14px; }
    .header nav a { display: inline-flex; align-items: center; min-height: 40px; }
    .folder-tree { max-height: 28vh; }
    .tree summary { padding-block: 8px; }
    .file-search { flex: 1 0 100%; }
    .file-search input[name="q"] { flex: 1 1 130px; width: 100%; }
    input, select, textarea { font-size: 16px; }
    button, .button, select { min-height: 40px; }
    .preview iframe { height: 65vh; }
}

@media (max-width: 480px) {
    .page { padding: 10px; }
    .card { padding: 13px; }
    .file-table th, .file-table td { padding-inline: 5px; }
    .page-size { flex: 1 0 100%; justify-content: flex-end; }
}

.user-directory { max-width: 1050px; margin-inline: auto; }
.user-directory h1 { margin-bottom: 12px; }
.user-directory-header { border-top: 1px solid var(--line); padding-top: 12px; }
.user-directory-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 10px;
    margin: 16px 0 12px;
}
.user-table { table-layout: fixed; }
.user-table th:first-child { width: 22%; }
.user-table .account-email { width: 29%; }
.user-table .account-role { width: 17%; }
.user-table .account-status { width: 12%; }
.user-table td { overflow-wrap: anywhere; }
.user-table tbody tr:nth-child(even) { background: #f3f7f4; }
.user-table .button { display: inline-flex; align-items: center; }
.account-meta { display: none; }
.user-directory-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    margin-top: 14px;
}
.user-directory-footer .pagination { margin: 0; }

@media (max-width: 600px) {
    .user-directory-filters { grid-template-columns: minmax(0, 1fr) auto; }
    .user-directory-filters label:first-child { grid-column: 1 / -1; }
    .user-table .account-email, .user-table .account-role, .user-table .account-status { display: none; }
    .user-table th:first-child { width: 68%; }
    .account-meta { display: block; font-size: .85rem; }
}


.account-actions { gap: 6px; }
.short-link-table th:first-child { width: 28%; }
.short-link-table th:last-child { width: 24%; }

@media (max-width: 600px) {
    .short-link-table th:first-child { width: 31%; }
    .short-link-table th:last-child { width: 34%; }
    .short-link-table td, .short-link-table th { padding-inline: 5px; }
    .short-link-table button { padding-inline: 6px; }
}

.short-link-list { margin-top: 14px; }

.short-link-dialog { width: min(720px, 94vw); }
.short-link-dialog > h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); margin: 0 0 16px; }
.short-link-fields { min-width: 0; display: grid; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.short-link-fields legend { font-weight: 700; padding: 0 6px; }

.short-link-address { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 10px; }
.short-link-address > span { padding-bottom: 10px; color: var(--muted); }

@media (max-width: 520px) {
    .short-link-address { grid-template-columns: minmax(0, 1fr); }
    .short-link-address > span { display: none; }
}

.short-url a { color: #195586; text-decoration: underline; overflow-wrap: anywhere; }
.copy-link-icon {
    display: inline-grid;
    position: relative;
    place-items: center;
    width: 18px;
    min-height: 22px;
    margin-inline-start: 4px;
    vertical-align: middle;
    padding: 0;
    border: 0;
    color: #195586;
    background: transparent;
}
.copy-link-icon::before, .copy-link-icon::after {
    content: '';
    width: 8px;
    height: 11px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    position: absolute;
}
.copy-link-icon::before { transform: translate(-2px, 2px); }
.copy-link-icon::after { transform: translate(2px, -2px); background: #fff; }
.copy-link-icon:hover { background: #e5f0f7; }
.copy-link-status { color: var(--muted); font-size: .8rem; }

.folder-access-table th:first-child { width: 43%; }
.folder-access-table th:last-child { width: 18%; }
.folder-access-person > span:last-child { display: block; }
.folder-access-person + .folder-access-person { margin-top: 6px; }

@media (max-width: 600px) {
    .folder-access-table th:first-child { width: 36%; }
    .folder-access-table th:last-child { width: 26%; }
    .folder-access-table th, .folder-access-table td { padding-inline: 5px; }
    .folder-access-table .button { padding-inline: 8px; }
}

.wrapped-field {
    display: block;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-wrap: anywhere;
}
.audit-table { table-layout: fixed; }

@media (max-width: 600px) {
    .audit-table, .audit-table tbody, .audit-table tr { display: block; }
    .audit-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .audit-table tr { padding-block: 8px; border-bottom: 1px solid var(--line); }
    .audit-table td { display: block; border: 0; padding: 3px 0; }
    .audit-table td[data-label] { display: grid; grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); gap: 8px; }
    .audit-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 650; }
}

.file-workspace {
    grid-template-columns: clamp(150px, var(--folder-width, 230px), min(600px, 50%)) 12px minmax(0, 1fr);
    font-size: 13px;
}
.file-workspace .sidebar, .file-workspace .explorer { min-width: 0; }
.file-workspace .sidebar { padding: 10px; }
.file-workspace .folder-panel > summary { font-size: 14px; }
.file-workspace .folder-tree {
    font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
    white-space: nowrap;
}
.file-workspace .folder-tree a { color: #243530; font-weight: 400; }
.file-workspace .folder-tree > .tree { min-width: max-content; }
.file-workspace .tree summary { padding-block: 3px; }
.file-workspace .crumbs { flex-wrap: nowrap; white-space: nowrap; overflow-x: auto; }
.file-workspace .explorer h1 { font-size: 1.25rem; white-space: nowrap; overflow-x: auto; }
.file-scroll { padding: 1px; }
.file-table {
    width: 100%;
    font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
    white-space: nowrap;
    overflow-wrap: normal;
}
.file-table th { font-weight: 500; }
.file-table th, .file-table td { padding: 3px 9px; }
.file-table .filename {
    color: #243530;
    font-weight: 400;
    overflow-wrap: normal;
}
.file-table .file-size { color: var(--muted); }
.file-table td.file-size { text-align: right; font-variant-numeric: tabular-nums; }
.file-table .file-size, .file-table .actions { width: 1%; }
.file-table .actions .file-action {
    display: inline-grid;
    place-items: center;
    width: 27px;
    min-height: 27px;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--green);
    vertical-align: middle;
}
.file-table .actions .delete-link { color: #892a22; }
.file-table .actions .file-action:hover { background: #edf5ef; border-color: var(--line); }
.folder-resize {
    align-self: stretch;
    cursor: col-resize;
    touch-action: none;
    background: linear-gradient(var(--line), var(--line)) center / 2px 100% no-repeat;
}
.folder-resize:hover, .folder-resize:focus-visible { background-color: #e5f2e9; }
.file-workspace.is-resizing { user-select: none; cursor: col-resize; }

@media (max-width: 620px) {
    .file-workspace { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .folder-resize { display: none; }
    .file-table .actions .file-action { width: 34px; min-height: 34px; }
}

.shared-view { max-width: none; padding: clamp(8px, 2vw, 24px); }
.shared-view .preview { max-width: none; padding: clamp(10px, 2vw, 22px); }
.shared-view .preview .toolbar { margin-top: 0; margin-bottom: 10px; }
.shared-view .preview .toolbar h1 { margin: 0; font-size: clamp(1rem, 3vw, 1.5rem); }
.shared-view .preview iframe { display: block; height: 82dvh; }

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand img {
    flex: none;
    width: 30px;
    height: 30px;
    padding: 3px;
    background: #fff;
    border-radius: 6px;
    object-fit: contain;
}
.login-layout-with-cover {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(16px, 4vw, 48px);
    max-width: 960px;
    margin: clamp(12px, 5vh, 48px) auto 0;
}
.login-layout-with-cover .login { width: 100%; margin: 0 auto; }
.login-cover {
    display: block;
    width: 100%;
    height: clamp(220px, 48vh, 450px);
    object-fit: cover;
    border-radius: 16px;
}
@media (max-width: 640px) {
    .login-layout-with-cover { grid-template-columns: minmax(0, 1fr); max-width: 425px; }
    .login-cover { height: clamp(120px, 25vh, 220px); }
}

.bulk-toolbar {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    white-space: nowrap;
    overflow-x: auto;
    padding: 3px;
}
.bulk-toolbar .bulk-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    height: 34px;
    padding: 0;
}
.bulk-toolbar [data-bulk-operation="delete"] { color: #892a22; }
.action-icon {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
}
.file-table .file-select { width: 1%; text-align: center; }
.file-select input {
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
    accent-color: var(--green);
    cursor: pointer;
}
.bulk-toolbar button:disabled { opacity: .55; cursor: default; }

.admin-action-row, .account-actions { flex-wrap: nowrap; }

.page:has(> :is(.file-workspace, .user-directory, .admin-detail)) {
    max-width: none;
    padding-inline: clamp(10px, 1.5vw, 24px);
}
.user-directory { max-width: none; }
.admin-detail { margin-inline: 0 auto; }
:is(.file-workspace, .user-directory, .admin-detail) {
    font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
}
:is(.user-directory, .admin-detail) h1 { font-size: 1.25rem; }
.user-directory .user-table th { font-weight: 500; }
.user-directory .user-table :is(th, td) { padding: 3px 9px; }
.user-directory .user-table :is(td a:not(.button), td strong, .account-meta) {
    font-weight: 400;
    font-size: inherit;
}
.user-directory .user-table .action-icon {
    display: inline-grid;
    place-items: center;
    width: 27px;
    min-width: 27px;
    height: 27px;
    min-height: 27px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--green);
}
.user-directory .user-table .action-icon.danger { color: #892a22; }
.user-directory .user-table .action-icon:hover {
    background: #edf5ef;
    border-color: var(--line);
}
@media (max-width: 620px) {
    .user-directory .user-table .action-icon {
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
    }
    .user-directory .user-table :is(th, td) { padding-inline: 5px; }
}
