/* ==========================================================================
   VisaReady Portal — portal.css
   Auth (login / forgot / activate) + Admin Command Center + Agency Dashboard
   ========================================================================== */

:root {
  --navy: #16244c;
  --navy-2: #0e1834;
  --gold: #c9a227;
  --gold-soft: #f6ecc3;
  --gold-ink: #7c6115;
  --bg: #eef0f6;
  --content-bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1b2437;
  --muted: #5a6478;
  --line: #e3e6ee;
  --blue: #2e5bff;
  --blue-soft: #e8eeff;
  --input: #f2f4f7;
  --green: #1f9d63;
  --green-soft: #e5f6ec;
  --red: #d64545;
  --red-soft: #fdeaea;
  --amber: #b7791f;
  --amber-soft: #fdf1d7;
  --shadow: 0 10px 30px rgba(22, 36, 76, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); }

button { font-family: inherit; cursor: pointer; }

input, select { font-family: inherit; }

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Shared bits
   -------------------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  user-select: none;
}
.brand img { width: 172px; height: 82px; object-fit: contain; display: block; }
.brand.small img { width: 132px; height: 62px; }
.brand .slashes {
  color: var(--navy);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1;
  border-bottom: 3px solid var(--gold);
  padding-bottom: 2px;
}
.brand .word {
  color: var(--navy);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.brand.small .slashes { font-size: 22px; }
.brand.small .word { font-size: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.6px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-2); }
.btn-blue { background: var(--blue); color: #fff; border-radius: 8px; }
.btn-blue:hover:not(:disabled) { background: #2048d8; }
.btn-block { width: 100%; padding: 15px 18px; font-size: 14px; text-transform: uppercase; }

.field { margin-bottom: 18px; text-align: left; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
}
.field label.caps { text-transform: uppercase; font-size: 11px; letter-spacing: 0.8px; color: var(--muted); }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  padding: 13px 44px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-wrap input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(22, 36, 76, 0.12); }
.input-wrap .in-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: #8a93a8;
  background: none;
  border: 0;
  padding: 2px;
}
.input-wrap button.in-icon:hover { color: var(--navy); }

.form-error {
  display: none;
  background: var(--red-soft);
  border: 1px solid #f3c2c2;
  border-left: 3px solid var(--red);
  color: #9c2b2b;
  font-size: 13px;
  line-height: 1.45;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 4px 0 16px;
  text-align: left;
}
.form-error.show { display: block; }

.form-ok {
  background: var(--green-soft);
  border: 1px solid #bfe6cf;
  border-left: 3px solid var(--green);
  color: #146641;
  font-size: 13px;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 4px 0 16px;
  text-align: left;
}

/* tiny toast for inert demo controls */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: min(90vw, 420px);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Auth pages (login / forgot / activate)
   -------------------------------------------------------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0) 34%),
    var(--bg);
}
.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 44px 56px 36px;
  text-align: center;
}
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 {
  margin: 0 0 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 700;
  color: var(--navy);
}
.auth-sub {
  margin: -14px 0 24px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.auth-sub strong { color: var(--ink); }

.role-badge {
  display: none;
  margin: -8px 0 16px;
  text-align: left;
}
.role-badge.show { display: block; }
.role-badge span {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--gold-ink);
  border: 1px solid #e6d289;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 3px;
  text-transform: uppercase;
}

.auth-links { margin-top: 18px; font-size: 13.5px; }
.auth-links a { color: var(--navy); font-weight: 600; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  margin-top: 18px;
  padding: 0;
}
.back-link:hover { text-decoration: underline; }

.note-box {
  margin-top: 22px;
  background: #f0f1f8;
  border-left: 3px solid var(--gold);
  border-radius: 3px;
  padding: 12px 14px;
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--ink);
  text-align: left;
}
.note-box strong { color: var(--navy); }

.auth-tagline {
  margin-top: 26px;
  font-size: 10.5px;
  letter-spacing: 2.4px;
  color: #9aa2b5;
  text-transform: uppercase;
}

.auth-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 16px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.auth-footer .f-left { color: var(--muted); }
.auth-footer .f-left strong { color: var(--navy); margin-right: 10px; }
.auth-footer .f-links { display: flex; gap: 26px; flex-wrap: wrap; }
.auth-footer .f-links a { color: var(--ink); text-decoration: none; font-weight: 600; }
.auth-footer .f-links a:hover { color: var(--navy); text-decoration: underline; }

