:root {
  color-scheme: light;
  --canvas: #f3f6fc;
  --nav: #fafbff;
  --surface: #fff;
  --surface-subtle: #f5f7fc;
  --surface-hover: #eef2fc;
  --ink: #18243b;
  --muted: #53617c;
  --line: #e1e7f1;
  --line-strong: #cad4e6;
  --accent: #4e44c7;
  --accent-hover: #3c31ab;
  --accent-text: #483bbb;
  --accent-light: #ebe9ff;
  --focus: #6559de;
  --hero-start: #fafaff;
  --hero-end: #e8edff;
  --hero-border: #dbe1f9;
  --hero-ring: #6174cc23;
  --hero-icon: #eeebff;
  --shadow-card: 0 2px 3px #202d4a05, 0 12px 30px #293f6a0b;
  --shadow-pop: 0 22px 65px #17223f30;
  --danger: #a2254a;
  --danger-fill: #fff0f4;
  --danger-button: #a2254a;
  --danger-hover: #841b3b;
  --positive: #24634d;
  --positive-fill: #e5f5ed;
  --inactive: #69496c;
  --inactive-fill: #f2eaf4;
  --folder-ink: #885817;
  --folder-fill: #fff1d5;
  --image-ink: #24634d;
  --image-fill: #e0f5eb;
  --document-ink: #315c9e;
  --document-fill: #e6efff;
  --archive-ink: #94464d;
  --archive-fill: #ffe9eb;
  --art-start: #39358d;
  --art-end: #191d45;
  font: 16px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101526;
  --nav: #131a2d;
  --surface: #1a2339;
  --surface-subtle: #202b44;
  --surface-hover: #283552;
  --ink: #f1f3ff;
  --muted: #b5c1db;
  --line: #2e3c5a;
  --line-strong: #475a80;
  --accent: #6353da;
  --accent-hover: #6959e1;
  --accent-text: #c8c0ff;
  --accent-light: #312951;
  --focus: #aa9cff;
  --hero-start: #22293f;
  --hero-end: #28274b;
  --hero-border: #424568;
  --hero-ring: #a1a7ff32;
  --hero-icon: #372c59;
  --shadow-card: 0 2px 3px #0a102433, 0 12px 30px #060a1840;
  --shadow-pop: 0 22px 65px #060a18a0;
  --danger: #ff94b0;
  --danger-fill: #41263d;
  --danger-button: #a73557;
  --danger-hover: #b13d61;
  --positive: #98e2bc;
  --positive-fill: #263e3c;
  --inactive: #e2c2e9;
  --inactive-fill: #3b2e4b;
  --folder-ink: #ffd288;
  --folder-fill: #4a3830;
  --image-ink: #98e2bc;
  --image-fill: #263e3c;
  --document-ink: #adcbff;
  --document-fill: #273a5b;
  --archive-ink: #ffc1c7;
  --archive-fill: #493044;
  --art-start: #292a62;
  --art-end: #10172f;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .63; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input::placeholder { color: var(--muted); opacity: 1; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
a { color: inherit; }
svg { width: 1.2rem; height: 1.2rem; display: block; flex: none; }
[data-icon] { display: inline-flex; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: .9rem; padding: .65rem .8rem; border-radius: 9px; background: var(--danger-fill); }
.loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: .8rem; color: var(--muted); }

