:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #17191d;
  --muted: #6f747d;
  --line: #e5e7eb;
  --soft: #eef0f3;
  --accent: #4e5bf2;
  --accent-dark: #3946dc;
  --accent-text: #4e5bf2;
  --danger: #d04444;
  --input-line: #d9dce2;
  --hover: #fafbff;
  --selected: #eef0ff;
  --soft-hover: #e4e6ea;
  --subtle-panel: #fafafa;
  --row-line: #eff0f2;
  --danger-soft: #fff0f0;
  --login-bg: #f7f7f9;
  --login-glow: #eef0ff;
  --login-panel: rgba(255,255,255,.94);
  --login-line: rgba(255,255,255,.8);
  --topbar-bg: rgba(255,255,255,.92);
  --drop-bg: rgba(239,240,255,.92);
  --folder-bg: #fff1c9;
  --folder-color: #ae7917;
  --image-bg: #e6f6ef;
  --image-color: #27845f;
  --video-bg: #eee9ff;
  --video-color: #7558c8;
  --audio-bg: #e4f4fb;
  --audio-color: #307c9e;
  --pdf-bg: #ffebeb;
  --pdf-color: #c54848;
  --shadow: 0 18px 50px rgba(21, 26, 38, .11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1e26;
  --text: #eceef5;
  --muted: #a1a8b7;
  --line: #343947;
  --soft: #282d39;
  --accent-text: #a5adff;
  --danger: #ff8f8f;
  --input-line: #414859;
  --hover: #232836;
  --selected: #292f4c;
  --soft-hover: #363d4d;
  --subtle-panel: #20232c;
  --row-line: #2b303c;
  --danger-soft: #44292e;
  --login-bg: #111318;
  --login-glow: #252b49;
  --login-panel: rgba(27,30,38,.94);
  --login-line: #343947;
  --topbar-bg: rgba(27,30,38,.94);
  --drop-bg: rgba(26,30,48,.94);
  --folder-bg: #43371e;
  --folder-color: #edc46e;
  --image-bg: #1e3b31;
  --image-color: #73d3a5;
  --video-bg: #342948;
  --video-color: #bea0ff;
  --audio-bg: #1c3542;
  --audio-color: #75c9ed;
  --pdf-bg: #44292e;
  --pdf-color: #ff9c9c;
  --shadow: 0 18px 50px rgba(0,0,0,.32);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.login-page { background: radial-gradient(circle at 20% 0%, var(--login-glow) 0, transparent 42%), var(--login-bg); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 430px); background: var(--login-panel); border: 1px solid var(--login-line); border-radius: 24px; padding: 38px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--accent); color: white; font-size: 25px; font-weight: 750; box-shadow: 0 10px 24px rgba(78,91,242,.27); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; box-shadow: none; }
