/* Shared interface: PHP screens and React components use the same tokens. */
:root {
  --navy: #182b49;
  --navy-soft: #243c5e;
  --blue: #2863df;
  --blue-deep: #1d50bc;
  --cyan: #39b4bb;
  --bg: #f5f7fb;
  --text: #26364f;
  --muted: #637189;
  --line: #e4e9f1;
  --radius: 14px;
  --shadow: 0 3px 14px rgba(25, 43, 73, .035);
  --shadow-hover: 0 8px 24px rgba(25, 43, 73, .08);
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2863df; outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 12px 18px; background: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sidebar { width: 248px; background: #14243e; padding: 28px 16px 20px; box-shadow: none; }
.brand { margin: 0 4px 27px; gap: 10px; }
.brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 10px; box-shadow: none; }
.brand-copy strong { font-size: 16px; }
.brand-copy small { color: #9baec9; font-size: 9px; }
.nav-label { color: #8fa2c0; font-weight: 600; font-size: 10px; padding-top: 23px; letter-spacing: .09em; }
.sidebar nav { gap: 5px; }
.sidebar nav a { color: #bfcbdd; padding: 11px 12px; font-size: 13px; font-weight: 500; border-radius: 8px; }
.sidebar nav a i { color: #94aaca; font-size: 17px; }
.sidebar nav a.active { background: #284875; box-shadow: inset 3px 0 #7ba8ff; color: #fff; }
.sidebar nav a.active i { color: #9bc1ff; }
.sidebar nav a:hover { transform: none; background: #203754; }
.sidebar-footer { border-color: #30405a; color: #adbed4; font-size: 12px; }
.page { margin-left: 248px; width: calc(100% - 248px); }
.topbar { height: 78px; padding: 0 32px; background: #fff; backdrop-filter: none; }
.topbar-title strong { font-size: 14px; font-weight: 650; }
.topbar-title small { font-size: 11px; }
.top-actions { gap: 12px; }
.top-actions .button { font-size: 12px; font-weight: 550; }
.user-avatar { background: #e8effe; color: #2854ab; box-shadow: none; border-radius: 12px; }
.content { padding: 32px; max-width: 1680px; }
h1 { font-size: clamp(25px, 2.4vw, 33px); font-weight: 700; letter-spacing: -.045em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 16px; }
.page-heading { margin-bottom: 28px; }
.page-heading .muted { margin-bottom: 0; font-size: 14px; }
.breadcrumb { color: var(--muted); font-size: 11px; font-weight: 500; }
.panel { box-shadow: var(--shadow); padding: 24px; }
.button { min-height: 40px; font-size: 13px; font-weight: 600; border-radius: 8px; }
.button-primary { background: var(--blue); box-shadow: 0 2px 4px #2863df20; }
.button-primary:hover { background: var(--blue-deep); box-shadow: none; }
.button:disabled { opacity: .45; cursor: default; transform: none; }
.button-ghost { background: transparent; }
input, select, textarea { border-color: #d7dfeb; border-radius: 8px; min-height: 42px; font-size: 14px; }
input[type=checkbox], input[type=radio] { min-height: auto; accent-color: var(--blue); }
label { font-size: 13px; font-weight: 600; }
.field-help { font-weight: 400; }
.toolbar { gap: 14px; padding-bottom: 20px; }
.toolbar form { gap: 10px; }
.toolbar input, .toolbar select { max-width: 100%; }
.table-wrap { border-radius: 10px; scrollbar-color: #bac8dc #f5f7fb; }
th { padding: 14px 16px; background: #f8fafc; color: #5e6d84; font-size: 10px; font-weight: 650; letter-spacing: .06em; white-space: nowrap; }
td { padding: 16px; font-size: 13px; vertical-align: middle; }
td strong { font-weight: 600; }
td small { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbff; }
.badge { border-radius: 6px; font-weight: 550; font-size: 11px; }
.section-heading { align-items: center; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading p { margin: 7px 0 0; font-size: 13px; }
.workspace-search { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: #f8fafc; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12px; }
kbd { font: inherit; font-size: 10px; color: #637189; padding: 2px 5px; border: 1px solid #dce3ed; border-radius: 4px; background: white; }
.command-dialog { width: min(580px, calc(100vw - 32px)); max-height: 80dvh; padding: 24px; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 100px #101e3f40; color: var(--text); }
.command-dialog::backdrop { background: #10203c70; backdrop-filter: blur(3px); }
.command-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.command-header h2 { margin: 0; }
.command-input, .table-search { display: flex; align-items: center; gap: 10px; margin: 0; }
.command-input input { flex: 1; min-width: 0; }
.command-results { display: grid; gap: 5px; max-height: 45dvh; overflow-y: auto; margin-top: 18px; }
.command-results a { display: flex; align-items: center; gap: 14px; padding: 13px 10px; color: var(--text); border-radius: 8px; font-size: 14px; }
.command-results a:hover, .command-results a:focus-visible { background: #edf3ff; }
.command-results a i:first-child { color: var(--blue); }
.command-results a i:last-child { margin-left: auto; color: var(--muted); }
.command-hint { border-top: 1px solid var(--line); padding-top: 16px; margin: 16px 0 0; color: var(--muted); font-size: 11px; }
.sidebar-backdrop { position: fixed; inset: 0; border: 0; background: #10203c80; z-index: 19; cursor: pointer; }
.menu-close { position: absolute; top: 20px; right: 20px; background: #fff; color: var(--navy); border-radius: 8px; padding: 10px 12px; }
.navigation-open { overflow: hidden; }
.table-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 0 0 16px; }
.table-search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.table-search i { position: absolute; left: 13px; color: #74839b; }
.table-search input { padding-left: 38px; background: #fcfdff; font-weight: 400; }
.table-result-count { color: var(--muted); font-size: 12px; margin-left: auto; }
.table-size { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--muted); font-size: 12px; }
.table-size select { width: 75px; min-height: 36px; padding: 6px; font-size: 12px; }
.table-pagination { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.table-pagination .button { min-height: 34px; padding: 6px 10px; }
.eyebrow { color: #687c9b; letter-spacing: .12em; font-size: 10px; font-weight: 700; margin: 0 0 10px; }
.dashboard-heading { align-items: center; }
.dashboard-date { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); padding: 10px 14px; border-radius: 8px; color: var(--muted); background: #fff; font-size: 12px; white-space: nowrap; }
.workspace-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 32px; }
.metric-card { padding: 21px 23px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--text); box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
.metric-card:hover { border-color: #aec6f8; box-shadow: var(--shadow-hover); }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: #8a99ad; margin-bottom: 18px; }
.metric-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; background: #edf3ff; color: #2863df; font-size: 19px; }
.metric-card.teal .metric-icon { background: #eaf7f6; color: #127e79; }
.metric-card.violet .metric-icon { background: #f1edfd; color: #7350bf; }
.metric-card > strong { display: block; font-size: 32px; line-height: 1.2; letter-spacing: -.04em; font-weight: 650; margin-bottom: 6px; color: var(--navy); }
.metric-card > span { color: var(--muted); font-size: 12px; }
.quick-section { margin-bottom: 26px; }
.quick-section .section-heading > .muted { font-size: 12px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quick-action { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 15px; color: var(--text); transition: border-color .15s; }
.quick-action:hover { border-color: #8db2f5; }
.quick-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: #f0f4fa; color: #446286; flex-shrink: 0; font-size: 18px; }
.quick-action strong { display: block; font-size: 12px; font-weight: 650; }
.quick-action small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.quick-action > i { margin-left: auto; color: #8799b2; font-size: 12px; }
.attention-strip { display: flex; align-items: center; gap: 22px; padding: 18px 22px; margin-bottom: 28px; background: #fffaf0; border: 1px solid #eee2c5; border-radius: 12px; }
.attention-title { display: flex; gap: 10px; align-items: center; color: #8b6223; font-size: 12px; white-space: nowrap; }
.attention-strip a { display: flex; align-items: center; gap: 10px; color: #735e3c; font-size: 12px; border-left: 1px solid #e8dcc4; padding-left: 22px; }
.attention-number { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 5px; border-radius: 7px; background: #f7ecd4; font-weight: 700; }
.attention-strip a > i { color: #a68755; }
.recent-readings { padding: 24px; }
.recent-readings .section-heading .eyebrow { margin: 0 0 8px; font-size: 10px; }
.recent-search { margin-bottom: 18px; }
.cell-subtitle { display: block; margin-top: 4px; font-size: 11px; }
.numeric-cell { font-variant-numeric: tabular-nums; }
.row-detail { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.workspace-empty { display: grid; justify-items: center; text-align: center; padding: 38px 16px; border: 1px dashed var(--line); border-radius: 10px; background: #fcfdff; }
.workspace-empty > i { display: grid; place-items: center; width: 54px; height: 54px; font-size: 25px; background: #edf3fc; border-radius: 16px; color: #6e8bb5; margin-bottom: 18px; }
.workspace-empty h3 { margin: 0 0 8px; }
.workspace-empty p { color: var(--muted); font-size: 13px; max-width: 420px; margin: 0 0 20px; }
.team-summary { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.auth-shell { background: radial-gradient(ellipse at 15% 20%, #e5edfd, transparent 50%), #f5f7fb; }
.login-card { border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 70px #182b4910; padding: 36px; }
.login-card::before { background: #2863df; height: 4px; }
.login-card h1 { font-size: 25px; }
@media (min-width: 761px) and (max-width: 1250px) {
  .workspace-search span, .workspace-search kbd { display: none; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attention-strip { flex-wrap: wrap; gap: 14px; }
  .attention-title { width: 100%; }
  .attention-strip a { border-left: 0; padding-left: 0; }
}
@media (max-width: 1000px) {
  .workspace-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 22px; }
  .content { padding: 24px; }
  .top-actions { gap: 7px; }
  .top-actions .button-ghost span { display: none; }
}
@media (max-width: 760px) {
  .page { margin-left: 0; width: 100%; }
  .sidebar { width: 248px; }
  .topbar { height: 68px; padding: 0 16px; gap: 10px; }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar-title strong { font-size: 12px; }
  .topbar-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
  .workspace-search { padding: 10px; }
  .workspace-search span, .workspace-search kbd { display: none; }
  .content { padding: 24px 16px; }
  .dashboard-heading { align-items: flex-start; gap: 16px; }
  .dashboard-date { font-size: 11px; padding: 8px 10px; }
  .workspace-stats { gap: 12px; margin-bottom: 24px; }
  .metric-card { padding: 16px; }
  .metric-card > strong { font-size: 28px; }
  .metric-top { margin-bottom: 12px; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-action { padding: 14px 12px; align-items: flex-start; }
  .quick-action > i { display: none; }
  .quick-action small { font-size: 11px; }
  .quick-icon { width: 28px; height: 28px; font-size: 16px; }
  .quick-section .section-heading { align-items: flex-start; gap: 6px; }
  .attention-strip { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px; }
  .attention-strip a { border: 0; padding: 0; }
  .attention-strip a > i { margin-left: auto; }
  .panel, .recent-readings { padding: 18px; }
  .section-heading { align-items: flex-start; }
  .table-tools { gap: 10px; }
  .table-search { flex-basis: 100%; max-width: none; }
  .table-result-count { margin-left: 0; margin-right: auto; }
  .table-size { font-size: 11px; }
  .table-pagination { gap: 7px; }
  .toolbar form > input, .toolbar form > select { flex: 1 1 100%; width: 100%; }
  .toolbar .button { flex: 1 1 auto; }
  .login-card { padding: 28px 24px; }
}
@media (max-width: 380px) {
  .quick-actions { grid-template-columns: 1fr; }
  .topbar-title small { max-width: 130px; }
  .table-size { display: none; }
}
/* Shared list filters: stable field grid and a separate row for actions. */
.toolbar { align-items: stretch; }
.toolbar form.filter-form { display: block; flex: 1 1 100%; min-width: 0; padding: 18px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.filter-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: var(--navy); font-size: 13px; }
.filter-heading i { color: var(--blue); }
.filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px 16px; align-items: end; }
.filter-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 0; }
.filter-field > span { color: #52627a; font-size: 12px; }
.toolbar .filter-field input, .toolbar .filter-field select { width: 100%; min-width: 0; margin: 0; background-color: #fff; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.toolbar .filter-count { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.command-account { display: flex; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 14px; }
.section-search-fallback { position: relative; }
.section-search-fallback summary { cursor: pointer; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.section-search-fallback nav { position: absolute; right: 0; top: 100%; z-index: 30; display: grid; gap: 8px; padding: 16px; width: min(320px, 90vw); max-height: 75dvh; overflow: auto; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-hover); }
.section-search-fallback nav a { padding: 10px; }
.page, .content, .panel, .form-grid > *, .detail-grid > * { min-width: 0; }
@media (max-width: 760px) {
  .sidebar, .sidebar.open, [data-sidebar-toggle] { display: none; }
  .topbar { height: 70px; padding: 12px 16px; }
  .topbar-title, .top-actions > .user-avatar, .top-actions > a, .top-actions > form { display: none; }
  .top-actions, #workspace-tools { width: 100%; }
  .workspace-search { width: 100%; min-height: 46px; padding: 12px 16px; font-size: 14px; text-align: left; }
  .workspace-search span { display: inline; }
  .workspace-search kbd { display: none; }
  input, select, textarea { font-size: 16px; }
  .button, .command-results a { min-height: 44px; }
  .content { padding: 20px 12px; }
  .panel { padding: 14px; }
  .toolbar form.filter-form { padding: 14px; }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .filter-field-wide { grid-column: 1 / -1; }
  .filter-actions { gap: 8px; }
  .filter-actions .button { flex: 1 1 130px; white-space: normal; text-align: center; }
  .table-actions { width: 100%; }
  .table-actions .button { flex: 1 1 auto; }
  .page-heading > .button { width: 100%; }
  .command-dialog { padding: 18px; max-height: 90dvh; }
  .command-results { max-height: 48dvh; }
  .command-input input { font-size: 16px; }
  .mobile-records, .mobile-records tbody { display: block; width: 100%; min-width: 0; }
  .mobile-records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .mobile-records tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-bottom: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .mobile-records tbody td { display: block; padding: 10px 0; min-width: 0; overflow-wrap: anywhere; white-space: normal; border-bottom: 1px solid var(--line); }
  .mobile-records tbody td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
  .mobile-records tbody td:first-child, .mobile-records tbody td:last-child, .mobile-records tbody td[colspan] { grid-column: 1 / -1; }
  .mobile-records tbody td:last-child { border: 0; }
  .mobile-records td a, .mobile-records .link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 8px; }
  dl { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  dd { margin: 0 0 12px; overflow-wrap: anywhere; }
}
@media (max-width: 380px) {
  .filter-fields { grid-template-columns: minmax(0, 1fr); }
  .mobile-records tbody tr { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .table-tools, .skip-link, .sidebar-backdrop, .command-dialog { display: none !important; }
  .page { width: 100%; margin: 0; }
  .content { max-width: none; padding: 0; }
  .table-wrap { overflow: visible; }
  tbody tr[hidden] { display: table-row !important; }
}
