:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #17191d;
  background: #f2f4f8;
  font-synthesis: none;
  --brand: #487cdb;
  --brand-strong: #315fb8;
  --brand-soft: #edf3ff;
  --ink: #17191d;
  --muted: #687181;
  --line: #dfe3ea;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;
  --success: #21845a;
  --danger: #b63d3a;
  --shadow: 0 16px 44px rgba(24, 34, 58, 0.07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; padding-top: 38px; background: #f2f4f8; }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-titlebar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: 38px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid #2b303c;
  background: #171a22;
  color: #fff;
  user-select: none;
}

.app-drag-region {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  -webkit-app-region: drag;
}

.app-drag-region img { width: 19px; height: 19px; border-radius: 5px; }
.app-drag-region strong { font-size: 11px; letter-spacing: -0.01em; }
.app-drag-region span { color: #7f899b; font-size: 9px; }

.window-controls { display: flex; -webkit-app-region: no-drag; }
.window-controls button {
  width: 46px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aeb6c5;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.window-controls button:hover { background: #292e39; color: #fff; }
.window-controls .window-close:hover { background: #c94242; color: #fff; }
.window-controls svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.15; }

.shell {
  min-height: calc(100vh - 38px);
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.rail {
  position: fixed;
  inset: 38px auto 0 0;
  z-index: 10;
  width: 238px;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow-y: auto;
  background: #161922;
  color: #fff;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand img { width: 42px; height: 42px; display: block; border-radius: 12px; box-shadow: 0 9px 24px rgba(72, 124, 219, 0.28); }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 15px; letter-spacing: -0.02em; }
.brand small { color: #aeb6c5; font-size: 10px; }

.rail-nav { display: grid; gap: 7px; margin: 32px 0 auto; }
.rail-nav-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: #aeb6c5;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.rail-nav-item:hover { background: #202532; color: #fff; }
.rail-nav-item:active { transform: translateY(1px); }
.rail-nav-item.is-active { border-color: #39445c; background: #262c3a; color: #fff; }
.rail-nav-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #252a36;
  color: #8691a5;
  font-size: 9px;
  font-weight: 900;
}
.rail-nav-item.is-active .rail-nav-icon { background: var(--brand); color: #fff; }
.rail-nav-item > span:last-child { min-width: 0; display: grid; gap: 3px; }
.rail-nav-item strong { font-size: 11px; }
.rail-nav-item small { overflow: hidden; color: #7f899b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.rail-nav-item.is-active small { color: #aebce0; }

.privacy { display: grid; gap: 5px; margin-top: 22px; padding: 14px; border: 1px solid #303746; border-radius: 13px; background: #1c202a; }
.privacy b { font-size: 10px; }
.privacy span { color: #929cac; font-size: 9px; line-height: 1.5; }

.workspace {
  grid-column: 2;
  min-width: 0;
  height: calc(100vh - 38px);
  padding: 26px clamp(24px, 4vw, 48px) 112px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.workspace-header p, .section-heading p, .preview-card-head p { margin: 0 0 7px; color: var(--brand); font-size: 9px; font-weight: 900; letter-spacing: 0.16em; }
.workspace-header h1 { margin: 0; font-size: 30px; line-height: 1; letter-spacing: -0.045em; }
.workspace-subtitle { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.status { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #616a78; font-size: 10px; font-weight: 800; box-shadow: 0 6px 20px rgba(24, 34, 58, 0.04); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #9aa2ae; }
.status.is-connected i { background: var(--success); box-shadow: 0 0 0 4px #e1f3ea; }
.status.is-error i { background: var(--danger); box-shadow: 0 0 0 4px #fae7e6; }

.view-panel { opacity: 1; }
.overview-grid, .receipt-settings-grid { display: grid; grid-template-columns: minmax(310px, 0.9fr) minmax(330px, 1.1fr); gap: 16px; align-items: start; }

.readiness-card, .preview-card, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.readiness-card { overflow: hidden; }
.section-heading, .preview-card-head, .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid #e9ecf1; }
.section-heading h2, .preview-card-head h2, .panel-title h2 { margin: 0; font-size: 16px; letter-spacing: -0.025em; }
.readiness-score { display: grid; min-width: 48px; height: 34px; place-items: center; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-size: 11px; font-weight: 900; }
.readiness-list { display: grid; padding: 8px; }
.readiness-item { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.readiness-item:hover { background: var(--surface-soft); }
.readiness-item > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.readiness-item strong { font-size: 11px; }
.readiness-item small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.readiness-item > b { color: #a5adba; font-size: 16px; }
.readiness-check { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #d9dee7; border-radius: 10px; background: #f5f7fa; color: #7a8493; font-size: 10px; font-weight: 900; }
.readiness-check.is-ready { border-color: #ccebdc; background: #e9f7f0; color: var(--success); }
.agent-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid #e9ecf1; background: #fafbfc; }
.agent-summary div { min-width: 0; display: grid; gap: 5px; padding: 13px 14px; border-right: 1px solid #e9ecf1; }
.agent-summary div:last-child { border-right: 0; }
.agent-summary span { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.agent-summary strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.preview-card { overflow: hidden; }
.preview-card-head { align-items: flex-start; }
.preview-switch { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: #f0f2f6; }
.preview-switch button { min-height: 28px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: #737c8a; font-size: 8px; font-weight: 850; cursor: pointer; }
.preview-switch button.is-active { background: #fff; color: var(--ink); box-shadow: 0 2px 7px rgba(20, 28, 45, 0.1); }
.receipt-stage { min-height: 350px; display: grid; place-items: start center; padding: 20px; overflow: auto; background: #e9ecf1; }
.receipt-stage iframe { width: 302px; max-width: 100%; height: 430px; border: 0; background: #fff; box-shadow: 0 10px 28px rgba(20, 28, 45, 0.18); transition: width 180ms ease; }
.preview-actions { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; border-top: 1px solid #e9ecf1; }
.preview-actions span { color: var(--muted); font-size: 9px; }

.panel { margin-bottom: 16px; overflow: hidden; }
.panel-title { justify-content: flex-start; }
.panel-title > span { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 900; }
.panel-title > div { display: grid; gap: 4px; }
.panel-title p { margin: 0; color: var(--muted); font-size: 10px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.field-section-heading {
  display: flex;
  min-height: 48px;
  margin: 2px 0 -2px;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e1e5eb;
  border-radius: 11px;
  background: #f7f8fb;
}
.field-section-heading > div { display: grid; gap: 3px; }
.field-section-heading strong { font-size: 10px; }
.field-section-heading small { color: var(--muted); font-size: 8px; line-height: 1.35; }
.field-section-heading > span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .1em;
}
label { min-width: 0; }
.fields label, .route-card label { display: grid; gap: 6px; }
.fields label > span, .route-card label > span { font-size: 10px; font-weight: 850; }
.fields label > small { min-height: 14px; color: var(--muted); font-size: 9px; line-height: 1.4; }
input, select { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #d9dee7; border-radius: 10px; outline: 0; background: #fafbfc; color: var(--ink); font-size: 11px; }
input:hover, select:hover { border-color: #b9c2cf; }
input:focus-visible, select:focus-visible { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(72, 124, 219, 0.15); }
.panel-actions { display: flex; align-items: center; gap: 12px; padding: 0 20px 20px; }
.panel-actions > span { color: var(--muted); font-size: 9px; }
.secondary, .routes button, .custom-routes button, .icon-button { min-height: 36px; padding: 0 13px; border: 1px solid #d8dde6; border-radius: 9px; background: #fff; color: var(--ink); font-size: 9px; font-weight: 850; cursor: pointer; }
.secondary:hover, .routes button:hover, .icon-button:hover { border-color: #b7c0ce; background: #f7f8fb; }
.icon-button { width: 38px; height: 38px; margin-left: auto; padding: 0; font-size: 17px; }
.panel-title > div:not(.panel-title-actions) { min-width: 0; flex: 1; }
.panel-title > .panel-title-actions { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.panel-title-actions .icon-button { margin-left: 0; }

.check { position: relative; grid-template-columns: 38px minmax(0, 1fr) !important; align-items: center; align-content: center; padding: 8px 0; cursor: pointer; }
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check > i { position: relative; width: 38px; height: 23px; border-radius: 999px; background: #bbc2cd; transition: background 160ms ease; }
.check > i::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); content: ""; transition: transform 160ms ease; }
.check input:checked + i { background: var(--brand); }
.check input:checked + i::after { transform: translateX(15px); }
.check > span { display: grid; gap: 3px; }
.check b { font-size: 10px; }
.check small { color: var(--muted); font-size: 9px; }

.routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.custom-routes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:0 18px 18px}
.route-card { display: grid; align-content: start; gap: 13px; padding: 15px; border: 1px solid #e1e5eb; border-radius: 14px; background: #fafbfc; }
.route-label { min-height: 42px; display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 9px; align-items: start; }
.route-label > div { display: grid; gap: 4px; }
.route-label strong { font-size: 11px; }
.route-label small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.route-dot { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--brand); }
.route-dot-cancel { background: var(--danger); }
.route-dot-cashier { background: var(--success); }
.route-dot-custom{background:#7b5dcc}
.routes button { width: 100%; margin-top: 2px; }
.route-help { display: flex; align-items: center; gap: 10px; margin: 0 18px 18px; padding: 12px 14px; border-radius: 11px; background: var(--brand-soft); }
.route-help strong { flex: 0 0 auto; color: var(--brand-strong); font-size: 9px; }
.route-help span { color: #66718a; font-size: 9px; }

.receipt-settings-grid { grid-template-columns: minmax(340px, 0.95fr) minmax(330px, 1.05fr); }
.receipt-options { margin: 0; }
.receipt-guidance { margin: 0 20px 20px; padding: 14px; border: 1px solid #dce5f6; border-radius: 12px; background: var(--brand-soft); }
.receipt-guidance strong { color: var(--brand-strong); font-size: 10px; }
.receipt-guidance p { margin: 6px 0 0; color: #657089; font-size: 9px; line-height: 1.55; }
.receipt-editor-preview { position: sticky; top: 0; }

.workspace-footer { position: fixed; z-index: 8; right: 0; bottom: 0; left: 238px; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(24px, 4vw, 48px); border-top: 1px solid rgba(210, 216, 226, 0.94); background: rgba(249, 250, 252, 0.94); box-shadow: 0 -10px 30px rgba(20, 28, 45, 0.05); backdrop-filter: blur(14px); }
.footer-state { min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; }
.footer-state span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-state .is-error { color: var(--danger); }
.save-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.footer-actions { display: flex; align-items: center; gap: 9px; }
.primary { min-height: 42px; padding: 0 17px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 20px rgba(72, 124, 219, 0.22); }
.primary:hover { background: var(--brand-strong); }
button:disabled { opacity: .55; cursor: wait; }
.director-auth{position:fixed;z-index:50;inset:0;display:grid;padding:24px;background:rgba(12,17,27,.7);backdrop-filter:blur(8px);place-items:center}.director-auth[hidden]{display:none}.director-auth section{width:min(430px,100%);display:grid;grid-template-columns:52px minmax(0,1fr);gap:18px;padding:26px;border:1px solid rgba(255,255,255,.12);border-radius:20px;background:#fff;box-shadow:0 24px 70px rgba(7,12,22,.32)}.director-auth-mark{display:grid;width:48px;height:48px;border-radius:14px;background:var(--brand);color:#fff;font-size:20px;font-weight:900;place-items:center}.director-auth section>div{display:grid;gap:5px}.director-auth p{margin:0;color:var(--brand);font-size:8px;font-weight:900;letter-spacing:.16em}.director-auth h2{margin:0;font-size:22px}.director-auth section>div>span{color:var(--muted);font-size:10px;line-height:1.5}.director-auth label,.director-auth footer,.director-auth small{grid-column:1/-1}.director-auth label{display:grid;gap:6px}.director-auth label>span{font-size:10px;font-weight:850}.director-auth small{padding:9px 11px;border-radius:8px;background:#fff0f0;color:var(--danger);font-size:9px}.director-auth footer{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}

@media (max-width: 900px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  .rail { width: 210px; }
  .workspace-footer { left: 210px; }
  .overview-grid, .receipt-settings-grid { grid-template-columns: 1fr; }
  .receipt-editor-preview { position: static; }
  .routes { grid-template-columns: 1fr; }
  .custom-routes{grid-template-columns:1fr}
  .route-card { grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.3fr) 74px; align-items: end; }
  .route-label { align-self: center; }
  .route-card button { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .shell { display: block; }
  .rail { position: static; width: auto; min-height: 0; padding: 16px; }
  .rail-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0 0; }
  .rail-nav-item { min-height: 44px; grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .rail-nav-item > span:last-child small, .privacy, .rail-nav-icon { display: none; }
  .workspace { height: auto; padding: 22px 16px 104px; }
  .workspace-footer { left: 0; padding: 12px 16px; }
  .fields, .fields.two { grid-template-columns: 1fr; }
  .fields .wide { grid-column: auto; }
  .agent-summary { grid-template-columns: 1fr; }
  .agent-summary div { border-right: 0; border-bottom: 1px solid #e9ecf1; }
  .agent-summary div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
/* Global legibility floor; kept here as well as fixes.css for packaged/offline builds. */
small,.app-rail nav strong,.app-rail nav span,.app-rail nav small,.app-brand strong,.app-brand span,.rail-nav-icon{font-size:12px!important;line-height:1.4!important}
button,input,select,textarea{font-size:13px!important;line-height:1.4!important}
[class*="label"],[class*="meta"],[class*="status"],.eyebrow,.kicker{font-size:12px!important;line-height:1.4!important}
.app-drag-region :is(strong,span),.rail-nav-item strong,.privacy :is(b,span),.workspace-header>div>p,.workspace-header>div>span,.section-heading>div>p,.section-heading>span,.readiness-item :is(span,strong),.agent-summary :is(span,strong),.preview-card-head p,.preview-actions span,.footer-state span{font-size:12px!important;line-height:1.4!important}
@media(max-width:720px){.main-content h1,.page-heading h1,h1{font-size:24px!important;line-height:1.2!important}}
