/* QOL Cloud: the QOL command-deck base + glass gloss, subtle fx (the house standard). Mobile-first; no horizontal page scroll. */
:root {
  --bg: #070b16; --bg-2: #050810; --panel: #0b1120; --panel-2: #0d1426;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.04);
  --fg: #f4f7ff; --muted: #9aa6c2; --subtle: #7e8aac;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1080px;
  --hi: inset 0 1px 0 rgba(255,255,255,.06);
  /* QOL Cloud: an opal blue that leans to sky. */
  --accent: #7C9BFF; --accent-2: #9EE7F5; --glow: rgba(124,155,255,.42); --btn-ink: #04060d;
  --brand: linear-gradient(135deg, var(--accent), var(--accent-2));
  --c-files: #8EA6FF; --c-history: #9EE7F5; --c-trash: #c3a6ff;
  --ease: cubic-bezier(.16,1,.3,1);
  --r: 18px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--font); font-weight: 400; line-height: 1.5; min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 40vmax at 85% -10%, rgba(124,155,255,.16), transparent 60%),
    radial-gradient(50vmax 36vmax at -10% 110%, rgba(158,231,245,.08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* ---------- glass ---------- */
.glass { position: relative; background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.06); border-radius: var(--r); box-shadow: var(--hi), 0 20px 40px -24px rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); }
.glass::before { content: ""; position: absolute; inset: 0 0 66% 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, rgba(7,11,22,.86), rgba(7,11,22,.6)); border-bottom: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brandmark { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; }
.brandmark .cloud { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account .email { color: var(--muted); font-size: .85rem; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform .14s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn::after { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-18deg); transition: left .6s var(--ease); }
.btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.28); }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .chip:focus-visible, .row:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--btn-ink); border-color: transparent; box-shadow: 0 0 18px -10px var(--glow); }
.btn-ghost { background: transparent; }
.btn-glass { background: rgba(255,255,255,.06); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .85rem; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.02rem; }
.btn[aria-pressed="true"] { border-color: rgba(195,166,255,.5); background: rgba(195,166,255,.1); }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; letter-spacing: -.025em; }
h1 { font-weight: 800; font-size: clamp(1.9rem, 8vw, 3.4rem); line-height: 1.06; text-wrap: balance; }
h2 { font-weight: 700; font-size: 1.3rem; line-height: 1.2; overflow-wrap: anywhere; }
.grad { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { margin: 0 0 6px; color: var(--subtle); font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }
.lede { color: var(--muted); font-size: 1.05rem; font-weight: 300; max-width: 34ch; margin: 14px 0 24px; }

/* ---------- loading ---------- */
.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--accent-2); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- signed out ---------- */
.hero { padding: 36px 0 56px; }
.hero-card { padding: 30px 22px; }
.signin-error { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: rgba(255,120,140,.08); border: 1px solid rgba(255,120,140,.25); color: #ffc6cf; font-size: .92rem; }
.trio { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.trio li { padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.trio-icon { grid-row: span 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: rgba(124,155,255,.12); color: var(--accent-2); }
.trio span:last-child { color: var(--muted); font-size: .9rem; }

/* ---------- meter ---------- */
#app { padding: 20px 0 64px; }
.meter { padding: 20px 18px; }
.meter-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.meter-figure { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.meter-figure .muted { font-size: 1rem; font-weight: 400; }
.pill { flex: none; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid rgba(124,155,255,.35);
  background: linear-gradient(180deg, rgba(124,155,255,.30), rgba(124,155,255,.16)); }
.bar { display: flex; height: 10px; margin: 16px 0 12px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.06); box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }
.seg { display: block; height: 100%; width: 0; transition: width .9s var(--ease); }
.seg-files { background: var(--c-files); }
.seg-history { background: var(--c-history); }
.seg-trash { background: var(--c-trash); }
.legend { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .85rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--fg); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-files { background: var(--c-files); } .dot-history { background: var(--c-history); } .dot-trash { background: var(--c-trash); }
.upgrade { width: 100%; }

/* ---------- toolbar ---------- */
.toolbar { display: grid; gap: 12px; margin: 18px 0 8px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 48px; border-radius: 999px; }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 1rem; }
.search input::placeholder { color: var(--subtle); }
.toolbar-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.toolbar-row.actions { justify-content: space-between; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; min-width: 0; flex: 1; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--muted); font-size: .86rem; font-weight: 500; cursor: pointer; transition: border-color .3s var(--ease), color .3s var(--ease), background .3s var(--ease); }
.chip[aria-selected="true"] { color: var(--fg); border-color: rgba(124,155,255,.45); background: linear-gradient(180deg, rgba(124,155,255,.24), rgba(124,155,255,.12)); }
.banner { padding: 12px 16px; margin: 6px 0 10px; color: var(--muted); font-size: .9rem; }

/* ---------- groups + rows ---------- */
.groups { display: grid; gap: 18px; margin-top: 10px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; }
.group-head h3 { font-size: .95rem; font-weight: 600; }
.group-head span { color: var(--subtle); font-size: .82rem; }
.rows { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; cursor: pointer; min-width: 0;
  transition: background .3s var(--ease), transform .14s var(--ease); animation: dominoIn .5s var(--ease) both; }
.row:hover { background: rgba(255,255,255,.04); }
.thumb { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.05);
  border: 1px solid var(--line-2); color: var(--muted); font-size: .64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-main { min-width: 0; }
.row-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { color: var(--subtle); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-ver { font-size: .74rem; color: var(--muted); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.empty { padding: 26px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--fg); margin-bottom: 4px; font-weight: 600; }
@keyframes dominoIn { from { opacity: 0; transform: translateY(-10px) rotateX(40deg); } to { opacity: 1; transform: none; } }
@keyframes snapIn { 0% { transform: scale(1.12); } 60% { transform: scale(.96); } 100% { transform: scale(1); } }

/* ---------- sheets ---------- */
dialog.sheet { padding: 0; border: 0; background: transparent; color: var(--fg); width: 100%; max-width: 640px; max-height: 92dvh;
  margin: auto auto 0; }
dialog.sheet::backdrop { background: rgba(2,4,10,.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-inner { background: linear-gradient(180deg, rgba(20,28,48,.97), rgba(11,17,32,.98)); border: 1px solid rgba(255,255,255,.08); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: var(--hi), 0 -20px 60px -20px rgba(0,0,0,.7); padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; overflow-x: hidden; animation: rise .45s var(--ease) both; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-title { min-width: 0; }
.sheet-title .muted { margin: 4px 0 0; font-size: .88rem; }
.preview { margin: 16px 0; border-radius: 14px; overflow: hidden; background: rgba(0,0,0,.35); border: 1px solid var(--line-2); display: grid; place-items: center; min-height: 120px; }
.preview img, .preview video { display: block; max-width: 100%; max-height: 52dvh; }
.preview audio { width: calc(100% - 24px); margin: 24px 12px; }
.preview pre { margin: 0; padding: 14px; width: 100%; max-height: 40dvh; overflow: auto; font-family: var(--font); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; color: #d7def0; }
.preview .none { padding: 28px 18px; color: var(--muted); text-align: center; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 140px; }
.section-title { margin: 22px 0 8px; font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 1px solid var(--line); display: grid; gap: 4px; }
.timeline li { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; border-radius: 10px; }
.timeline li::before { content: ""; position: absolute; left: -19px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--panel-2); border: 1px solid rgba(255,255,255,.25); }
.timeline li.current::before { background: var(--accent-2); border-color: transparent; box-shadow: 0 0 12px -2px var(--glow); }
.timeline li.snap { animation: snapIn .3s var(--ease); }
.v-main { min-width: 0; }
.v-title { font-weight: 600; font-size: .92rem; }
.v-meta { color: var(--subtle); font-size: .78rem; }
.note { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; font-size: .86rem; color: var(--muted);
  background: linear-gradient(180deg, rgba(158,231,245,.08), rgba(158,231,245,.03)); border: 1px solid rgba(158,231,245,.16); }
.note b { color: var(--fg); font-weight: 600; }

/* ---------- plans ---------- */
.plans { display: grid; gap: 12px; margin-top: 18px; }
.plan { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.03); box-shadow: var(--hi); }
.plan.current { border-color: rgba(124,155,255,.4); background: linear-gradient(180deg, rgba(124,155,255,.14), rgba(124,155,255,.05)); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.plan-name { font-weight: 700; font-size: 1.1rem; }
.plan-status { font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.plan.current .plan-status { color: var(--fg); border-color: rgba(124,155,255,.45); }
.plan ul { list-style: none; padding: 0; margin: 10px 0 0; color: var(--muted); font-size: .9rem; display: grid; gap: 4px; }
.plan ul b { color: var(--fg); font-weight: 600; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 50; display: grid; gap: 8px; justify-items: center; padding: 0 16px; pointer-events: none; }
.toast { width: 100%; max-width: 420px; padding: 12px 14px; border-radius: 14px; pointer-events: auto; font-size: .9rem;
  background: rgba(16,23,40,.96); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 16px 40px -16px rgba(0,0,0,.8); animation: rise .4s var(--ease) both; }
.toast.err { border-color: rgba(255,120,140,.35); }
.toast .t-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.toast .t-sub { color: var(--muted); font-size: .8rem; }
.progress { height: 4px; margin-top: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s var(--ease); }

.notfound { padding: 18vh 16px; display: grid; gap: 12px; justify-items: start; }

/* ---------- wider screens ---------- */
@media (min-width: 720px) {
  .hero { padding: 72px 0 88px; }
  .hero-card { padding: 48px 44px; }
  .trio { grid-template-columns: repeat(3, 1fr); }
  .meter { padding: 24px 26px; display: grid; grid-template-columns: 1fr auto; column-gap: 24px; align-items: end; }
  .meter-head, .bar, .legend { grid-column: 1; }
  .meter .bar { margin-bottom: 10px; }
  .meter .legend { margin-bottom: 0; }
  .upgrade { grid-column: 2; grid-row: 1 / span 3; width: auto; align-self: center; }
  .toolbar { grid-template-columns: minmax(220px, 1fr) auto; }
  .toolbar .search { grid-column: 1 / -1; }
  .toolbar-row.actions { justify-content: flex-end; }
  dialog.sheet { margin: auto; }
  .sheet-inner { border-radius: 22px; border-bottom: 1px solid rgba(255,255,255,.08); padding: 26px 26px 28px; }
  .plans { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
