/* LOMN Checker — styled 1:1 to medwork-scheduling
   (libs/frontend/ui tailwind.preset.js + shell-layout.tsx + login.tsx).
   Gray palette, white sidebar, primary-50 active nav, rounded-xl cards. */
:root {
  /* medwork-scheduling tokens */
  --primary-50: #eff6ff; --primary-100: #dbeafe; --primary-200: #bfdbfe;
  --primary-500: #3b82f6; --primary-600: #2563eb; --primary-700: #1d4ed8;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937; --gray-900: #111827;
  --green-100: #dcfce7; --green-500: #22c55e; --green-600: #16a34a; --green-800: #166534;
  --yellow-100: #fef9c3; --yellow-800: #854d0e;
  --red-100: #fee2e2; --red-600: #dc2626; --red-800: #991b1b;
  --blue-100: #dbeafe; --blue-600: #2563eb; --blue-800: #1e40af;
  --purple-100: #f3e8ff; --purple-800: #6b21a8;
  --orange-50: #fff7ed; --orange-600: #ea580c;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--gray-50); color: var(--gray-900);
  font: 14px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.hidden { display: none !important; }

/* ============ login (login.tsx: bg-gray-50 page, white card shadow-md) ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--gray-50); padding: 48px 16px;
}
.login-outer { max-width: 28rem; width: 100%; }
.login-head { text-align: center; display: flex; flex-direction: column; align-items: center; }
.login-logo { height: 56px; max-width: 260px; object-fit: contain; margin-bottom: 16px; }
.powered { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.powered-label { font-size: 12px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }
.module-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-50); border: 1px solid var(--primary-200);
  padding: 8px 16px; border-radius: 8px; margin-bottom: 12px;
  font-size: 14px; font-weight: 600; color: var(--primary-700);
  text-transform: uppercase; letter-spacing: .025em;
}
.module-badge svg { width: 20px; height: 20px; color: var(--primary-600); }
.login-sub { margin: 0 0 24px; color: var(--gray-600); font-size: 20px; font-weight: 400; }
.login-card {
  background: white; border-radius: 8px; box-shadow: var(--shadow-md); padding: 32px;
}
.login-card form { text-align: left; display: flex; flex-direction: column; gap: 24px; }
.login-card label { display: block; font-size: 14px; color: var(--gray-700); font-weight: 500; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 8px 12px;
  border: 1px solid var(--gray-300); border-radius: 8px; font: inherit;
  box-shadow: var(--shadow-sm);
}
.login-card input::placeholder { color: var(--gray-400); }
.login-card input:focus { outline: 2px solid var(--primary-500); outline-offset: 0; border-color: var(--primary-500); }
.login-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 8px; padding: 16px; font-size: 14px;
}
.btn-block { width: 100%; justify-content: center; padding: 10px 16px; font-size: 14px; }
.login-foot { color: var(--gray-500); font-size: 13px; margin: 16px 0 0; text-align: center; }

/* SSO (login.tsx: 'Or continue with' divider + white Google button) */
.sso-divider {
  position: relative; text-align: center; margin: 24px 0 20px;
}
.sso-divider::before {
  content: ""; position: absolute; inset: 50% 0 auto 0;
  border-top: 1px solid var(--gray-300);
}
.sso-divider span {
  position: relative; background: white; padding: 0 12px;
  font-size: 12px; color: var(--gray-500);
}
.btn-google {
  width: 100%; display: inline-flex; align-items: center; justify-content: center;
  gap: 12px; padding: 10px 16px; border: 1px solid var(--gray-300);
  border-radius: 8px; background: white; font: inherit; font-size: 14px;
  font-weight: 500; color: var(--gray-700); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background-color .15s;
}
.btn-google:hover { background: var(--gray-50); }
.btn-google:disabled { opacity: .5; cursor: not-allowed; }

/* medwork iO wordmark (logo.tsx: gray-700 MEDWORK + blue bubble) */
.mw-mark { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--gray-700); font-size: 13px; letter-spacing: .02em; }
.mw-bubble {
  background: var(--primary-500); color: white; border-radius: 8px 8px 8px 2px;
  font-size: 10px; font-weight: 700; padding: 1px 5px;
}

