/* RCRSS Regenexx Forms - theme. Self-hosted fonts, no external requests. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url(/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f1f5f6; --surface: #ffffff; --surface-2: #f7f9fa; --side: #f8fafb; --border: #e3e9ec; --border-strong: #cfd8dc;
  --ink: #16242b; --ink-2: #4b5d66; --ink-3: #8497a1;
  --accent: #0f9488; --accent-ink: #ffffff; --accent-soft: #e0f3ef; --accent-text: #0b7a70;
  --tile-grad: linear-gradient(135deg, #0d9488, #0f766e); --tile-ink: #ffffff;
  --danger: #dc2626; --warn: #d97706; --info: #0284c7;
  --chip-purple-bg: #ede9fe; --chip-purple: #6d28d9; --chip-teal-bg: #d5f3ea; --chip-teal: #0b7a5c;
  --chip-amber-bg: #fef3c7; --chip-amber: #b45309; --chip-green-bg: #dcfce7; --chip-green: #15803d;
  --shadow: 0 1px 2px rgba(15, 35, 45, .05), 0 4px 14px rgba(15, 35, 45, .04);
  --radius: 12px; --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080f0e; --surface: #101917; --surface-2: #0d1514; --side: #0a1211; --border: #1c2b28; --border-strong: #2a3d39;
    --ink: #e6f0ee; --ink-2: #a3b6b2; --ink-3: #6d837e;
    --accent: #14b8a6; --accent-ink: #04201c; --accent-soft: #0f2b27; --accent-text: #3fd8c6;
    --tile-grad: linear-gradient(135deg, #0f766e, #14b8a6); --tile-ink: #04201c;
    --danger: #f87171; --warn: #fbbf24; --info: #38bdf8;
    --chip-purple-bg: #2a2347; --chip-purple: #c4b5fd; --chip-teal-bg: #0f3a33; --chip-teal: #5eead4;
    --chip-amber-bg: #3b2f0e; --chip-amber: #fbbf24; --chip-green-bg: #12361f; --chip-green: #86efac;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080f0e; --surface: #101917; --surface-2: #0d1514; --side: #0a1211; --border: #1c2b28; --border-strong: #2a3d39;
  --ink: #e6f0ee; --ink-2: #a3b6b2; --ink-3: #6d837e;
  --accent: #14b8a6; --accent-ink: #04201c; --accent-soft: #0f2b27; --accent-text: #3fd8c6;
  --tile-grad: linear-gradient(135deg, #0f766e, #14b8a6); --tile-ink: #04201c;
  --danger: #f87171; --warn: #fbbf24; --info: #38bdf8;
  --chip-purple-bg: #2a2347; --chip-purple: #c4b5fd; --chip-teal-bg: #0f3a33; --chip-teal: #5eead4;
  --chip-amber-bg: #3b2f0e; --chip-amber: #fbbf24; --chip-green-bg: #12361f; --chip-green: #86efac;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.01em; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--ink-3); } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.sr { position: absolute; left: -9999px; }

/* ------------------------------------------------------------ app shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); padding: 2px 6px 18px; }
.brand:hover { text-decoration: none; } .brand img { width: 34px; height: 34px; }
.nav-label { font: 500 10px var(--mono); letter-spacing: .12em; color: var(--ink-3); padding: 8px 10px 6px; text-transform: uppercase; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; border-left: 3px solid transparent; }
.nav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); font-weight: 600; }
.nav .sub a { padding-left: 42px; font-size: 13px; }
.nav .grow { margin-left: auto; opacity: .6; }
.nav-spacer { flex: 1; min-height: 20px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top .menu-btn, .top .brand-mobile { display: none; }
.search { flex: 1; max-width: 440px; position: relative; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search input[type=search] { width: 100%; padding: 9px 12px 9px 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font: inherit; }
.search input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.badge-dot { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font: 700 10px/16px var(--sans); text-align: center; padding: 0 4px; }
.theme-sun { display: none; } :root[data-theme="dark"] .theme-sun { display: inline; } :root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-sun { display: inline; } :root:not([data-theme="light"]) .theme-moon { display: none; } }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--ink-2); }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font: 700 11px var(--sans); }
.usermenu .pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 30; }
.usermenu .pop .who { padding: 6px 10px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu .pop .btn { width: 100%; justify-content: flex-start; }
.content { padding: 22px 28px 40px; flex: 1; max-width: 1400px; width: 100%; }
.footer { padding: 14px 28px 20px; font-size: 12px; color: var(--ink-3); text-align: right; }
.bottom-nav { display: none; }

/* ------------------------------------------------------------ page parts */
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 0 0 16px; }
.page-title h1 { font-size: 24px; font-weight: 700; margin-right: 6px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 20px 20px; margin-bottom: 18px; }
.card > h2 { font-size: 16px; font-weight: 700; padding: 16px 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > h2 + * { margin-top: 0; }
.row { display: flex; gap: 18px; flex-wrap: wrap; } .row > * { flex: 1 1 320px; min-width: 0; }
.pull-right { margin-left: auto; display: inline-flex; gap: 6px; font-size: 12px; font-weight: 400; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 0 0 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-content: start; min-height: 98px; }
.tile .n { font: 700 28px/1.2 var(--mono); letter-spacing: -.02em; }
.tile .tile-ico { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); grid-row: 1 / span 1; grid-column: 2; }
.tile .tile-ico.amber { background: var(--chip-amber-bg); color: var(--chip-amber); } .tile .tile-ico.violet { background: var(--chip-purple-bg); color: var(--chip-purple); }
.tile .l { font-weight: 600; grid-column: 1 / -1; margin-top: 6px; } .tile .s { font-size: 12px; color: var(--ink-3); grid-column: 1 / -1; }
.tile.hero { background: var(--tile-grad); color: var(--tile-ink); border-color: transparent; }
.tile.hero .tile-ico { background: rgba(255, 255, 255, .22); color: var(--tile-ink); } .tile.hero .s { color: inherit; opacity: .85; }
.tile progress { grid-column: 1 / -1; width: 100%; height: 5px; margin-top: 8px; appearance: none; border: 0; border-radius: 4px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.tile progress::-webkit-progress-bar { background: rgba(255, 255, 255, .28); } .tile progress::-webkit-progress-value { background: var(--tile-ink); border-radius: 4px; } .tile progress::-moz-progress-bar { background: var(--tile-ink); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:nth-child(even) td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a.id, td:first-child > a { font-family: var(--mono); font-weight: 700; color: var(--accent-text); }
.total-row td { font-weight: 700; }
.narrow { max-width: 460px; } .narrow td { background: transparent !important; }
.status-list td:first-child { white-space: nowrap; }

/* chips, dots */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.chip-purple { background: var(--chip-purple-bg); color: var(--chip-purple); } .chip-teal { background: var(--chip-teal-bg); color: var(--chip-teal); }
.chip-amber { background: var(--chip-amber-bg); color: var(--chip-amber); } .chip-green { background: var(--chip-green-bg); color: var(--chip-green); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot-orange { background: #f59e0b; } .dot-blue { background: #3b82f6; } .dot-red { background: #ef4444; } .dot-purple { background: #8b5cf6; }
.dot-gold { background: #eab308; } .dot-green { background: #22c55e; } .dot-black { background: var(--ink); } .dot-gray { background: #94a3b8; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 6px 12px; font: 600 12.5px var(--sans); cursor: pointer; color: var(--accent-ink); background: var(--accent); text-decoration: none; line-height: 1.4; }
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-teal { background: var(--accent); } .btn-info { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn-warn { background: var(--chip-amber-bg); color: var(--chip-amber); } .btn-danger { background: var(--danger); color: #fff; }
.btn-default { background: transparent; color: var(--ink-2); border-color: var(--border-strong); }
.btn-lg { font-size: 13.5px; padding: 9px 18px; }
.inline { display: inline; margin: 0; }
td.actions { white-space: nowrap; } td.actions > * { margin-right: 6px; vertical-align: middle; } .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.flash { padding: 11px 14px; margin: 0 0 16px; border: 1px solid; border-radius: 10px; font-weight: 500; }
.flash-success { background: var(--chip-green-bg); border-color: transparent; color: var(--chip-green); }
.flash-error { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); border-color: transparent; color: var(--danger); }

/* forms */
label { font-weight: 600; color: var(--ink-2); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; color: var(--ink); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.field { display: grid; grid-template-columns: 200px minmax(0, 380px); gap: 8px 18px; align-items: start; margin-bottom: 14px; }
.field > label { text-align: right; padding-top: 8px; }
.form-actions { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 18px; padding-left: 218px; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 6px 0 12px; } .kv dt { font-weight: 600; color: var(--ink-2); } .kv dd { margin: 0; }
.allergy { color: var(--danger); font-weight: 700; }
.neg { color: var(--danger); } .pos { color: var(--chip-green); }
.line-grid { display: grid; grid-template-columns: minmax(180px, 2fr) 90px 90px 90px 90px 120px; gap: 8px; align-items: center; margin-bottom: 8px; }
.line-grid.other { grid-template-columns: minmax(180px, 2fr) 90px 120px; }
.line-grid.head { font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.hint { font-size: 11px; color: var(--ink-3); cursor: pointer; display: block; }
input.mini { width: 80px; display: inline-block; padding: 4px 8px; } .inline-select { width: auto; display: inline-block; }
.searchbox { display: flex; gap: 6px; margin-bottom: 12px; }
.upload { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; } .upload input[type=text] { width: 240px; }
.pill-filter { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.pill { padding: 5px 14px; border-radius: 9px; border: 1px solid var(--border-strong); font: 600 12.5px var(--sans); color: var(--ink-2); background: var(--surface); }
.pill:hover { text-decoration: none; background: var(--surface-2); } .pill.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.empty { color: var(--ink-3); font-style: italic; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 34px 30px 26px; text-align: center; }
.login .login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 22px; font-weight: 700; margin-bottom: 22px; }
.login .login-brand img { width: 44px; height: 44px; }
.login input { margin-bottom: 14px; padding: 10px 12px; }
.login .btn { width: 100%; padding: 11px; font-size: 14px; }
.login .error { color: var(--danger); margin-bottom: 14px; font-weight: 600; }
.login small { display: block; color: var(--ink-3); margin-top: 20px; }

/* dashboard schedule: table on desktop, cards on phones */
.sched-cards { display: none; }
.sched-card { display: block; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface); color: inherit; }
.sched-card:hover { text-decoration: none; border-color: var(--accent); }
.sched-card .top-line { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-weight: 700; color: var(--accent-text); }
.sched-card .name { font-size: 17px; font-weight: 700; margin-top: 4px; } .sched-card .doc { color: var(--ink-3); font-size: 13px; }
.sched-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.sched-card .when { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 10px; font-size: 13px; align-items: end; }
.sched-card .when small { display: block; font: 500 10px var(--mono); letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.sched-card .when b { font-family: var(--mono); }

/* ------------------------------------------------------------ small screens */
@media (max-width: 860px) {
  .app { display: block; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 270px; max-width: 84vw; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.drawer-open .side { transform: none; }
  body.drawer-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
  .top { padding: 10px 14px; gap: 8px; }
  .top .menu-btn { display: inline-flex; order: 3; } .top .brand-mobile { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
  .top .brand-mobile img { width: 28px; height: 28px; } .top .brand-mobile:hover { text-decoration: none; }
  .search { display: none; } .top-actions { order: 2; margin-left: auto; } .top .menu-btn { order: 3; }
  .usermenu summary span.email { display: none; } .usermenu summary { padding: 3px; }
  .content { padding: 16px 14px 90px; }
  .footer { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; } .tile { padding: 12px 14px; min-height: 0; } .tile .n { font-size: 24px; } .tile .tile-ico { display: none; }
  .tile .l { font-size: 12.5px; margin-top: 2px; } .tile .s { display: none; } .tile.hero .s { display: block; }
  .sched-table { display: none; } .sched-cards { display: block; }
  .page-title h1 { font-size: 21px; }
  .field { grid-template-columns: 1fr; } .field > label { text-align: left; padding: 0; } .form-actions { padding-left: 0; }
  .line-grid, .line-grid.other { grid-template-columns: 1fr 1fr; } .line-grid.head { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
  .card { padding: 4px 14px 14px; }
  .bottom-nav { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 14px; color: var(--ink-3); font-size: 11px; font-weight: 600; border-radius: 10px; }
  .bottom-nav a.active { color: var(--accent-text); } .bottom-nav a:hover { text-decoration: none; }
}
@media print { .side, .top, .footer, .bottom-nav, .no-print { display: none !important; } .app { display: block; } .content { padding: 0; } .card { box-shadow: none; } body { background: #fff; color: #000; } }
