/* ═══════════════════════════════════════════════════════════════════════════
   VYNAKRO ADMIN PORTAL — STYLES
   ───────────────────────────────────────────────────────────────────────────
   Structurally mirrors the MCS Claims-Core admin portal
   (/var/www/mcs/mcs_v8.html). Component vocabulary kept identical
   (.nav-item, .page-header, .card, .metric-card, .btn, .table-wrap)
   so screens can be cloned and re-skinned without restructuring.

   Color overrides (Vynakro green palette replacing MCS navy):
     MCS navy gradient #0B1F3A → #091729 → #060F1C
     Vynakro navy      #002650 → #001830 → #001224 (the logo, 2026-10-06)
     Accent            electric blue #0090F0 (the logo)

   Spec deviation note: design doc VYNAKRO_ADMIN_PORTAL_DESIGN.md §1
   reserved Vynakro green/gold for customer pages and called for MCS
   navy on the operator surface. This implementation overrides that
   choice — operator portal uses Vynakro brand colors. Spec to be
   updated to reflect the override at Phase 5 sign-off.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Vynakro brand palette */
  --navy-950:   #001224;
  --navy-900:   #001830;
  --navy-800:   #002650;
  --navy-700:   #003078;
  --navy-600:   #184890;
  --navy-100:   #D6E6F5;
  --navy-50:    #EEF4FB;

  --blue-500:   #0090F0;
  --blue-400:   #33A6F5;
  --blue-200:   #99D2FA;
  --blue-50:    #E8F4FE;

  /* Neutrals (kept identical to MCS for component fidelity) */
  --bg:         #F4F3F0;
  --surface:    #FFFFFF;
  --surface-2:  #F9F8F6;
  --border:     #E2DDD6;
  --border-2:   #CCC5BB;

  /* Ink */
  --text:       #002650;  /* primary text uses Vynakro navy */
  --text-1:     #001830;
  --text-2:     #374151;
  --text-3:     #6B7280;
  --text-4:     #9CA3AF;

  /* Status colors */
  --status-green:  #16A34A;
  --status-red:    #DC2626;
  --status-orange: #D97706;
  --status-blue:   #2563EB;

  /* Layout tokens */
  --sidebar-w:  240px;
  --topbar-h:   56px;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(15,51,37,0.08);
  --shadow-md:  0 4px 24px rgba(15,51,37,0.13);

  /* Sidebar/topbar gradient (Vynakro green) */
  --gradient-bar: linear-gradient(170deg, #002650 0%, #001830 60%, #001224 100%);
}

/* ─── RESET ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
main { display: block; }

body {
  font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--navy-800); text-decoration: underline; }

/* ─── APP SHELL (table layout, mirrors MCS) ─────────────────────────────── */
#app-shell {
  display: table;
  width: 100%;
  min-height: calc(100vh - var(--topbar-h));
}

#sidebar {
  background: var(--gradient-bar);
  display: table-cell;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  vertical-align: top;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.07);
}

#content {
  display: table-cell;
  vertical-align: top;
  background: var(--bg);
  padding: 24px 32px;
}

/* ─── TOPBAR ────────────────────────────────────────────────────────────── */
.app-topbar {
  height: var(--topbar-h);
  background: var(--gradient-bar);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.app-topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-w);
  margin-left: -20px;
  padding-left: 20px;
}

.app-topbar .brand .logo {
  width: 36px;
  height: 36px;
  background: var(--blue-500);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-950);
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 18px;
  font-weight: 800;
}

.app-topbar .brand .btext {
  color: white;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: 'DM Serif Display', Georgia, serif;
}

