/* Pavia BPLO staff console.
 *
 * The :root block is copied verbatim from web/portal/css/styles.css so the
 * console and the resident portal are demonstrably the same product. Nothing
 * console-specific goes inside it — additions live below, under their own
 * heading, so the next person can diff the two token blocks and see they
 * match.
 *
 * This is a dense working surface, not a marketing page: more rows per screen
 * than the portal, smaller type, and one accent doing all the work.
 */

/* ---------------------------------------------------------------- tokens - */

:root {
  --brand:       #146b2b;
  --brand-deep:  #0e5420;
  --brand-soft:  #28a745;
  --brand-tint:  #e6f2e9;
  --brand-wash:  #f2f9f4;

  --gold:        #d79d11;
  --gold-tint:   #fdf3d9;

  --ink:         #1b2318;
  --ink-2:       #495245;
  --ink-3:       #6f7a6c;
  --line:        #ded9c9;
  --line-soft:   #ebe6d7;

  --bg:          #faf5e9;
  --surface:     #ffffff;
  --surface-2:   #fffdf7;

  --danger:      #a8271f;
  --danger-bg:   #fceceb;
  --warn:        #8a5d00;
  --warn-bg:     #fdf2da;
  --ok:          #146b2b;
  --ok-bg:       #e6f2e9;
  --info:        #1f5673;
  --info-bg:     #e8f1f7;

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;

  /* The only shadow. Offset and blur, never a zero-offset halo. */
  --lift:  0 6px 16px -6px rgba(27,35,24,.18), 0 2px 5px -2px rgba(27,35,24,.10);
  --lift-hi: 0 18px 40px -14px rgba(27,35,24,.26), 0 4px 10px -4px rgba(27,35,24,.12);

  --ease: cubic-bezier(.16,1,.3,1);
  --maxw: 1040px;

  --tap: 48px;   /* the floor for anything a thumb must hit */
}

/* --------------------------------------------------------- console only - */

:root {
  --console-maxw: 1180px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 0.95rem; }
p  { margin: 0 0 .6rem; }
a  { color: var(--brand-deep); }

/* ------------------------------------------------------------- top bar -- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--lift);
}
.topbar-in {
  max-width: var(--console-maxw);
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 0 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.16);
  font-weight: 800; font-size: .72rem; letter-spacing: .04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .95rem; font-weight: 700; }
.brand-text small  { font-size: .7rem; opacity: .8; }

.env {
  font-size: .65rem; font-weight: 800; letter-spacing: .08em;
  padding: 4px 8px; border-radius: 999px;
  background: var(--gold); color: #3a2a00;
}

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav-link {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .875rem; font-weight: 600;
  padding: 8px 12px; border-radius: 999px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.is-active { background: #fff; color: var(--brand-deep); }

.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who-name { font-size: .82rem; font-weight: 600; }
.who-role { font-size: .68rem; opacity: .78; }

/* -------------------------------------------------------------- layout -- */

main { max-width: var(--console-maxw); margin: 0 auto; padding: 24px 20px 64px; }

.page-head {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head p { color: var(--ink-2); margin: 4px 0 0; font-size: .875rem; }
.page-head .spacer { margin-left: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--lift);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
}
.card-body { padding: 18px; }

