/* FileSync account panel: one design system for every signed-in page and the sign-in pages.
   Colours come from style.css (--bg, --card, --text, --muted, --border, --accent ...); nothing here picks a new colour.
   Scale: spacing 4/8/12/16/24/32/48, radius 10 (controls) 14 (rows) 20 (cards) 999 (pills), type 13/14/15/17/22/28. */

:root {
    --ok: #2ea043;
    --warn: #d29922;
    --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
    --ok-soft: color-mix(in srgb, var(--ok) 16%, transparent);
    --warn-soft: color-mix(in srgb, var(--warn) 18%, transparent);
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .05);
    --side: 264px;
}

body.app { font-size: 15px; line-height: 1.55; }
h1, h2, h3 { letter-spacing: -.01em; }

/* ---------- Shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

@media (min-width: 721px) {
    .sidebar { display: flex; flex-direction: column; width: var(--side); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
               background: var(--card); border-right: 1px solid var(--border); padding: 1.5rem 1rem 1rem; }
    .signed-in .topbar, .signed-in .tabbar { display: none; }
}

.side-brand { display: flex; align-items: center; gap: .1rem; padding: .25rem .75rem 1.5rem; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.side-label { padding: 0 .85rem; margin: 1.1rem 0 .4rem; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); opacity: .85; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a { display: flex; align-items: center; gap: .8rem; padding: .62rem .85rem; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 600; }
.side-nav a .icon { width: 1.25rem; height: 1.25rem; }
.side-nav a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-foot .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.side-foot .who span { display: block; font-size: .8rem; color: var(--muted); }
.side-foot form { margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; flex: none; font-weight: 700;
          background: linear-gradient(135deg, var(--accent), #2dc5a2); color: var(--accent-text); }

/* ---------- Page ---------- */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 2rem 2.5rem 3rem; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.75rem; }
.page-head h1 { margin: 0; font-size: 1.75rem; line-height: 1.2; }
.page-head p { margin: .3rem 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.section-title { margin: 2rem 0 .9rem; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.section-title .count { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--accent-soft); border-radius: 999px; padding: .05rem .6rem; }
.page .alert { border-radius: 14px; padding: .85rem 1.1rem; margin: 0 0 1.25rem; }

.grid { display: grid; gap: 1.25rem; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 1.5rem; margin: 0; box-shadow: var(--shadow); }
.page .card + .card { margin-top: 1.25rem; }
.grid > .card, .grid > .stat { margin-top: 0 !important; }
.page > .grid + .grid, .page > .grid + .card, .page > .card + .grid, .page > .notice + .grid { margin-top: 1.25rem; }
.btn-row { margin: 1rem 0 0; }
.hint.tight { margin: 0 0 1rem; }
.steps-inline { display: inline-block; text-align: left; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; }
.card-head h2, .card > h2 { margin: 0; font-size: 1.1rem; }
.card-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 1.25rem 1.5rem 0; }

.chip { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 14px; flex: none; background: var(--accent-soft); color: var(--accent); }
.chip .icon { width: 1.3rem; height: 1.3rem; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.off { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }

/* Stat tiles */
.stat { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.stat .label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); }
.stat .value { display: block; margin: .3rem 0 .15rem; font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat .sub { display: block; font-size: .85rem; color: var(--muted); }

/* Pills and status */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); white-space: nowrap; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.5rem; padding: 0 1.1rem; border-radius: 12px; border: 1px solid var(--border);
       background: var(--card); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { min-height: 2.1rem; padding: 0 .8rem; font-size: .88rem; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--accent-soft); color: var(--accent); }
.btn .icon { width: 1.1rem; height: 1.1rem; }

/* Rows inside a card */
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li, .row-item { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.rows > li:first-child { border-top: 0; }
.grow { flex: 1; min-width: 0; }
.row-item strong, .rows li strong { display: block; }
.row-item .sub { display: block; font-size: .86rem; color: var(--muted); }
.card:not(.flush) .rows > li { padding-left: 0; padding-right: 0; }

/* Progress (a real <progress>, so no inline styles are needed) */
progress.meter { appearance: none; -webkit-appearance: none; width: 100%; height: .5rem; border: 0; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--muted) 22%, transparent); }
progress.meter::-webkit-progress-bar { background: transparent; }
progress.meter::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--accent), #2dc5a2); }
progress.meter::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--accent), #2dc5a2); }

/* Notice */
.notice { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.5rem; padding: 1rem 1.25rem; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); border-radius: 16px; background: var(--warn-soft); }
.notice .chip { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.notice > div { flex: 1; min-width: 0; }
.notice p { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- Device cards ---------- */
.dev { padding: 0; overflow: hidden; }
.dev-head { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; }
.dev-head .titles { flex: 1; min-width: 0; }
.dev-head h3 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dev-head .sub { color: var(--muted); font-size: .88rem; }
.dev-body { padding: 0 1.5rem 1.25rem; display: grid; gap: 1rem; }
.dev-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem 1.5rem; margin: 0; }
.dev-facts div { min-width: 0; }
.dev-facts dt { font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dev-facts dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips .pill { padding: .3rem .75rem; font-size: .84rem; }
.dev-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .9rem 1.5rem; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 55%, var(--card)); }
.dev-foot .spacer { flex: 1; }
.dev-foot form { margin: 0; }
.old-hint { margin: 0; padding: .6rem .85rem; border-radius: 12px; background: var(--warn-soft); font-size: .88rem; color: var(--text); }

