/* App chrome: login/gate screens, dashboard, settings, and the editor's admin bar. */
:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --ink: #16202E;
  --soft: #5B6576;
  --faint: #8A93A2;
  --line: #E1E6ED;
  --navy: #012F6B;
  --navy-2: #0B3F86;
  --gold: #E0A527;
  --ok: #1E7A4C; --ok-soft: #E6F4EC;
  --warn: #8F620A; --warn-soft: #FCF3DF;
  --err: #B42318; --err-soft: #FDECEA;
  --info: #2F6FD6; --info-soft: #EAF1FC;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.6 Poppins, "Segoe UI", system-ui, sans-serif; }
a { color: var(--navy-2); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 34px; color: var(--navy); line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.appwrap { max-width: 1060px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.appbar { background: #1F1F1F; color: #fff; }
.appbar .appwrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.brand img { height: 36px; width: auto; display: block; }
.appmain { padding-block: 36px 80px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--soft); }
.faint { color: var(--faint); font-size: 13px; }

.panelbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: 0 1px 2px rgba(1,26,60,.04), 0 8px 24px rgba(1,26,60,.05); }
.narrow { max-width: 460px; margin: 4vh auto 0; }
.gate-logo { max-height: 56px; width: auto; display: block; margin-bottom: 18px; }

form .row { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--soft); }
input[type=text], input[type=email], input[type=number], input[type=password], textarea, select {
  font: 500 16px Poppins, "Segoe UI", sans-serif; padding: 11px 12px; border: 1px solid #C9D1DC; border-radius: 6px; background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--navy) 22%, transparent); border-color: var(--navy); }
.code-input { font-size: 28px !important; letter-spacing: .4em; text-align: center; font-weight: 600 !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px Poppins, "Segoe UI", sans-serif; border-radius: 8px; padding: 11px 18px; border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: #EEF2F8; }
.btn.small { padding: 6px 12px; font-size: 13.5px; border-radius: 6px; }
.btn.danger { background: transparent; color: var(--err); border-color: #E7B4AE; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--navy-2); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

.msg { border-radius: 8px; padding: 11px 14px; font-size: 14px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.info { background: var(--info-soft); color: var(--navy-2); }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill.Draft { background: #EEF0F3; color: var(--soft); }
.pill.Published { background: var(--info-soft); color: var(--navy-2); }
.pill.Signed { background: var(--ok-soft); color: var(--ok); }
.pill.Withdrawn { background: var(--err-soft); color: var(--err); }
.pill.Declined { background: #FDF0E6; color: #9A4A0E; }

.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.list { width: 100%; border-collapse: collapse; min-width: 640px; }
table.list th, table.list td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; background: #F8F9FB; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.t a { font-weight: 600; color: var(--ink); text-decoration: none; }
table.list td.t a:hover { text-decoration: underline; }
.empty { padding: 40px; text-align: center; color: var(--soft); }

details.newbox > summary { list-style: none; }
details.newbox > summary::-webkit-details-marker { display: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radios label { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); font-size: 14.5px; }

/* editor admin bar */
.adminbar { position: sticky; top: 0; z-index: 30; background: #1F1F1F; color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.adminbar .inner { max-width: 1240px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.adminbar .title { font-weight: 600; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.adminbar .grow { flex: 1 1 auto; }
.adminbar .status { font-size: 13px; color: #C9CED6; }
.adminbar .btn { padding: 7px 13px; font-size: 13.5px; border-radius: 6px; }
.adminbar .btn.ghost { color: #fff; border-color: #4A4F57; }
.adminbar .btn.ghost:hover { background: #2C2F34; }
.adminbar .btn.primary { background: var(--gold); border-color: var(--gold); color: #1F1F1F; }
.adminbar .btn.primary:hover { background: #F0B53A; }
.adminbar a.back { color: #C9CED6; text-decoration: none; font-size: 13px; }
.adminbar .pill { font-size: 11.5px; }
.drawer { background: #2A2D32; color: #E8EAED; }
.drawer .inner { max-width: 1240px; margin: 0 auto; padding: 18px 16px 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.drawer label { color: #C9CED6; }
.drawer h3 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.drawer .faint { color: #9EA4AD; }
.drawer input, .drawer textarea { background: #fff; }
.activity { max-height: 260px; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.activity .ev { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; }
.activity .ev .when { color: #9EA4AD; font-variant-numeric: tabular-nums; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-size: 13px; padding: 7px 9px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); transform: translateX(-50%); background: #1F1F1F; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

@media (max-width: 700px) { .grid2 { grid-template-columns: minmax(0, 1fr); } .adminbar .title { max-width: 180px; } }