/* ============ shell (shell-layout.tsx: white sidebar w-64, border-r) ======= */
.shell { display: flex; min-height: 100vh; background: var(--gray-50); }
.sidebar {
  width: 256px; flex: 0 0 256px; background: white;
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 50;
}
.side-brand {
  display: flex; gap: 10px; align-items: center; height: 64px; padding: 0 16px;
  border-bottom: 1px solid var(--gray-200);
}
.side-logo { height: 36px; max-width: 150px; object-fit: contain; }
.side-title { font-weight: 700; color: var(--gray-900); font-size: 15px; line-height: 1.2; }
.side-sub { font-size: 11px; color: var(--gray-500); }
.side-nav { flex: 1; padding: 16px 8px; overflow-y: auto; }
.side-sect {
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--gray-400); margin: 8px 12px 4px; padding: 8px 0 0;
}
.side-nav > .side-sect:first-child { margin-top: 0; padding-top: 0; }
.side-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 12px; margin: 2px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--gray-600); font: inherit;
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
  transition: color .15s, background-color .15s;
}
.side-item:hover { background: var(--gray-100); color: var(--gray-900); }
.side-item.active { background: var(--primary-50); color: var(--primary-700); }
.side-item svg { width: 20px; height: 20px; flex: 0 0 20px; }
.side-item .count {
  margin-left: auto; background: var(--gray-100); color: var(--gray-600);
  border-radius: 999px; font-size: 11px; padding: 0 8px; line-height: 18px; font-weight: 600;
}
.side-item.active .count { background: var(--primary-100); color: var(--primary-700); }
.side-foot {
  border-top: 1px solid var(--gray-200); padding: 16px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--primary-100);
  color: var(--primary-600); font-weight: 500; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 32px;
}
.side-user { flex: 1; min-width: 0; }
.side-user .side-name {
  font-size: 14px; font-weight: 500; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-user .side-role {
  display: block; font-size: 12px; color: var(--gray-500); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-logout {
  border: 0; background: transparent; color: var(--gray-400); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex;
}
.side-logout:hover { color: var(--gray-600); background: var(--gray-100); }
.side-logout svg { width: 18px; height: 18px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagebar {
  display: flex; align-items: center; background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px; height: 64px; position: sticky; top: 0; z-index: 40;
}
.pagebar h1 { font-size: 18px; font-weight: 600; color: var(--gray-900); margin: 0; }
.pagebar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.container { max-width: 1240px; width: 100%; margin: 0 auto; padding: 24px; }

/* ============ cards (Card.tsx: rounded-xl border-gray-100 shadow-sm) ====== */
.card {
  background: white; border: 1px solid var(--gray-100);
  border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px 24px; }
.muted { color: var(--gray-500); }
.small { font-size: 12.5px; color: var(--gray-400); }
.toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* inputs (Input.tsx) */
select, input[type="text"], input[type="email"], input[type="password"] {
  border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px;
  background: white; font: inherit; color: var(--gray-900); transition: border-color .15s;
}
select:hover, input:hover { border-color: var(--gray-300); }
select:focus, input:focus { outline: 2px solid var(--primary-500); border-color: transparent; }

/* buttons (Button.tsx: rounded-lg, px-4 py-2 text-sm font-medium) */
button, .btn {
  border: 1px solid var(--gray-300); border-radius: 8px; padding: 8px 16px;
  background: transparent; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--gray-700); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s, color .15s;
}
button:hover, .btn:hover { background: var(--gray-50); }
.btn-primary { background: var(--primary-600); border-color: transparent; color: white; }
.btn-primary:hover { background: var(--primary-700); }
.btn-success { background: #059669; border-color: transparent; color: white; }
.btn-success:hover { background: #047857; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ============ tables (Table.tsx) ========================================== */
table { width: 100%; border-collapse: collapse; }
thead { background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
th {
  text-align: left; padding: 12px 24px; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500);
}
td { text-align: left; padding: 16px 24px; border-bottom: 1px solid var(--gray-100); font-size: 14px; color: var(--gray-600); }
td strong { color: var(--gray-900); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.rowlink { cursor: pointer; transition: background-color .15s; }
tbody tr.rowlink:hover { background: var(--gray-50); }
td.center, th.center { text-align: center; }

/* ============ badges (Badge.tsx: rounded-full px-2.5 py-0.5 text-xs, -100/-800) */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip.ready      { background: var(--green-100); color: var(--green-800); }
.chip.needs_info { background: var(--yellow-100); color: var(--yellow-800); }
.chip.editing    { background: var(--blue-100); color: var(--blue-800); }
.chip.submitted, .chip.delivered { background: var(--purple-100); color: var(--purple-800); }
.chip.held       { background: var(--yellow-100); color: var(--yellow-800); }
.chip.error, .chip.rejected, .chip.inactive { background: var(--red-100); color: var(--red-800); }
.chip.processing, .chip.viewer { background: var(--gray-100); color: var(--gray-600); }
.chip.active { background: var(--green-100); color: var(--green-800); }
.chip.admin { background: var(--purple-100); color: var(--purple-800); }
.chip.provider { background: var(--blue-100); color: var(--blue-800); }
.chip.clinician { background: var(--green-100); color: var(--green-800); }
.score { font-weight: 700; }
.score.hi { color: var(--green-600); } .score.mid { color: #d97706; } .score.lo { color: var(--red-600); }
.verdict { font-weight: 700; font-size: 12.5px; }
.verdict.pass { color: var(--green-600); } .verdict.fail { color: var(--red-600); } .verdict.open { color: #d97706; }

/* ============ dashboard (StatsCard.tsx: icon box + title + value) ========= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat {
  background: white; border: 1px solid var(--gray-100); border-radius: 12px;
  box-shadow: var(--shadow-sm); padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  padding: 12px; border-radius: 8px; display: flex; flex: 0 0 auto;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: #eff6ff; color: var(--blue-600); }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.yellow { background: #fefce8; color: #ca8a04; }
.stat-icon.red    { background: #fef2f2; color: var(--red-600); }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-icon.orange { background: var(--orange-50); color: var(--orange-600); }
.stat-icon.gray   { background: var(--gray-50); color: var(--gray-600); }
.stat-body { flex: 1; min-width: 0; }
.stat .stat-label { font-size: 14px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 74px; align-items: center; gap: 10px; margin: 7px 0; }
.hbar-track { background: var(--gray-100); border-radius: 6px; height: 16px; overflow: hidden; }
.hbar-fill { background: var(--primary-500); height: 100%; border-radius: 6px; }
.hbar-label { font-weight: 500; font-size: 13px; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { font-size: 12px; color: var(--gray-500); text-align: right; }

/* ============ detail / editor ============================================= */
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 150px 1fr; row-gap: 8px; }
.kv dt { color: var(--gray-500); font-size: 13px; }
.kv dd { margin: 0; color: var(--gray-900); font-size: 14px; }
.editor {
  width: 100%; min-height: 480px; resize: vertical;
  border: 1px solid var(--gray-200); border-radius: 8px; padding: 14px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--gray-900); background: var(--gray-50);
}
.editor:focus { outline: 2px solid var(--primary-500); border-color: transparent; background: white; }
.editor[readonly] { background: var(--gray-50); color: var(--gray-500); }
.back { color: var(--primary-600); text-decoration: none; font-weight: 500; font-size: 14px; }
.back:hover { color: var(--primary-700); }
.gap-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.gap-row:last-child { border-bottom: 0; }
.gap-field { font-weight: 500; color: var(--gray-900); font-size: 14px; }
.gap-note { color: var(--gray-500); flex: 1; font-size: 13px; }
.evidence { color: var(--gray-500); font-size: 13px; }
.empty { padding: 48px 24px; text-align: center; color: var(--gray-400); }

/* ============ admin ======================================================= */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { font-size: 14px; color: var(--gray-700); font-weight: 500; }
.form-grid input, .form-grid select { display: block; width: 100%; margin-top: 6px; }
.perm {
  display: inline-block; background: var(--gray-100); border-radius: 6px;
  padding: 1px 8px; font-size: 11.5px; margin: 1px 2px; color: var(--gray-600); font-weight: 500;
}

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--gray-900); color: white; border-radius: 8px; padding: 10px 18px;
  box-shadow: var(--shadow-md); z-index: 60; font-weight: 500; font-size: 14px;
}
.toast.err { background: var(--red-600); }
