:root {
  --canvas: oklch(0.94 0.012 205);
  --bg: oklch(0.985 0.004 205);
  --surface: oklch(0.955 0.012 205);
  --surface-strong: oklch(0.91 0.02 205);
  --ink: oklch(0.24 0.035 205);
  --muted: oklch(0.47 0.026 205);
  --primary: oklch(0.42 0.085 190);
  --primary-hover: oklch(0.35 0.08 190);
  --nav: oklch(0.25 0.055 205);
  --nav-muted: oklch(0.79 0.025 205);
  --line: oklch(0.85 0.016 205);
  --danger: oklch(0.5 0.15 28);
  --focus: oklch(0.59 0.12 82);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --space-1: .5rem;
  --space-2: .75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color: var(--ink);
  font-family: Aptos, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --canvas: oklch(0.1 0.018 205);
  --bg: oklch(0.145 0.022 205);
  --surface: oklch(0.19 0.026 205);
  --surface-strong: oklch(0.24 0.03 205);
  --ink: oklch(0.94 0.01 205);
  --muted: oklch(0.72 0.023 205);
  --primary: oklch(0.71 0.105 190);
  --primary-hover: oklch(0.79 0.11 190);
  --nav: oklch(0.12 0.027 205);
  --nav-muted: oklch(0.72 0.025 205);
  --line: oklch(0.33 0.02 205);
  --focus: oklch(0.8 0.13 82);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1, h2 { color: var(--ink); letter-spacing: -.025em; text-wrap: balance; }
p { color: var(--muted); font-size: .9375rem; line-height: 1.55; text-wrap: pretty; }

.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: 62px minmax(calc(100vh - 62px), auto); width: min(1480px, 100%); min-height: 100vh; margin: 0 auto; background: var(--bg); }
.auth-visual { display: none; }
.drive-sidebar { grid-row: 1 / -1; padding: 22px 14px 18px; background: var(--nav); color: white; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; text-decoration: none; }
.drive-sidebar .brand { padding: 0 7px; color: white; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid currentColor; border-radius: var(--radius-sm); font-family: Aptos, "Segoe UI", system-ui, sans-serif; font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
.drive-nav { display: grid; gap: 4px; margin-top: 42px; }
.nav-item { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--nav-muted); font-size: .925rem; font-weight: 700; text-decoration: none; transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 180ms var(--ease-out); }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nav-item:hover { color: white; background: color-mix(in oklch, white 9%, transparent); transform: translateY(-1px); }
.nav-item.is-active { color: white; background: color-mix(in oklch, white 15%, transparent); }
.sidebar-note { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 16px 10px 0; }
.sidebar-note p { margin: 0; color: var(--nav-muted); font-size: .77rem; line-height: 1.45; }
.sidebar-note span:not(.status-dot) { color: color-mix(in oklch, var(--nav-muted) 78%, transparent); }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 5px; border-radius: 50%; background: oklch(.78 .13 160); }

.appbar { display: flex; grid-column: 2; align-items: center; justify-content: flex-end; min-width: 0; padding: 0 34px; border-bottom: 1px solid var(--line); }
.appbar .brand { display: none; }
.appbar-note { margin: 0; color: var(--muted); font-size: .8125rem; font-weight: 700; }
.workspace { grid-column: 2; width: min(1180px, 100%); min-width: 0; margin: 0; padding: 28px 34px 56px; }
.library-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.header-copy { min-width: 0; }
.overline { margin: 0 0 3px; color: var(--muted); font-size: .8rem; font-weight: 750; letter-spacing: .025em; }
h1 { margin-bottom: 3px; font-size: clamp(1.8rem, 3vw, 2.35rem); line-height: 1.1; }
h2 { margin-bottom: 3px; font-size: 1rem; line-height: 1.3; }
.library-summary { margin: 0; font-size: .875rem; }
.header-actions, .upload-actions, .dialog-actions, .progress-copy { display: flex; align-items: center; gap: 8px; }
.primary-button, .ghost-button, .danger-button, .upload-trigger, .appearance-button { min-height: 40px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0 13px; font-size: .9rem; font-weight: 750; transition: transform 180ms var(--ease-out), background-color 180ms var(--ease-out), border-color 180ms var(--ease-out); }
.primary-button, .upload-trigger { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: white; text-decoration: none; }
.primary-button:hover, .upload-trigger:hover { background: var(--primary-hover); transform: translateY(-2px); }
.ghost-button, .appearance-button { background: transparent; border-color: var(--line); color: var(--ink); }
.ghost-button:hover, .appearance-button:hover { background: var(--surface); }
.danger-button { background: var(--danger); color: white; }
.is-hidden { display: none; }