.app-topbar .brand .badge {
  background: var(--blue-500);
  color: var(--navy-950);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.topbar-spacer { flex: 1; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 14px;
}

.topbar-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-500);
  color: var(--navy-950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.topbar-logout {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.topbar-logout:hover {
  background: rgba(255,255,255,0.18);
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────── */
.sidebar-section {
  padding: 12px 0 4px;
}

.sidebar-label {
  padding: 4px 20px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
  text-decoration: none;
}

.nav-item.active {
  background: rgba(0,144,240,0.12);
  color: white;
  border-left: 3px solid var(--blue-500);
  font-weight: 600;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ─── PAGE HEADER ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: -0.5px;
  font-family: 'DM Serif Display', Georgia, serif;
}

.page-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── CARDS ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: 0.2px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title .icon {
  margin-right: 6px;
}

/* ─── METRICS ───────────────────────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--blue-500);
  opacity: 0.7;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1;
  font-family: 'DM Serif Display', Georgia, serif;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}

.metric-card.danger .metric-value { color: var(--status-red); }
.metric-card.warn .metric-value { color: var(--status-orange); }
.metric-card.good .metric-value { color: var(--status-green); }

@media (max-width: 1100px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .metrics-row { grid-template-columns: 1fr; }
}

/* ─── TABLES ────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.cell-id { font-family: 'IBM Plex Mono', Menlo, monospace; font-weight: 600; color: var(--navy-800); font-size: 13px; }
.cell-muted { color: var(--text-3); font-size: 13px; }
.cell-mono { font-family: 'IBM Plex Mono', Menlo, monospace; font-size: 13px; }
.cell-right { text-align: right; }

/* Status pills */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.pill-green   { background: #DCFCE7; color: #166534; }
.pill-yellow  { background: #FEF3C7; color: #92400E; }
.pill-red     { background: #FEE2E2; color: #991B1B; }
.pill-blue    { background: #DBEAFE; color: #1E40AF; }
.pill-gray    { background: #E5E7EB; color: #374151; }

/* ─── BUTTONS ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--navy-800); color: white; }
.btn-primary:hover { background: var(--navy-700); box-shadow: 0 2px 8px rgba(21,71,52,0.25); }

.btn-gold { background: var(--blue-500); color: var(--navy-950); }
.btn-gold:hover { background: var(--blue-400); }

.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); }

.btn-danger { background: var(--status-red); color: white; }
.btn-danger:hover { background: #B91C1C; }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 14px; border-radius: 10px; }

/* ─── FORMS ─────────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  flex: 1;
}

.field-full { flex: 0 0 100%; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.2px;
}

.input, select.input, textarea.input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 2px rgba(31,99,71,0.12);
}

.input::placeholder { color: var(--text-4); }

/* Filter bar — used on list screens */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters-bar .field { min-width: 160px; flex: 0 1 auto; }

/* ─── ALERTS ────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert-warn { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.alert-error { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.alert-success { background: #DCFCE7; border-color: #86EFAC; color: #166534; }

/* ─── EMPTY STATE ───────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
}

.empty-state .icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto;
}

/* ─── LOADING ───────────────────────────────────────────────────────────── */
.loading {
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--navy-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── PAGINATION ────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-3);
}

.pagination .controls {
  display: flex;
  gap: 6px;
}

/* ─── LOGIN PAGE (standalone, no shell) ─────────────────────────────────── */
body.login-body {
  background: var(--gradient-bar);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 36px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(10,36,25,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

.login-card .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.login-card .brand .logo {
  width: 44px;
  height: 44px;
  background: var(--navy-800);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-500);
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 22px;
  font-weight: 800;
}

.login-card .brand .btext {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy-800);
}

.login-card .brand .badge {
  background: var(--blue-500);
  color: var(--navy-950);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: auto;
}

.login-card h2 {
  font-size: 17px;
  color: var(--navy-800);
  margin-bottom: 6px;
  font-family: 'DM Serif Display', Georgia, serif;
}

.login-card .sub {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 22px;
}

.login-card .field { margin-bottom: 14px; }

.login-card .submit-row {
  margin-top: 20px;
}

.login-card .submit-row .btn {
  width: 100%;
  justify-content: center;
}

/* ─── UTILITIES ─────────────────────────────────────────────────────────── */
.muted    { color: var(--text-3); }
.mono     { font-family: 'IBM Plex Mono', Menlo, monospace; }
.right    { text-align: right; }
.center   { text-align: center; }
.mt0      { margin-top: 0; }
.mt8      { margin-top: 8px; }
.mt16     { margin-top: 16px; }
.mt24     { margin-top: 24px; }
.mb0      { margin-bottom: 0; }
.mb8      { margin-bottom: 8px; }
.mb16     { margin-bottom: 16px; }
.mb24     { margin-bottom: 24px; }
.flex     { display: flex; }
.flex-1   { flex: 1; }
.gap-8    { gap: 8px; }
.gap-16   { gap: 16px; }
.hidden   { display: none !important; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* td126: the Vynakro logo as the mark */
.app-topbar .brand img.logo, .login-card .brand img.logo { background: transparent; object-fit: contain; padding: 0; }
