/* Vision Examination Portal — visual prototype stylesheet
   De Jesus Platform Works, LLC. Non-production mockup. */

:root {
  --navy: #0f2138;
  --navy-2: #16304f;
  --ink: #16202c;
  --body: #3d4a5a;
  --muted: #6b7887;
  --line: #dde4ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --accent: #0f6fb5;
  --accent-soft: #e8f1f9;
  --ok: #1d7a4c;
  --ok-soft: #e6f4ec;
  --warn: #a1650a;
  --warn-soft: #fdf3e1;
  --bad: #a32626;
  --bad-soft: #fbeaea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 8px 24px rgba(16, 32, 48, .06);
  --sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.demo-banner {
  background: #2b3b4e;
  color: #e8eef5;
  font-size: .78rem;
  letter-spacing: .02em;
  text-align: center;
  padding: 7px 16px;
}
.demo-banner strong { color: #fff; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
}
.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(140deg, #1d7fc4, #0c4f86);
  display: grid; place-items: center;
  font-weight: 700; font-size: .8rem; color: #fff;
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 600; font-size: .98rem; color: #fff; }
.brand-sub { font-size: .7rem; color: #9db4cd; letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: #c4d4e5;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: .87rem;
  white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.15); color: #fff; }

.whoami { display: flex; align-items: center; gap: 9px; font-size: .82rem; color: #9db4cd; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #2f5d8a; color: #fff;
  display: grid; place-items: center;
  font-size: .72rem; font-weight: 600;
}

/* ---------- Layout ---------- */
.page { max-width: 1140px; margin: 0 auto; padding: 26px 24px 60px; }
.page-head { margin-bottom: 22px; }
.page-head .eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 600; margin-bottom: 5px;
}
.page-head p.lede { color: var(--body); max-width: 62ch; margin: 0; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.grid > .card + .card { margin-top: 0; }
.grid > * { min-width: 0; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-note { font-size: .82rem; color: var(--muted); }

/* ---------- Stats ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 650; color: var(--ink); line-height: 1.2; margin-top: 4px; }
.stat-foot { font-size: .8rem; color: var(--muted); }

/* ---------- Filter bar ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.filters input[type=search] { flex: 1 1 260px; min-width: 0; }
.filters select { flex: 0 0 auto; width: auto; }
.filters [data-filter-count] { font-size: .8rem; white-space: nowrap; }
.btn-sm { padding: 6px 11px; font-size: .82rem; }
@media (max-width: 680px) {
  .filters input[type=search], .filters select { flex: 1 1 100%; width: 100%; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 0; }
/* wide data tables scroll rather than cram their columns */
table.data.wide { min-width: 620px; }
table.data th, table.data td {
  text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  font-size: .73rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; background: #fafbfd;
}
table.data tbody tr:hover { background: #f8fafc; }
table.data td.num { font-variant-numeric: tabular-nums; }

/* ---------- Requirements reference table ---------- */
table.reqs { border: 1px solid var(--line); }
table.reqs caption {
  caption-side: top; text-align: center; font-weight: 700; font-size: .82rem;
  color: var(--ink); background: #fafbfd;
  border: 1px solid var(--line); border-bottom: 0; padding: 9px 12px;
  text-transform: uppercase; letter-spacing: .06em;
}
table.reqs th, table.reqs td { border: 1px solid var(--line); vertical-align: top; }
table.reqs th[scope="row"] {
  width: 30%; text-align: right; background: #fafbfd;
  text-transform: none; letter-spacing: 0; font-size: .86rem;
  color: var(--ink); font-weight: 650; white-space: normal;
}
table.reqs th[scope="row"] span { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
table.reqs ul { margin: 0; padding-left: 18px; }
table.reqs ul li { padding: 2px 0; }
table.reqs tfoot td {
  text-align: center; font-size: .82rem; color: var(--body); background: #fafbfd;
}
table.reqs sup { font-size: .75em; }
@media (max-width: 680px) {
  table.reqs th[scope="row"] { width: auto; text-align: left; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 650; letter-spacing: .02em; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.neutral { background: #eef1f5; color: #55616f; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  font-family: var(--sans); font-size: .89rem; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff; text-decoration: none;
}
.btn:hover { background: #0c5e9b; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f4f6f9; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: #fff; color: var(--bad); border-color: #e8c9c9; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.success { background: var(--ok); }
.btn.success:hover { background: #17603c; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label, .field-label {
  display: block; font-size: .82rem; font-weight: 650; color: var(--ink); margin-bottom: 6px;
}
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #ccd6e0; border-radius: 8px;
  font-family: var(--sans); font-size: .9rem; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,111,181,.15);
}
textarea { min-height: 92px; resize: vertical; }
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 4px; margin: 0 0 20px;
}
legend { font-size: .8rem; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.radio-row label { display: flex; align-items: center; gap: 7px; font-size: .88rem; }
.radio-row input { accent-color: var(--accent); }

/* ---------- Auth screens ---------- */
.auth-shell {
  min-height: calc(100vh - 34px);
  display: grid; grid-template-columns: 1.05fr .95fr;
}
.auth-aside {
  background: linear-gradient(165deg, #0f2138 0%, #123a60 100%);
  color: #dce7f2; padding: 54px 56px; display: flex; flex-direction: column; gap: 26px;
}
.auth-aside h1 { color: #fff; font-size: 1.9rem; max-width: 22ch; }
.auth-aside .brand-name, .auth-aside .brand-sub { color: #fff; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.auth-points li { display: flex; gap: 11px; font-size: .92rem; align-items: flex-start; }
.auth-points .tick {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff;
  display: grid; place-items: center; font-size: .7rem; margin-top: 2px;
}
.auth-foot { margin-top: auto; font-size: .78rem; color: #93abc5; }
.auth-main { display: grid; place-items: center; padding: 48px 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }

/* ---------- Signature ---------- */
.sig-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; }
.sig-pad {
  height: 130px; border: 1px dashed #b9c6d4; border-radius: 8px;
  background: repeating-linear-gradient(0deg, #fff, #fff 32px, #f2f5f8 32px, #f2f5f8 33px);
  display: grid; place-items: center; cursor: crosshair; position: relative;
}
.sig-pad span { color: var(--muted); font-size: .84rem; pointer-events: none; }
.sig-pad.signed {
  border-style: solid; border-color: var(--ok); background: var(--ok-soft);
}
.sig-pad.signed span { color: var(--ok); font-weight: 600; }
.sig-meta { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--muted); margin-top: 9px; flex-wrap: wrap; }

/* ---------- Barcode block ---------- */
.barcode-block {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: #fff; text-align: center;
}
.barcode-block svg { width: 100%; max-width: 420px; height: auto; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 13px; padding-bottom: 18px; position: relative; }
.timeline li:not(:last-child)::before {
  content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: var(--line);
}
.timeline .dot {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); border: 2px solid var(--accent); z-index: 1;
}
.timeline .dot.done { background: var(--ok); border-color: var(--ok); }
.timeline .dot.pending { background: #fff; border-color: #c3cedb; }
.timeline .t-title { font-weight: 600; color: var(--ink); font-size: .9rem; }
.timeline .t-meta { font-size: .8rem; color: var(--muted); }

/* ---------- Record sheet ---------- */
.record {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 32px; box-shadow: var(--shadow);
}
.record-head {
  display: flex; justify-content: space-between; gap: 20px;
  border-bottom: 2px solid var(--navy); padding-bottom: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.record-title { font-size: 1.2rem; font-weight: 700; color: var(--ink); margin: 0; }
.record-sub { font-size: .82rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 26px; }
.kv > div { min-width: 0; }
.kv dt, .kv .k {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650;
}
.kv dd, .kv .v { margin: 2px 0 0; font-size: .93rem; color: var(--ink); overflow-wrap: anywhere; }
.section-title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  color: var(--navy); border-bottom: 1px solid var(--line);
  padding-bottom: 7px; margin: 26px 0 14px;
}

/* ---------- Misc ---------- */
.notice {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 12px 15px; border-radius: 0 8px 8px 0; font-size: .87rem; color: #204f77;
}
.notice.warn { border-color: var(--warn); background: var(--warn-soft); color: #6f4705; }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); color: #145c39; }
.upload-zone {
  border: 1px dashed #b9c6d4; border-radius: var(--radius);
  padding: 26px; text-align: center; background: #fafbfd; color: var(--muted); font-size: .88rem;
}
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 9px;
  font-size: .88rem; box-shadow: 0 10px 30px rgba(0,0,0,.24);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
  max-width: min(90vw, 460px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer {
  border-top: 1px solid var(--line); margin-top: 42px; padding: 20px 24px;
  font-size: .78rem; color: var(--muted); text-align: center;
}
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; white-space: nowrap; }
.hide { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 34px 28px; }
  .auth-aside h1 { font-size: 1.55rem; }
  .grid.split, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .page { padding: 20px 16px 48px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.split { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .nav { margin-left: 0; width: 100%; }
  .topbar-inner { padding: 10px 0; }
  .record { padding: 20px 18px; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: portrait; margin: 12mm; }

  body { background: #fff; }
  .demo-banner, .topbar, .footer, .btn, .btn-row, .filters, .no-print { display: none !important; }
  .page { padding: 0; max-width: none; width: 100%; }

  /* Collapse every multi-column grid to full width. A hidden sidebar still
     reserves its grid track, which left the right half of the page blank. */
  .grid, .grid.split, .grid.cols-2, .grid.cols-3, .grid.cols-4 {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
  }
  .grid > div { width: 100% !important; max-width: none !important; }

  .record, .card {
    width: 100% !important; max-width: none !important;
    box-sizing: border-box; float: none !important;
  }
  .record { border: none; box-shadow: none; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }

  /* keep the two-up key/value pairs, they fit the page width fine */
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .table-wrap { overflow: visible !important; }
  table.data, table.reqs { width: 100% !important; min-width: 0 !important; }
}