/* --------------------------------------------------------------- tabs --- */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .82rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s var(--ease);
}
.tab:hover { border-color: var(--brand-soft); color: var(--ink); }
.tab.is-active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.tab .count {
  background: var(--brand-tint); color: var(--brand-deep);
  border-radius: 999px; padding: 1px 7px;
  font-size: .72rem; font-weight: 800;
}
.tab.is-active .count { background: rgba(255,255,255,.22); color: #fff; }

/* -------------------------------------------------------------- tables -- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3);
  padding: 10px 18px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.table td {
  padding: 13px 18px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--brand-wash); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); font-size: .8rem; }
.strong { font-weight: 600; }

/* --------------------------------------------------------------- pills -- */

.pill {
  display: inline-block; border-radius: 999px;
  padding: 3px 10px; font-size: .72rem; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap;
}
.pill-ok     { background: var(--ok-bg);     color: var(--ok); }
.pill-warn   { background: var(--warn-bg);   color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info   { background: var(--info-bg);   color: var(--info); }
.pill-quiet  { background: var(--line-soft); color: var(--ink-2); }

/* ------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: .875rem; font-weight: 650;
  cursor: pointer;
  background: var(--brand); color: #fff;
  transition: transform .16s var(--ease), background .16s var(--ease),
              box-shadow .16s var(--ease), opacity .16s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--brand-deep); box-shadow: var(--lift); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-quiet  { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { background: var(--brand-wash); border-color: var(--brand-soft); }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #8d1f19; }
.btn-warn   { background: var(--warn); }
.btn-warn:hover:not(:disabled) { background: #6f4b00; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .8rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- forms -- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: .78rem; font-weight: 650;
  color: var(--ink-2); margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.field .hint { font-size: .74rem; color: var(--ink-3); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.form-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: .84rem; margin-bottom: 14px;
}

/* -------------------------------------------------------------- states -- */

.state { padding: 44px 24px; text-align: center; }
.state-title { font-weight: 650; color: var(--ink); margin-bottom: 4px; }
.state-body  { color: var(--ink-3); font-size: .875rem; max-width: 46ch;
               margin-left: auto; margin-right: auto; }
.state .btn { margin-top: 14px; }
.state-denied .state-title { color: var(--warn); }
.state-error  .state-title,
.state-offline .state-title { color: var(--danger); }

.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 2.5px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- toasts -- */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--r-sm);
  font-size: .85rem; box-shadow: var(--lift-hi);
  animation: rise .22s var(--ease);
}
.toast-ok    { background: var(--brand-deep); }
.toast-error { background: var(--danger); }
.toast.out   { opacity: 0; transition: opacity .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- modal -- */

.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(27,35,24,.45);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
  width: min(520px, 100%);
  max-height: 88vh; overflow: auto;
  animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal-head { padding: 18px 20px 0; }
.modal-body { padding: 14px 20px; }
.modal-foot {
  padding: 14px 20px 18px;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* --------------------------------------------------------- sign-in page - */

.signin-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--brand-tint), transparent 70%),
    var(--bg);
}
.signin {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
  padding: 30px 28px;
}
.signin .seal {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: .8rem; letter-spacing: .04em;
}
.signin h1 { font-size: 1.25rem; text-align: center; }
.signin .sub {
  text-align: center; color: var(--ink-3);
  font-size: .82rem; margin: 6px 0 20px;
}
.signin .btn { width: 100%; }
.signin .env-note {
  margin-top: 16px; text-align: center;
  font-size: .74rem; color: var(--warn);
  background: var(--warn-bg); border-radius: var(--r-sm); padding: 8px;
}

/* ------------------------------------------------------- review layout -- */

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shot {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.shot h3 {
  padding: 9px 12px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
}
.shot img {
  display: block; width: 100%; height: 230px;
  object-fit: contain; background: #f4f1e6;
  cursor: zoom-in;
}
.shot.wide { grid-column: 1 / -1; }
.shot.wide img { height: 300px; }

.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
  font-size: .85rem;
}
.facts li:last-child { border-bottom: 0; }
.facts .k { color: var(--ink-3); }
.facts .v { font-weight: 600; text-align: right; }

.reasons { display: grid; gap: 8px; margin: 6px 0 4px; }
.reason {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.reason:hover { border-color: var(--brand-soft); background: var(--brand-wash); }
.reason input { margin-top: 3px; }
.reason .label { font-size: .85rem; font-weight: 600; }
.reason .hint  { font-size: .76rem; color: var(--ink-3); }

/* The one-time password panel. Deliberately loud: it is shown once. */
.once {
  background: var(--gold-tint);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 16px;
}
.once .value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem; font-weight: 700; letter-spacing: .04em;
  background: var(--surface); border: 1px dashed var(--gold);
  border-radius: var(--r-sm); padding: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  word-break: break-all;
}
.once .warn { font-size: .8rem; color: var(--warn); margin: 10px 0 0; }

/* ------------------------------------------------------------ narrower -- */

@media (max-width: 900px) {
  .review-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-in { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .who { margin-left: auto; }
  main { padding: 18px 16px 56px; }
  .shots { grid-template-columns: 1fr; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