.manager-commandbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 14px; margin-top: 22px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.toolbar { min-width: 0; }
.search-field { position: relative; display: block; width: min(420px, 100%); }
.search-field svg { position: absolute; top: 50%; left: 12px; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-linecap: round; stroke-width: 1.8; }
.search-field input { width: 100%; min-height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.account-status { display: none; margin: 0; }
.upload-panel { min-width: 0; }
.upload-copy { display: none; }
.upload-actions { justify-content: flex-end; flex-wrap: wrap; }
.upload-trigger input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.folder-action { display: inline-flex; align-items: center; gap: 7px; }
.button-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.folder-section { padding-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-heading p { margin: 0; font-size: .875rem; }
.text-button { min-height: 36px; border: 0; padding: 0 8px; background: transparent; color: var(--primary); font-size: .875rem; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 14px; }
.folder-card { display: flex; min-width: 0; min-height: 144px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-align: center; transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), transform 180ms var(--ease-out); }
.folder-card:hover { border-color: var(--line); background: var(--surface); transform: translateY(-2px); }
.folder-card svg.folder-icon { display: block; width: 62px; height: 62px; fill: var(--primary); }
.folder-copy { display: grid; min-width: 0; gap: 2px; }
.folder-copy strong, .folder-copy span { display: block; overflow: hidden; max-width: 16ch; text-overflow: ellipsis; white-space: nowrap; }
.folder-copy strong { font-size: .875rem; }
.folder-copy span { color: var(--muted); font-size: .75rem; }

.category-section { padding-top: 25px; }
.category-section .section-heading { margin-bottom: 8px; }
.category-section .section-heading p { display: none; }
.category-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.category-card { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: transparent; color: var(--ink); font-size: .8125rem; font-weight: 700; transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out); }
.category-card strong { min-width: 1.25em; color: var(--muted); font-size: .78rem; }
.category-card:hover, .category-card.is-active { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 12%, var(--surface)); }
.category-card.is-active strong { color: var(--primary); }

.gallery-section { padding-top: 30px; }
.upload-progress { margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.progress-copy { justify-content: space-between; margin-bottom: 8px; color: var(--ink); font-size: .84rem; font-weight: 750; }
progress { width: 100%; height: 7px; accent-color: var(--primary); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 14px; }
.photo-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); animation: card-in 180ms var(--ease-out) both; }
.photo-card img { display: block; width: 100%; aspect-ratio: 1 / .8; object-fit: cover; background: var(--surface-strong); transition: transform 180ms var(--ease-out); }
.photo-card:hover img, .photo-card:focus-within img { transform: scale(1.025); }
.file-visual { display: grid; width: 100%; aspect-ratio: 1 / .8; place-items: center; padding: 18px; background: var(--surface-strong); color: var(--primary); font-size: .92rem; font-weight: 800; letter-spacing: .08em; }
.file-visual.is-pdf { background: oklch(.9 .035 28); color: oklch(.42 .14 28); }
.file-visual.is-documents { background: oklch(.9 .03 250); color: oklch(.42 .1 250); }
.file-visual.is-other { background: oklch(.9 .025 82); color: oklch(.42 .1 82); }
:root[data-theme="dark"] .file-visual.is-pdf { background: oklch(.26 .055 28); color: oklch(.82 .11 28); }
:root[data-theme="dark"] .file-visual.is-documents { background: oklch(.25 .045 250); color: oklch(.8 .08 250); }
:root[data-theme="dark"] .file-visual.is-other { background: oklch(.27 .04 82); color: oklch(.84 .09 82); }
.photo-meta { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; gap: 8px; min-width: 0; padding: 9px; background: var(--surface); }
.photo-name { overflow: hidden; color: var(--ink); font-size: .78rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.photo-size { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; }
.delete-button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; }
.delete-button:hover, .delete-button:focus-visible { background: color-mix(in oklch, var(--danger) 12%, transparent); color: var(--danger); outline: 0; }
.skeleton { aspect-ratio: 1 / .8; border-radius: var(--radius-sm); background: var(--surface-strong); animation: shimmer 1.25s var(--ease-out) infinite; }
.empty-state { display: grid; min-height: 260px; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-md); background: color-mix(in oklch, var(--surface) 68%, transparent); text-align: center; }
.empty-state > div { max-width: 360px; padding: 30px; }
.empty-state h2 { font-size: 1.15rem; }
.empty-state p { margin-bottom: 18px; }