/* 6-digit code boxes */
.code-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 20px;
}
.code-box {
  width: 52px;
  height: 60px;
  border: 1px solid #cfd4e0;
  border-radius: 4px;
  background: #fff;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.code-box:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(22, 36, 76, 0.12); }
.code-box.filled { border-color: var(--navy); background: #f7f8fc; }

.resend-line { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.resend-line strong { color: var(--ink); }
.resend-line button {
  background: none;
  border: 0;
  color: var(--gold-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}
.resend-line button:disabled { color: var(--muted); text-decoration: none; cursor: default; }

/* password policy checklist */
.pw-checklist {
  list-style: none;
  margin: 0 0 22px;
  padding: 12px 14px;
  background: #f0f1f8;
  border-radius: 4px;
  text-align: left;
  display: grid;
  gap: 8px;
}
.pw-checklist li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}
.pw-checklist li .ck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d5dae6;
  color: #fff;
  flex: 0 0 auto;
}
.pw-checklist li.ok { color: var(--green); }
.pw-checklist li.ok .ck { background: var(--green); }

/* --------------------------------------------------------------------------
   Shells (admin + agency)
   -------------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--content-bg);
}

/* sidebar */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { padding: 0 10px 20px; border-bottom: 1px solid var(--line); }
.side-brand .brand { justify-content: flex-start; }
.side-brand .side-sub {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.side-brand .agency-name {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
}
.side-brand .agency-code { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* overflow-y:auto lets a long nav scroll instead of overflowing off-screen —
   the admin portal has more items than fit on a laptop viewport. min-height:0
   is required for a flex child to shrink below its content height. */
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; flex: 1; overflow-y: auto; min-height: 0; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  width: 100%;
}
.side-link svg { flex: 0 0 auto; }
.side-link:hover { background: #f3f5fa; color: var(--ink); }
.side-link.active { background: var(--blue-soft); color: var(--blue); }
.shell.admin .side-link.active { background: #eceff7; color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }

.side-cta {
  margin: 8px 4px 12px;
  padding: 13px;
  border-radius: 10px;
  font-size: 14px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #f3f5fa;
  border-radius: 12px;
  padding: 11px 12px;
  margin: 0 4px;
}
.side-user .avatar { width: 38px; height: 38px; font-size: 13px; }
.side-user .su-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.side-user .su-sub { font-size: 11.5px; color: var(--muted); }

/* avatar (initials) */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  flex: 0 0 auto;
}
.avatar.blue { background: var(--blue); }
.avatar.v1 { background: #6d5bd0; }
.avatar.v2 { background: #2e7d64; }
.avatar.v3 { background: #b0562f; }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 { margin: 0; font-size: 21px; font-weight: 800; color: var(--navy); white-space: nowrap; }
.topbar .search {
  flex: 1;
  max-width: 560px;
  position: relative;
}
.topbar .search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a93a8;
  pointer-events: none;
}
.topbar .search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  font-size: 13.5px;
  outline: none;
}
.topbar .search input:focus { border-color: var(--navy); background: #fff; }
.topbar .tb-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.icon-btn {
  position: relative;
  background: none;
  border: 0;
  color: #4a5370;
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
}
.icon-btn:hover { background: #f3f5fa; color: var(--navy); }
.icon-btn .dot {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}
.tb-support { font-size: 13.5px; font-weight: 700; color: var(--ink); background: none; border: 0; }
.tb-support:hover { color: var(--blue); }
.tb-user { display: flex; align-items: center; gap: 11px; }
.tb-user .tu-meta { text-align: right; line-height: 1.25; }
.tb-user .tu-role { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.tb-user .tu-logout {
  background: none;
  border: 0;
  padding: 0;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-transform: uppercase;
}
.tb-user .tu-logout:hover { color: var(--red); }
.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue-soft);
  border: 1px solid #ccd9ff;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 7px 13px;
  white-space: nowrap;
}

/* live alerts strip (admin) */
.alerts {
  background: var(--navy);
  color: #dfe5f3;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 28px;
  font-size: 12px;
  letter-spacing: 0.4px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.alerts::-webkit-scrollbar { display: none; }
.alerts .al-title { color: #fff; font-weight: 800; display: inline-flex; align-items: center; gap: 7px; }
.alerts .al-item { display: inline-flex; align-items: center; gap: 8px; }
.alerts .al-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.alerts .al-dot.gold { background: var(--gold); }
.alerts .al-dot.red { background: #ff6b6b; }
.alerts .al-dot.green { background: #39d98a; }
.alerts .al-health { margin-left: auto; color: #fff; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }

/* content */
.content { padding: 26px 28px 20px; display: flex; flex-direction: column; gap: 22px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 14px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 12px;
  min-width: 0;
}
.stat-card .sc-label { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.3; min-height: 26px; }
.stat-card .sc-value {
  font-size: 23px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.stat-card .sc-delta { font-size: 11px; font-weight: 700; color: var(--green); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--navy); }
.panel-head .link { font-size: 12.5px; font-weight: 700; color: var(--muted); background: none; border: 0; }
.panel-head .link:hover { color: var(--navy); }

.duo-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 22px; }

/* bar chart */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: #fff;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.seg button.active { background: var(--navy); color: #fff; }
.chart { display: flex; align-items: flex-end; gap: 4.5%; height: 230px; padding: 8px 4px 0; border-bottom: 1px solid var(--line); }
.chart .bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 8%; height: 100%; }
.chart .bar { width: 42%; border-radius: 4px 4px 0 0; }
.chart .bar.back { background: #dde2ee; }
.chart .bar.front { background: var(--navy); }
.chart-x { display: flex; gap: 4.5%; padding-top: 8px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

/* donut */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.donut {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: conic-gradient(var(--navy) 0 78%, var(--gold) 78% 94%, var(--red) 94% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut .hole {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut .hole b { font-size: 24px; color: var(--navy); }
.donut .hole span { font-size: 11.5px; color: var(--muted); }
.legend { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.legend .lg-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink); }
.legend .lg-dot { width: 11px; height: 11px; border-radius: 3px; }
.legend .lg-val { margin-left: auto; font-weight: 800; color: var(--navy); }

/* tables */
.table-wrap { overflow-x: auto; }

/* Long free-text cells (notes, reasons, remarks) clamp to two lines and expand
   on click — previously they ran to full length with no way to read the rest. */
.cell-clip {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 42ch; cursor: pointer; position: relative;
}
.cell-clip.open { -webkit-line-clamp: unset; overflow: visible; white-space: pre-wrap; }
.cell-clip[data-clipped="1"]::after {
  content: 'more'; display: block; font-size: 11px; font-weight: 700;
  color: var(--blue); letter-spacing: .02em;
}
.cell-clip.open[data-clipped="1"]::after { content: 'less'; }
table.grid { width: 100%; border-collapse: collapse; min-width: 720px; }
table.grid th {
  text-align: left;
  font-size: 10.8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8f9fc;
}
table.grid td {
  padding: 14px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid #eef0f5;
  color: var(--ink);
  vertical-align: middle;
}
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.bold { font-weight: 700; }
table.grid td .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10.6px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.approved { background: var(--green-soft); color: var(--green); }
.pill.flagged { background: var(--red-soft); color: var(--red); }
.pill.review { background: var(--blue-soft); color: var(--blue); }
.pill.score { text-transform: none; letter-spacing: 0; font-size: 11.5px; }

.client-cell { display: flex; align-items: center; gap: 12px; }
.client-cell .avatar { width: 40px; height: 40px; font-size: 13px; }

/* agency content header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; color: var(--ink); }
.page-head .sub { margin: 5px 0 0; font-size: 13.5px; color: var(--muted); }

/* filters row */
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: end;
}
.filters .f-field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.filters select, .filters input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost:hover { border-color: var(--navy); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pager .pg-info { font-size: 12.5px; color: var(--muted); }
.pager .pg-btns { display: flex; gap: 6px; align-items: center; }
.pager .pg-btns button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  padding: 0 8px;
}
.pager .pg-btns button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pager .pg-btns button:disabled { opacity: 0.4; cursor: default; }
.pager .pg-dots { color: var(--muted); padding: 0 3px; }

/* credit banner */
.credit-banner {
  background: var(--navy);
  border-radius: 14px;
  color: #dfe5f3;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
}
.credit-banner .cb-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: 0 0 auto;
}
.credit-banner h4 { margin: 0 0 6px; color: #fff; font-size: 15.5px; }
.credit-banner p { margin: 0; font-size: 13px; line-height: 1.55; }
.credit-banner .cb-balance { margin-left: auto; text-align: right; white-space: nowrap; }
.credit-banner .cb-balance .cb-cap { font-size: 10.5px; letter-spacing: 1.6px; color: #aeb8d4; text-transform: uppercase; }
.credit-banner .cb-balance .cb-val { font-size: 27px; font-weight: 800; color: #fff; }

/* shell footer */
.shell-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}
.shell-footer .f-links { display: flex; gap: 22px; flex-wrap: wrap; }
.shell-footer .f-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.shell-footer .f-links a:hover { color: var(--navy); }

/* mobile top-nav (<=768px) */
.mobile-nav { display: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .duo-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; }
  .side-brand .brand .word, .side-brand .side-sub,
  .side-brand .agency-name, .side-brand .agency-code { display: none; }
  .side-brand { padding-bottom: 14px; }
  .side-brand .brand { justify-content: center; }
  .side-link { justify-content: center; padding: 12px 0; }
  .side-link .sl-label { display: none; }
  .side-user .su-meta, .side-cta .sl-label { display: none; }
  .side-cta { padding: 12px 0; }
  .side-user { justify-content: center; padding: 8px 0; background: none; }
}

@media (max-width: 768px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 64px;
    z-index: 40;
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav .side-link { width: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 12.5px; }
  .mobile-nav .side-link .sl-label { display: inline; }
  .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  .topbar h2 { font-size: 18px; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .content { padding: 18px 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credit-banner { flex-direction: column; align-items: flex-start; }
  .credit-banner .cb-balance { margin-left: 0; text-align: left; }
  .auth-card { padding: 34px 24px 28px; }
  .auth-footer { padding: 14px 18px; justify-content: center; text-align: center; }
  .code-row { gap: 8px; }
  .code-box { width: 44px; height: 52px; font-size: 20px; }
  .tb-user .tu-meta { display: none; }
}

/* --------------------------------------------------------------------------
   IT Admin integration-secret control plane
   -------------------------------------------------------------------------- */

.it-admin-screen {
  min-height: 100vh;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 42px);
  background: var(--content-bg);
  overflow-x: hidden;
}
.it-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.it-admin-header h1 { margin: 0 0 8px; color: var(--navy); font-size: clamp(26px, 4vw, 36px); }
.it-admin-header p { margin: 0; max-width: 780px; color: var(--muted); line-height: 1.55; }
.it-admin-header .btn { flex: 0 0 auto; min-height: 44px; padding: 10px 16px; background: #fff; color: var(--navy); border: 1px solid var(--line); }
.it-admin-kicker { margin: 0 0 7px !important; color: var(--gold-ink) !important; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.it-admin-notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fffaf0;
  color: #4b5563;
  line-height: 1.5;
}
.it-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.it-admin-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.it-admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.it-admin-card h2 { margin: 0; color: var(--navy); font-size: 20px; }
.it-admin-card-description { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.it-admin-status { display: inline-flex; min-height: 28px; align-items: center; padding: 4px 9px; border-radius: 999px; background: #edf0f5; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: capitalize; white-space: nowrap; }
.it-admin-status-active { background: var(--green-soft); color: #137548; }
.it-admin-status-disabled { background: var(--red-soft); color: #a12929; }
.it-admin-status-unavailable { background: var(--amber-soft); color: #8b5c12; }
.it-admin-metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 15px; }
.it-admin-metadata > div { min-width: 0; padding: 9px 10px; border-radius: 8px; background: #f7f8fb; }
.it-admin-metadata dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase; }
.it-admin-metadata dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; font-weight: 700; }
.it-admin-metadata [data-it-mask] { color: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; }
.it-admin-schema { margin: 0 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.it-admin-schema summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--navy); font-size: 12px; font-weight: 800; }
.it-admin-schema ul { margin: 0 0 10px; padding: 0; list-style: none; }
.it-admin-schema li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; color: var(--muted); font-size: 11px; }
.it-admin-schema li span:first-child { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.it-admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.it-admin-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--ink); font-size: 12px; font-weight: 700; }
.it-admin-label { display: block; overflow-wrap: anywhere; }
.it-admin-label span { color: var(--red); }
.it-admin-input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 11px; border: 1px solid #cfd6e4; border-radius: 7px; background: #fff; color: var(--ink); font-size: 14px; outline: none; }
.it-admin-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(22, 36, 76, .14); }
.it-admin-checkbox { width: 22px; min-width: 22px; height: 22px; min-height: 22px; padding: 0; }
.it-admin-check-wrap { display: flex; min-height: 44px; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.it-admin-help { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.35; }
.it-admin-reason-field { margin-top: 14px; }
.it-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.it-admin-actions .btn { min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 11px; }
.it-admin-actions .btn-navy { border-color: var(--navy); background: var(--navy); color: #fff; }
.it-admin-feedback { margin-top: 12px; padding: 10px 12px; border-radius: 7px; background: var(--red-soft); color: #922b2b; font-size: 12px; line-height: 1.45; }
.it-admin-feedback.is-success { background: var(--green-soft); color: #137548; }
.it-admin-history-panel { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.it-admin-history-panel h3 { margin: 0 0 8px; color: var(--navy); font-size: 13px; }
.it-admin-history-panel ol { margin: 0; padding-left: 19px; }
.it-admin-history-panel li { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 6px 0; }
.it-admin-history-panel li span { min-width: 0; overflow-wrap: anywhere; }
.it-admin-history-panel .btn { min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 10px; white-space: nowrap; }
.it-admin-history-empty { margin: 0; }
.it-admin-dialog { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(14, 24, 52, .56); }
.it-admin-dialog-panel { width: min(100%, 460px); padding: 24px; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(14, 24, 52, .25); }
.it-admin-dialog-panel h2 { margin: 0 0 8px; color: var(--navy); font-size: 20px; }
.it-admin-dialog-panel p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.it-admin-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.it-admin-dialog-actions .btn { min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); background: #fff; color: var(--navy); }
.it-admin-dialog-actions .btn-navy { border-color: var(--navy); background: var(--navy); color: #fff; }
.it-admin-dialog-feedback { margin-top: 10px; padding: 9px 10px; border-radius: 7px; background: var(--red-soft); color: #922b2b; font-size: 12px; }
.it-admin-dialog-feedback.is-success { background: var(--green-soft); color: #137548; }
.it-admin-screen button:focus-visible, .it-admin-screen input:focus-visible, .it-admin-screen summary:focus-visible { outline: 3px solid rgba(46, 91, 255, .45); outline-offset: 2px; }

.agy-wa-step { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
.agy-wa-step summary { padding: 11px 13px; cursor: pointer; color: var(--navy); font-size: 13px; font-weight: 800; }
.agy-wa-step dl { display: grid; grid-template-columns: minmax(145px, 42%) 1fr; gap: 5px 12px; margin: 0; padding: 0 13px 13px; }
.agy-wa-step dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.agy-wa-step dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; }

.agy-cust-dl { display: grid; grid-template-columns: minmax(145px, 35%) 1fr; gap: 8px 14px; margin: 0; padding: 4px 0 0; }
.agy-cust-dl dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.agy-cust-dl dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; font-weight: 500; }

@media (max-width: 1180px) {
  .it-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .it-admin-screen { padding: 18px 12px 28px; }
  .it-admin-header { display: block; }
  .it-admin-header .btn { margin-top: 14px; }
  .it-admin-grid { grid-template-columns: minmax(0, 1fr); }
  .it-admin-card { padding: 16px; }
  .agy-wa-step dl { grid-template-columns: minmax(0, 1fr); }
  .agy-cust-dl { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 430px) {
  .it-admin-fields { grid-template-columns: minmax(0, 1fr); }
  .it-admin-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .it-admin-actions .btn { width: 100%; }
  .it-admin-history-panel li { align-items: flex-start; flex-direction: column; }
  .it-admin-history-panel .btn { width: 100%; }
}
