/**
 * Shared portal chrome (login, dashboard, encounters) for headacheMD Houston PLLC.
 * Version: 1.1.4 — primary buttons: fern green; hover/active cascade fix
 *   hmdhou.com/admin/index.html.tmpl line 29 (body { font-family: … })
 *   hmdhou.com/admin/index.html.tmpl lines 68 and 75 (.line-item .value, .mono)
 *   (same stacks appear in hmdhou.com/admin/index.html at lines 28, 67, 74.)
 */
/* global URL */

:root {
  /* Exact body stack from admin/index.html.tmpl line 29 (verbatim) */
  --hmd-font-body: 'Segoe UI',system-ui,-apple-system,sans-serif;
  /* Headings use inherit in SPA; no separate stack — same as body (tmpl L29) */
  --hmd-font-heading: 'Segoe UI',system-ui,-apple-system,sans-serif;
  /* Exact mono stack from admin/index.html.tmpl lines 68 and 75 (verbatim) */
  --hmd-font-mono: 'SF Mono','Cascadia Code','Consolas',monospace;
  --bg: #f8f7f4;
  --surface: #fff;
  --surface2: #f1f0ec;
  --text: #1a1a1a;
  --text2: #666660;
  --text3: #999990;
  --border: rgba(0, 0, 0, 0.12);
  --accent-navy: #1f3864;
  --accent-teal: #0f766e;
  --accent-fern: #6B8E23;
  --accent-fern-hover: #5a7a1e;
  --accent-fern-active: #4d6919;
  --red: #c00000;
  --green-ok: #375623;
  --orange-sub: #833c00;
  --pharma-bg: #e2efd9;
  --uncat-bg: #fff2cc;
  --noshow-bg: #ffd7d7;
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}
html {
  font-family: var(--hmd-font-body);
}
body {
  margin: 0;
  font-family: var(--hmd-font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.hmd-shell,
.hmd-page {
  font-family: var(--hmd-font-body);
}
h1,
h2,
h3,
h4,
.hmd-heading {
  font-family: var(--hmd-font-heading);
}
code,
pre,
.hmd-mono,
.mono,
.hmd-numeric-table td.num {
  font-family: var(--hmd-font-mono);
}
.hmd-counts-chart-scroll svg text {
  font-family: var(--hmd-font-body);
}

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

.ops-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ops-topbar .ops-topbar-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 4px;
  text-decoration: none;
}
.ops-topbar .ops-topbar-logo-link:hover {
  opacity: 0.92;
}
.ops-topbar .ops-topbar-logo-link img {
  height: 48px;
  width: auto;
  display: block;
}
.ops-topbar strong {
  color: var(--accent-navy);
  font-weight: 600;
}
.ops-topbar .spacer {
  flex: 1;
}
.ops-topbar .muted {
  color: var(--text2);
  font-size: 13px;
}

.ops-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.ops-btn {
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
}
.ops-btn:hover {
  background: var(--surface2);
}
.ops-btn-primary {
  background: var(--accent-fern);
  color: #ffffff;
  border-color: var(--accent-fern);
}
.ops-btn-navy {
  background: var(--accent-navy);
  color: #fff;
  border-color: var(--accent-navy);
}

.ops-input,
.ops-select {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.ops-input:focus,
.ops-select:focus {
  outline: none;
  border-color: var(--accent-navy);
  box-shadow: 0 0 0 2px rgba(31, 56, 100, 0.12);
}

.ops-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
@media (max-width: 640px) {
  .ops-tiles {
    grid-template-columns: 1fr;
  }
}

.ops-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  border-top: 4px solid var(--tile-accent, var(--accent-navy));
}
.ops-tile:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}
.ops-tile h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.ops-tile p {
  margin: 0;
  font-size: 13px;
  color: var(--text2);
}
.ops-tile .last {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text3);
}
.ops-dash-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent-navy);
}
.ops-dash-welcome {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text2);
  padding-bottom: 14px;
  border-bottom: 3px solid var(--accent-teal);
}
.ops-role-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.ops-role-pill--admin {
  background: #e2efd9;
  color: var(--green-ok);
}
.ops-role-pill--viewer {
  background: #e8f4fc;
  color: var(--accent-navy);
}
.ops-role-pill--staff {
  background: #ede9fe;
  color: #5b21b6;
}
.ops-tile-status {
  margin-top: 14px;
}
.ops-tile-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.ops-tile-pill--active {
  background: #e2efd9;
  color: var(--green-ok);
}
.ops-tile-pill--readonly {
  background: #fff8e6;
  color: var(--orange-sub);
}
.ops-tile-pill--soon {
  background: #eef2f7;
  color: var(--text2);
}

