/* Subscriber area and admin panel. Colours come from base.css tokens. */

body { font-size: 15px; background: var(--bg-alt); }
h1 { font-size: 1.75rem; margin-bottom: 4px; }
h2, legend { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--navy); }
.field-error { color: var(--danger); font-size: .875rem; margin: 6px 0 0; }

/* Bare layout: login, magic link, unsubscribe */
.bare { min-height: 100vh; position: relative; overflow-x: hidden; background: linear-gradient(180deg, var(--brand-soft) 0%, var(--bg-alt) 60%); }
.bare__waves { position: fixed; right: -220px; top: -160px; width: 720px; height: 720px; fill: none; stroke: var(--brand); stroke-width: 26; stroke-linecap: round; opacity: .16; pointer-events: none; }
.bare__main { position: relative; max-width: 440px; margin: 0 auto; padding: 56px 20px; }
.bare__logo { display: flex; justify-content: center; margin-bottom: 28px; text-decoration: none; }
.bare__card { padding: 28px; }
.bare__alt { margin: 20px 0 0; text-align: center; }
.bare__second { margin-top: 10px; }
.h-card { font-size: 1.5rem; margin-bottom: 8px; }

/* Shell */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; padding-bottom: 72px; }
.sidebar { display: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--navy); padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
.topbar a { display: inline-flex; text-decoration: none; }
.main { padding: 24px 16px; width: 100%; max-width: 1040px; margin: 0 auto; }

.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: .6875rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.bottomnav a[aria-current="page"] { color: var(--brand); }

@media (min-width: 960px) {
  .shell { grid-template-columns: 248px 1fr; padding-bottom: 0; }
  .topbar, .bottomnav { display: none; }
  .sidebar { display: flex; flex-direction: column; background: var(--navy); color: var(--navy-soft); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .main { padding: 40px 40px 64px; margin: 0; }
}

.sidebar__logo { display: inline-flex; padding: 6px 10px 24px; text-decoration: none; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar__nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-md); color: var(--navy-soft); text-decoration: none; font-weight: 500; }
.sidebar__nav a:hover { background: rgba(255, 255, 255, .07); color: var(--bg); }
.sidebar__nav a[aria-current="page"] { background: var(--brand); color: var(--bg); }
.sidebar__label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--navy-soft); opacity: .7; margin: 20px 12px 6px; }
.sidebar__foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; }
.sidebar__user { font-size: .8125rem; margin: 0 12px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__logout { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; background: none; border: 0; border-radius: var(--radius-md); color: var(--navy-soft); font: 500 .9375rem var(--font-body); cursor: pointer; }
.sidebar__logout:hover { background: rgba(255, 255, 255, .07); color: var(--bg); }
.topbar .sidebar__logout { width: auto; min-width: 44px; justify-content: center; }

/* Content */
.page-title { margin-bottom: 24px; }
.page-title p { margin: 0; }
.section-card { margin-bottom: 20px; }
fieldset.section-card { min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 8px; }
legend + * { clear: both; }

.stats { display: grid; gap: 16px; margin-bottom: 20px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats--4 { grid-template-columns: repeat(4, 1fr); } }
.stat { border-left: 3px solid var(--brand); padding: 18px 20px; }
.stat p { margin: 0; }
.stat__label { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.stat__value { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: -0.02em; color: var(--navy); line-height: 1.3; }

.empty { text-align: center; padding: 48px 24px; }
.empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); margin-bottom: 16px; }
.empty p { max-width: 32em; margin-left: auto; margin-right: auto; }

.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; margin: 0; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pill span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--bg); font-weight: 500; font-size: .875rem; color: var(--ink); }
.pill input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); }
.pill input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.savebar { position: sticky; bottom: 76px; display: flex; justify-content: flex-end; }
@media (min-width: 960px) { .savebar { bottom: 16px; } }
.savebar .btn { box-shadow: var(--shadow-card); }

.subhead { font-size: 1rem; margin: 8px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions form { margin: 0; }
.mono, code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .875rem; }
code { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; word-break: break-all; }

.filters { display: grid; gap: 0 16px; align-items: end; margin-bottom: 20px; }
.filters .btn { margin-bottom: 16px; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr auto; } }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
