/* Clinic EMR — "Teal Glass" design (version 2). No CDNs: fonts are served from /fonts (SIL Open Font License). */
@font-face { font-family: 'Battambang'; src: url('/fonts/Battambang-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Moul'; src: url('/fonts/Moul-Khmer.woff2') format('woff2'); unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC; font-display: swap; }
@font-face { font-family: 'Moul'; src: url('/fonts/Moul-Latin.woff2') format('woff2'); unicode-range: U+0000-00FF; font-display: swap; }

:root {
  --font: 'Battambang', 'Noto Sans Khmer', 'Khmer OS Siemreap', 'Khmer UI', 'Segoe UI', system-ui, sans-serif;
  --font-title: 'Moul', 'Khmer OS Muol Light', serif;
  --bg: #eaf6f6; --card: rgba(255, 255, 255, .84); --card-solid: #fff; --text: #17394a; --muted: #5d7684; --line: #d3e6ee;
  --primary: #0890b0; --primary-dark: #056f8a; --primary-soft: #e3f5f9; --navy: #0d3b8e; --red: #d32f2f;
  --success: #1f8a4c; --danger: #c62828; --warn: #e07b00;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 10px 28px rgba(20, 90, 120, .08);
  --sidebar-w: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--text);
  background: radial-gradient(1100px 620px at 0% 0%, #d4f0e9 0%, transparent 62%),
              radial-gradient(1000px 620px at 100% 100%, #d3e9f7 0%, transparent 62%),
              linear-gradient(135deg, #eaf7f6 0%, #eaf3f9 100%) fixed;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.5; }
h3 { font-size: 1.04rem; color: var(--primary-dark); } h4 { font-size: .95rem; }
.boot { padding: 2rem; }
.muted { color: var(--muted); }
.block { display: block; }
.mt { margin-top: .5rem; } .mb { margin-bottom: .9rem; }
.pre { white-space: pre-wrap; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.error { color: var(--danger); min-height: 1.2em; }
.notice { background: #fff8e1; border: 1px solid #ffe082; padding: .5rem .75rem; border-radius: var(--radius-sm); }
.ok-box { background: #e8f5e9; border: 1px solid #a5d6a7; padding: .5rem .75rem; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.moul { font-family: var(--font-title); font-weight: 400; }
svg[aria-hidden="true"] { width: 1.2em; height: 1.2em; vertical-align: -0.22em; flex: none; }

/* ---------------------------------------------------------------- inputs & buttons */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: .42rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255,255,255,.95); min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid #19b6cf; outline-offset: 0; border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled { background: #f3f7f9; color: #3d5562; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .42rem .95rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; white-space: nowrap; color: var(--text);
  transition: background .12s, box-shadow .12s;
}
.btn:hover:not(:disabled) { background: var(--primary-soft); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(180deg, #0aa1c2, var(--primary)); border-color: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(8, 144, 176, .25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: linear-gradient(180deg, #27a35d, var(--success)); border-color: var(--success); color: #fff; box-shadow: 0 3px 10px rgba(31, 138, 76, .25); }
.btn-success:hover:not(:disabled) { background: #176b3a; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-outline { color: var(--danger); border-color: #ef9a9a; }
.btn-ghost { background: transparent; border-color: transparent; color: inherit; }
.btn-small { padding: .12rem .55rem; font-size: .86rem; }
.btn-lg { padding: .55rem 1.35rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { border: none; background: none; cursor: pointer; font-size: 1.2rem; line-height: 1; padding: .25rem .4rem; border-radius: 6px; color: inherit; }
.btn-icon:hover { background: #e8f2f6; }
.btn-icon.danger { color: var(--danger); }
.btn-icon svg { width: 18px; height: 18px; vertical-align: middle; }
.check { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; white-space: nowrap; }

.field { display: flex; flex-direction: column; gap: .12rem; }
.field-label { font-size: .84rem; color: var(--muted); }
.hint { color: var(--muted); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem .9rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
@media (max-width: 1200px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- shell: sidebar + workspace */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .4rem; padding: .9rem .7rem;
  background: linear-gradient(180deg, #0aa7c6 0%, #0689a8 62%, #057a97 100%); color: #f2fcff; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .3rem .8rem; border-bottom: 1px solid rgba(255,255,255,.25); margin-bottom: .4rem; }
.brand-mark { width: 50px; height: 50px; flex: none; border-radius: 14px; background: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0, 55, 74, .2); }
.brand-mark img { width: 40px; height: 40px; object-fit: contain; }
.brand-name { font-family: var(--font-title); font-size: .78rem; line-height: 1.9; color: #fff; }
.brand-name small { display: block; font-family: var(--font); font-size: .72rem; opacity: .9; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; color: #f2fcff; text-decoration: none; white-space: nowrap;
}
.nav a svg { width: 21px; height: 21px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.16); }
.nav a.active { background: #fff; color: #05708a; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 55, 74, .18); }
.nav .badge-count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .74rem; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.nav a.active .badge-count { background: var(--red); }
.side-foot { border-top: 1px solid rgba(255,255,255,.25); padding-top: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.side-user { display: flex; align-items: center; gap: .55rem; padding: .2rem .3rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #05708a; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-user .who { line-height: 1.35; min-width: 0; }
.side-user .who small { display: block; opacity: .85; }
.side-btn { display: flex; align-items: center; gap: .6rem; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: .35rem .6rem; border-radius: 9px; cursor: pointer; }
.side-btn:hover { background: rgba(255,255,255,.26); }
.side-btn.logout:hover { background: var(--red); border-color: var(--red); }
.side-btn svg { width: 18px; height: 18px; flex: none; }
/* Auto-hide menu: a 72px icon bar that opens over the page while the mouse is on it ("fold" closes it after a click). */
.workspace { grid-column: 2; }
.side-btn { white-space: nowrap; }
.shell.auto { --sidebar-w: 72px; }
.shell.auto .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 72px; overflow-x: hidden; transition: width .18s ease, box-shadow .18s ease; }
.shell.auto .sidebar:hover:not(.fold) { width: 236px; box-shadow: 10px 0 34px rgba(0, 45, 65, .28); }
.shell.auto .brand { padding-left: 0; padding-right: 0; }
.shell.auto .brand-mark { width: 46px; height: 46px; }
.shell.auto .brand-name { flex: none; width: 160px; }
.shell.auto .sidebar :is(.brand-name, .nav a span, .side-user .who, .side-btn span, .nav .badge-count) { opacity: 0; transition: opacity .12s ease; white-space: nowrap; }
.shell.auto .sidebar:hover:not(.fold) :is(.brand-name, .nav a span, .side-user .who, .side-btn span, .nav .badge-count) { opacity: 1; }
.shell.auto .sidebar:hover:not(.fold) .brand-name { white-space: normal; }
/* Full-page medical record: no menu at all. */
.shell.focus { grid-template-columns: 1fr; }
.shell.focus .sidebar { display: none; }
.shell.focus .workspace { grid-column: 1; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .55rem 1.2rem;
  background: rgba(255,255,255,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.9); box-shadow: 0 4px 18px rgba(20, 90, 120, .06);
}
.topbar h1 { font-size: 1.15rem; color: var(--primary-dark); }
.topbar .spacer { flex: 1; }
.topbar .chip-info { background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: .1rem .7rem; font-size: .85rem; white-space: nowrap; }
main { padding: 1rem 1.2rem 0; max-width: 1760px; width: 100%; margin: 0 auto; }

.card {
  background: var(--card); border: 1px solid rgba(255,255,255,.95); border-radius: var(--radius); padding: .9rem 1.05rem; margin-bottom: .9rem;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: .45rem; }
.card-head h3 svg { width: 19px; height: 19px; color: var(--primary); }
.subhead { display: flex; align-items: center; gap: 1rem; margin: .9rem 0 .4rem; flex-wrap: wrap; }
.placeholder, .empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state img { width: 110px; opacity: .9; margin-bottom: .5rem; }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card {
  background: rgba(255,255,255,.88); padding: 1.6rem 1.7rem; border-radius: 22px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 50px rgba(20, 90, 120, .16); border: 1px solid #fff; display: flex; flex-direction: column; gap: .75rem;
}
.login-logo { text-align: center; }
.login-logo img { width: 100%; max-width: 300px; }
.login-card h1 { font-size: 1.15rem; text-align: center; font-family: var(--font-title); font-weight: 400; color: var(--navy); line-height: 2; }
.lang-btn { font-weight: 600; }

/* ---------------------------------------------------------------- OPD */
.opd { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 980px) { .opd { grid-template-columns: 1fr; } }
.opd-side { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow: auto; }
.result-list, .today-list, .dropdown { list-style: none; margin: .5rem 0 0; padding: 0; }
.result-list li, .today-list li { border-bottom: 1px solid #e6f0f4; }
.result { display: block; width: 100%; text-align: left; border: none; background: none; padding: .45rem .35rem; cursor: pointer; border-radius: 8px; color: inherit; }
.result:hover { background: var(--primary-soft); }
.today-list li.current { background: #d9f1f7; border-radius: 8px; }

.patient-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: rgba(255,255,255,.92); border: 1px solid #fff; border-left: 5px solid var(--primary); border-radius: var(--radius);
  padding: .55rem 1rem; margin-bottom: .9rem; position: sticky; top: 3.6rem; z-index: 10; box-shadow: var(--shadow);
}
.banner-left { display: flex; align-items: center; gap: .8rem; }
.banner-photo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: #e3eef3; flex: none; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.banner-name { font-size: 1.2rem; font-weight: 700; margin-right: .75rem; color: var(--navy); }
.allergy-alert { color: var(--danger); font-weight: 600; }
.allergy-ok { color: var(--success); }
.allergy-unknown { color: var(--warn); }
.chip { display: inline-block; padding: 0 .5rem; margin: 0 .15rem; border-radius: 999px; background: #ffebee; border: 1px solid #ef9a9a; font-weight: 500; }
.chip-severe { background: var(--danger); color: #fff; }
.allergy-row input { flex: 2; } .allergy-row select { flex: 1; max-width: 150px; }
.allergy-row, .dx-row { flex-wrap: nowrap; margin-bottom: .35rem; }
.rows { margin-bottom: .3rem; }
details.more { margin-top: .6rem; }
details.more summary { cursor: pointer; color: var(--primary); }
details.more[open] summary { margin-bottom: .5rem; }
.photo-box { display: flex; align-items: center; gap: .7rem; }
.photo-box img, .photo-box .ph { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; background: #e3eef3; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); }
.addr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
@media (max-width: 1300px) { .addr-grid { grid-template-columns: repeat(2, 1fr); } }

.visit-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .55rem 1rem; border-radius: var(--radius); margin-bottom: .9rem; background: #dff3f8; border: 1px solid #fff; }
.visit-header.status-completed { background: #e3f4e8; }
.visit-header.status-cancelled { background: #fbe9e7; }
.visit-header .full { flex-basis: 100%; }
.badge { display: inline-block; padding: 0 .55rem; border-radius: 999px; font-size: .8rem; background: #e0e7eb; }
.badge-open, .badge-ordered { background: #cdeef6; color: #05617a; }
.badge-completed, .badge-reported { background: #c8e6c9; color: #1b5e20; }
.badge-cancelled { background: #ffcdd2; color: #b71c1c; }

.vitals { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
.bp input { width: 4.5rem; }
.bmi { font-weight: 600; padding: .4rem 0; }
input.abnormal { border-color: #e57373; background: #fff3f3; color: var(--danger); font-weight: 600; }
.dob-row input[type=date] { flex: 1; min-width: 0; }
.w-age { width: 4.2rem; flex: none; } .w-icd { width: 6.5rem; flex: none; } .w-qty { width: 4.6rem; } .w-dose { width: 4.2rem; } .w-str { width: 6.5rem; }
.dx-row .check { font-size: .85rem; }

.soap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .9rem; }
@media (max-width: 1300px) { .soap-grid { grid-template-columns: 1fr; } }
.soap-label { display: flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--primary-dark); }
.soap-letter { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.soap-S { background: #0890b0; } .soap-O { background: #1f8a4c; } .soap-A { background: #e07b00; } .soap-P { background: #6a3fb5; }
.tpl-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.tpl-bar select { max-width: 360px; }

.picker { position: relative; }
.med-picker { position: relative; max-width: 620px; margin-bottom: .6rem; }
.dropdown { position: absolute; z-index: 40; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgba(0,0,0,.14); max-height: 360px; overflow: auto; }
.dropdown li { border-bottom: 1px solid #eef3f6; padding: 0 .2rem; }
.dropdown .code { display: inline-block; min-width: 4.5rem; font-weight: 700; color: var(--primary-dark); }
.stock { font-size: .8rem; padding: 0 .4rem; border-radius: 5px; white-space: nowrap; display: inline-block; }
.stock-ok { background: #e8f5e9; color: #1b5e20; }
.stock-low { background: #fff3e0; color: #e65100; }
.stock-out { background: #ffebee; color: #b71c1c; }
.stock-outside { background: #ede7f6; color: #4527a0; }
.rx-table td { vertical-align: top; }
.rx-table td.instr { min-width: 190px; }
.rx-table select { min-width: 7.5rem; }
tr.locked { background: #f4f7f8; }
tr.outside-row td:first-child { border-left: 3px solid #7e57c2; }
.src-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: .78rem; margin-top: .2rem; }
.src-toggle button { border: none; background: #fff; padding: .05rem .45rem; cursor: pointer; white-space: nowrap; }
.src-toggle button.on { background: var(--primary); color: #fff; }
.src-toggle button.on.outside { background: #7e57c2; }

.order-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.order-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .35rem .15rem .65rem; border-radius: 999px; background: var(--primary-soft); border: 1px solid #b9e3ee; }
.order-chip .x { border: none; background: none; cursor: pointer; color: var(--danger); font-size: 1.05rem; line-height: 1; }
.panel-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .8rem; max-height: 340px; overflow: auto; padding: .3rem; }
.panel-picker h5 { grid-column: 1 / -1; margin: .5rem 0 .1rem; color: var(--primary-dark); font-size: .9rem; }
.flag-H, .flag-L, .flag-A { color: var(--danger); font-weight: 700; }
.result-table td.val { font-weight: 600; }

.action-bar {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: .6rem 1.2rem; margin: 0 -1.2rem; z-index: 15;
}
.save-indicator { color: var(--warn); font-size: 1.3rem; visibility: hidden; }
.save-indicator.show { visibility: visible; }

.visit-view .kv { display: grid; grid-template-columns: 180px 1fr; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid #eef3f6; }
.visit-view .k { color: var(--muted); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .38rem .5rem; border-bottom: 1px solid #e3edf2; text-align: left; vertical-align: middle; }
.table th { font-size: .84rem; color: var(--muted); font-weight: 600; background: rgba(240, 248, 251, .9); }
.table th.num, .table td.num { text-align: right; }
.table tfoot td { font-weight: 700; border-bottom: none; }
.table.compact th, .table.compact td { padding: .2rem .4rem; font-size: .9rem; }
.table tr.inactive td { color: #9aa9b0; }
.table td.details { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; max-width: 520px; word-break: break-all; }
.perm-table td:first-child { min-width: 260px; }

/* ---------------------------------------------------------------- settings */
.tabs { display: flex; gap: .25rem; margin-bottom: .75rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tab { border: none; background: none; padding: .45rem .9rem; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); }
.tab.active { border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.sig-preview { max-width: 240px; max-height: 90px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; padding: 4px; }
.range-row { display: grid; grid-template-columns: 110px 90px 90px 110px 110px 36px; gap: .4rem; align-items: center; margin-bottom: .3rem; }

/* ---------------------------------------------------------------- dialogs & toasts */
.modal { border: none; border-radius: 16px; padding: 0; width: min(560px, 95vw); box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.modal-wide { width: min(1000px, 96vw); }
.modal::backdrop { background: rgba(10, 40, 55, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #f3fafc; }
.modal-head h2 { font-size: 1.08rem; color: var(--primary-dark); }
.modal-body { padding: 1rem; max-height: 78vh; overflow: auto; }
.modal-body label { display: flex; flex-direction: column; gap: .25rem; }
.modal-body label.check { flex-direction: row; }
.toasts { position: fixed; right: 1rem; bottom: 4.5rem; display: flex; flex-direction: column; gap: .5rem; z-index: 1000; }
.toast { padding: .6rem 1rem; border-radius: 10px; background: #263238; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.2); max-width: 460px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.cam video { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; }

/* ---------------------------------------------------------------- pharmacy / cashier / lab / ultrasound / reports */
.two-pane { display: grid; grid-template-columns: 330px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 980px) { .two-pane { grid-template-columns: 1fr; } }
.pane-list { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: none; background: #fff; padding: .3rem .8rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--primary); color: #fff; }
.alert-strip { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { padding: .1rem .6rem; border-radius: 999px; background: var(--primary-soft); font-size: .85rem; white-space: nowrap; }
.pill-warn { background: #fff3e0; color: #e65100; }
.pill-danger { background: #ffebee; color: #b71c1c; }
.badge-pending { background: #e0e7eb; }
.badge-partial { background: #fff3e0; color: #e65100; }
.badge-dispensed { background: #c8e6c9; color: #1b5e20; }
small.badge { display: inline-block; margin-top: .2rem; }
.km-instr { color: var(--navy); }
.w-money { width: 8.5rem; } .w-search { max-width: 360px; } input.big { font-size: 1.2rem; font-weight: 600; }
.nowrap { white-space: nowrap; }
.neg { color: var(--danger); } .pos { color: var(--success); }
tr.sub td { background: #f4f9fb; font-weight: 600; }
tr.expired-row td { color: var(--danger); }
tr.refund-row td { color: #8d2a2a; }
tr.void-row td { color: #9aa9b0; text-decoration: line-through; }
tfoot tr.sub td { font-weight: 500; }
tfoot tr.due td { color: var(--danger); font-size: 1.1rem; }
tfoot tr.credit td { color: var(--warn); font-size: 1.1rem; }
.bal { font-weight: 600; font-size: .9rem; }
.bal-due { color: var(--danger); } .bal-credit { color: var(--warn); } .bal-zero { color: var(--success); }
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-left: 5px solid var(--success); }
.session-bar.session-none { border-left-color: var(--warn); background: rgba(255, 250, 240, .9); }
.stats { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat small { color: var(--muted); }
.stat strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.pay-card { border-left: 5px solid var(--success); }
.change { font-size: 1.4rem; color: var(--success); }
.riel { color: var(--navy); font-weight: 600; }
.qr-box { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: center; }
.qr-box .qr { background: #fff; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.qr-box .qr img { width: 100%; display: block; }
.khqr-head { background: #e1232e; color: #fff; font-weight: 700; text-align: center; border-radius: 10px 10px 0 0; padding: .2rem; letter-spacing: .1em; }
.report-bar { align-items: flex-end; }
.report-bar .field { min-width: 150px; }
.report-out .card { overflow: hidden; }
.us-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.us-images figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .35rem; }
.us-images img { width: 100%; height: 120px; object-fit: contain; background: #000; border-radius: 6px; }
.us-images figcaption { font-size: .8rem; }
.ob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem .7rem; }
.calc-out { background: var(--primary-soft); border-radius: 10px; padding: .5rem .8rem; margin-top: .6rem; }

/* ================================================================ PRINT ================================================================ */
#print-area { display: none; }
@page a4 { size: A4 portrait; margin: 11mm 12mm; }
@page a5 { size: A5; margin: 1cm; }
@page receipt { size: 80mm auto; margin: 3mm; }
@page labels { size: 80mm auto; margin: 2mm; }
@page report { size: A4 landscape; margin: 1cm; }
/* ---------- A4 documents (prescription, invoice, lab, ultrasound, letters): used by the printer AND the on-screen preview */
#print-area.print-a4, .a4-sheet { font-size: 10.5pt; line-height: 1.55; color: #000; }
.doc { position: relative; }
.doc + .doc { break-before: page; page-break-before: always; }
.doc-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 6mm; padding-bottom: 2.5mm; border-bottom: 1.6pt solid #0d3b8e; }
.doc-brand { display: flex; align-items: center; gap: 3.5mm; }
.doc-brand img { width: 21mm; height: 25mm; object-fit: contain; }
.doc-brand .nm-km { font-family: var(--font-title); font-size: 13.5pt; color: #0d3b8e; line-height: 1.9; }
.doc-brand .nm-en { font-weight: 700; font-size: 11.5pt; color: #0d3b8e; letter-spacing: .03em; }
.doc-brand .addr { font-size: 8.8pt; color: #222; line-height: 1.5; }
.doc-motto { text-align: center; font-family: var(--font-title); font-size: 10.5pt; line-height: 2.1; color: #000; }
.doc-motto .ornament { font-family: var(--font); font-size: 9pt; letter-spacing: .3em; color: #0d3b8e; }
.doc-title { text-align: center; font-family: var(--font-title); font-size: 15pt; margin: 3.5mm 0 1mm; color: #000; }
.doc-subtitle { text-align: center; font-size: 9.5pt; margin-bottom: 3mm; letter-spacing: .08em; }
.doc-no { position: absolute; right: 0; top: 0; font: 8.5pt Consolas, monospace; }
.doc-info { font-size: 10pt; line-height: 1.75; margin-bottom: 3mm; }
.doc-info .lbl { font-weight: 700; }
.doc-info .gap { display: inline-block; width: 6mm; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6mm; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 10pt; margin: 2mm 0 3mm; }
.doc-table th { border: .8pt solid #000; padding: 1.4mm 1.5mm; text-align: center; font-weight: 700; background: #fff; }
.doc-table td { border: .8pt solid #000; padding: 1.4mm 1.5mm; vertical-align: top; }
.doc-table td.c { text-align: center; white-space: nowrap; }
.doc-table td.r { text-align: right; white-space: nowrap; }
.doc-table .sec td { background: #eef6fa !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-table .flag-H, .doc-table .flag-L, .doc-table .flag-A { font-weight: 700; color: #000; }
.doc-foot { display: grid; grid-template-columns: 1fr 70mm; gap: 6mm; margin-top: 3mm; font-size: 10pt; break-inside: avoid; }
.doc-sign { text-align: center; line-height: 1.7; }
.doc-table.compact th, .doc-table.compact td { padding: .7mm 1.5mm; font-size: 9.5pt; }
.doc-sign .sig-img { height: 16mm; display: flex; align-items: center; justify-content: center; }
.doc-sign .sig-img img { max-height: 18mm; max-width: 55mm; }
.doc-sign .sig-space { height: 14mm; }
.doc-sign .sig-name { font-weight: 700; }
.doc-notice { font-size: 9pt; font-style: italic; }
.doc-box { border: .8pt solid #000; padding: 2mm 3mm; margin: 2mm 0; white-space: pre-wrap; }
.doc-section { margin: 2.5mm 0 1mm; font-weight: 700; text-decoration: underline; }
.doc-text { white-space: pre-wrap; }
.doc-totals { width: 72mm; margin-left: auto; border-collapse: collapse; font-size: 10pt; }
.doc-totals td { padding: 1mm 2mm; border: .8pt solid #000; }
.doc-totals td.r { text-align: right; }
.doc-totals tr.grand td { font-weight: 700; font-size: 11pt; }
.inv-mid { display: grid; grid-template-columns: 1fr 74mm; gap: 6mm; align-items: start; }
.inv-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20mm; margin-top: 8mm; text-align: center; }
.inv-sign .line { border-bottom: .8pt dotted #000; height: 16mm; margin: 0 10mm 1.5mm; }
.us-print-images { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; margin: 2mm 0; }
.us-print-images figure { margin: 0; text-align: center; font-size: 8.5pt; break-inside: avoid; }
.us-print-images img { width: 100%; height: 55mm; object-fit: contain; background: #000; }
.doc-small { font-size: 8.5pt; color: #333; }
.appt-table td, .appt-table th { font-size: 9.5pt; }


/* On-screen A4 preview */
.a4-preview { background: #5f6b72; padding: 14px; border-radius: 8px; max-height: 72vh; overflow: auto; }
.a4-sheet { background: #fff; width: 210mm; min-height: 297mm; padding: 11mm 12mm; margin: 0 auto; box-shadow: 0 4px 18px rgba(0,0,0,.35); box-sizing: border-box; }
.a4-sheet .doc + .doc { margin-top: 11mm; padding-top: 11mm; border-top: 2px dashed #9aa; }
.a4-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; margin-bottom: .7rem; }
.a4-toolbar .grow { flex: 1; }
.a4-badge-draft { color: #b42318; font-weight: 700; }
.modal.modal-a4 { width: min(1000px, 96vw); max-width: 96vw; }

@media print {
  #print-area.print-a4 { page: a4; }
  body { background: #fff !important; font-size: 11pt; color: #000; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  #print-area img { max-width: 100%; }

  /* ---------- legacy small formats */
  #print-area.print-a5 { page: a5; padding: 0 .3cm; }
  #print-area.print-receipt { page: receipt; font-size: 9.5pt; width: 72mm; }
  .r-center { text-align: center; margin-bottom: 2mm; }
  .r-title { font-weight: 700; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 1mm 0; margin: 2mm 0; }
  .r-small { font-size: 8.5pt; }
  .r-table { width: 100%; border-collapse: collapse; margin: 2mm 0; }
  .r-table td { padding: .3mm 0; vertical-align: top; }
  .r-totals { border-top: 1px dashed #000; }
  .r-strong td { font-weight: 700; font-size: 10.5pt; }
  .r-sign { margin-top: 12mm; text-align: center; }
  #print-area.print-labels { page: labels; width: 76mm; }
  .label { border: 1px solid #000; border-radius: 2mm; padding: 2mm; margin-bottom: 2mm; break-inside: avoid; page-break-inside: avoid; }
  .label-clinic { font-size: 8pt; border-bottom: 1px solid #000; margin-bottom: 1mm; }
  .label-patient { font-weight: 700; }
  .label-med { font-size: 10pt; }
  .label-instr { font-size: 13pt; font-weight: 700; margin: 1mm 0; }
  .label-foot { font-size: 7pt; }
  #print-area.print-report { page: report; font-size: 9pt; }
  #print-area.print-report .card { border: none; padding: 0; margin-bottom: 4mm; box-shadow: none; background: #fff; }
  #print-area.print-report table { width: 100%; border-collapse: collapse; }
  #print-area.print-report th, #print-area.print-report td { border: 1px solid #999; padding: 1px 3px; }
}

/* Shown when the running server is older than the program files (restart needed after an update). */
.restart-banner { position: sticky; top: 0; z-index: 1000; background: #b42318; color: #fff; padding: .55rem 1rem; text-align: center; font-size: .95rem; }
@media print { .restart-banner { display: none; } }

/* Lab / ultrasound work list: finished results filter + quick print */
.result-filters { display: grid; gap: .4rem; margin-bottom: .6rem; }
.result-filters input[type=date] { min-width: 0; flex: 1; }
.pane-list .today-list li { position: relative; }
.pane-list .today-list li .quick-print { position: absolute; right: .35rem; top: .35rem; }

/* Khmer ultrasound report: Khmer script needs more line height */
.us-findings { font-size: 10.5pt; line-height: 1.85; }
.ob-table td { font-size: 9.5pt; }
.pane-list .today-list li:has(.quick-print) .result { padding-right: 2.6rem; }

/* ---------------------------------------------------------------- patient list (#/opd) */
.plist-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.plist-search { flex: 1 1 380px; display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 .75rem; }
.plist-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px #bfe9f2; }
.plist-search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.plist-search input { border: none; background: transparent; padding: .6rem 0; font-size: 1.05rem; }
.plist-search input:focus { outline: none; }
.table.plist tr.click-row { cursor: pointer; }
.table.plist tr.click-row:hover td, .table.plist tr.click-row:focus td { background: #e4f5fa; }
.table.plist tr.click-row:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.table.plist td.code { white-space: nowrap; color: var(--primary-dark); font-weight: 600; font-variant-numeric: tabular-nums; }
.table.plist td.addr { max-width: 360px; font-size: .88rem; color: #3f5966; }
.empty-line { padding: 1.5rem; text-align: center; }

/* patient panel (slides in from the right) */
.modal.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(880px, 100vw); max-width: 100vw; border-radius: 18px 0 0 18px; animation: drawer-in .2s ease-out; }
.modal.drawer .modal-body { max-height: calc(100vh - 3.3rem); }
@keyframes drawer-in { from { transform: translateX(48px); opacity: .3; } to { transform: none; opacity: 1; } }
.pp-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .7rem; }
.pp-photo { width: 96px; height: 116px; border-radius: 12px; object-fit: cover; background: #e3eef3; border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--muted); }
.pp-photo svg { width: 42px; height: 42px; }
.pp-name { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); line-height: 1.7; }
.pp-head .kv { display: grid; grid-template-columns: 110px 1fr; gap: .5rem; padding: .15rem 0; }
.pp-head .k { color: var(--muted); }
.pp-actions { margin: .9rem 0 .4rem; gap: .6rem; flex-wrap: wrap; }
.pp-visits { display: flex; flex-direction: column; gap: .45rem; }
.pp-visit { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pp-visit[open] { box-shadow: var(--shadow); border-color: #a9dbe7; }
.pp-visit > summary { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; cursor: pointer; flex-wrap: wrap; list-style: none; }
.pp-visit > summary::-webkit-details-marker { display: none; }
.pp-visit > summary::before { content: '▸'; color: var(--primary); transition: transform .15s; }
.pp-visit[open] > summary::before { transform: rotate(90deg); }
.pp-visit > summary:hover { background: var(--primary-soft); border-radius: 12px; }
.pp-visit.status-cancelled { opacity: .7; }
.pp-date { font-weight: 700; min-width: 6.4rem; }
.pp-dx { flex: 1; min-width: 12rem; }
.pp-visit-body { padding: .3rem .9rem .8rem; border-top: 1px dashed var(--line); }
.badge-today { background: #fff1c2; color: #6d5200; }

/* full-page medical record (#/record) */
.record-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.record-bar h2 { font-size: 1.15rem; color: var(--primary-dark); }


/* ---------------------------------------------------------------- imaging report editor (ultrasound / X-Ray / ECG) */
.mod-tabs { display: flex; width: 100%; }
.mod-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; white-space: nowrap; padding-left: .3rem; padding-right: .3rem; font-size: .9rem; }
.mod-tabs button svg { width: 17px; height: 17px; }
.mod-tabs .count { background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .4rem; min-width: 1.2rem; }
.mod-tag { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: .05rem .45rem; vertical-align: middle; white-space: nowrap; }
.mod-US { background: #dff3f8; color: #05708a; }
.mod-XR { background: #ece7fb; color: #5b3fb0; }
.mod-ECG { background: #fde8ea; color: #b3261e; }
.rep-tools { margin-bottom: .6rem; }
.rep-rows { display: flex; flex-direction: column; gap: .45rem; }
.rep-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: .6rem; align-items: start; padding: .45rem .5rem; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.rep-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px #d4f0f6; }
.rep-label { font-weight: 700; color: var(--primary-dark); border-color: transparent; background: #f3fafc; }
.rep-main { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.rep-pick { font-size: .86rem; color: var(--muted); background: #f7fbfc; }
.rep-text { resize: vertical; min-height: 38px; line-height: 1.7; overflow: hidden; }
.rep-free { line-height: 1.8; }
.rep-detail .card-head .hint { margin: 0; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: .8rem 0 .4rem; z-index: 5; }
.qtc { font-weight: 700; padding: .42rem .2rem; display: block; }
.order-picks { margin-bottom: .5rem; gap: .4rem; }
.order-pick { max-width: 260px; }
.row-actions { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; }
@media (max-width: 900px) { .rep-row { grid-template-columns: 1fr auto; } .rep-row .rep-main { grid-column: 1 / -1; } }

.qr-static { width: 200px; height: 200px; display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 14px; padding: .8rem; color: var(--muted); font-size: .85rem; }
.qr-static svg { width: 54px; height: 54px; color: var(--primary); }
#bank-alerts-btn .count { background: var(--red); color: #fff; border-radius: 999px; font-size: .74rem; padding: 0 .45rem; margin-left: .4rem; }
.tg-card h4 { margin: .4rem 0; }

/* ---------------------------------------------------------------- pay by QR (same look as the old Borkeo EMR) */
.modal.qr-bank-dialog { width: min(92vw, 440px); }
.qr-bank-list { display: grid; gap: .6rem; }
.qr-bank-list button { display: flex; justify-content: space-between; align-items: center; gap: .8rem; min-height: 60px; padding: .6rem 1.1rem; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.qr-bank-list button:hover:not(:disabled) { border-color: var(--primary); background: #f0f9fb; }
.qr-bank-list button:disabled { cursor: not-allowed; opacity: .55; background: #f8fafc; }
.qr-bank-list strong { font-size: 1.15rem; color: #0b3d5c; }
.qr-bank-list small { color: #64748b; font-size: .8rem; }
.modal.khqr-card { width: fit-content; min-width: 340px; max-width: calc(100vw - 16px); }
.modal.khqr-card .modal-body { padding: .6rem .8rem .9rem; max-height: calc(100vh - 4rem); }
/* the clinic's KHQR sticker (img/khqr/khqr-frame.png, 902 x 1280) with the live QR in the frame */
.khqr-sticker { position: relative; container-type: inline-size; width: min(360px, calc((100vh - 260px) * .7047)); aspect-ratio: 902 / 1280; margin: 0 auto; overflow: hidden; border-radius: 12px; box-shadow: 0 6px 20px rgba(15, 23, 42, .15); }
.khqr-frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.khqr-code { position: absolute; left: 28.6%; top: 26.8%; width: 42.9%; height: 30.23%; background: #fff; overflow: hidden; }
.khqr-code img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.khqr-code-static { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; text-align: center; font-size: 3cqw; color: #475569; padding: 4%; }
.khqr-code-static svg { width: 30%; height: auto; color: #c8102e; }
.khqr-center { position: absolute; left: 50.39%; top: 42.58%; width: 7.98%; transform: translate(-50%, -50%); }
.khqr-name, .khqr-amount { position: absolute; left: 4%; right: 4%; transform: translateY(-50%); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: Arial, Helvetica, sans-serif; line-height: 1.1; }
.khqr-name { top: 67.9%; font-size: 5.1cqw; color: #1c3a5c; letter-spacing: .01em; }
.khqr-amount { top: 76.5%; font-size: 7cqw; font-weight: 700; color: #111827; }
.khqr-body { text-align: center; padding-top: .6rem; display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.khqr-meta-line { display: flex; justify-content: center; align-items: center; gap: .5rem; color: #6b7280; font-size: .85rem; }
.khqr-bank { padding: .05rem .7rem; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: .8rem; font-weight: 600; }
.khqr-status { margin: 0; color: #374151; font-size: .9rem; }
/* green "payment received" panel */
.modal.pay-ok { width: min(92vw, 440px); border-top: 5px solid #16a34a; }
.modal.pay-ok .modal-head { border: 0; background: #fff; padding: .4rem .6rem 0; }
.modal.pay-ok .modal-body { text-align: center; padding: .2rem 1.6rem 1.4rem; }
.pay-ok-check { width: 76px; height: 76px; margin: 0 auto .8rem; }
.pay-ok-check svg { width: 100%; height: 100%; display: block; }
.pay-ok-check circle { fill: #16a34a; transform-origin: center; animation: pay-ok-pop .35s ease-out both; }
.pay-ok-check path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: pay-ok-tick .4s .25s ease-out forwards; }
@keyframes pay-ok-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pay-ok-tick { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .pay-ok-check circle, .pay-ok-check path { animation: none; stroke-dashoffset: 0; } }
.pay-ok-title { font-size: 1.05rem; font-weight: 600; color: #15803d; }
.pay-ok-amount { font-size: 2.2rem; font-weight: 700; color: #166534; line-height: 1.5; }
.pay-ok-method { display: inline-block; padding: .15rem .9rem; border-radius: 999px; background: #dcfce7; color: #166534; font-weight: 600; font-size: .9rem; }
.pay-ok-details { margin: 1rem 0 0; padding-top: .3rem; border-top: 1px solid #e2e8f0; text-align: left; }
.pay-ok-details > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
.pay-ok-details dt { color: #64748b; }
.pay-ok-details dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.qr-preview { min-width: 200px; }
.manual-qr-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-top: .4rem; }
.manual-qr { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-top: .5rem; }
.khqr-sticker.khqr-small { width: 230px; margin: 0; }
.qr-wait { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .6rem 0; font-weight: 600; color: var(--primary-dark); }
.spinner { width: 18px; height: 18px; border: 3px solid #cde8ef; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
