/* portal.css — the one stylesheet of the News Agent customer portal (NEW-83).
   Served from /static/ by the portal itself. Templates carry NO inline styles,
   so a later CSP can use style-src 'self' (see portal-stack/caddy/Caddyfile). */

:root {
  --ink: #1a1a2e;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --bg: #f4f5f7;
  --surface: #fff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #c0392b;
  --danger-hover: #a93226;
  --danger-ink: #b91c1c;
  --ok-ink: #15803d;
  --warn-ink: #92400e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); margin: 0;
  min-height: 100vh; display: flex; flex-direction: column;
}

a { color: var(--accent); }
p { line-height: 1.6; margin: .5rem 0; }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
.muted { color: var(--muted); font-size: .85rem; margin-top: 1.5rem; }
.email { font-weight: 600; overflow-wrap: anywhere; }

/* ---- Header + navigation ------------------------------------------------ */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .bar {
  max-width: 56rem; margin: 0 auto; padding: .8rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-2); text-decoration: none; padding: .35rem .7rem;
  border-radius: 8px; font-size: .95rem;
}
.site-nav a:hover { background: var(--bg); }
.site-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.account { margin-left: auto; display: flex; gap: .9rem; align-items: center; font-size: .9rem; }
.account .who-mini { color: var(--muted); overflow-wrap: anywhere; }
.account a { text-decoration: none; font-weight: 600; }
.account a:hover { text-decoration: underline; }

/* ---- Page body ---------------------------------------------------------- */
main { flex: 1; width: 100%; max-width: 56rem; margin: 0 auto; padding: 2rem 1.5rem 1rem; }
.card {
  max-width: 34rem; margin: 1.5rem auto 0; background: var(--surface);
  border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow);
}
.card.card-wide { max-width: 48rem; }
.card.card-medium { max-width: 40rem; }
.card.card-doc { max-width: 46rem; }
.subtitle { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }

