:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17233c;
  background: #f4f6fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: #3156c8; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px max(24px, calc((100% - 1180px) / 2)); background: #14213d; color: #fff; }
.brand-group { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { color: #fff; font-size: 17px; font-weight: 750; letter-spacing: -.3px; white-space: nowrap; }
.brand span { color: #aab9e8; font-weight: 450; }
.device-status { display: flex; align-items: center; gap: 7px; color: #dce4ff; font-size: 11px; white-space: nowrap; }
.machine-icon { width: 16px; height: 16px; fill: none; stroke: #b7c5ed; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.device-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #aab3c5; }
.device-status[data-status="connected"] .device-dot { background: #40d28b; box-shadow: 0 0 0 3px #40d28b22; }
.device-status[data-status="offline"] .device-dot,
.device-status[data-status="not-connected"] .device-dot { background: #f06b72; }
.device-status[data-status="unavailable"] .device-dot { background: #f2bf4a; }
.device-status-label { font-weight: 650; }
.device-last-seen { color: #aab9e8; }
nav { display: flex; align-items: center; gap: 24px; }
nav a, .nav-button { color: #dce4ff; font-size: 14px; }
.inline { display: inline; }
.nav-button { padding: 0; border: 0; background: none; cursor: pointer; }
.page { width: min(1180px, calc(100% - 40px)); margin: 36px auto 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
h1 { margin: 4px 0 0; font-size: clamp(25px, 3vw, 32px); letter-spacing: -1px; }
h2 { margin: 0; font-size: 17px; }
.eyebrow { color: #687694; font-size: 11px; font-weight: 750; letter-spacing: 1.4px; }
.muted, .panel-heading p { color: #74809a; }
.page-heading p { margin: 7px 0 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card, .panel, .login-card { border: 1px solid #e6eaf2; border-radius: 12px; background: #fff; box-shadow: 0 4px 16px #25365a08; }
.stat-card { display: grid; gap: 12px; padding: 20px; }
.stat-card span { color: #6f7a91; font-size: 13px; }
.stat-card strong { font-size: 28px; letter-spacing: -.7px; }
.panel { margin-bottom: 22px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; }
.panel-heading p { margin: 5px 0 0; font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 18px; border-top: 1px solid #edf0f5; white-space: nowrap; font-size: 13px; }
th { color: #74809a; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .55px; background: #fbfcfe; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.success-badge { color: #147649; background: #e5f7ef; }
.warning-badge { color: #9a5a08; background: #fff2d9; }
.muted-badge { color: #69758b; background: #eff2f7; }
.empty { padding: 28px; color: #75819a; text-align: center; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid #dfe4ee; border-radius: 7px; background: #fff; color: #293650; font-size: 13px; font-weight: 650; cursor: pointer; }
.button:hover { background: #f7f8fb; text-decoration: none; }
.button.primary { border-color: #3156c8; background: #3156c8; color: #fff; }
.button.primary:hover { background: #284ab2; }
.date-filter { display: flex; align-items: end; gap: 10px; }
.date-filter label { display: grid; gap: 6px; color: #66728b; font-size: 12px; }
input { min-height: 40px; padding: 8px 10px; border: 1px solid #dfe4ee; border-radius: 7px; color: #17233c; background: #fff; }
.report-filter { padding: 22px; flex-wrap: wrap; }
.report-total { padding: 0 22px; color: #687694; font-size: 13px; }
.form-panel { max-width: 640px; padding: 24px; }
.stack { display: grid; gap: 17px; }
.stack label { display: grid; gap: 7px; color: #34415b; font-size: 13px; font-weight: 650; }
.stack small { color: #7a859a; font-size: 12px; font-weight: 400; }
.stack input:not([type=checkbox]) { width: 100%; }
.stack input[readonly] { background: #f2f4f8; }
.checkbox { display: flex !important; grid-template-columns: auto 1fr; align-items: center; justify-content: start; }
.checkbox input { min-height: 0; }
.actions { display: flex; gap: 10px; margin-top: 4px; }
.notice { margin: 16px 0; padding: 12px 14px; border: 1px solid #dce5ff; border-radius: 7px; color: #3156a8; background: #f2f6ff; font-size: 13px; }
.notice.error { border-color: #f1d0d0; color: #a63737; background: #fff5f5; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0, #e8edff 0, #f4f6fb 55%); }
.login-card { width: min(420px, 100%); padding: 34px; }
.login-card h1 { font-size: 27px; }
.login-card > p { margin: 9px 0 22px; font-size: 14px; }
.login-card .button { width: 100%; margin-top: 2px; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 15px 20px; }
  .brand-group { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
  .device-status { flex-wrap: wrap; }
  nav { width: 100%; flex-wrap: wrap; gap: 14px 20px; }
  .page { width: min(100% - 28px, 1180px); margin-top: 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 24px; }
}

@media (max-width: 560px) {
  .date-filter { width: 100%; flex-wrap: wrap; }
  .date-filter label { flex: 1 1 150px; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { padding: 7px 15px; border-top: 1px solid #edf0f5; }
  td { display: flex; justify-content: space-between; gap: 16px; padding: 8px 2px; border: 0; white-space: normal; text-align: right; }
  td::before { content: attr(data-label); color: #74809a; font-weight: 650; text-align: left; }
  td.empty { display: block; text-align: center; }
  td.empty::before { content: none; }
  .form-panel { padding: 18px; }
  .login-card { padding: 26px; }
}
