/* Ko-Cloud — one stylesheet, no build step. Mobile first, light/dark from the system. */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --line: #dde3ee;
  --text: #1b2333;
  --muted: #667085;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #e6eeff;
  --danger: #c62f3b;
  --danger-soft: #fdecee;
  --ok: #157f4b;
  --ok-soft: #e3f6ec;
  --warn: #9a5b00;
  --warn-soft: #fff4dc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 6px 20px rgb(16 24 40 / 6%);
  --shadow-lg: 0 18px 50px rgb(16 24 40 / 22%);
  --topbar: 60px;
  --sidenav: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a;
    --surface: #171c25;
    --surface-2: #1f2632;
    --line: #2b3443;
    --text: #e7ebf3;
    --muted: #98a2b3;
    --accent: #5b8cff;
    --accent-2: #7aa2ff;
    --accent-soft: #1d2a47;
    --danger: #ff6b76;
    --danger-soft: #3a1c22;
    --ok: #4cc38a;
    --ok-soft: #173326;
    --warn: #f0b04a;
    --warn-soft: #3a2d14;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0 0 .6em; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; word-break: break-all; }
.sprite { display: none; }
.ic { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.error { color: var(--danger); background: var(--danger-soft); padding: .55em .8em; border-radius: var(--radius-sm); }
.warn { color: var(--warn); }
[hidden] { display: none !important; }

/* --- buttons & fields ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 42px; padding: 0 1em; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; list-style: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 .7em; font-size: .9em; }
.btn:disabled { opacity: .55; cursor: default; }
summary.btn::-webkit-details-marker { display: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 1.3em; height: 1.3em; }

input[type=text], input[type=password], input[type=search], input[type=number], select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 .8em; width: 100%;
}
.field { display: grid; gap: .3em; margin-bottom: .9em; }
.field > span { font-weight: 550; font-size: .92em; }
.field-inline { display: inline-flex; align-items: center; gap: .5em; font-size: .92em; }
.field-inline select, .field-inline input { width: auto; min-width: 8em; }
.check { display: flex; align-items: center; gap: .55em; margin: .3em 0 1.1em; }
.check input { width: 20px; height: 20px; }
.code-input { font-size: 1.5em; letter-spacing: .25em; text-align: center; }

/* --- shell ----------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; gap: .6em; padding: 0 .75em;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .45em; font-weight: 750; font-size: 1.12em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .ic { color: var(--accent); width: 1.6em; height: 1.6em; fill: var(--accent-soft); }
.brand-lg { font-size: 1.5em; justify-content: center; margin-bottom: 1.2em; }
.search { flex: 1; max-width: 560px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: .8em; color: var(--muted); }
.search input { padding-left: 2.5em; background: var(--surface-2); border-color: transparent; border-radius: 999px; }
.search input:focus { background: var(--surface); border-color: var(--line); }
.usermenu { position: relative; }
.usermenu summary { list-style: none; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: .35em; display: grid;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: .65em; padding: .7em .8em; border-radius: 8px;
  color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; width: 100%;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu form { margin: 0; }
.menu-head { padding: .6em .8em .7em; border-bottom: 1px solid var(--line); margin-bottom: .3em; display: grid; }
.menu-head span { color: var(--muted); font-size: .88em; }
.menu .danger { color: var(--danger); }

.sidenav {
  position: fixed; top: var(--topbar); left: 0; bottom: 0; width: var(--sidenav); z-index: 25;
  display: flex; flex-direction: column; gap: 2px; padding: .9em .7em;
  background: var(--bg); overflow-y: auto;
}
.sidenav a {
  display: flex; align-items: center; gap: .75em; padding: .65em .85em; border-radius: 10px;
  color: var(--text); font-weight: 520;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--accent-soft); color: var(--accent); }
.sidenav a .ic { width: 1.25em; height: 1.25em; }
.sidenav-foot { margin-top: auto; display: grid; gap: .6em; padding: .6em .4em 0; }
.storage { display: grid; gap: .3em; }
.warn-link { color: var(--warn) !important; background: var(--warn-soft); }
.nav-toggle { display: none; }
.scrim { display: none; }

.content { margin-left: var(--sidenav); padding: 1.4em 1.8em 6em; max-width: 1200px; }
.page-title { font-size: 1.55em; margin-bottom: .7em; }

progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.meter { height: 12px; margin: .4em 0; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .brand span { display: none; }
  .sidenav { transform: translateX(-102%); transition: transform .2s ease; background: var(--surface); box-shadow: var(--shadow-lg); width: min(82vw, 300px); }
  body.nav-open .sidenav { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / 35%); }
  .content { margin-left: 0; padding: 1em .9em 7em; }
  .hide-sm { display: none; }
}

/* --- start page ------------------------------------------------------------------------ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9em; margin-bottom: 1.2em; }
.tile {
  display: flex; align-items: center; gap: 1em; padding: 1.2em; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); }
.tile-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.tile-icon .ic { width: 28px; height: 28px; }
.tile-text { display: grid; }
.tile-text strong { font-size: 1.12em; }
.tile-text span { color: var(--muted); font-size: .9em; }
.tile-docs .tile-icon { background: #e6eeff; color: #2563eb; }
.tile-photos .tile-icon { background: #fde9ef; color: #d6336c; }
.tile-family .tile-icon { background: #e3f6ec; color: #157f4b; }
.tile-shared .tile-icon { background: #fff1db; color: #b25e00; }
.tile-backups .tile-icon { background: #efe9ff; color: #6d28d9; }
@media (prefers-color-scheme: dark) {
  .tile-docs .tile-icon { background: #1d2a47; color: #7aa2ff; }
  .tile-photos .tile-icon { background: #3d1d29; color: #ff8fb1; }
  .tile-family .tile-icon { background: #173326; color: #4cc38a; }
  .tile-shared .tile-icon { background: #3a2d14; color: #f0b04a; }
  .tile-backups .tile-icon { background: #2c2147; color: #b794ff; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1em 1.2em; margin-bottom: 1em; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: .7em; justify-content: space-between; margin-bottom: .7em; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.1em; display: flex; align-items: center; gap: .45em; }
.warn-panel { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.empty-hint { color: var(--muted); }

/* --- folder view ----------------------------------------------------------------------- */
.folder-head { display: flex; flex-wrap: wrap; align-items: center; gap: .8em 1em; margin-bottom: 1em; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35em; min-width: 0; flex: 1 1 260px; font-size: 1.05em; }
.crumbs a { color: var(--muted); }
.crumbs h1 { font-size: 1.45em; }
.crumbs .sep { color: var(--muted); }
.crumbs-small { font-size: .95em; margin: .2em 0 .6em; }
.crumbs-small button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.toolbar { display: flex; align-items: center; gap: .5em; flex-wrap: wrap; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown .menu { left: 0; right: auto; }
.sort select { min-height: 42px; width: auto; }
.when-grid { display: none; }
.is-grid .when-grid { display: inline; }
.is-grid .when-list { display: none; }

.items { list-style: none; margin: 0; padding: 0; }
.view-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.view-list .item {
  display: flex; align-items: center; gap: .6em; padding: .35em .6em .35em .45em; min-height: 58px;
  border-bottom: 1px solid var(--line);
}
.view-list .item:last-child { border-bottom: 0; }
.item:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.item.selected { background: var(--accent-soft); }
.item.flash { animation: flash 1.6s ease; }
@keyframes flash { from { background: var(--accent-soft); } }
.pick { display: grid; place-items: center; width: 34px; height: 34px; flex: none; cursor: pointer; }
.pick input { width: 19px; height: 19px; cursor: pointer; accent-color: var(--accent); }
.item-main { display: flex; align-items: center; gap: .8em; flex: 1; min-width: 0; color: var(--text); padding: .3em 0; }
.item-main:hover { text-decoration: none; }
.item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 520; display: grid; }
.item-name small { font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.item-meta { color: var(--muted); font-size: .88em; white-space: nowrap; }
.compact .item { min-height: 50px; }
@media (max-width: 600px) { .view-list .item-meta { display: none; } }

.thumb { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.thumb .ic { width: 22px; height: 22px; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-folder { background: #e6eeff; color: #2563eb; }
.thumb-folder .ic { fill: #c9dafd; }
.thumb-image { background: #fde9ef; color: #d6336c; }
.thumb-video { background: #f1e8ff; color: #7c3aed; }
.thumb-audio { background: #fff1db; color: #b25e00; }
.thumb-pdf { background: #fdecee; color: #c62f3b; }
.thumb-doc { background: #e6eeff; color: #1d4ed8; }
.thumb-sheet { background: #e3f6ec; color: #157f4b; }
.thumb-slides { background: #fff1db; color: #c2410c; }
@media (prefers-color-scheme: dark) {
  .thumb-folder { background: #1d2a47; color: #7aa2ff; }
  .thumb-folder .ic { fill: #2a3d66; }
  .thumb-image { background: #3d1d29; color: #ff8fb1; }
  .thumb-video { background: #2c2147; color: #b794ff; }
  .thumb-audio, .thumb-slides { background: #3a2d14; color: #f0b04a; }
  .thumb-pdf { background: #3a1c22; color: #ff6b76; }
  .thumb-doc { background: #1d2a47; color: #7aa2ff; }
  .thumb-sheet { background: #173326; color: #4cc38a; }
}

/* grid view */
.is-grid .items#items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8em; background: none; border: 0; box-shadow: none; }
.is-grid #items .item { position: relative; display: block; padding: .5em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-height: 0; }
.is-grid #items .item-main { flex-direction: column; align-items: stretch; gap: .5em; padding: 0; }
.is-grid #items .thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }
.is-grid #items .thumb .ic { width: 42%; height: 42%; }
.is-grid #items .item-name { text-align: center; font-size: .92em; padding: 0 .2em; }
.is-grid #items .item-meta { display: none; }
.is-grid #items .pick { position: absolute; top: .55em; left: .55em; z-index: 2; background: color-mix(in srgb, var(--surface) 85%, transparent); border-radius: 8px; opacity: 0; }
.is-grid #items .item:hover .pick, .is-grid #items .item.selected .pick, .is-grid.selecting #items .pick { opacity: 1; }
.is-grid #items .item-more { position: absolute; top: .45em; right: .45em; background: color-mix(in srgb, var(--surface) 85%, transparent); }
@media (max-width: 600px) { .is-grid .items#items { grid-template-columns: repeat(3, 1fr); gap: .45em; } .is-grid #items .item { padding: .3em; } .is-grid #items .pick { opacity: 1; } }

.empty { text-align: center; padding: 3.5em 1em; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .ic { width: 56px; height: 56px; color: var(--line); margin-bottom: .6em; }

.selbar {
  position: sticky; top: calc(var(--topbar) + .5em); z-index: 15; display: flex; align-items: center; gap: .5em; flex-wrap: wrap;
  background: var(--accent-soft); color: var(--text); padding: .5em .7em; border-radius: 12px; margin-bottom: .8em;
}

.fab {
  position: fixed; right: 1.2em; bottom: calc(1.2em + env(safe-area-inset-bottom)); z-index: 18;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer;
  display: none; place-items: center; box-shadow: 0 8px 24px rgb(37 99 235 / 40%);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
@media (max-width: 860px) { .fab { display: grid; } }

.dropzone { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.dropzone > div { background: var(--surface); padding: 2em 2.5em; border-radius: var(--radius); border: 3px dashed var(--accent); text-align: center; box-shadow: var(--shadow-lg); font-weight: 600; }
.dropzone .ic { width: 48px; height: 48px; color: var(--accent); }

/* upload panel */
.uploads {
  position: fixed; right: 1em; bottom: 1em; z-index: 50; width: min(380px, calc(100vw - 2em)); max-height: 50vh;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.uploads-head { display: flex; align-items: center; justify-content: space-between; padding: .5em .5em .5em 1em; border-bottom: 1px solid var(--line); }
.uploads ul { list-style: none; margin: 0; padding: .3em 0; overflow-y: auto; }
.uploads li { padding: .45em 1em; display: grid; gap: .25em; font-size: .9em; }
.uploads li .row { display: flex; gap: .5em; justify-content: space-between; }
.uploads li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .state { color: var(--muted); white-space: nowrap; }
.uploads li.done .state { color: var(--ok); }
.uploads li.failed .state { color: var(--danger); }
.uploads progress { height: 5px; }
@media (max-width: 860px) { .uploads { bottom: calc(5.5em + env(safe-area-inset-bottom)); } }

/* context menu */
.ctxmenu { position: fixed; z-index: 70; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .35em; display: grid; }
.ctxmenu button { display: flex; align-items: center; gap: .7em; padding: .7em .8em; border: 0; background: none; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.ctxmenu button:hover { background: var(--surface-2); }
.ctxmenu button.danger { color: var(--danger); }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: .3em 0; }
@media (max-width: 600px) {
  .ctxmenu { left: .5em !important; right: .5em; top: auto !important; bottom: calc(.5em + env(safe-area-inset-bottom)); min-width: 0; padding: .5em; }
  .ctxmenu button { padding: .9em .8em; }
}

/* dialogs */
.dlg { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 1.5em)); box-shadow: var(--shadow-lg); }
.dlg-wide { width: min(620px, calc(100vw - 1.5em)); }
.dlg::backdrop { background: rgb(10 15 25 / 45%); }
.dlg-body { padding: 1.3em 1.4em; display: grid; gap: .8em; }
.dlg-body h2 { font-size: 1.2em; }
.dlg-body h3 { font-size: 1em; display: flex; align-items: center; gap: .45em; margin: .4em 0 .5em; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.dlg-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-actions { display: flex; gap: .5em; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.picker-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; max-height: 45vh; overflow-y: auto; }
.picker-list li button { display: flex; align-items: center; gap: .7em; width: 100%; padding: .75em .9em; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.picker-list li:last-child button { border-bottom: 0; }
.picker-list li button:hover { background: var(--surface-2); }
.picker-list small { color: var(--muted); margin-left: auto; }
.picker-list .empty-row { padding: 1em; color: var(--muted); }
.share-add { display: flex; gap: .5em; flex-wrap: wrap; align-items: center; }
.share-add select:first-child { flex: 1 1 160px; width: auto; }
.share-add > select { width: auto; }
.share-list { list-style: none; padding: 0; margin: .6em 0 0; display: grid; gap: .4em; }
.share-list li { display: flex; align-items: center; gap: .6em; padding: .55em .7em; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; }
.share-list .grow { flex: 1; min-width: 0; display: grid; }
.share-list input[readonly] { min-height: 36px; font-size: .88em; }
.link-box { display: flex; gap: .5em; }

/* viewer */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgb(8 10 14 / 96%); color: #fff; display: grid; grid-template-rows: auto 1fr; }
.viewer-bar { display: flex; align-items: center; gap: .4em; padding: .5em .7em; padding-top: calc(.5em + env(safe-area-inset-top)); }
.viewer-bar .icon-btn { color: #e5e7eb; }
.viewer-bar .icon-btn:hover { background: rgb(255 255 255 / 12%); color: #fff; }
.viewer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-stage { display: grid; place-items: center; overflow: hidden; padding: 0 .5em 1em; touch-action: pan-y; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; border-radius: 6px; }
.viewer-stage audio { width: min(520px, 90vw); }
.viewer-stage .viewer-doc { width: min(1100px, 100%); height: calc(100vh - 90px); height: calc(100dvh - 90px); border: 0; border-radius: 6px; background: #fff; }
.viewer-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgb(255 255 255 / 12%); color: #fff; cursor: pointer; display: grid; place-items: center; }
.viewer-nav .ic { width: 28px; height: 28px; }
.viewer-nav.prev { left: 1em; }
.viewer-nav.next { right: 1em; }
@media (max-width: 600px) { .viewer-nav { display: none; } }

/* toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1.2em + env(safe-area-inset-bottom)); z-index: 90; display: grid; gap: .5em; width: min(520px, calc(100vw - 2em)); }
.toast { background: #1b2333; color: #fff; padding: .8em 1em; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 1em; animation: toast-in .2s ease; }
.toast.error-toast { background: var(--danger); }
.toast button { margin-left: auto; background: none; border: 0; color: #9cc0ff; font: inherit; font-weight: 700; cursor: pointer; padding: .2em .4em; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 860px) { .toasts { bottom: calc(6em + env(safe-area-inset-bottom)); } }

/* account / admin / shares */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35em 1.2em; margin: 0 0 1em; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.inline-form { display: flex; gap: .6em; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 220px; }
.inline-form input { width: auto; flex: 1 1 140px; }
.stack-form { max-width: 440px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 .8em; align-items: end; }
.grid-form .btn { margin-bottom: .9em; }
.badge { display: inline-block; padding: .1em .6em; border-radius: 99px; font-size: .8em; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.row-actions { display: flex; gap: .4em; flex-wrap: wrap; }
.steps { padding-left: 1.2em; display: grid; gap: 1em; margin-top: 1em; }
.qr { margin: .6em 0; }
.qr svg { display: block; width: 220px; max-width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; background: #fff; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .4em; list-style: none; padding: 0; font-family: ui-monospace, Consolas, monospace; font-size: 1.05em; }
.codes li { background: var(--surface-2); padding: .4em .6em; border-radius: 8px; text-align: center; }
.session-list, .event-list { list-style: none; margin: 0; padding: 0; }
.session-list li { display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: .7em 0; border-bottom: 1px solid var(--line); }
.session-list li:last-child { border-bottom: 0; }
.event-list li { padding: .4em 0; }
.share-overview { list-style: none; padding: 0; margin: 0; display: grid; gap: .7em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1em 1.1em; box-shadow: var(--shadow); }
.share-overview .card { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; }
.card-main { display: flex; gap: .9em; align-items: center; min-width: 0; }
.card-main p { margin: .2em 0 0; }
.card-actions { display: flex; gap: .5em; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .94em; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: .5em .6em; border-bottom: 1px solid var(--line); }
.table td { padding: .6em; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table progress { width: 120px; }
.table-compact td { padding: .35em .6em; }
.row-warn td { background: var(--warn-soft); }
.invite-result { margin-top: 1em; padding-top: 1em; border-top: 1px solid var(--line); }
.mail-status { font-weight: 600; color: var(--ok); }
.mail-status.is-error { color: var(--warn); }
.grid-form .field-wide { grid-column: span 2; }
@media (max-width: 600px) { .grid-form .field-wide { grid-column: auto; } }

/* bare pages (login, invite, public links) */
.bare-main { max-width: 440px; margin: 0 auto; padding: 3em 1em 4em; }
body.bare .bare-main:has(.public) { max-width: 960px; }
.auth-card h1 { font-size: 1.4em; margin-bottom: .8em; }
.public-file { text-align: center; display: grid; gap: .6em; justify-items: center; }
.public-preview { max-width: 100%; max-height: 70vh; border-radius: 10px; }
.public-foot { text-align: center; margin-top: 2em; }

/* start page upload */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6em 1em; }
.page-head .page-title { margin-bottom: 0; }
.home-hint { margin: .4em 0 1em; }

/* hints in Fotos / Backups */
.hint-bar { display: flex; align-items: center; gap: .7em; padding: .6em .9em; margin-bottom: 1em; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: .93em; }
.hint-bar > .ic { width: 20px; height: 20px; color: var(--accent); flex: none; }
.hint-bar span { flex: 1; }
.hint-panel { margin-bottom: 1em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.hint-panel summary { cursor: pointer; padding: .7em 1em; font-weight: 600; display: flex; align-items: center; gap: .5em; }
.hint-panel summary .ic { width: 20px; height: 20px; color: var(--accent); }
.hint-body { padding: 0 1.1em 1em; }
.hint-body ul { padding-left: 1.2em; display: grid; gap: .45em; }
.hint-body code { font-size: .85em; overflow-wrap: anywhere; }

/* upload conflicts */
.conflict-names { margin: .2em 0 .8em; padding-left: 1.2em; max-height: 9em; overflow: auto; font-size: .93em; }
.choice-list { display: grid; gap: .5em; }
.choice { display: flex; align-items: flex-start; gap: .8em; text-align: left; padding: .75em .9em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.choice:hover, .choice:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.choice > .ic { width: 22px; height: 22px; flex: none; margin-top: .1em; color: var(--accent); }
.choice span { display: grid; gap: .15em; }
.choice small { color: var(--muted); }

/* versions */
.version-list { list-style: none; padding: 0; margin: .8em 0 0; display: grid; gap: .4em; }
.version-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5em .8em; padding: .6em .75em; border-radius: 10px; background: var(--surface-2); }
.version-list li.current { background: var(--accent-soft); }
.version-info { flex: 1; min-width: 12em; display: grid; }

/* photo timeline */
.year-bar { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top, 0px)); z-index: 5; display: flex; gap: .4em; overflow-x: auto; padding: .5em 0; margin-bottom: .5em; background: var(--bg); scrollbar-width: thin; }
.year-bar a { flex: none; padding: .3em .9em; border-radius: 99px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .92em; }
.year-bar a:hover { text-decoration: none; background: var(--accent-soft); }
.year-bar a.active { background: var(--accent); color: #fff; }
.month { margin-bottom: 1.4em; }
.month-head { font-size: 1.05em; margin: 0 0 .5em; display: flex; align-items: baseline; gap: .5em; }
.photo-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 3px; }
@media (min-width: 900px) { .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; } }
.photo-grid .item { display: block; padding: 0; border: 0; background: none; min-height: 0; }
.photo { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo:hover img { transform: scale(1.04); }
.photo-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.photo-icon .ic { width: 36%; height: 36%; }
.badge-play { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / 55%); color: #fff; }
.badge-play .ic { width: 14px; height: 14px; fill: currentColor; }
.more-row { text-align: center; margin: 1.5em 0; }

/* album choice */
.album-list { display: grid; gap: .35em; max-height: 16em; overflow: auto; margin: .3em 0 .8em; }
.album-option { display: flex; align-items: center; gap: .6em; padding: .55em .7em; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.album-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.album-option .ic { width: 18px; height: 18px; color: var(--accent); }
.album-bar { position: static; padding-bottom: 0; }
.album-bar a.active { background: var(--text); color: var(--bg); }

/* phone app page */
.pairing { margin-top: 1em; }
.pair-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.3em; letter-spacing: .08em; }
.plain-list { padding-left: 1.2em; display: grid; gap: .45em; }

/* favourites */
.fav-mark { width: 14px; height: 14px; color: #e0a100; fill: #f5c542; vertical-align: -2px; margin-left: .2em; }
.fav-head .ic { width: 18px; height: 18px; vertical-align: -3px; color: #e0a100; fill: #f5c542; }

/* guest upload page */
.guest-upload h1 .ic { width: 24px; height: 24px; vertical-align: -4px; color: var(--accent); }
.guest-done { font-weight: 600; color: var(--ok); }
