/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { opacity: .85; transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--ink3);
  color: var(--ink2);
}
.btn-secondary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn-danger {
  background: var(--red-s);
  color: var(--red);
  border: 1px solid rgba(232,52,26,.2);
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-lg { font-size: 17px; padding: 15px 32px; border-radius: var(--r-lg); }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ── Status Pills ─────────────────────────────────────────────────────────── */
.pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
  display: inline-block;
}
.pill-ok      { background: var(--green-s); color: #135F48; }  /* #1A7A5E → darkened to 5.2:1 */
.pill-wait    { background: var(--amber-s); color: #7A4E0B; }  /* #C47F17 → darkened to 5.1:1 */
.pill-changed { background: var(--blue-s);  color: #1438B8; }  /* #1A4FE8 → darkened to 5.0:1 */
.pill-revoked { background: var(--red-s);   color: #B52C16; }  /* #E8341A → darkened to 4.7:1 */

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 14px 16px; border-radius: var(--r-md); }

/* ── Scope Tiles ──────────────────────────────────────────────────────────── */
.scope-tile {
  padding: 10px 14px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}
.scope-tile.on {
  background: var(--green-s);
  border: 1px solid rgba(26,122,94,.15);
  color: var(--green);
}
.scope-tile.off {
  background: var(--red-s);
  border: 1px solid rgba(232,52,26,.1);
  color: var(--red);
  text-decoration: line-through;
  opacity: .7;
}

/* ── Toggle Row ───────────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 15px; color: var(--ink2); }
.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--green); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch.on::after { left: 23px; }

/* ── Form Elements ────────────────────────────────────────────────────────── */
input, textarea, select {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink2); }
textarea { resize: vertical; min-height: 100px; }
label { font-size: 13px; font-weight: 500; color: var(--ink3); display: block; margin-bottom: 6px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-hint { font-size: 12px; color: var(--ink4); margin-top: 4px; }

/* ── Checkbox ─────────────────────────────────────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: var(--green);
  cursor: pointer;
}
.checkbox-row span { font-size: 14px; color: var(--ink2); line-height: 1.4; }

/* ── Headings ─────────────────────────────────────────────────────────────── */
h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
}
h2 {
  font-family: var(--serif);
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
}
h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
}

/* ── Eyebrow ──────────────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 12px;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242,237,228,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--ink);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-state-icon { font-size: 40px; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--ink3); font-size: 15px; margin-bottom: 24px; }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section { padding: 60px 20px; }
.section-inner { max-width: 1100px; margin: 0 auto; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(19,17,16,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--ink3); font-size: 14px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Alert Banner ─────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--green-s); color: var(--green); border: 1px solid rgba(26,122,94,.2); }
.alert-warn    { background: var(--amber-s); color: var(--amber); border: 1px solid rgba(196,127,23,.2); }
.alert-error   { background: var(--red-s);   color: var(--red);   border: 1px solid rgba(232,52,26,.2); }
.alert-info    { background: var(--blue-s);  color: var(--blue);  border: 1px solid rgba(26,79,232,.2); }

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border2);
  margin-top: 5px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-dot.confirmed { background: var(--green); }
.timeline-dot.revoked   { background: var(--red); }
.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute;
  left: 4px; top: 10px;
  width: 2px;
  height: calc(100% + 10px);
  background: var(--border);
}
.timeline-body { flex: 1; }
.timeline-title { font-size: 14px; font-weight: 500; color: var(--ink2); }
.timeline-time  { font-size: 12px; color: var(--ink4); margin-top: 2px; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--sans);
}
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover:not(.active) { color: var(--ink2); }

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 100px;
  transition: width .4s ease;
}

/* ── Copy Input ───────────────────────────────────────────────────────────── */
.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-row input {
  flex: 1;
  font-size: 13px;
  background: var(--bg2);
  color: var(--ink2);
  border-color: var(--border);
}
.copy-row .btn { flex-shrink: 0; }

/* ── Signature Field ──────────────────────────────────────────────────────── */
.sig-field {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 20px 12px;
  border-bottom: 2px solid var(--ink3);
  position: relative;
}
.sig-placeholder {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--ink4);
  pointer-events: none;
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
}
