/* ==========================================================================
   AxisOS design system — shared by every suite module.
   Layout:  .topbar  +  .shell > .sidebar + .content
   Blocks:  .page-head .card .grid-2/3/4 .stats/.stat .table .badge-* .btn(-primary|-danger|-ghost|-sm)
            .field .form-grid .tabs .alert-* .popover .menu .person-banner .board/.col/.kcard
            .timeline .empty .pager .split .toolbar .chip .kv .rx-grid .mono .muted .small .right
   Module accent colour: var(--module) (set per module by layout.php)
   ========================================================================== */
:root {
  --bg: #f5f6f8; --surface: #fff; --surface-2: #f9fafb; --border: #e3e6ea; --border-strong: #cfd4da;
  --text: #16202b; --text-2: #4b5663; --muted: #6b7682;
  --primary: #1f5eff; --primary-600: #1a4fd6; --primary-50: #eef3ff;
  --green: #15803d; --green-50: #e9f7ef; --amber: #b45309; --amber-50: #fdf3e2; --red: #c62828; --red-50: #fdecec;
  --blue: #1d4ed8; --blue-50: #e8effd; --gray-50: #f1f3f5;
  --radius: 10px; --radius-sm: 7px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.14);
  --topbar-h: 56px; --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --module: #1f5eff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; } hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 13px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; } .hidden { display: none !important; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ic { flex: none; vertical-align: middle; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--module); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); white-space: nowrap; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--module); }
.gsearch { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--gray-50); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 10px; height: 36px; color: var(--muted); margin-left: 12px; }
.gsearch input { border: 0; background: transparent; outline: 0; flex: 1; font: inherit; color: var(--text); height: 34px; }
.gsearch:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-50); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0;
  background: transparent; border-radius: 8px; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--gray-50); }
.dot-count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red);
  color: #fff; font-size: 10px; line-height: 16px; font-weight: 700; text-align: center; }
.loc-switch { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.loc-switch select { border: 1px solid var(--border); border-radius: 8px; height: 34px; padding: 0 8px; background: #fff; font: inherit; max-width: 200px; }
.entity-chip { background: var(--gray-50); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--text-2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .entity-chip { display: none; } }
.user-chip { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 4px 8px; border-radius: 8px; font: inherit; color: var(--text); }
.user-chip:hover { background: var(--gray-50); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--module); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.popover { display: none; position: absolute; top: calc(var(--topbar-h) - 6px); left: 10px; z-index: 60; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; }
.popover.right { left: auto; right: 10px; } .popover.open { display: block; }
.menu { list-style: none; margin: 0; padding: 0; } .menu a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 7px; color: var(--text); }
.menu a:hover { background: var(--gray-50); text-decoration: none; }
.app-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 6px; padding: 6px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 10px; color: var(--text); font-weight: 550; font-size: 13px; }
.app-tile:hover { background: var(--gray-50); text-decoration: none; } .app-tile.cur { background: var(--primary-50); }
.app-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--c); color: #fff; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h));
  /* the sticky sidebar is one viewport tall; paint its column down the whole page so long pages / prints have no gap */
  background: linear-gradient(90deg, var(--surface) 0, var(--surface) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 10px 8px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; display: flex; flex-direction: column; }
.sidebar nav { flex: 1; }
.nav-section { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--text-2); font-weight: 500; }
.nav-item:hover { background: var(--gray-50); color: var(--text); text-decoration: none; }
.nav-item.active { background: color-mix(in srgb, var(--module) 12%, #fff); color: var(--text); font-weight: 650; }
.nav-item.active .ic { color: var(--module); }
.nav-badge { margin-left: auto; background: var(--module); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); }
/* collapsible menu groups (layout.php + axis.js) */
.nav-group { margin-top: 2px; }
.nav-group-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left;
  border-radius: 7px; font-family: inherit; padding: 10px 10px 6px; }