.ops-tile--locked,
.ops-tile--pending {
  opacity: 0.45;
  cursor: not-allowed;
}
.ops-tile--locked:hover,
.ops-tile--pending:hover {
  box-shadow: none;
  transform: none;
}
.ops-tile--locked .ops-tile-state-icon,
.ops-tile--pending .ops-tile-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 8px;
  vertical-align: middle;
  color: var(--text2);
}
.ops-tile-description {
  margin: 0;
  font-size: 13px;
  color: var(--text2);
}
.ops-tile-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.ops-tile-badge[hidden] {
  display: none;
}
.ops-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ops-modal-overlay.is-open {
  display: flex;
}
.ops-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.ops-modal h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--accent-navy);
}
.ops-modal p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text2);
}
.ops-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.ops-btn {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}
.ops-btn--primary {
  background: var(--accent-fern);
  color: #ffffff;
  border-color: var(--accent-fern);
}
.ops-btn.ops-btn--primary:hover,
.ops-btn--primary:hover,
.ops-btn-primary:hover {
  background: var(--accent-fern-hover) !important;
  color: #ffffff !important;
  border-color: var(--accent-fern-hover) !important;
  filter: none;
}
.ops-btn.ops-btn--primary:active,
.ops-btn--primary:active,
.ops-btn-primary:active {
  background: var(--accent-fern-active) !important;
  color: #ffffff !important;
  border-color: var(--accent-fern-active) !important;
  filter: none;
}
.ops-btn.ops-btn--primary:focus-visible,
.ops-btn--primary:focus-visible,
.ops-btn-primary:focus-visible {
  outline: 2px solid var(--accent-fern);
  outline-offset: 2px;
  background: var(--accent-fern);
  color: #ffffff;
}
.ops-btn--primary:disabled,
.ops-btn--primary.disabled,
.ops-btn-primary:disabled,
.ops-btn-primary.disabled {
  background: #a8b89a;
  color: #ffffff;
  border-color: #a8b89a;
  cursor: not-allowed;
  opacity: 1;
}
.ops-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ops-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent-navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 10001;
  display: none;
}
.ops-toast.is-visible {
  display: block;
}

.ops-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ops-table th,
.ops-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.ops-table th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  color: var(--text2);
  font-weight: 500;
  white-space: nowrap;
}
.ops-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.st-scheduled {
  background: #e5e5e5;
  color: #444;
}
.st-arrived {
  background: #cfe2ff;
  color: #084298;
}
.st-completed {
  background: #d1e7e7;
  color: #0f766e;
}
.st-coded {
  background: #e7d4f7;
  color: #6f42c1;
}
.st-submitted {
  background: #ffe5d0;
  color: var(--orange-sub);
}
.st-paid {
  background: #d4e6d4;
  color: var(--green-ok);
}
.st-closed {
  background: #c4d8c4;
  color: #1e3d16;
}
.st-docneed {
  background: #fff3cd;
  color: #856404;
}
.st-noshow {
  background: var(--noshow-bg);
  color: var(--red);
}
.st-cancelled {
  background: #f0d6d6;
  color: #842029;
}

.var-bad {
  color: var(--red);
  font-weight: 600;
}
.var-good {
  color: var(--green-ok);
  font-weight: 600;
}

.ops-widgets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .ops-widgets {
    grid-template-columns: repeat(2, 1fr);
  }
}
.ops-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.ops-widget .lbl {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ops-widget .val {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ops-widget .sub {
  font-size: 11px;
  color: var(--text3);
}
.ops-widget.warn .val {
  color: var(--red);
}

.ops-note-hint {
  font-size: 12px;
  color: var(--orange-sub);
  margin-top: 4px;
}