.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.26rem; line-height: 1.15; font-weight: 760; letter-spacing: -.042em; white-space: nowrap; }
.brand img { border-radius: 11px; flex: none; }
.theme-switch { display: inline-flex; align-items: center; flex: none; gap: .15rem; padding: .2rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 11px; }
.theme-option { display: inline-flex; align-items: center; justify-content: center; gap: .33rem; min-height: 34px; padding: .3rem .5rem; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 650; color: var(--muted); background: transparent; }
.theme-option svg { width: .98rem; height: .98rem; }
.theme-option:hover { background: var(--surface-hover); color: var(--ink); }
.theme-option[aria-pressed="true"] { background: var(--accent-light); color: var(--accent-text); }

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) 1.1fr; background: var(--surface); }
.auth-card { width: min(100% - 3rem, 430px); margin: auto; padding: 3rem 0; }
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 3rem; }
.auth h1 { font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1.12; letter-spacing: -.052em; }
.auth .muted { margin: .85rem 0 1.8rem; }
.auth .error { margin-top: 1rem; }
.auth-visual { background: radial-gradient(circle at 70% 24%, #8c80ff57 0, transparent 47%), linear-gradient(150deg, var(--art-start), var(--art-end) 86%); position: relative; overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.orbit { position: absolute; border: 1px solid #d6ccff48; width: min(42vw, 650px); aspect-ratio: 1; border-radius: 50%; z-index: -1; }
.orbit-one { scale: .85; }
.orbit-two { scale: 1.25; }
.visual-folder { position: relative; width: min(28vw, 380px); height: min(18vw, 240px); background: linear-gradient(160deg,#b2a0ff,#7560eb); transform: rotate(-12deg); border-radius: 22px; box-shadow: 0 35px 70px #110b3880; }
.visual-folder i { width: 46%; height: 34%; top: -15%; border-radius: 21px 26px 0 0; background: #b2a0ff; position: absolute; }
.visual-folder b { position: absolute; height: 78%; bottom: 0; left: 0; right: 0; border-radius: 22px; background: linear-gradient(125deg, #d1c7ff, #a997fd 65%, #7862ef); box-shadow: inset 0 2px 0 #fff5; }
.visual-file { width: min(10vw, 140px); height: min(13vw, 180px); background: #fff0cb; border-radius: 16px; transform: translate(110%,65%) rotate(15deg); box-shadow: 0 18px 45px #1b103072; position: absolute; display: grid; place-content: center; gap: .55rem; }
.visual-file i { width: 4vw; max-width: 52px; height: 5px; border-radius: 40px; background: #c89b58; }
.visual-file i:last-child { width: 55%; }

form label { display: grid; gap: .4rem; margin-bottom: .95rem; font-size: .9rem; font-weight: 650; }
form input:not([type=checkbox]), form select { width: 100%; min-height: 44px; padding: .65rem .8rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-subtle); color: var(--ink); font-size: 1rem; font-weight: 400; }
form .wide + .wide { margin-top: .35rem; }
.password-field { display: grid; gap: .4rem; margin-bottom: .95rem; }
.password-field > label { margin-bottom: 0; }
.password-input { position: relative; min-width: 0; }
form .password-input input { padding-inline-end: 3.25rem; }
.password-input input::-ms-reveal { display: none; }
.field-hint { color: var(--muted); font-size: .82rem; font-weight: 400; line-height: 1.4; }
.select-field { position: relative; display: block; }
.select-field select { appearance: none; padding-right: 2rem; }
.select-field::after { content: ""; position: absolute; top: 44%; right: .9rem; width: .45rem; height: .45rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 42px; padding: .6rem .88rem; border: 1px solid transparent; border-radius: 10px; font-size: .9rem; font-weight: 680; white-space: nowrap; background: transparent; color: var(--ink); text-decoration: none; }
.button svg { width: 1.05rem; height: 1.05rem; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 3px 6px #22165226; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover, .button.ghost:hover { background: var(--surface-hover); }
.button.danger { color: #fff; background: var(--danger-button); }
.button.danger:hover { background: var(--danger-hover); }
.button.wide { width: 100%; }
.icon-button { display: inline-grid; place-items: center; width: 39px; height: 39px; background: transparent; color: inherit; border: 0; border-radius: 9px; }
.icon-button:hover { background: var(--accent-light); color: var(--accent-text); }
.password-toggle { position: absolute; inset-inline-end: .25rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); touch-action: none; user-select: none; }
.password-toggle:focus-visible { outline-offset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .button, .theme-option, .icon-button, .nav-link { transition: background-color .16s, color .16s, border-color .16s; }
}

.shell { display: grid; grid-template-columns: 234px minmax(0,1fr); min-height: 100vh; }
.sidebar { min-height: 100vh; height: 100vh; height: 100dvh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 1.6rem 1rem 1rem; color: var(--ink); background: var(--nav); border-right: 1px solid var(--line); }
.sidebar .brand { padding: 0 .45rem; margin-bottom: 2.35rem; }
.sidebar nav { display: grid; gap: .38rem; }
.nav-link { display: flex; width: 100%; align-items: center; gap: .66rem; border: 0; border-radius: 10px; color: var(--muted); font-size: .94rem; font-weight: 660; min-height: 44px; padding: .58rem .82rem; text-align: left; background: transparent; }
.nav-link:hover { background: var(--surface-hover); color: var(--ink); }
.nav-link.active { background: var(--accent-light); color: var(--accent-text); box-shadow: inset 3px 0 var(--focus); }
.sidebar-bottom { margin-top: auto; display: grid; gap: .85rem; }
.storage { margin-top: .65rem; padding: .75rem; display: grid; gap: .5rem; color: var(--muted); font-size: .82rem; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.storage-heading { font-size: .88rem; color: var(--ink); display: flex; gap: .5rem; align-items: center; font-weight: 700; }
.storage-heading svg { width: 1rem; height: 1rem; color: var(--accent-text); }
.storage-details { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .15rem .65rem; font-variant-numeric: tabular-nums; }
#storage-bar[value]:not([value="0"])::-webkit-progress-value { min-width: 2px; }
#storage-bar[value]:not([value="0"])::-moz-progress-bar { min-width: 2px; }
progress { width: 100%; height: .46rem; border: 0; border-radius: 10px; overflow: hidden; accent-color: var(--focus); background: var(--surface-hover); }
progress::-webkit-progress-bar { background: var(--surface-hover); }
progress::-webkit-progress-value { background: var(--focus); }
progress::-moz-progress-bar { background: var(--focus); }
.profile { border-top: 1px solid var(--line); padding: .85rem .2rem 0; display: flex; align-items: center; gap: .55rem; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-light); color: var(--accent-text); font-size: .8rem; font-weight: 760; flex: none; }
.profile-name { display: grid; min-width: 0; font-size: .86rem; }
.profile-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name small { color: var(--muted); font-size: .78rem; }
.account-button { margin-left: auto; color: var(--muted); flex: none; }

.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: 70px; padding: .65rem clamp(1.05rem,4vw,3.5rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-start, .topbar-actions { display: flex; align-items: center; min-width: 0; }
.topbar-start { gap: clamp(.6rem,2.45vw,2.8rem); }
.topbar-actions { gap: .7rem; }
.section-name { font-weight: 720; font-size: .96rem; }
.back-button:disabled { background: var(--surface); cursor: default; }
.logout { color: var(--muted); }
.content { max-width: 1450px; margin: 0 auto; padding: clamp(1rem,3.55vw,3.1rem) clamp(1.05rem,4vw,3.5rem); }
.return { margin-bottom: .7rem; color: var(--accent-text); }
.hero { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 1.2rem; padding: clamp(1.1rem,2.65vw,2rem); margin-bottom: 1.5rem; border: 1px solid var(--hero-border); border-radius: 20px; background: linear-gradient(112deg,var(--hero-start),var(--hero-end)); box-shadow: var(--shadow-card); }
.hero::before { content: ""; position: absolute; z-index: -1; width: min(55%,440px); aspect-ratio: 1; right: -5%; top: 50%; transform: translateY(-50%); border-radius: 50%; background: repeating-radial-gradient(circle at center, transparent 0 23px, var(--hero-ring) 24px 25px); pointer-events: none; }
.hero-icon { display: grid; place-items: center; flex: none; width: 60px; height: 60px; border: 1px solid var(--hero-border); border-radius: 17px; color: var(--accent-text); background: var(--hero-icon); }
.hero-icon svg { width: 1.65rem; height: 1.65rem; stroke-width: 1.75; }
.hero-copy { flex: 1 1 13rem; min-width: 0; }
.hero h1 { font-size: clamp(1.7rem,3.05vw,2.45rem); font-weight: 780; letter-spacing: -.05em; line-height: 1.12; overflow-wrap: anywhere; }
.hero p { margin-top: .32rem; color: var(--muted); font-size: .95rem; }
.hero-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .55rem; }
.collection { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; min-width: 0; box-shadow: var(--shadow-card); }
.collection-bar { display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; }
.collection-bar h2 { font-size: 1.12rem; letter-spacing: -.02em; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem; min-width: 0; }
.crumb { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 0; border-radius: 8px; color: var(--muted); padding: .38rem .46rem; font-size: .94rem; font-weight: 650; }
.crumb:hover { background: var(--accent-light); color: var(--accent-text); }
.crumb-current { color: var(--ink); }
.crumb-separator { color: var(--muted); }
.search { display: flex; gap: .5rem; align-items: center; min-width: min(40%, 218px); padding: .43rem .65rem; min-height: 40px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 10px; }
.search svg { width: 1rem; height: 1rem; }
.search input { width: 100%; min-width: 0; background: transparent; color: var(--ink); border: 0; outline: none; font-size: .88rem; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.table-wrap { min-height: 80px; }
.table-wrap.dragging { outline: 2px dashed var(--focus); outline-offset: -3px; background: var(--surface-hover); }
table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; }
th { color: var(--muted); font-size: .83rem; font-weight: 700; background: var(--surface-subtle); border-block: 1px solid var(--line); }
th, td { padding: .58rem .9rem; }
td { height: 62px; font-size: .88rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 1.18rem; }
th:nth-child(2) { width: 24%; }
th:nth-child(3) { width: 16%; }
#member-table th:nth-child(3), #item-table th:nth-child(3) { width: 22%; }
th:last-child, td:last-child { width: 57px; text-align: right; }
tbody tr:hover, .folder-row:focus-within { background: var(--surface-subtle); }
.folder-row { cursor: pointer; }
.folder-row .item-name { width: 100%; }
.item-name { display: flex; gap: .65rem; align-items: center; min-width: 0; text-align: left; background: transparent; border: 0; color: var(--ink); font-size: .94rem; font-weight: 670; border-radius: 9px; padding: .1rem .25rem .1rem 0; text-decoration: none; }
.item-name > span:last-child { overflow-wrap: anywhere; }
.item-name:hover { color: var(--accent-text); text-decoration: underline; }
.item-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent-light); color: var(--accent-text); }
.item-icon.folder { background: var(--folder-fill); color: var(--folder-ink); }
.item-icon.image { background: var(--image-fill); color: var(--image-ink); }
.item-icon.document { background: var(--document-fill); color: var(--document-ink); }
.item-icon.archive { background: var(--archive-fill); color: var(--archive-ink); }
.item-icon svg { width: 1.13rem; height: 1.13rem; }
.collection-footer { padding: .73rem 1.18rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); background: var(--surface-subtle); }
.empty { text-align: center; display: grid; place-items: center; gap: .48rem; min-height: 254px; align-content: center; padding: 1.5rem; border-top: 1px solid var(--line); }
.empty-icon { width: 62px; height: 62px; margin-bottom: .55rem; border-radius: 18px; display: grid; place-items: center; color: var(--accent-text); background: var(--accent-light); box-shadow: 0 0 0 7px var(--surface-subtle); }
.empty-icon svg { width: 1.8rem; height: 1.8rem; stroke-width: 1.6; }
.empty h2 { font-size: 1.12rem; letter-spacing: -.018em; }
.empty p { color: var(--muted); font-size: .9rem; }
.member-name { display: grid; min-width: 0; gap: .08rem; }
.member-name small { color: var(--muted); font-weight: 450; font-size: .82rem; }
.trash-item { display: flex; align-items: center; gap: .65rem; }
.trash-details { display: grid; min-width: 0; gap: .12rem; }
.trash-details small { color: var(--muted); font-size: .82rem; }
#trash-table th:nth-child(2) { width: 19%; }
#trash-table th:last-child, #trash-table td:last-child { width: 7.4rem; }
#trash-table .button { min-height: 36px; padding: .4rem .65rem; }
.status { display: inline-block; max-width: 100%; padding: .2rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 660; color: var(--positive); background: var(--positive-fill); }
.status.inactive { color: var(--inactive); background: var(--inactive-fill); }
.progress-panel { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; border: 1px solid var(--hero-border); border-radius: 12px; background: var(--surface); margin-bottom: 1rem; font-size: .9rem; }
.progress-panel > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.progress-panel > [data-icon] { color: var(--accent-text); }

dialog { width: min(100% - 2rem, 475px); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: #0c132d91; }
dialog form { padding: 1.2rem 1.35rem 1.35rem; }
dialog header, dialog footer { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
dialog header { margin-bottom: .9rem; }
dialog footer { justify-content: flex-end; margin-top: 1.1rem; }
dialog h2 { font-size: 1.24rem; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
dialog p { margin: .35rem 0 .8rem; overflow-wrap: anywhere; }
.dialog-actions { display: grid; gap: .38rem; }
.dialog-actions .button { justify-content: flex-start; white-space: normal; }
.dialog-actions .warning { color: var(--danger); }
.dialog-actions .warning:hover { background: var(--danger-fill); }
.move-folders { max-height: 250px; overflow: auto; display: grid; gap: .3rem; }
.move-folders .button { justify-content: flex-start; text-align: left; white-space: normal; }
.toast { position: fixed; z-index: 5; bottom: 1.25rem; right: 1.25rem; max-width: calc(100% - 2.5rem); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: var(--shadow-pop); padding: .73rem 1rem; overflow-wrap: anywhere; }
.toast.bad { background: var(--danger-fill); color: var(--danger); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 195px minmax(0,1fr); }
  .hero { flex-wrap: wrap; }
  .hero-actions { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-header { margin-bottom: 2.25rem; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { min-height: auto; height: auto; position: static; padding: .65rem .9rem .6rem; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .53rem .85rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin: 0 auto 0 0; padding: 0; }
  .sidebar nav { order: 3; display: flex; flex-wrap: wrap; flex-basis: 100%; }
  .nav-link { width: auto; min-height: 39px; padding: .48rem .65rem; }
  .sidebar-bottom { margin: 0; }
  .storage { order: 4; flex: 0 0 100%; margin-top: 0; padding: .5rem .65rem; gap: .35rem; }
  .profile { padding: 0; border: 0; }
  .profile-name { max-width: 95px; }
  .topbar { min-height: 56px; padding: .35rem .85rem; }
  .content { padding-inline: .85rem; }
  .hero { gap: .72rem; padding: .95rem; margin-bottom: 1rem; border-radius: 16px; }
  .hero-copy { flex-basis: min(12rem, 60%); }
  .hero-icon { width: 47px; height: 47px; border-radius: 13px; }
  .hero-actions .button { padding-inline: .65rem; }
  .collection-bar { padding: .7rem; }
  th:first-child, td:first-child { padding-left: .7rem; }
  th:nth-child(2), td:nth-child(2) { display: none; }
  #member-table th:nth-child(3), #item-table th:nth-child(3) { width: 32%; }
  th:nth-child(3) { width: 24%; }
  th, td { padding-inline: .35rem; }
  th:last-child, td:last-child { width: 45px; padding-right: .45rem; }
}
@media (max-width: 560px) {
  .topbar-actions { gap: .3rem; }
  .theme-option { min-width: 36px; min-height: 36px; padding-inline: .35rem; }
  .theme-label, .logout-label { display: none; }
  .logout { padding-inline: .55rem; }
}
@media (max-width: 380px) {
  .collection-bar { flex-wrap: wrap; }
  .search { flex: 1; }
  .item-icon { width: 29px; height: 29px; }
  .item-name { gap: .38rem; }
  .profile-name { display: none; }
  .topbar-start { gap: .4rem; }
  .back-button { padding-inline: .55rem; }
}