.nav-group-head:hover { color: var(--text); background: var(--gray-50); }
.nav-group-head:focus-visible { outline: 2px solid var(--module); outline-offset: -2px; }
.nav-group-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-head > .ic:last-child { flex: none; transition: transform .15s ease; transform: rotate(-90deg); opacity: .7; }
.nav-group.open > .nav-group-head > .ic:last-child { transform: none; }
.nav-group-body { display: none; padding-bottom: 4px; }
.nav-group.open > .nav-group-body { display: block; }
.nav-group.has-active > .nav-group-head { color: var(--text); }
.nav-group-badge { font-size: 10px; line-height: 16px; padding: 0 6px; margin-left: 0; letter-spacing: 0; }
.nav-group.open > .nav-group-head .nav-group-badge { display: none; }   /* the items show their own counts */
.nav-group-count { font-weight: 600; letter-spacing: 0; opacity: .7; }
.nav-group-allhidden { display: none; }
body.ui-nav-edit .nav-group-allhidden { display: block; }
body.ui-nav-edit .nav-group-head > .ic:last-child, body.ui-nav-edit .nav-group-badge { display: none; }
.nav-tools { display: flex; gap: 12px; margin-bottom: 6px; }
.nav-tools .link-btn { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.nav-tools .link-btn:hover { color: var(--text); text-decoration: underline; }
.nav-toggle { display: none; }
.sidebar-scrim { display: none; }
.content { flex: 1; min-width: 0; padding: 22px 26px 60px; max-width: 1320px; }
.content.wide { max-width: none; }
.bare-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; } .page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; } .breadcrumb a { color: var(--muted); }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; width: 100%; } .card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.split-left { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .split, .split-left { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .sidebar { display: none; } .shell { background: none; } .content { padding: 16px; } .gsearch { display: none; }
  /* the menu button opens the sidebar over the page */
  .nav-toggle { display: inline-flex; }
  body.nav-open .sidebar { display: flex; position: fixed; left: 0; top: var(--topbar-h); bottom: 0; height: auto; z-index: 55; width: min(300px, 86vw); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(17, 24, 39, .35); z-index: 54; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); display: block; }
a.stat:hover { border-color: var(--module); text-decoration: none; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; } .stat-hint { font-size: 12px; color: var(--muted); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; } .table tbody tr:hover td { background: #fafbfc; }
.table.compact td, .table.compact th { padding: 6px 10px; } .table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }
.table-wrap .table { border: 0; }
tr.clickable { cursor: pointer; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 18px; }
.badge-green { background: var(--green-50); color: var(--green); } .badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-amber { background: var(--amber-50); color: var(--amber); } .badge-red { background: var(--red-50); color: var(--red); }
.badge-gray { background: var(--gray-50); color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 13px; color: var(--text-2); }
.chip.active { border-color: var(--module); color: var(--text); background: color-mix(in srgb, var(--module) 8%, #fff); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--gray-50); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-600); }
.btn-module { background: var(--module); border-color: var(--module); color: #fff; } .btn-module:hover { filter: brightness(.94); background: var(--module); }
.btn-danger { background: #fff; border-color: #f1b8b8; color: var(--red); } .btn-danger:hover { background: var(--red-50); }
.btn-ghost { background: transparent; border-color: transparent; } .btn-ghost:hover { background: var(--gray-50); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; } .btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); } .req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local],
input[type=tel], input[type=search], input[type=url], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 36px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
input[readonly] { background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 4px 14px 8px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; font-size: 13px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.inline-form { display: inline; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }

/* Rx grid (OD/OS rows) */
.rx-grid { display: grid; grid-template-columns: 44px repeat(var(--cols, 8), minmax(62px, 1fr)); gap: 6px; align-items: center; }
.rx-grid .rx-h { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; }
.rx-grid .rx-eye { font-weight: 800; color: var(--module); }
.rx-grid input, .rx-grid select { text-align: center; padding: 6px 4px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 14px; color: var(--text-2); font-weight: 600; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: 600 13.5px var(--font); white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--module); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--green-50); border-color: #bfe5cd; color: #14532d; }
.alert-error, .alert-danger { background: var(--red-50); border-color: #f3c2c2; color: #7f1d1d; }
.alert-warning { background: var(--amber-50); border-color: #f2d7a6; color: #78350f; }
.alert-info { background: var(--blue-50); border-color: #c7d6fb; color: #1e3a8a; }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; } .kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; font-weight: 500; }

/* ---------- Person banner ---------- */
.person-banner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--module); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.pb-avatar { width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--module) 15%, #fff); color: var(--module); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.pb-name { font-size: 17px; font-weight: 700; } .pb-meta { color: var(--muted); font-size: 13px; }
.pb-col { border-left: 1px solid var(--border); padding-left: 16px; } .pb-k { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pb-col.tone-red > div:last-child { color: var(--red); font-weight: 650; } .pb-col.tone-amber > div:last-child { color: var(--amber); font-weight: 650; }
.pb-col.tone-green > div:last-child { color: var(--green); font-weight: 650; }
.pb-alerts { display: flex; gap: 6px; flex-wrap: wrap; }
.pb-actions { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---------- Public (anonymous) pages: layout_header($t, ['public' => true]) ---------- */
body.public .bare-main { justify-content: flex-start; }
.public-head { width: 100%; max-width: 960px; display: flex; align-items: center; justify-content: center; padding: 8px 0 20px; }
.public-logo { max-height: 56px; max-width: 260px; } .public-name { font-size: 20px; font-weight: 700; }

/* ---------- Kanban / WIP board ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board .col { flex: 0 0 250px; background: var(--gray-50); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; max-height: 75vh; overflow-y: auto; }
.board .col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; padding: 4px 6px 8px; }
.kcard { display: block; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: var(--text); box-shadow: var(--shadow); font-size: 13px; }
.kcard:hover { border-color: var(--module); text-decoration: none; } .kcard.late { border-left: 3px solid var(--red); } .kcard.rush { border-left: 3px solid var(--amber); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--module); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }

/* ---------- Empty / pager ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); } .empty .ic { color: var(--border-strong); } .empty h3 { color: var(--text); margin-top: 10px; }
.pager { display: flex; gap: 4px; align-items: center; justify-content: flex-end; padding: 10px 0; }
.pager a, .pager .cur { min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.pager .cur { background: var(--module); color: #fff; border-color: var(--module); } .pager .muted { margin-right: auto; }

/* ---------- Login / bare ---------- */
.auth-card { width: 100%; max-width: 400px; } .auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; font-weight: 750; font-size: 20px; }
.auth-logo .brand-dot { width: 14px; height: 14px; border-radius: 4px; }

/* ---------- Launcher ---------- */
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.launch-tile { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px; color: var(--text); box-shadow: var(--shadow); }
.launch-tile:hover { border-color: var(--c); text-decoration: none; box-shadow: var(--shadow-lg); } .launch-tile .app-ic { width: 48px; height: 48px; }
.launch-tile h3 { margin: 0 0 4px; } .launch-tile.locked { opacity: .55; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-cart { position: sticky; top: calc(var(--topbar-h) + 16px); }
.pos-total { font-size: 28px; font-weight: 800; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile-btn { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.tile-btn:hover { border-color: var(--module); }

/* ---------- Print ---------- */
@media print {
  .topbar, .sidebar, .page-actions, .no-print, .btn, .toolbar { display: none !important; }
  body { background: #fff; } .shell { background: none; } .content { padding: 0; max-width: none; } .card { box-shadow: none; border: 0; padding: 0; }
}
/* Hub › Settings › Documents & printing = Black & white: every printout in every module prints in black only */
@media print {
  body.print-bw, body.print-bw * { color: #000 !important; border-color: #000 !important; box-shadow: none !important; text-shadow: none !important; }
  body.print-bw *:not(.docflag-solid) { background-color: transparent !important; background-image: none !important; }
  body.print-bw img, body.print-bw svg { filter: grayscale(1); }
  body.print-bw .docflag-solid { background: #000 !important; color: #fff !important; }
}

/* ---- standard Rx / measurement entry (core/lib/rx_ui.php + rx_entry.js) — same layout as the Lab order form ---- */
.rx-entry, .rx-meas { margin: 4px 0 8px; }
.rx-help { margin: 0 0 8px; max-width: 900px; }
.rx-scroll { overflow-x: auto; }
.rx-table-std { border-collapse: collapse; width: 100%; min-width: 560px; }
.rx-table-std th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 4px 6px; text-align: center; white-space: nowrap; }
.rx-table-std tbody th { text-align: left; color: var(--module); font-size: 12px; }
.rx-table-std td { padding: 3px 4px; }
.rx-table-std input, .rx-table-std select { width: 100%; min-width: 58px; text-align: center; padding: 7px 4px; font-variant-numeric: tabular-nums; }
.rx-table-std td.rx-brand { min-width: 200px; }
.rx-table-std td.rx-brand input { text-align: left; }
.rx-table-std input:disabled { background: var(--surface-2, #f1f5f9); }
.rx-bad, input.rx-bad, select.rx-bad { border-color: #dc2626 !important; box-shadow: 0 0 0 2px rgba(220, 38, 38, .15); background: #fef2f2; }
.rx-errors { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; font-size: 13px; }
.rx-errors div + div { margin-top: 2px; }
.rx-transpose { margin-top: 8px; }
.rx-need input { border-color: #ca8a04; }
.rx-cl-note { margin-top: 2px; text-align: left; font-size: 11px; }
.rx-free { margin-top: 8px; }
.rx-free-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.rx-free-row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.rx-free-row input { width: 90px; text-align: center; }

/* product photos (inv_item_thumb) */
.item-thumb { display: inline-block; object-fit: contain; background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; vertical-align: middle; }
.item-thumb-none { background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #f8fafc 6px, #f8fafc 12px); }
.item-cell { display: flex; gap: 10px; align-items: center; }
.variant-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.variant-strip a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; font-size: 11px; color: inherit; text-decoration: none; width: 104px; text-align: center; }
.variant-strip a.on { border-color: var(--module); box-shadow: 0 0 0 2px color-mix(in srgb, var(--module) 25%, transparent); }
.variant-strip a:hover { border-color: var(--module); }

/* ---------- Help button + side panel (hub/help; axis.js Axis.help) ---------- */
.help-btn { width: auto; padding: 0 8px; gap: 4px; }
.help-btn-label { font-size: 13px; font-weight: 600; }
@media (max-width: 1100px) { .help-btn-label { display: none; } }
.help-drawer { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: var(--help-w, 520px); z-index: 45; background: var(--surface);
  border-left: 1px solid var(--border-strong); box-shadow: -8px 0 24px rgba(16,24,40,.10); display: flex; }
.help-drawer[hidden] { display: none; }
.help-drawer iframe { flex: 1; border: 0; width: 100%; height: 100%; background: var(--surface); }
.help-drawer-grip { width: 6px; cursor: ew-resize; background: transparent; flex: none; }
.help-drawer-grip:hover, body.help-resizing .help-drawer-grip { background: var(--primary-50); }
body.help-resizing { user-select: none; cursor: ew-resize; }
body.help-resizing .help-drawer iframe { pointer-events: none; }
@media (min-width: 1000px) { body.help-open .shell { margin-right: var(--help-w, 520px); } }
@media (max-width: 760px) { .help-drawer { width: 100% !important; } }
@media print { .help-drawer, .help-btn { display: none !important; } body.help-open .shell { margin-right: 0; } }

/* ---------- Favorites + personal layout (core/assets/ui_custom.js) ---------- */
.fav-btn.on { color: #d97706; }
.fav-pop { width: 320px; padding: 6px 0; }
.fav-pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px 8px; border-bottom: 1px solid var(--border); }
.fav-pop-foot { border-top: 1px solid var(--border); padding: 6px 8px 2px; text-align: right; }
.fav-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; margin-right: 2px; }
.nav-favs { border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 0 0 4px; }
.nav-favs .nav-group-head { color: #b45309; padding-top: 8px; }
.nav-fav { padding-left: 14px; }
.fav-edit { padding: 8px 12px; }
.fav-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.fav-row input { flex: 1; height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 8px; font: inherit; }
.fav-edit-btns { margin-top: 8px; display: flex; gap: 6px; }
.ui-grip { cursor: grab; color: var(--muted); padding: 0 2px; user-select: none; }
.nav-hidden { display: none !important; }
.ui-box-hidden { display: none !important; }
body.ui-nav-edit .nav-hidden { display: flex !important; opacity: .45; }
body.ui-page-edit .ui-box-hidden { display: block !important; opacity: .4; }
body.ui-page-edit .stat.ui-box-hidden { display: flex !important; }
body.ui-customizing .ui-navgroup { border: 1px dashed var(--border-strong); border-radius: 8px; margin: 4px 0; padding: 2px; cursor: grab; background: var(--surface); }
body.ui-nav-edit a.nav-item { cursor: grab; position: relative; }
body.ui-nav-edit a.nav-item:hover { background: var(--primary-50); }
.ui-eye { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 13px; padding: 0 2px; line-height: 1; }
body.ui-page-edit .ui-box { position: relative; outline: 2px dashed color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; cursor: grab; }
body.ui-page-edit .ui-box-top { outline-color: color-mix(in srgb, var(--module) 55%, transparent); outline-offset: 5px; }
.ui-eye-box { position: absolute; top: 6px; right: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 5px; z-index: 2; }
.ui-dragging { opacity: .5; }
.ui-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 60; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  max-width: min(960px, calc(100vw - 24px)); padding: 10px 14px; background: #111827; color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; }
.ui-bar-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ui-bar .btn-ghost { color: #e5e7eb; }
.ui-toast { position: fixed; right: 16px; bottom: 16px; z-index: 70; background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); }
.ui-toast.bad { background: var(--red); }
@media print { .ui-bar, .fav-btn, .nav-favs, .sidebar-scrim { display: none !important; } }
/* Test-data-only installs (core/lib/test_data.php): a small fixed strip, always visible, never blocks a click */
.test-data-banner { position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 80; pointer-events: none;
  background: var(--amber-50); color: #78350f; border: 1px solid #f2d7a6; border-radius: 999px; padding: 3px 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); opacity: .95; }
@media (max-width: 640px) { .test-data-banner { white-space: normal; text-align: center; width: calc(100% - 24px); } }
@media print { .test-data-banner { position: static; transform: none; display: block; margin: 0 0 6px; box-shadow: none; } }