.form-label { display: block; margin: 18px 0 7px; color: var(--ink); font-size: .875rem; font-weight: 700; }
#folder-name { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); }
.form-error { margin: 8px 0 0; color: var(--danger); font-size: .875rem; font-weight: 650; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }
dialog { width: min(440px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--ink); }
dialog::backdrop { background: oklch(.12 .02 205 / .58); }
dialog form { padding: 24px; }
.folder-menu { position: fixed; z-index: 4; min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); box-shadow: 0 6px 8px oklch(.18 .02 205 / .14); }
.folder-menu button { display: block; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: .875rem; font-weight: 700; text-align: left; }
.folder-menu button:hover, .folder-menu button:focus-visible { background: var(--surface); outline: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 5; max-width: min(360px, calc(100% - 40px)); padding: 12px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-size: .9rem; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@keyframes card-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 50% { opacity: .56; } }

body.is-signed-out .drive-sidebar { display: none; }
body.is-signed-out .app-shell { grid-template-columns: minmax(330px, 42%) minmax(0, 1fr); grid-template-rows: minmax(100vh, auto); }
body.is-signed-out .auth-visual { display: flex; grid-column: 1; min-height: 100vh; padding: clamp(32px, 5vw, 72px); background: var(--nav); color: white; flex-direction: column; }
body.is-signed-out .auth-visual .brand { color: white; }
.auth-visual-copy { max-width: 29rem; margin: auto 0; }
.auth-visual-copy > p:first-child { color: var(--nav-muted); font-size: .84rem; font-weight: 700; }
.auth-visual-copy h2 { color: white; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.15rem); line-height: 1.1; }
.auth-visual-copy p, .auth-footnote { color: var(--nav-muted); }
.auth-footnote { margin: 0; font-size: .8rem; }
body.is-signed-out .appbar { display: none; }
body.is-signed-out .workspace { display: grid; grid-column: 2; min-height: 100vh; align-items: center; padding: clamp(32px, 8vw, 110px); }
body.is-signed-out .library-header { width: min(430px, 100%); flex-direction: column; align-items: flex-start; margin: 0 auto; }
body.is-signed-out .manager-commandbar, body.is-signed-out .folder-section, body.is-signed-out .category-section, body.is-signed-out .gallery-section { display: none; }

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .drive-sidebar { padding: 18px 10px; }
  .drive-sidebar .brand { justify-content: center; padding: 0; }
  .drive-sidebar .brand > span:last-child, .nav-item span, .sidebar-note { display: none; }
  .drive-nav { margin-top: 38px; }
  .nav-item { justify-content: center; padding: 0; }
  .workspace { padding: 26px 24px 48px; }
  .appbar { padding: 0 24px; }
}
@media (max-width: 640px) {
  .app-shell { display: block; }
  .drive-sidebar { display: none; }
  .appbar { min-height: 60px; padding: 0 20px; justify-content: space-between; }
  .appbar .brand { display: inline-flex; font-size: .95rem; }
  .appbar-note { display: none; }
  .workspace { width: 100%; padding: 24px 18px 42px; }
  .library-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .manager-commandbar { grid-template-columns: 1fr; }
  .search-field { width: 100%; max-width: none; }
  .upload-actions { justify-content: flex-start; }
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .folder-card { min-height: 128px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.is-signed-out .app-shell { display: block; }
  body.is-signed-out .auth-visual { min-height: 290px; padding: 30px 24px; }
  body.is-signed-out .workspace { display: grid; min-height: auto; padding: 46px 24px 70px; }
}
@media (max-width: 400px) { .header-actions > * { flex: 1 1 auto; } .appearance-button { flex: 0 0 auto; } .upload-actions > * { flex: 1 1 auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
/* Native media and first-page document previews. */
.media-preview, .pdf-preview { display: block; width: 100%; aspect-ratio: 1 / .8; border: 0; background: var(--surface-strong); }
.media-preview { object-fit: cover; }
.audio-preview { display: block; width: 100%; height: 42px; padding: 6px 8px; background: var(--surface); }
.file-visual.is-audio { background: oklch(.9 .03 165); color: oklch(.38 .1 165); }
:root[data-theme="dark"] .file-visual.is-audio { background: oklch(.26 .045 165); color: oklch(.82 .1 165); }
.document-preview { min-height: 122px; padding: 16px; overflow: hidden; background: var(--surface-strong); color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: .8rem; line-height: 1.55; text-align: left; }
.photo-meta { grid-template-columns: minmax(0, 1fr) auto; }
.file-actions { display: flex; align-items: center; gap: 2px; }
.download-button { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; color: var(--muted); font-size: 1.15rem; font-weight: 800; line-height: 1; text-decoration: none; }
.download-button:hover, .download-button:focus-visible { background: color-mix(in oklch, var(--primary) 13%, transparent); color: var(--primary); outline: 0; }
/* cPanel authentication screen and authenticated-only controls. */
.cpanel-logout { display: none; align-items: center; justify-content: center; text-decoration: none; }
body.cpanel-auth #sign-in, body.cpanel-auth #sign-out { display: none; }
body.cpanel-auth .cpanel-logout { display: inline-flex; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--canvas); }
.login-card { width: min(420px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); }
.login-copy { margin: 34px 0 24px; }
.login-copy h1 { margin-bottom: 9px; font-size: 1.8rem; }
.login-copy p { margin-bottom: 0; }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 7px; color: var(--ink); font-size: .86rem; font-weight: 750; }
.login-form input { min-height: 42px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 11px; background: var(--surface); color: var(--ink); }
.login-form .primary-button { width: 100%; margin-top: 13px; }
.login-error { margin: 6px 0 0; color: var(--danger); font-size: .86rem; font-weight: 700; }
.share-button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.05rem; font-weight: 800; line-height: 1; }
.share-button:hover, .share-button:focus-visible { background: color-mix(in oklch, var(--primary) 13%, transparent); color: var(--primary); outline: 0; }
#share-duration { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); }
.share-result { margin: 16px 0 0; padding: 10px; overflow-wrap: anywhere; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: .82rem; }
.shared-image, .shared-media, .shared-pdf { display: block; width: 100%; max-height: 55vh; margin: 18px 0; border: 0; border-radius: var(--radius-sm); object-fit: contain; background: var(--surface); }
.shared-pdf { height: 55vh; }
.share-card .primary-button { width: 100%; }.share-button img { width: 16px; height: 16px; opacity: .78; }
.share-button:hover img, .share-button:focus-visible img { opacity: 1; }
.shared-file-list { display: grid; gap: 8px; margin: 18px 0; }
.shared-file-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: left; }
.shared-file-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: .9rem; }
.shared-file-list span { color: var(--muted); font-size: .78rem; }
.shared-file-list article div { grid-column: 1 / -1; display: flex; gap: 12px; }
.shared-file-list a { color: var(--primary); font-size: .84rem; font-weight: 750; text-decoration: none; }
.shared-file-list a:hover { text-decoration: underline; }