/* Portalia panel - light theme, mobile first */
:root {
  --bg: #f6f5fb;
  --card: #ffffff;
  --text: #1d1b2c;
  --muted: #6b6880;
  --line: #e6e3f0;
  --brand: #6b46e5;          /* portal violet */
  --brand-soft: #efeaff;
  --ok: #1f9d55;
  --ok-soft: #e5f6ec;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --err: #c53030;
  --err-soft: #fde8e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 44, .05), 0 4px 16px rgba(29, 27, 44, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: .6rem 16px;
  display: flex; align-items: center; gap: .75rem;
}
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem;
        color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px;
             background: radial-gradient(circle at 50% 55%, #fff 0 22%, transparent 23%),
                         linear-gradient(140deg, #8b6cff, #5a35d9); }
.topbar .spacer { flex: 1; }
.nav { max-width: 960px; margin: 0 auto; padding: 0 8px; display: flex; gap: .25rem;
       overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: .55rem .8rem; border-radius: 10px; color: var(--muted); text-decoration: none;
         white-space: nowrap; font-weight: 600; font-size: .95rem; }
.nav a.on { color: var(--brand); background: var(--brand-soft); }
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; }
                            .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
       padding: .65rem 1rem; border-radius: 10px; border: 1px solid var(--line);
       background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
       text-decoration: none; min-height: 44px; }
.btn:hover { border-color: #cfc9e6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #5a35d9; }
.btn-danger { color: var(--err); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: .35rem .7rem; font-size: .9rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
label { display: block; font-weight: 600; margin: .75rem 0 .35rem; }
input[type=text], select, textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--text); min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.check { display: flex; gap: .6rem; align-items: center; font-weight: 600; margin: .75rem 0; }
.check input { width: 20px; height: 20px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.hint.ok { color: var(--ok); } .hint.err { color: var(--err); }
.inline-form { display: inline; }

/* badges, flashes */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem;
         border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-sleep { background: #eeedf3; color: var(--muted); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash-ok { background: var(--ok-soft); color: #17693a; }
.flash-error { background: var(--err-soft); color: var(--err); }

/* address box */
.address { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; margin: .5rem 0; }
.address code { flex: 1 1 230px; display: flex; align-items: center; padding: .6rem .8rem;
                background: var(--brand-soft); color: #3d2a91; border-radius: 10px;
                font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between;
           padding: .75rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.slot.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
details { border-top: 1px solid var(--line); padding: .6rem 0; }
details summary { cursor: pointer; font-weight: 600; }
.steps { margin: .5rem 0 0; padding-left: 1.2rem; }

/* login / hero */
.hero { max-width: 440px; margin: 8vh auto 0; text-align: center; }
.hero .logo { justify-content: center; font-size: 1.6rem; margin-bottom: 1rem; }
.hero .logo-mark { width: 44px; height: 44px; border-radius: 12px; }
.plans { display: grid; gap: 12px; margin: .5rem 0; }
@media (min-width: 560px) { .plans { grid-template-columns: 1fr 1fr; } }
.plan { display: block; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px;
        cursor: pointer; font-weight: 400; margin: 0; }
.plan input { margin-right: .4rem; }
.plan:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.price { font-size: 1.4rem; font-weight: 800; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; }

/* admin */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats .card + .card { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: 14px 16px; }
.stat b { font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.table td { padding: .6rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
