:root {
  --navy: #10344c;
  --teal: #0f8a7f;
  --teal-light: #e6f5f3;
  --bg: #f4f7f8;
  --card: #ffffff;
  --border: #dfe6e9;
  --text: #1c2b33;
  --muted: #64798a;
  --danger: #c0392b;
  --warn: #d68910;
  --ok: #1e8449;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,52,76,0.08), 0 1px 2px rgba(16,52,76,0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--navy);
  color: white;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.topbar .brand { font-weight: 700; font-size: 1.02rem; display:flex; align-items:center; gap:10px; white-space:nowrap; }
.topbar .brand .dot { width:10px; height:10px; border-radius:50%; background: var(--teal); flex-shrink:0; }
.topbar .brand img { flex-shrink:0; }
.topbar .userinfo { font-size: 0.85rem; color: #cfe3ec; white-space:nowrap; }
.topbar button.logout {
  background: transparent; border: 1px solid #3d5b70; color: #cfe3ec;
  padding: 5px 10px; border-radius: 6px; cursor: pointer; margin-left: 12px; font-size: 0.8rem; flex-shrink:0;
}
.topbar .menuToggle {
  display: none; background: transparent; border: none; color: white; cursor: pointer;
  padding: 6px; margin-right: 10px; flex-shrink: 0;
}

/* ---- Sidebar navigation ---- */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 236px;
  background: #0e2a3d;
  overflow-y: auto;
  padding: 14px 0 24px;
  z-index: 40;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar .navGroupLabel {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #5f7f93;
  font-weight: 700;
  padding: 14px 18px 6px;
}
.sidebar .navGroupLabel:first-child { padding-top: 4px; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #b9cedb;
  text-decoration: none;
  padding: 9px 18px;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.sidebar a svg { flex-shrink: 0; width: 17px; height: 17px; opacity: 0.85; }
.sidebar a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar a.active {
  background: rgba(15,138,127,0.18);
  color: #fff;
  border-left-color: var(--teal);
  font-weight: 600;
}
.sidebar a.active svg { opacity: 1; }

.sidebarOverlay { display: none; }

@media (max-width: 880px) {
  .topbar .menuToggle { display: inline-flex; align-items:center; justify-content:center; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebarOverlay.open {
    display: block; position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,0.35); z-index: 39;
  }
  .container { margin-left: 16px !important; }
  .topbar .brand span.brandText { display: none; }
}

.container { max-width: none; margin: 24px 32px 24px 260px; padding: 0 16px 0 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

h1 { font-size: 1.4rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--navy); }
label { display:block; font-size: 0.82rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 60px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }

button.btn {
  background: var(--teal);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
}
button.btn:hover { opacity: 0.92; }
button.btn.secondary { background: var(--navy); }
button.btn.small { padding: 6px 12px; font-size: 0.82rem; margin-top: 0; }
button.btn:disabled { background: #b7c4cb; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--teal-light); }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 0.74rem; font-weight: 700;
}
.badge.waiting { background: #fdecea; color: var(--danger); }
.badge.with_doctor { background: #fef5e7; color: var(--warn); }
.badge.billing { background: #eaf2f8; color: var(--navy); }
.badge.completed { background: #eafaf1; color: var(--ok); }
.badge.unpaid { background: #fdecea; color: var(--danger); }
.badge.paid { background: #eafaf1; color: var(--ok); }
.badge.partially_paid { background: #fef5e7; color: var(--warn); }

.empty-state { color: var(--muted); font-size: 0.9rem; padding: 20px 0; text-align: center; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }
.success-msg { color: var(--ok); font-size: 0.85rem; margin-top: 8px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), #0a1f2e);
}
.login-card {
  background: white; border-radius: 14px; padding: 36px; width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.login-card h1 { text-align:center; color: var(--navy); }
.login-card .sub { text-align:center; color: var(--muted); font-size:0.85rem; margin-bottom: 20px;}
.hint-users { font-size: 0.75rem; color: var(--muted); margin-top: 16px; text-align:center; }

.offline-banner {
  background: var(--warn); color: white; text-align:center; padding: 6px; font-size: 0.8rem; display:none;
}
.offline-banner.show { display:block; }

/* ---- Dashboard ---- */
.statGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.statCard {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.statCard .statLabel { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.statCard .statValue { font-size: 1.7rem; font-weight: 700; color: var(--navy); margin-top: 4px; }
.statCard .statSub { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.statCard.warn .statValue { color: var(--warn); }
.statCard.danger .statValue { color: var(--danger); }
.statCard.ok .statValue { color: var(--ok); }

.quickActions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quickAction {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 10px; text-decoration: none; color: var(--text); font-size: 0.82rem; font-weight: 600;
  text-align: center; transition: box-shadow 0.12s, transform 0.12s;
}
.quickAction:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--teal); }
.quickAction svg { width: 26px; height: 26px; color: var(--teal); }

.activityFeed { list-style: none; margin: 0; padding: 0; }
.activityFeed li {
  display: flex; justify-content: space-between; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.activityFeed li:last-child { border-bottom: none; }
.activityFeed .actWho { color: var(--muted); font-size: 0.78rem; }

/* ============================================================
   TOP-BAR TOOLS (calendar, calculator, chat) + notification bang
   ============================================================ */
.topTool { position: relative; }
.topToolBtn {
  background: transparent; border: none; color: #cfe3ec; cursor: pointer;
  font-size: 1.05rem; padding: 6px 7px; border-radius: 8px; position: relative;
  line-height: 1; transition: background 0.14s, transform 0.14s;
}
.topToolBtn:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.topBadge {
  display: none; position: absolute; top: -1px; right: -1px;
  background: var(--accent); color: #fff; border-radius: 50%;
  min-width: 16px; height: 16px; font-size: 0.6rem; font-weight: 700;
  line-height: 16px; text-align: center; padding: 0 3px; box-shadow: 0 0 0 2px var(--navy);
}
@keyframes bellBang {
  0%,100% { transform: rotate(0); }
  15% { transform: rotate(16deg) scale(1.15); }
  30% { transform: rotate(-14deg) scale(1.15); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
}
.topToolBtn.bang { animation: bellBang 0.7s ease; }

.topPopup {
  display: none; position: absolute; top: 40px; right: 0;
  width: 300px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(16,52,76,0.22);
  z-index: 100; padding: 12px; color: var(--text);
  animation: popIn 0.14s ease;
}
.topPopup.wide { width: 340px; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
#notifDropdown { padding: 0; width: 320px; max-height: 400px; overflow-y: auto; }

/* Calendar */
.calHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--navy); }
.calNav { background: var(--teal-light); border: none; color: var(--teal); width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 1rem; }
.calNav:hover { background: var(--teal); color: #fff; }
.calGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calGrid.calDow div { font-size: 0.68rem; color: var(--muted); font-weight: 700; padding: 4px 0; }
.calDay { padding: 7px 0; font-size: 0.82rem; border-radius: 7px; cursor: default; }
.calDay:hover { background: var(--teal-light); }
.calDay.today { background: var(--teal); color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(15,138,127,0.4); }

/* Calculator */
.calcDisplay {
  background: #0e2a3d; color: #eafff9; text-align: right; font-size: 1.5rem;
  padding: 14px 14px; border-radius: 10px; margin-bottom: 10px; font-variant-numeric: tabular-nums;
  overflow: hidden; min-height: 52px; font-weight: 600;
}
.calcGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calcKey {
  padding: 13px 0; border: none; border-radius: 9px; background: #eef3f5; color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform 0.08s, filter 0.12s;
}
.calcKey:hover { filter: brightness(0.96); }
.calcKey:active { transform: scale(0.94); }
.calcKey.op { background: var(--teal-light); color: var(--teal); }
.calcKey.eq { background: linear-gradient(135deg, var(--teal), #0bbfa6); color: #fff; }
.calcKey.clr { background: #fdecea; color: var(--danger); }

/* Chat */
.chatHead { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; color: var(--navy); }
.chatList { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 2px; }
.chatBubble { max-width: 85%; padding: 7px 10px; border-radius: 12px; font-size: 0.84rem; }
.chatBubble.theirs { background: #eef3f5; align-self: flex-start; border-bottom-left-radius: 3px; }
.chatBubble.mine { background: var(--teal-light); align-self: flex-end; border-bottom-right-radius: 3px; }
.chatBubble.unread.theirs { background: #fff5e6; box-shadow: inset 3px 0 0 var(--accent); }
.chatWho { font-size: 0.68rem; color: var(--muted); margin-bottom: 2px; }
.chatText { white-space: pre-wrap; word-break: break-word; }
.chatCompose { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.chatCompose select, .chatCompose textarea { font-size: 0.85rem; }

/* ============================================================
   VISUAL POLISH — warmer, friendlier, a little heat
   ============================================================ */
:root {
  --accent: #f4793b;          /* warm coral/amber accent */
  --accent-soft: #fff1ea;
  --radius: 12px;
  --shadow: 0 2px 6px rgba(16,52,76,0.07), 0 6px 20px rgba(16,52,76,0.05);
}
body { background: linear-gradient(180deg, #eef4f6 0%, #f4f7f8 240px) fixed, var(--bg); }

.topbar {
  background: linear-gradient(100deg, #0c2f45 0%, var(--navy) 45%, #126b63 160%);
  box-shadow: 0 2px 10px rgba(10,31,46,0.25);
}
.topbar .brand .dot { background: var(--accent); box-shadow: 0 0 10px rgba(244,121,59,0.7); }

.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s, transform 0.18s;
}
.card:hover { box-shadow: 0 4px 10px rgba(16,52,76,0.09), 0 12px 32px rgba(16,52,76,0.07); }

h1 { background: linear-gradient(90deg, var(--navy), var(--teal)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

button.btn {
  background: linear-gradient(135deg, var(--teal) 0%, #0bbfa6 100%);
  box-shadow: 0 2px 8px rgba(15,138,127,0.28);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
button.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15,138,127,0.38); opacity: 1; filter: brightness(1.03); }
button.btn.secondary { background: linear-gradient(135deg, var(--navy), #14496a); box-shadow: 0 2px 8px rgba(16,52,76,0.25); }
button.btn:active { transform: translateY(0) scale(0.99); }

input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,138,127,0.14);
}

.sidebar a.active { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(244,121,59,0.14), rgba(15,138,127,0.10)); }

/* Dashboard stat cards — warm, lively, colour-accented */
.statCard {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: transform 0.16s, box-shadow 0.16s;
}
.statCard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--teal); }
.statCard.warn::before { background: var(--warn); }
.statCard.danger::before { background: var(--danger); }
.statCard.ok::before { background: var(--ok); }
.statCard:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(16,52,76,0.12); }
.statCard .statValue { background: linear-gradient(135deg, var(--navy), var(--teal)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.quickAction:hover { border-color: var(--accent); box-shadow: 0 8px 20px rgba(244,121,59,0.14); transform: translateY(-2px); }
.quickAction svg { color: var(--teal); }

.badge { box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
tr:hover td { background: var(--accent-soft); }

/* ============================================================
   AUTH / LOGIN PAGES — split hero + form, warm and welcoming
   ============================================================ */
.auth-split { display: flex; min-height: 100vh; }
.auth-hero {
  flex: 1.15; position: relative; overflow: hidden; color: #eaf6f4;
  display: flex; flex-direction: column; justify-content: center; padding: 60px 56px;
  background: linear-gradient(135deg, #0b2b40 0%, #10344c 38%, #0d6f68 100%);
}
.auth-hero::before, .auth-hero::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(6px); opacity: 0.5;
  background: radial-gradient(circle at 30% 30%, rgba(244,121,59,0.55), transparent 70%);
  animation: floatBlob 16s ease-in-out infinite;
}
.auth-hero::before { width: 420px; height: 420px; top: -120px; right: -80px; }
.auth-hero::after {
  width: 320px; height: 320px; bottom: -100px; left: -60px; animation-delay: -8s;
  background: radial-gradient(circle at 30% 30%, rgba(11,191,166,0.5), transparent 70%);
}
@keyframes floatBlob { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(20px,-24px) scale(1.08); } }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .hero-logo {
  width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 26px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.auth-hero .hero-logo img { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; }
.auth-hero h1 { font-size: 2.3rem; line-height: 1.15; margin: 0 0 14px; color: #fff; -webkit-text-fill-color: #fff; background: none; }
.auth-hero .tagline { font-size: 1.02rem; opacity: 0.9; max-width: 430px; line-height: 1.55; }
.auth-hero .features { list-style: none; padding: 0; margin: 34px 0 0; display: flex; flex-direction: column; gap: 14px; }
.auth-hero .features li { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; opacity: 0.96; }
.auth-hero .features .tick {
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.8rem;
}
.auth-hero .hero-foot { position: absolute; bottom: 26px; left: 56px; font-size: 0.78rem; opacity: 0.7; z-index: 1; }

.auth-form-side {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 28px;
  background: linear-gradient(180deg, #eef4f6, #f7fafb);
}
.auth-card { width: 100%; max-width: 380px; animation: authIn 0.5s cubic-bezier(.2,.8,.2,1); }
@keyframes authIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.auth-card .brand-badge {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--teal), #0bbfa6); display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #fff; box-shadow: 0 8px 22px rgba(15,138,127,0.35);
}
.auth-card .brand-badge img { width: 58px; height: 58px; border-radius: 16px; object-fit: cover; }
.auth-card h2 { text-align: center; margin: 0 0 4px; color: var(--navy); -webkit-text-fill-color: initial; background: none; font-size: 1.5rem; }
.auth-card .welcome-sub { text-align: center; color: var(--muted); font-size: 0.88rem; margin-bottom: 26px; }
.auth-field { position: relative; margin-bottom: 16px; }
.auth-field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 12px 14px 12px 42px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; background: #fff; transition: border .15s, box-shadow .15s;
}
.auth-field .ficon { position: absolute; left: 14px; top: 34px; font-size: 1rem; opacity: 0.6; }
.auth-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,138,127,0.14); outline: none; }
.auth-btn {
  width: 100%; padding: 13px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; color: #fff;
  cursor: pointer; margin-top: 6px; background: linear-gradient(135deg, var(--teal) 0%, #0bbfa6 100%);
  box-shadow: 0 6px 18px rgba(15,138,127,0.3); transition: transform .12s, box-shadow .12s, filter .12s;
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(15,138,127,0.4); filter: brightness(1.03); }
.auth-btn:active { transform: translateY(0) scale(.99); }
.auth-alt { text-align: center; margin-top: 18px; font-size: 0.84rem; color: var(--muted); }
.auth-alt a { color: var(--teal); text-decoration: none; font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }
.auth-foot { text-align: center; margin-top: 24px; font-size: 0.72rem; color: var(--muted); }

@media (max-width: 860px) {
  .auth-split { flex-direction: column; }
  .auth-hero { flex: none; padding: 40px 28px 34px; min-height: auto; }
  .auth-hero h1 { font-size: 1.7rem; }
  .auth-hero .features, .auth-hero .hero-foot { display: none; }
  .auth-form-side { flex: none; padding: 30px 20px 50px; }
}

/* ============================================================
   LIVING BACKGROUND — a gentle, slow gradient drift behind the
   app content. Deliberately near-white and very slow so it feels
   alive without distracting from clinical work. Covered entirely
   on the login pages (they have their own full-screen hero).
   ============================================================ */
body {
  background: linear-gradient(130deg, #eef4f6 0%, #e9f3f1 25%, #f1f1ec 50%, #e9f3f4 75%, #eef4f6 100%);
  background-size: 320% 320%;
  background-attachment: fixed;
  animation: appAurora 44s ease infinite;
}
@keyframes appAurora { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }

/* ============================================================
   v5 — COORDINATED DESIGN SYSTEM (colourful, lively, professional)
   All theme-driven, so the white-label accent (--teal) flows through
   every component. color-mix tints have a solid fallback for older
   browsers. Offline-safe: no external fonts or assets.
   ============================================================ */
:root {
  --teal-2: #0bbfa6;                                   /* bright teal for gradients */
  --surface-tint: color-mix(in srgb, var(--teal) 6%, #ffffff);
  --header-tint:  color-mix(in srgb, var(--teal) 11%, #ffffff);
  --ring: color-mix(in srgb, var(--teal) 24%, transparent);
}
html, body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Topbar — crisp finished edge with a brand→accent underline */
.topbar { border-bottom: 2px solid var(--teal); border-image: linear-gradient(90deg, var(--teal), var(--accent)) 1; }

/* Sidebar — rounded active pills */
.sidebar a { border-radius: 0 20px 20px 0; margin-right: 10px; }

/* Section titles — a coordinated accent bar (app content only, not auth) */
.container h1 { padding-left: 14px; border-left: 5px solid var(--teal); border-radius: 2px; line-height: 1.22; }

/* Inputs — unified radius + themed focus ring */
input, select, textarea { border-radius: 9px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--ring); }

/* Ghost button variant */
button.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); box-shadow: none; }
button.btn.ghost:hover { background: var(--teal-light); filter: none; transform: translateY(-1px); }

/* TABLES — premium, coordinated, scannable */
.container table { border-collapse: separate; border-spacing: 0; }
.container thead th {
  background: #eef5f4; background: var(--header-tint);
  color: var(--navy); position: sticky; top: 56px; z-index: 1;
  border-bottom: 2px solid #cfe3df; border-bottom-color: color-mix(in srgb, var(--teal) 32%, var(--border));
}
.container thead th:first-child { border-top-left-radius: 10px; }
.container thead th:last-child { border-top-right-radius: 10px; }
.container tbody td { border-bottom: 1px solid var(--border); }
.container tbody tr:nth-child(even) td { background: #f7fbfa; background: var(--surface-tint); }
.container tbody tr:hover td { background: var(--accent-soft); }
.container tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.container tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }

/* STAT CARDS — vivid, tinted, bigger numbers */
.statCard { background: #fff; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--teal) 4%, #fff)); }
.statCard::before { width: 5px; background: linear-gradient(var(--teal), var(--teal-2)); }
.statCard.warn::before { background: linear-gradient(#f6b43f, var(--warn)); }
.statCard.danger::before { background: linear-gradient(#e85d4a, var(--danger)); }
.statCard.ok::before { background: linear-gradient(#36c17a, var(--ok)); }
.statCard .statValue { font-size: 1.9rem; }

/* Badges default + variants */
.badge { background: var(--teal-light); color: var(--teal); }
.badge.info { background: #eaf2f8; color: var(--navy); }

/* App links */
.container a { color: var(--teal); }

/* Themed scrollbars (webkit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #b9c7cd; background: color-mix(in srgb, var(--teal) 38%, #b9c7cd); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--teal); background-clip: content-box; }

/* EXPORT / PRINT toolbar injected above data tables */
.tableTools { display: flex; gap: 8px; justify-content: flex-end; margin: 0 0 8px; flex-wrap: wrap; }
.tblBtn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #fff; border: 1px solid var(--border); color: var(--navy);
  font-size: 0.76rem; font-weight: 700; padding: 5px 12px; border-radius: 8px; transition: all .14s;
}
.tblBtn:hover { border-color: var(--teal); color: var(--teal); box-shadow: 0 2px 8px rgba(15,138,127,0.16); transform: translateY(-1px); }

/* PRINT / SAVE-AS-PDF — clean, chrome-free output */
@media print {
  .topbar, .sidebar, .sidebarOverlay, .tableTools, .offline-banner, #licenseBanner, .topPopup, button, .btn { display: none !important; }
  .container { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; animation: none !important; }
  .card { box-shadow: none !important; border: 1px solid #cbd5d9 !important; break-inside: avoid; }
  .container h1 { border-left: none; padding-left: 0; -webkit-text-fill-color: #10344c; color: #10344c; }
  .container thead th { position: static !important; background: #eef5f4 !important; }
  a { color: #000 !important; text-decoration: none !important; }
  @page { margin: 14mm; }
}
