:root {
  --page: #1e2124; --panel: #262a2e; --raise: #2f3439; --line: #3a4046; --text: #f1ece0; --muted: #a9ada8; --mint: #9ec4b5; --mint-ink: #12201b; --logo: #9ec4b5; --danger: #e8806f; --ok: #8fd19e;
  --r: 14px; --font: 'Poppins', system-ui, sans-serif; color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) { --page: #f6f3ec; --panel: #fffdf8; --raise: #efeae0; --line: #ddd6c9; --text: #1e2124; --muted: #5d625f; --mint: #4f8f7a; --mint-ink: #fff; --logo: #1e2124; color-scheme: light; }
}
:root[data-theme='light'] { --page: #f6f3ec; --panel: #fffdf8; --raise: #efeae0; --line: #ddd6c9; --text: #1e2124; --muted: #5d625f; --mint: #4f8f7a; --mint-ink: #fff; --logo: #1e2124; color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.45 var(--font); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--mint); }
.btn { border: 1px solid var(--line); background: var(--raise); border-radius: 999px; padding: 9px 16px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.btn:hover { border-color: var(--mint); }
.btn.primary { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: none; border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type='text'], input[type='password'], input[type='search'], input[type='number'], select { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Sign-in and first run */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 30px 26px; display: grid; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; text-decoration: none; }
.brand .logo { display: block; height: 24px; aspect-ratio: 775 / 100; background: var(--logo); -webkit-mask: url(/logo.svg) no-repeat center / contain; mask: url(/logo.svg) no-repeat center / contain; }
.brand-tag { font: 500 11px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.1em; text-transform: uppercase; color: #1e2124; background: #9ec4b5; padding: 5px 7px 4px; border-radius: 5px; white-space: nowrap; }
.gate h1 { margin: 6px 0 0; font-size: 24px; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 4px 10px 16px; gap: 8px; }
.side .brand .logo { height: 19px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; color: var(--text); text-decoration: none; border: 0; background: none; text-align: left; }
.nav:hover { background: var(--raise); }
.nav.on { background: color-mix(in srgb, var(--mint) 18%, transparent); color: var(--mint); font-weight: 600; }
.usage { margin-top: auto; padding: 12px; font-size: 13px; color: var(--muted); display: grid; gap: 8px; }
.bar { height: 6px; background: var(--raise); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--mint); border-radius: 99px; }
.main { padding: 18px 26px 120px; min-width: 0; }
.top { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.top .search { flex: 1; max-width: 520px; position: relative; }
.top .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top .search input { padding-left: 40px; border-radius: 999px; }
.menu-btn { display: none; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 20px; font-weight: 600; margin: 4px 0 14px; }
.crumbs button { background: none; border: 0; padding: 2px 6px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.crumbs button:hover { background: var(--raise); }
.crumbs .sep { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* Items */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; position: relative; user-select: none; }
.card:hover { border-color: var(--mint); }
.card.sel { outline: 2px solid var(--mint); }
.thumb { aspect-ratio: 4 / 3; background: var(--raise); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .icon { width: 42px; height: 42px; stroke-width: 1.4; }
.thumb.dir { color: var(--mint); }
.card .meta { padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.card .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .more { position: absolute; top: 6px; right: 6px; background: color-mix(in srgb, var(--page) 80%, transparent); border: 0; border-radius: 99px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; background: var(--mint); color: var(--mint-ink); border-radius: 99px; padding: 2px 8px; font-weight: 600; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: 18px; }
.empty b { color: var(--text); display: block; font-size: 18px; margin-bottom: 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; }
.photos .card { border-radius: 6px; border: 0; }
.photos .thumb { aspect-ratio: 1; }
.photos .meta { display: none; }

/* Drop zone, uploads */
.drop { position: fixed; inset: 0; background: color-mix(in srgb, var(--mint) 22%, transparent); border: 3px dashed var(--mint); display: none; place-items: center; font-size: 24px; font-weight: 600; z-index: 50; pointer-events: none; }
.drop.on { display: grid; }
.uploads { position: fixed; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; z-index: 40; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.uploads .row { display: grid; gap: 4px; font-size: 13px; }
.uploads .row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sheets (menus, dialogs) */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 60; display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; display: grid; gap: 14px; }
.sheet h2 { margin: 0; font-size: 19px; }
.sheet .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.menu { display: grid; gap: 2px; }
.menu button { display: flex; gap: 12px; align-items: center; background: none; border: 0; padding: 11px 10px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--raise); }
.list { display: grid; gap: 6px; }
.list .li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--raise); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.viewer { position: fixed; inset: 0; background: rgba(10, 12, 13, 0.94); z-index: 70; display: grid; grid-template-rows: auto 1fr; }
.viewer header { display: flex; gap: 10px; align-items: center; padding: 12px 16px; color: #f1ece0; }
.viewer header b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .stage { display: grid; place-items: center; min-height: 0; padding: 0 12px 12px; }
.viewer img, .viewer video { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 8px; }
.viewer iframe { width: min(1000px, 100%); height: calc(100vh - 90px); border: 0; background: #fff; border-radius: 8px; }
.viewer pre { color: #f1ece0; background: #1e2124; padding: 16px; border-radius: 10px; max-width: 900px; max-height: calc(100vh - 100px); overflow: auto; white-space: pre-wrap; }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; }
.toast { background: var(--text); color: var(--page); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 12px; margin-bottom: 16px; }
.panel h2 { margin: 0; font-size: 17px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
code { background: var(--raise); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* Phones: the sidebar becomes a tab bar along the bottom. */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 30; }
  .side .brand, .usage, .side .nav.extra { display: none; }
  .nav { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; align-items: center; }
  .main { padding: 14px 16px 110px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .two { grid-template-columns: 1fr; }
  .uploads { bottom: 80px; }
  .hide-phone { display: none; }
}

/* ---- Refinements ---- */
.nav.phone-only { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--mint); color: var(--mint-ink); font-weight: 700; cursor: pointer; display: grid; place-items: center; flex: none; margin-left: auto; letter-spacing: 0.02em; }
.avatar.big { margin-left: 0; width: 52px; height: 52px; font-size: 18px; cursor: default; }
.me { display: flex; gap: 14px; align-items: center; }
.usage { margin-top: auto; padding: 8px 4px; }
.usage-card { background: var(--raise); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.usage-head { display: flex; justify-content: space-between; color: var(--text); }
.bar.full > i { background: var(--danger); }
.head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 4px 0 14px; }
.head .crumbs { margin: 0; min-width: 0; }
.crumbs.small { font-size: 15px; margin: 0; }
.tools { display: flex; gap: 8px; align-items: center; }
.tools select { width: auto; border-radius: 999px; padding: 7px 12px; font-size: 14px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 999px; width: 34px; height: 30px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--raise); color: var(--mint); }
.seg .icon { width: 17px; height: 17px; }
.hint { align-self: center; font-size: 13px; }
.icon.big { width: 44px; height: 44px; stroke-width: 1.3; color: var(--mint); display: block; margin: 0 auto 10px; }
.empty { display: grid; justify-items: center; gap: 4px; }
.skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.skeleton i { aspect-ratio: 1; border-radius: var(--r); background: linear-gradient(90deg, var(--panel), var(--raise), var(--panel)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Cards: ticks for selecting, a coloured tag for each kind of file. */
.card { transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.tick { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, 0.25); z-index: 2; opacity: 0; transition: opacity 0.12s; cursor: pointer; }
.card:hover .tick, .rowi:hover .tick, .selecting .tick, .sel .tick { opacity: 1; }
.sel .tick { background: var(--mint); border-color: var(--mint); }
.sel .tick::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--mint-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.card.sel, .rowi.sel { outline: 2px solid var(--mint); outline-offset: -1px; }
.badge { left: auto; right: 46px; top: 10px; display: inline-flex; gap: 4px; align-items: center; }
.badge .icon { width: 13px; height: 13px; }
.card .badge ~ .tick, .tick { left: 8px; }
.filetag { position: relative; display: grid; place-items: center; color: var(--kc, var(--muted)); }
.filetag .icon { width: 54px; height: 54px; stroke-width: 1.2; }
.filetag em { position: absolute; bottom: 10px; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; background: var(--kc, var(--muted)); color: #fff; border-radius: 4px; padding: 1px 5px; }
.filetag.small { width: 36px; height: 28px; }
.filetag.small em { position: static; font-size: 9px; }
.k-pdf { --kc: #e05d4f; } .k-doc { --kc: #4a7fd6; } .k-xls { --kc: #3f9a5f; } .k-ppt { --kc: #d9792f; } .k-zip { --kc: #9b7bd1; } .k-cad { --kc: #2fa8a0; } .k-txt { --kc: #8a9096; } .k-aud { --kc: #c958a5; } .k-img, .k-vid { --kc: var(--mint); }
.thumb .play { position: absolute; width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; display: grid; place-items: center; font-size: 14px; }
.thumb { position: relative; }

/* List rows */
.rows { display: grid; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rowi { display: grid; grid-template-columns: 40px minmax(0, 1fr) 120px 80px 36px; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.rowi:last-child { border-bottom: 0; }
.rowi:hover { background: var(--raise); }
.rowi .tick { top: 50%; left: 19px; transform: translateY(-50%); border-color: var(--muted); background: var(--panel); }
.rowi:hover .tick { background: var(--raise); }
.rowi.sel .tick { background: var(--mint); border-color: var(--mint); }
.ri { transition: opacity 0.12s; }
.rowi:hover .ri, .selecting .rowi .ri, .rowi.sel .ri { opacity: 0; }
.ri { width: 40px; height: 32px; display: grid; place-items: center; border-radius: 6px; overflow: hidden; }
.ri img { width: 100%; height: 100%; object-fit: cover; }
.ri.dir { color: var(--mint); }
.rn { display: flex; gap: 8px; align-items: center; min-width: 0; }
.rn .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rd, .rs { color: var(--muted); font-size: 13px; }
.rs { text-align: right; }
.rowi .more { position: static; background: none; border: 0; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.chip { font-size: 11px; background: var(--raise); border-radius: 99px; padding: 2px 8px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.chip .icon { width: 12px; height: 12px; }
.month { margin: 18px 0 8px; font-size: 15px; }
.month:first-child { margin-top: 0; }
.li.pick { border: 0; cursor: pointer; justify-content: flex-start; }
.li.pick span { flex: 1; text-align: left; }

/* Selection bar */
.selbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--text); color: var(--page); border-radius: 999px; padding: 6px 6px 6px 18px; display: flex; gap: 6px; align-items: center; z-index: 35; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.selbar[hidden] { display: none; }
.selbar .btn { background: transparent; color: var(--page); border-color: transparent; }
.selbar .btn:hover { background: color-mix(in srgb, var(--page) 15%, transparent); }
.selbar b { margin-right: 6px; white-space: nowrap; }
.drop .icon { width: 30px; height: 30px; margin-right: 10px; }

@media (max-width: 760px) {
  .nav.phone-only { display: flex; }
  .avatar { width: 36px; height: 36px; }
  .rowi { grid-template-columns: 36px minmax(0, 1fr) 64px 32px; }
  .rowi .tick { left: 17px; }
  .selbar { bottom: 84px; }
  .tools select { padding: 6px 10px; font-size: 13px; }
  .card .tick { opacity: 0; }
  .selecting .card .tick, .card.sel .tick { opacity: 1; }
}

/* Storage bar sits on a raised card: give its track its own tone */
.usage-card .bar { background: rgba(255, 255, 255, 0.09); }
.bar > i { min-width: 6px; }
/* Account menu drops from the avatar instead of opening mid-screen */
.scrim.pop { background: rgba(0, 0, 0, 0.25); place-items: start end; padding: 66px 16px 16px; }
.scrim.pop .sheet { width: min(320px, 100%); padding: 16px; gap: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); animation: pop 0.14s ease-out; transform-origin: top right; }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .scrim.pop .sheet { animation: none; } }

/* Connect your devices */
.conn { display: grid; gap: 8px; }
.conn > div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.conn .muted { min-width: 76px; font-size: 13px; }
.conn code, .howto code, .apppass { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 13px; overflow-wrap: anywhere; }
.field { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.field > .muted { grid-column: 1 / -1; font-size: 12px; }
.appfield { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; overflow-wrap: anywhere; user-select: all; }
.apppass { display: block; font-size: 20px; letter-spacing: 0.06em; padding: 14px; text-align: center; user-select: all; }
.howto { display: grid; gap: 6px; }
.howto details { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ol { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); line-height: 1.5; }
.howto ol b, .howto ol code { color: var(--text); }
.secure { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--muted); line-height: 1.5; }
.secure b { color: var(--text); }

/* Away from home */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted, #888); margin-right: 8px; vertical-align: middle; }
.dot.on { background: #4fbf88; } .dot.off { background: var(--danger); }
.qr { background: #fff; border-radius: 14px; padding: 10px; width: min(280px, 100%); justify-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
[data-rf] label[hidden] { display: none; }