.eyebrow { margin: 28px 0 8px; color: var(--accent-text); font-size: 12px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.login-copy h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.login-copy > p:last-child { color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 16px; margin-top: 28px; }
.login-form label, .create-user-form > label:not(.check-row) { display: grid; gap: 7px; color: #3f444d; font-size: 13px; font-weight: 650; }
input[type="text"], input[type="password"], input[type="search"], input:not([type]) { min-width: 0; border: 1px solid var(--input-line); border-radius: 11px; background: var(--panel); color: var(--text); padding: 11px 13px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,91,242,.12); }
.button { min-height: 38px; border: 0; border-radius: 10px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 680; font-size: 13px; cursor: pointer; text-decoration: none; transition: transform .1s, background .15s, opacity .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { background: var(--accent); color: white; box-shadow: 0 7px 16px rgba(78,91,242,.2); }
.button.primary:hover { background: var(--accent-dark); }
.button.ghost { background: var(--soft); color: var(--text); box-shadow: none; }
.button.ghost:hover { background: var(--soft-hover); }
.button.wide { width: 100%; min-height: 45px; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; line-height: 1.4; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; position: sticky; top: 0; z-index: 20; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--topbar-bg); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 780; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.search-wrap { width: min(28vw, 300px); height: 39px; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: var(--soft); border-radius: 10px; color: var(--muted); }
.search-wrap input { width: 100%; border: 0; background: transparent; padding: 0; box-shadow: none; }
.search-wrap input:focus { box-shadow: none; }
.avatar { width: 35px; height: 35px; border: 0; border-radius: 50%; display: inline-grid; place-items: center; background: #e8eaff; color: var(--accent-dark); font-weight: 760; cursor: pointer; }
.account-button { display: flex; gap: 7px; align-items: center; border: 0; background: transparent; padding: 8px 4px; cursor: pointer; font-size: 13px; }
.menu { position: absolute; right: max(24px, calc((100vw - 1240px) / 2)); top: 58px; width: 280px; max-width: calc(100vw - 48px); padding: 13px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font-size: 13px; }
.menu p { margin: 2px 4px 12px; color: var(--muted); }
.menu button { width: 100%; border: 0; border-radius: 8px; padding: 9px; text-align: left; background: var(--soft); cursor: pointer; }
.theme-control { min-width: 0; margin: 0; padding: 0; border: 0; color: var(--muted); font-size: 13px; }
.theme-control legend { margin-bottom: 9px; padding: 0; font-weight: 650; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.theme-options label { position: relative; min-width: 0; cursor: pointer; }
.theme-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-options span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border-radius: 7px; font-size: 12px; font-weight: 650; }
.theme-options svg { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.theme-options label:hover span { color: var(--text); }
.theme-options input:checked + span { background: var(--panel); color: var(--accent-text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.theme-options input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.menu .theme-control { margin: 16px 4px; }
.login-card > .theme-control { margin-top: 24px; }
.content-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; min-height: 54px; margin-bottom: 20px; }
.breadcrumbs { display: flex; align-items: center; gap: 9px; min-width: 0; overflow: hidden; }
.breadcrumbs button { max-width: 260px; border: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; background: transparent; font-size: 24px; font-weight: 740; letter-spacing: -.035em; cursor: pointer; white-space: nowrap; }
.breadcrumbs button:not(:last-child) { color: var(--muted); font-weight: 590; }
.breadcrumb-separator { color: #b7bac1; font-size: 20px; }
.folder-summary { margin: 0 0 3px; color: var(--muted); font-size: 13px; }
.file-panel { overflow: hidden; min-height: 320px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 8px 26px rgba(24,27,35,.035); }
.file-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 12px; }
.select-all { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; }
.select-all input, .file-select { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.selection-count { color: var(--muted); white-space: nowrap; }
.selection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.selection-actions .button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.selection-actions a[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.sort-control { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; color: var(--muted); }
.sort-control > span { white-space: nowrap; }
.sort-control select { min-width: 0; max-width: 240px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.file-header, .file-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 90px 165px 245px; align-items: center; gap: 14px; padding: 0 18px; }
.file-header { height: 43px; border-bottom: 1px solid var(--line); background: var(--subtle-panel); color: var(--muted); font-size: 11px; font-weight: 720; letter-spacing: .06em; text-transform: uppercase; }
.sort-heading { align-self: stretch; display: flex; align-items: center; gap: 6px; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; cursor: pointer; }
.sort-heading.sorted, .sort-heading:not(:disabled):hover, .sort-heading:focus-visible { color: var(--text); }
.sort-heading:disabled { cursor: wait; }
.sort-arrow { opacity: 0; }
.sort-heading.sorted .sort-arrow, .sort-heading:not(:disabled):hover .sort-arrow, .sort-heading:focus-visible .sort-arrow { opacity: 1; }
.file-row { min-height: 61px; border-bottom: 1px solid var(--row-line); transition: background .12s; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--hover); }
.file-row.selected { background: var(--selected); }
.file-name { min-width: 0; height: 60px; display: flex; align-items: center; gap: 12px; border: 0; padding: 0; background: transparent; cursor: pointer; text-align: left; font-weight: 630; }
.file-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--soft); color: var(--muted); font-weight: 780; }
.file-icon.folder { background: var(--folder-bg); color: var(--folder-color); font-size: 20px; }
.file-icon.image { background: var(--image-bg); color: var(--image-color); }
.file-icon.video { background: var(--video-bg); color: var(--video-color); }
.file-icon.audio { background: var(--audio-bg); color: var(--audio-color); }
.file-icon.pdf { background: var(--pdf-bg); color: var(--pdf-color); }
.file-secondary { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; opacity: 0; transition: opacity .12s; }
.file-row:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.row-action { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 7px 8px; cursor: pointer; font-size: 12px; text-decoration: none; }
.row-action:hover { background: var(--soft); color: var(--text); }
.row-action.danger-text:hover { color: var(--danger); background: var(--danger-soft); }
.download-action { font-size: 17px; line-height: 1; }
.message-row { padding: 35px; text-align: center; color: var(--muted); }
.empty-state { padding: 72px 20px; text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 15px; background: var(--selected); color: var(--accent-text); font-size: 24px; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { margin: 0; color: var(--muted); }
.loading-state { display: flex; justify-content: center; gap: 6px; padding: 70px; }
.loading-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite alternate; }
.loading-state span:nth-child(2) { animation-delay: .18s; }.loading-state span:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { to { opacity: .2; transform: translateY(-4px); } }

.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px; background: rgba(15,17,22,.55); backdrop-filter: blur(5px); }
.modal { width: min(940px, 100%); max-height: min(820px, calc(100vh - 44px)); overflow: hidden; display: flex; flex-direction: column; border-radius: 18px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-header { min-height: 72px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { max-width: 650px; overflow: hidden; margin: 0; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 37px; height: 37px; border: 0; border-radius: 10px; background: var(--soft); cursor: pointer; font-size: 25px; line-height: 1; }
.preview-body { min-height: 360px; flex: 1; display: grid; place-items: center; overflow: auto; background: #202228; }
.preview-body img, .preview-body video { display: block; max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; }
.preview-body audio { width: min(600px, 90%); }
.preview-body iframe { width: 100%; height: min(730px, calc(100vh - 120px)); border: 0; background: white; }
.preview-body pre { align-self: stretch; justify-self: stretch; min-height: 500px; margin: 0; padding: 28px; overflow: auto; background: #16181d; color: #e8e9ec; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.no-preview { display: grid; gap: 8px; color: white; text-align: center; }.no-preview span { color: #aaadb5; }

.move-modal { width: min(600px, 100%); }
.move-body { padding: 20px; overflow: auto; }
.move-body .breadcrumbs { flex-wrap: wrap; overflow: visible; margin-bottom: 15px; }
.move-body .breadcrumbs button { max-width: 200px; font-size: 15px; }
.move-folders { min-height: 160px; max-height: 360px; overflow: auto; }
.move-folder { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.move-folder:hover { background: var(--soft); }
.move-folder > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); }

.users-modal { width: min(900px, 100%); }
.users-layout { display: grid; grid-template-columns: 1fr 300px; min-height: 420px; overflow: auto; }
.users-list { padding: 10px 20px 22px; }
.user-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.user-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }.user-identity div { display: grid; gap: 3px; }.user-identity span { color: var(--muted); font-size: 12px; }
.user-controls { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.mini-check, .check-row { display: flex; align-items: center; gap: 7px; color: #525761; font-size: 12px; }
.mini-check { padding: 6px 8px; border-radius: 8px; background: var(--soft); }
.create-user-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; border-left: 1px solid var(--line); background: #fafafa; }
.create-user-form h3 { margin: 0 0 4px; font-size: 16px; }
.create-user-form .button { margin-top: auto; }

.upload-tray { position: fixed; right: 22px; bottom: 22px; z-index: 35; width: min(380px, calc(100vw - 44px)); max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: var(--shadow); }
.upload-tray-heading { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.upload-tray-heading button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.upload-item { padding: 12px 15px; border-bottom: 1px solid var(--line); }.upload-item:last-child { border: 0; }
.upload-item > div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }.upload-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.upload-item span { flex: 0 0 auto; color: var(--muted); }
.progress-track { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: var(--soft); }.progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .15s; }.upload-item.failed .progress-fill { background: var(--danger); }
.drop-overlay { position: fixed; inset: 12px; z-index: 90; display: grid; place-items: center; border: 3px dashed var(--accent); border-radius: 22px; background: var(--drop-bg); pointer-events: none; }
.drop-overlay > div { display: grid; gap: 7px; text-align: center; }.drop-overlay strong { font-size: 26px; }.drop-overlay span { color: var(--muted); }
.toast-stack { position: fixed; right: 22px; top: 84px; z-index: 100; display: grid; gap: 9px; }
.toast { max-width: 340px; padding: 12px 15px; border-radius: 10px; background: #252830; color: white; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }.toast.error { background: #a93737; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }.content-shell { width: calc(100% - 24px); padding-top: 25px; }
  .search-wrap { width: 42px; }.search-wrap input { display: none; }.account-name, .topbar .button.ghost { display: none; }
  .file-header { display: none; }.file-row { grid-template-columns: 22px minmax(0, 1fr) auto; padding: 0 12px; gap: 9px; }.file-secondary { display: none; }.row-actions { opacity: 1; }
  .file-toolbar { padding: 12px; }.sort-control { flex-basis: 100%; }.sort-control select { flex: 1; max-width: none; }
  .page-heading { align-items: center; }.breadcrumbs button { max-width: 150px; font-size: 19px; }.folder-summary { display: none; }
  .users-layout { grid-template-columns: 1fr; }.create-user-form { border: 0; border-top: 1px solid var(--line); }.user-card { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 22px; border-radius: 19px; }.topbar-actions { gap: 5px; }.topbar .brand > span:last-child { display: none; }
  .file-name { gap: 9px; }.row-action:not(.download-action) { display: none; }.modal-backdrop { padding: 0; }.modal { max-height: 100vh; height: 100vh; border-radius: 0; }
}
