@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #16233A;
  --paper: #F6F3EC;
  --paper-raised: #FFFFFF;
  --teal: #2C6E75;
  --teal-dark: #1E4E54;
  --gold: #B68A2E;
  --line: #D8D2C4;
  --text: #23262B;
  --text-muted: #6B6F76;
  --danger: #9C3B3B;

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  background-size: 100% 42px;
  background-attachment: local;
}

a { color: inherit; }

.skip-link:focus {
  position: fixed;
  top: 8px; left: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  z-index: 100;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  background: var(--ink);
  color: var(--paper);
}

.topbar .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.topbar .brand .mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--gold);
}

.topbar nav {
  display: flex;
  gap: 24px;
  font-size: 0.92rem;
}

.topbar nav a {
  text-decoration: none;
  color: #CBD3DE;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: color 0.15s, border-color 0.15s;
}

.topbar nav a.active,
.topbar nav a:hover {
  color: var(--paper);
  border-color: var(--gold);
}

.topbar .signout {
  background: none;
  border: 1px solid #3A4A63;
  color: #CBD3DE;
  padding: 7px 14px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.topbar .signout:hover { border-color: var(--gold); color: var(--paper); }

/* ---------- Page shell ---------- */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.eyebrow-line {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.eyebrow-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

h1.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.1rem;
  margin: 0 0 6px;
  color: var(--ink);
}

.page-sub {
  color: var(--text-muted);
  margin: 0 0 36px;
  max-width: 60ch;
  line-height: 1.5;
}

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.id-card {
  width: 100%;
  max-width: 400px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 60px -30px rgba(22, 35, 58, 0.35);
  overflow: hidden;
}

.id-card__band {
  background: var(--ink);
  color: var(--paper);
  padding: 26px 30px 22px;
  position: relative;
}

.id-card__band .mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  color: var(--gold);
  margin-bottom: 14px;
}

.id-card__band h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  margin: 0 0 4px;
}

.id-card__band p {
  margin: 0;
  font-size: 0.87rem;
  color: #B9C2D0;
}

.id-card__body {
  padding: 28px 30px 30px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0.03em;
  background: var(--paper);
  color: var(--text);
}

.field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  background: var(--paper-raised);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 3px;
  background: var(--teal);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--teal-dark); }

.btn.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn.secondary:hover { border-color: var(--teal); color: var(--teal-dark); }

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -10px 0 18px;
  min-height: 1.1em;
}

.id-card__foot {
  padding: 14px 30px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--paper);
}

/* ---------- Document list ---------- */
.section-label {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  margin: 40px 0 14px;
}
.section-label:first-of-type { margin-top: 0; }

.doc-list {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-raised);
  overflow: hidden;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 15px 20px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--text);
  transition: background 0.12s;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #FBFAF6; }
.doc-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

.doc-row__icon {
  width: 34px; height: 34px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--teal-dark);
  font-size: 0.9rem;
}

.doc-row__main {
  flex: 1;
  min-width: 0;
}

.doc-row__title {
  font-weight: 600;
  font-size: 0.96rem;
}

.doc-row__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.doc-row__status {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.doc-row__status.ready {
  background: #E4EFE7;
  color: #2B6B3E;
}
.doc-row__status.pending {
  background: #F1EDE2;
  color: var(--text-muted);
}

.doc-row__chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 35, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--paper-raised);
  border-radius: 6px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 30px 70px -20px rgba(22, 35, 58, 0.5);
  overflow: hidden;
}

.modal__head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.modal__head .tag {
  font-size: 0.76rem;
  color: var(--gold);
  text-transform: none;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.modal__head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0 0 8px;
}

.modal__head p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal__body {
  padding: 20px 26px 26px;
}

.modal__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.modal__row:last-of-type { border-bottom: none; }
.modal__row dt { color: var(--text-muted); }
.modal__row dd { margin: 0; font-weight: 500; }

.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.unavailable-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
  margin-top: 20px;
  line-height: 1.5;
}

/* ---------- Profile page ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--gold);
}

.profile-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.8rem;
  margin: 0 0 4px;
  color: var(--ink);
}

.profile-header .sub {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 40px;
}

.info-cell {
  background: var(--paper-raised);
  padding: 16px 20px;
}

.info-cell dt {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.info-cell dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline {
  border-left: 2px solid var(--line);
  padding-left: 24px;
  margin-left: 6px;
}

.timeline-item {
  position: relative;
  padding-bottom: 26px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 2px solid var(--teal);
}

.timeline-item .t-date {
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 3px;
}
.timeline-item .t-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.timeline-item .t-desc {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .topbar { padding: 16px 18px; }
  .topbar nav { gap: 14px; font-size: 0.85rem; }
  main { padding: 32px 18px 60px; }
  .info-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; align-items: flex-start; }
}
