/* Clinic ERP Demo — design system.
   The brand colour comes from APP_PRIMARY_COLOR (injected as --primary by the
   layout), so the whole identity can be changed without touching this file. */

:root {
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: color-mix(in srgb, var(--primary) 10%, white);
  --primary-line: color-mix(in srgb, var(--primary) 28%, white);
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #1d2733;
  --ink-2: #4a5866;
  --ink-3: #7a8794;
  --line: #e3e8ed;
  --success: #15803d; --success-bg: #e8f6ed;
  --warning: #b45309; --warning-bg: #fdf3e2;
  --danger: #b91c1c;  --danger-bg: #fdecec;
  --info: #1d4ed8;    --info-bg: #e9effd;
  --neutral-bg: #eef1f4;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar: #12212c;
  --sidebar-ink: #c4d0da;
  --sidebar-w: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.icon { font-family: "Material Symbols Outlined"; font-size: 20px; line-height: 1; font-weight: normal; font-style: normal;
  display: inline-block; vertical-align: middle; font-variation-settings: "FILL" 0, "wght" 400; user-select: none; }

/* ── app shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-ink); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 15px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-ink); opacity: .8; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #7f93a3; margin: 16px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-ink); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .icon { font-size: 19px; }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot button { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--sidebar-ink);
  padding: 8px 6px; font: inherit; cursor: pointer; border-radius: 8px; }
.sidebar-foot button:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; min-height: 60px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title .where { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.topbar .title .where .icon { font-size: 15px; }
.menu-btn { display: none; }
.content { padding: 22px 24px 40px; width: 100%; max-width: 1480px; margin: 0 auto; }
.footer { padding: 14px 24px; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line); text-align: center; }
.demo-ribbon { background: #fff7e6; color: #8a5a00; border-bottom: 1px solid #f3dfb4; font-size: 12px; padding: 5px 24px; text-align: center; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; color: var(--ink); }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.user-chip .who { line-height: 1.2; font-size: 12.5px; }
.user-chip .who small { color: var(--ink-3); display: block; }

/* notifications */
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: none; overflow: hidden; }
.dropdown.open { display: block; }
.dropdown header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif .ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.notif b { display: block; font-size: 13px; }
.notif span { font-size: 12px; color: var(--ink-2); }
.notif-empty { padding: 26px; text-align: center; color: var(--ink-3); }

/* ── building blocks ───────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.stack > * + * { margin-top: 16px; }
.breadcrumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.breadcrumb a { color: var(--ink-3); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .icon { font-size: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn-danger { color: var(--danger); border-color: #f2c9c9; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 36px; padding: 0; border: 0; background: none; }
.btn-icon:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--ink-2); }

/* KPI tiles */
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.kpi .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.kpi .label { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .trend { font-size: 12px; margin-top: 2px; }
.trend.up { color: var(--success); } .trend.down { color: var(--danger); } .trend.flat { color: var(--ink-3); }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel],
select, textarea { width: 100%; height: 38px; padding: 0 11px; border: 1px solid #cfd7df; border-radius: 8px; background: #fff; color: var(--ink);
  font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[readonly] { background: var(--surface-2); }
input:invalid.touched, select:invalid.touched { border-color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; margin: 6px 0 -2px; grid-column: span 12; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters .field label { margin-bottom: 3px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: #fafcfd; }
.table tfoot td { font-weight: 650; background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--ink-3); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.empty { text-align: center; padding: 42px 16px; color: var(--ink-3); }
.empty .icon { font-size: 40px; color: #b7c2cc; display: block; margin: 0 auto 8px; }
.empty b { color: var(--ink-2); display: block; margin-bottom: 4px; }

/* definition lists for view pages */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--ink-3); font-size: 12.5px; }
.dl dd { margin: 0; font-weight: 500; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 12px; font: 600 13px var(--font); color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; } .tab-panel.active { display: block; }
.progress { height: 8px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.alert { padding: 11px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.alert-info { background: var(--info-bg); border-color: #c9d7fa; color: #1e3a8a; }
.alert-warning { background: var(--warning-bg); border-color: #f2d6a8; color: #7c3d06; }
.alert-danger { background: var(--danger-bg); border-color: #f2c9c9; color: #7f1d1d; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal.open { display: flex; }
.modal-card { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-card.wide { max-width: 760px; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }

/* auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #0b1720)); color: #fff;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 30px; line-height: 1.2; margin: 18px 0 10px; }
.auth-side p { color: rgba(255, 255, 255, .82); max-width: 420px; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-side li { display: flex; gap: 10px; align-items: center; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .card-body { padding: 28px; }
.auth-card h1 { margin-bottom: 4px; }
.demo-accounts { margin-top: 16px; font-size: 12.5px; }
.demo-accounts table { width: 100%; border-collapse: collapse; }
.demo-accounts td { padding: 4px 6px; border-bottom: 1px dashed var(--line); }
.demo-accounts button { font-size: 12px; }

/* DataTables / Select2 harmonisation */
div.dt-container { padding: 12px 14px; }
div.dt-container .dt-search input, div.dt-container .dt-length select { height: 34px; width: auto; }
div.dt-container .dt-paging .dt-paging-button.current { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; border-radius: 6px; }
div.dt-container .dt-buttons .dt-button { border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; padding: 5px 10px; }
table.dataTable thead th { background: var(--surface-2); }
.select2-container .select2-selection--single { height: 38px; border: 1px solid #cfd7df; border-radius: 8px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; padding-left: 11px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-dropdown { border-color: #cfd7df; border-radius: 8px; }
.fc { font-size: 13px; }
.fc .fc-button-primary { background: var(--primary); border-color: var(--primary); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: color-mix(in srgb, var(--primary) 75%, black); }

/* ── print ─────────────────────────────────────────────────── */
.print-page { max-width: 820px; margin: 24px auto; background: #fff; padding: 36px 40px; box-shadow: var(--shadow); border-radius: 6px; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; border-bottom: 2px solid var(--primary); padding-bottom: 14px; margin-bottom: 18px; }
.print-head img { width: 46px; height: 46px; }
.print-head .org { display: flex; gap: 12px; align-items: center; }
.print-head .org b { font-size: 18px; display: block; }
.print-toolbar { max-width: 820px; margin: 18px auto 0; display: flex; gap: 8px; justify-content: flex-end; }
.signature { margin-top: 48px; display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.signature div { border-top: 1px solid var(--ink-3); padding-top: 6px; min-width: 180px; text-align: center; }
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .footer, .demo-ribbon, .print-toolbar { display: none !important; }
  .print-page { box-shadow: none; margin: 0; max-width: none; padding: 0; }
  .content { padding: 0; }
  @page { size: A4; margin: 14mm; }
}

/* ── responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .user-chip .who, .hide-sm { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .print-page { padding: 20px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr; }
}