details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > .menu-panel { display: flex; }
.menu-panel { display: none; position: absolute; left: 0; bottom: calc(100% + .5rem); z-index: 5; width: 20rem; max-width: calc(100vw - 3rem); flex-direction: column; gap: .75rem; padding: 1rem; border-radius: 16px;
              background: var(--card); border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0, 0, 0, .28); }
.menu-panel p { margin: 0; font-size: .88rem; color: var(--muted); }
.menu-panel form { display: flex; flex-direction: column; gap: .6rem; }

/* ---------- Forms ---------- */
label { display: block; margin: 0 0 1rem; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], select, textarea {
    display: block; width: 100%; min-height: 2.75rem; margin-top: .4rem; padding: .6rem .85rem; font: inherit; font-weight: 400; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.form { max-width: 34rem; }
.form-actions { display: flex; gap: .6rem; margin-top: .25rem; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.settings-layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.settings-nav { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: .2rem; }
.settings-nav a { padding: .5rem .8rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.settings-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.settings-body > .card { scroll-margin-top: 1.5rem; }
@media (max-width: 960px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; } }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }

/* ---------- Plan ---------- */
.plan-hero { display: grid; gap: 1.25rem; }
.plan-hero .top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.plan-hero h2 { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .9rem; margin: 0; padding: 0; list-style: none; }
.limits li { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; gap: .15rem; }
.limits .what { font-size: .84rem; color: var(--muted); }
.limits .num { font-size: 1.35rem; font-weight: 700; }
.limits li.off .num { color: var(--muted); font-weight: 600; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; }
.tier { display: flex; flex-direction: column; gap: .9rem; }
.tier h3 { margin: 0; font-size: 1.2rem; }
.tier .desc { margin: 0; color: var(--muted); font-size: .92rem; }
.tier .adds { margin: 0; padding: 0; list-style: none; display: grid; gap: .4rem; font-size: .92rem; }
.tier .adds li { display: flex; gap: .5rem; align-items: flex-start; }
.tier .adds .icon { color: var(--ok); margin-top: .2rem; }
.tier .buy { margin-top: auto; display: grid; gap: .5rem; }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 12px; }
.buy-row .price { font-weight: 700; }
.buy-row .per { color: var(--muted); font-size: .85rem; font-weight: 400; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: .7rem 1.5rem; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: .85rem 1.5rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.empty-note { padding: 1.5rem; color: var(--muted); text-align: center; }

/* ---------- Sign-in pages (signed out) ---------- */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .1rem; margin: 3rem auto 1rem; font-weight: 700; font-size: 1.35rem; color: var(--text); text-decoration: none; }
body.app:not(.signed-in) .topbar { display: none; }
body.app:not(.signed-in) .container { max-width: 520px; padding-top: .5rem; }
.card.narrow { border-radius: 20px; padding: 2rem; margin: 1rem auto; }

/* ---------- Phones: top bar, bottom tabs, one column ---------- */
@media (max-width: 720px) {
    .shell { display: block; }
    .page { padding: 1.1rem 1rem 1.5rem; }
    .page-head h1 { font-size: 1.45rem; }
    .page-head .actions .btn { flex: 1; }
    .card { border-radius: 16px; padding: 1.1rem; }
    .dev-head { padding: 1rem; flex-wrap: wrap; }
    .dev-body { padding: 0 1rem 1rem; }
    .dev-foot { padding: .8rem 1rem; }
    .rows > li, .row-item { padding: .9rem 1rem; }
    .stat .value { font-size: 1.7rem; }
    .notice { flex-wrap: wrap; }
    .notice .btn { width: 100%; }
    .menu-panel { left: 0; right: 0; width: auto; }
    .table th, .table td { padding: .7rem 1rem; }
}
.card.narrow.left { margin-left: 0; margin-right: 0; max-width: 520px; }

/* limits: a compact list inside cards, tiles inside the plan hero */
.limits { display: block; }
.limits li { display: flex; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.limits li:last-child { border-bottom: 0; }
.limits .num { font-size: 1rem; }
.plan-hero .limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .9rem; }
.plan-hero .limits li { flex-direction: column; justify-content: flex-start; align-items: stretch; gap: .15rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 14px; }
.plan-hero .limits .num { font-size: 1.35rem; }
.dev-head .titles { flex: 1; min-width: 0; }
.rows > li > form { flex: none; }
.tiers > .card { margin: 0; }
.tier .buy > .pill { align-self: flex-start; }
.rows .sub { display: block; font-size: .86rem; color: var(--muted); }
.settings-nav { position: sticky; top: 1.5rem; align-self: start; }
.tier .buy > .pill { width: fit-content; }
@media (max-width: 720px) {
    .grid.cols-4 { grid-template-columns: 1fr 1fr; }
    .stat { padding: 1rem; }
    .plan-hero .limits { grid-template-columns: 1fr 1fr; }
}