/* ---- Buttons ------------------------------------------------------------ */
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: .7rem 1.4rem; font-size: 1rem; cursor: pointer; font-family: inherit;
}
button:hover { background: var(--accent-hover); }
button:disabled { background: #9ca3af; cursor: not-allowed; }
button.btn-danger { background: var(--danger); }
button.btn-danger:hover { background: var(--danger-hover); }
button.secondary {
  background: var(--surface); color: var(--danger-ink); border: 1px solid #fca5a5;
  padding: .5rem 1.1rem; font-size: .9rem; margin-top: .4rem;
}
button.secondary:hover { background: #fef2f2; }
button.primary { margin-top: .6rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---- Messages ----------------------------------------------------------- */
.banner { padding: .7rem 1rem; border-radius: 8px; margin: 1rem 0; }
.banner.msg { background: #dcfce7; color: #166534; }
.banner.err { background: #fee2e2; color: #991b1b; }
.error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger-ink);
         border-radius: 8px; padding: .7rem 1rem; margin: 1rem 0; font-size: .95rem; }
.notice { background: #fef3c7; border: 1px solid #fde68a; color: var(--warn-ink);
          border-radius: 8px; padding: .8rem 1rem; font-size: .9rem; margin: 1.5rem 0; }
.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
      border-radius: 8px; padding: 1rem 1.25rem; margin: 1.25rem 0; font-weight: 600; }

/* ---- Forms -------------------------------------------------------------- */
label { display: block; font-weight: 600; margin: 1rem 0 .3rem; font-size: .95rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: .15rem; }
input[type=email], input[type=text], input[type=number], select, textarea {
  width: 100%; padding: .6rem; border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 1rem; font-family: inherit; background: var(--surface);
}
textarea { min-height: 4.5rem; resize: vertical; }
input:disabled, select:disabled { background: #f3f4f6; color: var(--muted); }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 1.75rem 0 0; padding: 1rem 0 0; }
legend { font-size: 1.05rem; font-weight: 700; padding: 0 .4rem 0 0; }
.row { display: flex; gap: 1rem; }
.row > div { flex: 1; min-width: 0; }
.intro { color: var(--ink-2); line-height: 1.6; margin: .5rem 0 0; }

/* ---- Landing ------------------------------------------------------------ */
.hero { text-align: center; padding: 2rem 1rem 1rem; }
.hero h1 { font-size: 2.1rem; margin: 0 0 .6rem; }
.hero p { font-size: 1.15rem; color: var(--ink-2); max-width: 40rem; margin: 0 auto; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; margin-top: 2.5rem; }
.plan { background: var(--surface); border-radius: var(--radius); padding: 1.75rem;
        box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan h2 { font-size: 1.25rem; margin: 0 0 .25rem; }
.plan .price { font-size: 1.6rem; font-weight: 700; margin: .5rem 0; }
.plan .cadence { color: var(--muted); font-size: .9rem; font-weight: 400; }
.plan p { color: var(--ink-2); flex: 1; }
a.cta { display: inline-block; text-align: center; margin-top: 1rem; background: var(--accent);
        color: #fff; text-decoration: none; border-radius: 8px; padding: .75rem 1.4rem;
        font-size: 1rem; font-weight: 600; }
a.cta:hover { background: var(--accent-hover); }

/* ---- Checkout ----------------------------------------------------------- */
.selected { background: var(--accent-soft); border: 1px solid #bfdbfe; border-radius: 8px;
            padding: 1rem 1.25rem; margin: 1.25rem 0; }
.selected .name { font-weight: 700; font-size: 1.1rem; }
.accept { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; line-height: 1.5; }
.accept input { margin-top: .25rem; }
.accept label { font-weight: 400; margin: 0; }
.steps { color: var(--ink-2); }
.steps li { margin: .35rem 0; }

/* ---- Account / dashboard (/me) ----------------------------------------- */
.who { color: var(--muted); overflow-wrap: anywhere; }
.who .email { color: var(--ink); }
.block { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.25rem; }
.block h2 { margin-top: 0; font-size: 1.05rem; }
.state { font-weight: 600; }
.state.on { color: var(--ok-ink); }
.state.off { color: var(--danger-ink); }
.state.pending { color: var(--warn-ink); }
a.tile { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line);
         border-radius: 10px; padding: .9rem 1.1rem; margin: .6rem 0; }
a.tile:hover { border-color: var(--accent); background: #f8faff; }
a.tile strong { display: block; color: var(--accent); }
a.tile span { color: var(--muted); font-size: .9rem; }
.quiet p { color: var(--muted); font-size: .9rem; }
.block.latest { border-top: 0; margin-top: 1rem; padding: 1.1rem 1.25rem;
                background: var(--accent-soft); border-radius: 10px; }
a.button-link { display: inline-block; margin-top: .6rem; background: var(--accent); color: #fff;
                text-decoration: none; border-radius: 8px; padding: .65rem 1.3rem; font-weight: 600; }
a.button-link:hover { background: var(--accent-hover); }

/* ---- Briefing archive (NEW-85) ----------------------------------------- */
.archive { list-style: none; padding: 0; margin: 1rem 0; }
.archive li { display: flex; align-items: baseline; gap: 1rem; padding: .65rem 0;
              border-bottom: 1px solid var(--line); }
.archive-date { font-weight: 600; min-width: 9.5rem; white-space: nowrap; }
.archive-info { flex: 1; min-width: 0; color: var(--ink-2); font-size: .95rem; }
.archive-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
a.archive-link:hover { text-decoration: underline; }
.muted-inline { color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; font-size: .95rem; }
.pager a { text-decoration: none; font-weight: 600; }
.more-link { display: inline-block; margin-top: .6rem; margin-left: 1rem; font-weight: 600; text-decoration: none; }

/* ---- Recipients table --------------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
th { color: var(--muted); font-weight: 600; }
td.email { overflow-wrap: anywhere; font-weight: 400; }
.you { color: var(--muted); font-size: .85rem; }
.inactive { color: var(--danger-ink); }
.pending { color: var(--warn-ink); }
td.actions { white-space: nowrap; }
form.inline { display: inline; }
button.role { background: var(--line); color: var(--ink); padding: .35rem .8rem; font-size: .85rem; border-radius: 6px; }
button.role:hover { background: var(--line-2); }
a.remove { display: inline-block; background: var(--danger); color: #fff; border-radius: 6px;
           padding: .35rem .8rem; font-size: .85rem; text-decoration: none; }
a.remove:hover { background: var(--danger-hover); }
.addform { display: flex; flex-wrap: wrap; gap: .5rem; }
.addform input[type=email] { flex: 2 1 14rem; width: auto; }
.addform input[type=text] { flex: 1 1 10rem; width: auto; }
.addform select { flex: 0 1 8rem; width: auto; }
.addform button { padding: .6rem 1.1rem; }

/* ---- Legal pages -------------------------------------------------------- */
.meta { color: var(--muted); font-size: .85rem; margin-bottom: 1.25rem; }
.doc-body { white-space: pre-wrap; line-height: 1.6; font-size: .97rem; }
dl { line-height: 1.6; }
dt { font-weight: 600; margin-top: .6rem; }
dd { margin-left: 0; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { text-align: center; margin: 2.5rem auto 0; padding: 1.5rem 1rem 2rem;
               border-top: 1px solid var(--line); font-size: .9rem; width: 100%; max-width: 56rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .muted { font-size: .8rem; margin-top: .5rem; }

/* ---- Phones ------------------------------------------------------------- */
@media (max-width: 600px) {
  .site-header .bar { padding: .7rem 1rem; gap: .6rem 1rem; }
  .account { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding: 1rem; }
  .card { margin-top: .5rem; padding: 1.5rem; }
  .hero h1 { font-size: 1.7rem; }
  .row { flex-direction: column; gap: 0; }
  /* NEW-79: one stacked card per recipient instead of a 5-column table. */
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .75rem; }
  td { border: 0; padding: .2rem 0; }
  td[data-label]:not(.email)::before { content: attr(data-label) ": "; color: var(--muted); }
  td.email { font-weight: 600; }
  td.actions { padding-top: .5rem; white-space: normal; }
  .addform > * { flex: 1 1 100%; }
  .archive li { gap: .6rem; font-size: .92rem; }
  .archive-date { min-width: 0; }
}
