/* SMART — the platform owner's panel, in SMART's own identity (not a clinic's brand). */
:root {
  /* SMART identity */
  --sd-ink: #0B1B2B; --sd-primary: #0E9F8E; --sd-primary-hover: #0B7F72; --sd-primary-soft: #E3F6F2; --sd-accent: #FFB547;
  --sd-bg: #F6F8F7; --sd-surface: #FFFFFF; --sd-line: #E3E9E7; --sd-muted: #5B6B73;
  --bg: var(--sd-bg); --panel: var(--sd-surface); --line: var(--sd-line); --soft: #EEF3F1; --ink: var(--sd-ink); --muted: var(--sd-muted); --faint: #84949B;
  --accent: var(--sd-primary); --accent-deep: var(--sd-primary-hover); --accent-light: var(--sd-primary-soft); --warm: var(--sd-accent); --warm-l: #FFF1DA; --warm-ink: #8A5A00;
  --green: #22a06b; --green-l: #e3f5ec; --amber: #c98a12; --amber-l: #fbf1dc; --red: #d94848; --red-l: #fbe7e7; --violet: #7b5cd6; --violet-l: #efeafd; --teal: #D9577A; --teal-l: #FCE8EE;
  --radius: 16px; --shadow: 0 10px 30px -18px rgba(11, 27, 43, .35);
  --font: "Readex Pro", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
:focus-visible { outline: 3px solid rgba(14, 159, 142, .4); outline-offset: 2px; }
i[data-ico] { display: inline-grid; width: 18px; height: 18px; flex: none; }
i[data-ico] svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* buttons and fields (as in the clinic dashboard) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .2s, transform .15s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent-deep); color: #fff; }
.btn-primary:hover { background: #096A5F; }
.btn-soft { background: var(--accent-light); color: var(--accent-deep); }
.btn-soft:hover { background: #CDEDE6; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--soft); color: var(--ink); }
.btn-line { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-line:hover { box-shadow: inset 0 0 0 1px #C6D3CF; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #1b8a5b; }
.btn-red { background: var(--red-l); color: var(--red); }
.btn-red:hover { background: #f6d6d6; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn-xs i[data-ico] { width: 15px; height: 15px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
input, select, textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px var(--accent-light); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-deep); flex: none; margin: 0; }
input[dir=ltr], .ltr-in { text-align: left; direction: ltr; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; align-content: start; min-width: 0; }
label small { font-weight: 400; color: var(--faint); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; cursor: pointer; }
.form-error { color: var(--red); min-height: 1.4em; font-size: 13px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-light); border-top-color: var(--accent-deep); animation: spin .8s linear infinite; display: inline-block; }
.btn .spin { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; }

.mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #2CC4A8, var(--accent) 55%, var(--accent-deep)); color: #fff; flex: none; }
.mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mark.lg { width: 56px; height: 56px; border-radius: 16px; margin-inline: auto; box-shadow: 0 14px 30px -14px rgba(11, 127, 114, .9); }
.mark.lg svg { width: 30px; height: 30px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 500px at 80% 0%, #DDF3EE, transparent), radial-gradient(600px 400px at 0% 100%, #e3f5ec, transparent), var(--bg); }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 24px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center; }
.login-card h1 { font-size: 22px; }
.login-card p { color: var(--muted); }
.login-card label { text-align: start; }
.muted-link { color: var(--muted); font-size: 13px; }
.muted-link:hover { color: var(--accent-deep); }

/* shell */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--ink); color: rgba(255, 255, 255, .78); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: #fff; }
.side-brand b { display: block; font-weight: 700; letter-spacing: .12em; direction: ltr; text-align: right; }
.side-brand small { display: block; color: #8FD9CB; font-size: 12px; }
.side-nav { display: grid; gap: 3px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; transition: background-color .2s, color .2s; white-space: nowrap; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.on { background: var(--accent-deep); color: #fff; }
.badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--warm); color: var(--ink); font-weight: 600; font-size: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.badge:empty { display: none; }
.badge-red { background: var(--red); color: #fff; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.side-foot .grow { flex: 1; min-width: 0; }
.side-foot b { display: block; color: #fff; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot small { display: block; font-size: 11.5px; color: #87A0A6; direction: ltr; text-align: right; }
.side-foot .icon-btn { color: #8FD9CB; }
.side-foot .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; background: var(--accent-light); color: var(--accent-deep); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 66px; background: rgba(246, 248, 247, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-title { min-width: 0; }
.top-title h1 { font-size: 19px; }
.top-title p { color: var(--muted); font-size: 12.5px; }
.top-title p:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; justify-content: flex-end; }
.logout-sm { display: none; }
.view { padding: 22px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; outline: none; }

/* panels and grids */
.panel { background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel-head h2 .count { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 0 8px; font-weight: 500; }
.panel-head a { color: var(--accent-deep); font-size: 13px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .panel-head { padding: 16px 18px 0; }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.g-side { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 2px; position: relative; overflow: hidden; min-width: 0; }
.kpi .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; background: var(--accent-light); color: var(--accent-deep); }
.kpi small { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b em { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.kpi span { font-size: 12px; color: var(--faint); }
.kpi.c-green .ico { background: var(--green-l); color: var(--green); }
.kpi.c-amber .ico { background: var(--amber-l); color: var(--amber); }
.kpi.c-red .ico { background: var(--red-l); color: var(--red); }
.kpi.c-violet .ico { background: var(--violet-l); color: var(--violet); }
.kpi.c-teal .ico { background: var(--teal-l); color: var(--teal); }
.kpi.hero { background: linear-gradient(135deg, var(--accent-deep), var(--accent)); color: #fff; border: 0; }
.kpi.hero small, .kpi.hero span, .kpi.hero b em { color: #D5F2EC; }
.kpi.hero .ico { background: rgba(255, 255, 255, .16); color: #fff; }
.empty { color: var(--faint); text-align: center; padding: 22px 8px; font-size: 13.5px; display: grid; gap: 6px; justify-items: center; }
.empty i[data-ico] { width: 28px; height: 28px; color: #C0CCC8; }

/* lists */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
a.row:hover, .row.link:hover { background: var(--soft); border-radius: 10px; cursor: pointer; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .grow small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.row .end { text-align: end; font-size: 12.5px; color: var(--muted); flex: none; }
.ava { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 600; background: var(--accent-light); color: var(--accent-deep); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 500; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip i[data-ico] { width: 14px; height: 14px; }
.chip.s-trial { background: var(--violet-l); color: var(--violet); }
.chip.s-active, .chip.s-paid, .chip.ok { background: var(--green-l); color: var(--green); }
.chip.s-suspended, .chip.s-open, .chip.warn { background: var(--amber-l); color: var(--amber); }
.chip.s-cancelled, .chip.s-void { background: #F0F3F2; color: var(--faint); }
.chip.st-due { background: var(--amber-l); color: var(--amber); }
.chip.st-locked, .chip.bad { background: var(--red-l); color: var(--red); }
.chip.info { background: var(--accent-light); color: var(--accent-deep); }
.chip.legacy { background: var(--teal-l); color: var(--teal); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }

/* toolbar, tabs */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; display: block; }
.toolbar .search i { position: absolute; top: 11px; right: 12px; color: var(--faint); }
.toolbar .search input { padding-inline-start: 38px; }
.toolbar .grow { flex: 1; }
.tabs { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button b { font-weight: 500; font-size: 11.5px; background: var(--soft); border-radius: 6px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.tabs button.on { background: var(--accent-deep); color: #fff; }
.tabs button.on b { background: rgba(255, 255, 255, .2); }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FBFCFC; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--soft); }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.nowrap { white-space: nowrap; }
.table td .sub { display: block; color: var(--muted); font-size: 12px; }
.table td b { font-weight: 500; }
.table tfoot td { font-weight: 600; background: #FBFCFC; border-top: 1px solid var(--line); border-bottom: 0; }
.table .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.table.compact td { padding: 8px 10px; font-size: 13px; }
.slug { white-space: nowrap; direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); }
.meter { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; min-width: 60px; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.warn span { background: var(--amber); } .meter.bad span { background: var(--red); }
.seat-cell { display: grid; gap: 4px; min-width: 80px; }

/* forms */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.form-actions .form-error { margin-inline-end: auto; }
.section-label { font-size: 12px; color: var(--faint); font-weight: 600; letter-spacing: .02em; grid-column: 1 / -1; padding-top: 6px; border-top: 1px dashed var(--line); }
.feat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.feat-grid .check { font-size: 13px; }
.feat-grid .check code { font-size: 11px; color: var(--faint); direction: ltr; }
.switch { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: #CCD7D3; transition: background-color .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 3px solid rgba(14, 159, 142, .4); outline-offset: 2px; }

/* clinic detail */
.c-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.c-head .ava { width: 54px; height: 54px; border-radius: 16px; font-size: 22px; }
.c-head .grow { flex: 1; min-width: 200px; display: grid; gap: 4px; }
.c-head h2 { font-size: 20px; }
.c-head .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.c-head .meta a { color: var(--accent-deep); }
.c-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.usage { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.usage > div { padding: 12px 14px; border-inline-start: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.usage > div:first-child { border-inline-start: 0; }
.usage small { color: var(--muted); font-size: 12px; }
.usage b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage span { font-size: 11.5px; color: var(--faint); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.back:hover { color: var(--accent-deep); }
.back i[data-ico] { width: 16px; height: 16px; }
.note { background: var(--amber-l); color: #7a5208; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.note.info { background: var(--accent-light); color: var(--accent-deep); }

/* chart */
.chart { width: 100%; height: 200px; display: block; }
.chart .bar { fill: var(--accent); transition: fill .2s; }
.chart .bar:hover { fill: var(--accent-deep); }
.chart .bar.zero { fill: var(--soft); }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart text.v { fill: var(--ink); font-weight: 600; font-size: 12px; }
.chart line { stroke: var(--line); }

/* plans */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 12px; align-content: start; }
.plan-card.off { opacity: .65; background: #FAFBFB; }
.plan-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-card h3 { font-size: 17px; }
.plan-card .price b { font-size: 24px; font-variant-numeric: tabular-nums; }
.plan-card .price span { color: var(--muted); font-size: 13px; }
.plan-card .facts { display: flex; gap: 6px; flex-wrap: wrap; }
.feats { display: flex; flex-wrap: wrap; gap: 6px; }

/* announcements */
.ann { display: flex; gap: 12px; align-items: flex-start; padding: 14px 4px; border-top: 1px solid var(--line); }
.ann:first-child { border-top: 0; }
.ann .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-light); color: var(--accent-deep); flex: none; }
.ann.warn .ico { background: var(--amber-l); color: var(--amber); }
.ann .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ann .grow p { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.ann.off .grow { opacity: .55; }
.ann-preview { border-radius: 12px; padding: 12px 14px; background: var(--accent-light); color: var(--accent-deep); display: grid; gap: 2px; font-size: 13px; }
.ann-preview.warn { background: var(--amber-l); color: #7a5208; }

/* health */
.disk { display: grid; gap: 8px; }
.disk .meter { height: 12px; border-radius: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* audit */
.audit-detail { font-size: 12px; color: var(--muted); max-width: 420px; overflow-wrap: anywhere; display: block; }
.act { font-weight: 500; }
.act code { font-size: 11px; color: var(--faint); direction: ltr; unicode-bidi: isolate; margin-inline-start: 4px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(11, 27, 43, .42); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s ease; }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 20px; padding: 22px; display: grid; gap: 14px; box-shadow: 0 30px 60px -30px rgba(11, 27, 43, .6); animation: pop .25s cubic-bezier(.2, .7, .1, 1); }
.modal-card.wide { width: min(720px, 100%); }
.modal-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-card h2 { font-size: 18px; }
.modal-card .lead { color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.modal-actions .form-error { margin-inline-end: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* toasts */
.toasts { position: fixed; z-index: 90; bottom: 20px; left: 20px; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6); animation: toastIn .35s cubic-bezier(.2, .7, .1, 1); }
.toast.err { background: var(--red); }
.toast.ok i[data-ico] { color: #6fe0a6; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } }

/* skeleton while a view loads */
.skel { border-radius: var(--radius); background: linear-gradient(100deg, #fff 30%, #F1F5F3 50%, #fff 70%); background-size: 300% 100%; animation: shimmer 1.3s linear infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -150% 0; } }
.err-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; display: grid; gap: 12px; justify-items: center; color: var(--muted); }

/* printable invoice */
.print-area { position: fixed; inset: 0; z-index: 85; background: rgba(11, 27, 43, .55); overflow-y: auto; padding: 24px 16px; }
.print-bar { width: min(800px, 100%); margin: 0 auto 12px; display: flex; gap: 8px; justify-content: flex-end; }
.sheet { width: min(800px, 100%); margin: 0 auto; background: #fff; border-radius: 12px; padding: 44px 48px; color: var(--ink); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); display: grid; gap: 26px; }
.sheet .s-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.sheet .s-brand { display: flex; gap: 12px; align-items: center; }
.sheet .s-brand b { font-size: 20px; direction: ltr; }
.sheet .s-brand small { display: block; color: var(--muted); }
.sheet .s-title { text-align: end; }
.sheet .s-title h2 { font-size: 26px; color: var(--accent-deep); }
.sheet .s-title p { color: var(--muted); font-size: 13px; }
.sheet .s-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.sheet .s-parties div { background: var(--soft); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; font-size: 13.5px; }
.sheet .s-parties small { color: var(--muted); font-size: 12px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px; border-bottom: 2px solid var(--ink); }
.sheet td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
.sheet td.num, .sheet th.num { text-align: end; font-variant-numeric: tabular-nums; }
.sheet .s-total { display: flex; justify-content: flex-end; }
.sheet .s-total div { min-width: 280px; display: grid; gap: 6px; }
.sheet .s-total p { display: flex; justify-content: space-between; gap: 20px; }
.sheet .s-total p.grand { font-size: 19px; font-weight: 700; border-top: 2px solid var(--ink); padding-top: 8px; }
.sheet .s-pay { border: 1px dashed #C6D3CF; border-radius: 12px; padding: 14px 16px; font-size: 13.5px; display: grid; gap: 6px; }
.sheet .s-pay h4 { font-size: 14px; }
.sheet .s-pay p { white-space: pre-wrap; color: #3A4A52; }
.sheet .stamp { display: inline-block; border: 3px solid currentColor; border-radius: 10px; padding: 4px 14px; font-weight: 700; font-size: 18px; transform: rotate(-6deg); }
.sheet .stamp.s-paid { color: var(--green); } .sheet .stamp.s-open { color: var(--amber); } .sheet .stamp.s-void { color: var(--red); }
.sheet footer { color: var(--faint); font-size: 12px; text-align: center; }

/* ---------- tablet: the sidebar becomes a top bar ---------- */
@media (max-width: 1180px) {
  .kpis { gap: 10px; }
  .kpi { padding: 14px 12px; }
  .kpi b { font-size: 20px; }
  .kpi span { font-size: 11.5px; }
  .g-side { grid-template-columns: 1fr; }
  .usage { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .usage > div:nth-child(4) { border-inline-start: 0; }
  .usage > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side, .main { min-width: 0; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; }
  .side-brand { padding: 0; }
  .side-brand > span:last-child { display: none; }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(to left, #000 90%, transparent); mask-image: linear-gradient(to left, #000 90%, transparent); padding-inline-end: 20px; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { padding: 8px 12px; gap: 8px; flex: none; font-size: 13.5px; }
  .side-nav a .badge { margin-inline-start: 2px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .side-foot { display: none; }
  .top { top: 56px; padding: 10px 16px; min-height: 0; }
  .logout-sm { display: grid; }
  .site-link span { display: none; }
  .view { padding: 16px 16px 40px; }
  .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .kpis { gap: 10px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 19px; }
  .kpi .ico { width: 32px; height: 32px; margin-bottom: 4px; }
  .fields, .fields.three, .feat-grid { grid-template-columns: 1fr; }
  .usage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage > div:nth-child(odd) { border-inline-start: 0; }
  .usage > div:nth-child(4) { border-inline-start: 1px solid var(--line); }
  .usage > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .top { flex-wrap: wrap; }
  .top-actions { order: 3; width: 100%; justify-content: flex-start; }
  .toolbar .search { max-width: none; min-width: 100%; }
  .sheet { padding: 24px 18px; }
  .sheet .s-head, .sheet .s-parties { grid-template-columns: 1fr; display: grid; }
  .sheet .s-title { text-align: start; }
  .modal { padding: 10px; align-items: end; }
  .modal-card { max-height: calc(100vh - 20px); border-radius: 20px 20px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print: only the invoice sheet ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { position: static; background: none; padding: 0; overflow: visible; display: block !important; }
  .print-bar { display: none; }
  .sheet { box-shadow: none; border-radius: 0; padding: 0; width: 100%; }
  .sheet .s-parties div, .sheet .s-pay { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.mark { position: relative; }
.mark::after { content: ""; position: absolute; top: 5px; left: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.mark.lg::after { top: 8px; left: 8px; width: 9px; height: 9px; }
.clinics-tbl td:first-child { min-width: 230px; }
.clinics-tbl td:first-child b { display: inline; }

/* security */
.sec-box h3 { font-size: 15px; margin: 0 0 6px; }
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dev-list { display: grid; gap: 8px; }
.dev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.dev small { flex-basis: 100%; }
.bk-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bk-codes code, .bk-secret { font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .04em; background: var(--soft); border-radius: 8px; padding: 8px 10px; text-align: center; }
@media (max-width: 760px) { .sec-grid { grid-template-columns: 1fr; } }
