:root {
  --bg: #f4f6f8; --surface: #fff; --line: #e2e7ec; --text: #17212b;
  --muted: #687583; --blue: #1672e5; --blue-dark: #0d5fc7; --blue-soft: #eaf3ff;
  --green: #148455; --green-soft: #e8f7f0; --red: #c73f4d; --red-soft: #fff0f1;
  --radius: 16px; --shadow: 0 8px 26px rgba(35, 54, 76, .06);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.topbar { position: sticky; z-index: 20; top: 0; height: 72px; padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; color: #fff; background: var(--blue); font-weight: 800; }
.brand span:last-child { display: grid; line-height: 1.1; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.topbar nav { display: flex; align-items: center; gap: 24px; color: var(--muted); font-weight: 600; }
.topbar nav form { margin: 0; }
.link-button { padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-weight: 600; }
.topbar a:hover, .link-button:hover { color: var(--blue); }
.page { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 80px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.015em; }
.eyebrow { margin-bottom: 8px; color: var(--blue); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.button { min-height: 42px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 700; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border-color: var(--line); color: var(--text); background: #fff; }
.button-light { color: var(--blue); background: #fff; }
.button-danger { border-color: #f5c9ce; color: var(--red); background: var(--red-soft); }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.full-width { width: 100%; }
.card { margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card > form, .card > .empty, .side-stack .card { padding: 24px; }
.card-header { min-height: 64px; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.card-header p { margin: 4px 0 0; }
.diagnostic-content { padding: 20px 24px; }
.diagnostic-content summary { cursor: pointer; color: var(--blue); margin-bottom: 16px; }
.diagnostic-search { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.diagnostic-search label { flex: 1; min-width: 220px; }
.diagnostic-content td { overflow-wrap: anywhere; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 20px; display: grid; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat strong { font-size: 28px; line-height: 1; }
.stat span { margin-top: 9px; color: var(--muted); font-size: 13px; }
.stat-critical strong { color: var(--red); }
.stat-warning strong { color: #a86700; }
.health-banner { margin-bottom: 22px; padding: 17px 20px; display: grid; grid-template-columns: 13px 1fr auto; align-items: center; gap: 14px; border: 1px solid; border-radius: 14px; }
.health-banner span:nth-child(2) { display: grid; }
.health-banner small { margin-top: 3px; }
.health-banner > b { font-size: 13px; }
.health-banner--healthy { border-color: #bce5d4; color: #0c6c45; background: var(--green-soft); }
.health-banner--warning { border-color: #f0d39f; color: #895700; background: #fff8e9; }
.health-banner--critical { border-color: #f1c2c8; color: #9d2633; background: var(--red-soft); }
.health-signal { width: 11px; height: 11px; display: block; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(255,255,255,.55); }
.health-hero { margin-bottom: 22px; padding: 24px; display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 16px; border: 1px solid; border-radius: var(--radius); }
.health-hero h2, .health-hero p { margin-bottom: 0; }
.health-hero p, .health-hero small { opacity: .78; }
.health-hero--healthy { border-color: #bce5d4; color: #0c6c45; background: var(--green-soft); }
.health-hero--warning { border-color: #f0d39f; color: #895700; background: #fff8e9; }
.health-hero--critical { border-color: #f1c2c8; color: #9d2633; background: var(--red-soft); }
.health-issue-list { display: grid; }
.health-issue { min-height: 86px; padding: 17px 22px; display: grid; grid-template-columns: 12px minmax(260px, 1fr) minmax(160px, .35fr); align-items: center; gap: 15px; border-top: 1px solid var(--line); }
.health-issue:first-child { border-top: 0; }
.health-issue--critical { color: var(--red); }
.health-issue--warning { color: #a86700; }
.health-issue p { margin: 3px 0 0; color: var(--muted); }
.health-issue-meta { display: grid; justify-items: end; text-align: right; }
.health-issue-meta a { color: var(--blue); font-weight: 700; }
.health-issue-meta small { margin-top: 4px; color: var(--muted); }
.health-issue-meta form { margin-top: 10px; }
.health-status { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.health-status--healthy { color: var(--green); background: var(--green-soft); }
.health-status--warning { color: #895700; background: #fff3d7; }
.health-status--critical { color: var(--red); background: var(--red-soft); }
.table-link { color: var(--blue); font-weight: 700; }
.tenant-row { min-height: 88px; padding: 18px 22px; display: grid; grid-template-columns: 12px minmax(180px, 1.2fr) minmax(230px, 1fr) 120px 16px; align-items: center; gap: 16px; border-top: 1px solid var(--line); }
.tenant-row:first-child { border-top: 0; }
.tenant-row:hover { background: #f9fbfd; }
.status-dot { width: 9px; height: 9px; display: inline-block; flex: 0 0 9px; border-radius: 50%; background: #adb6bf; }
.status-dot.online { background: #16a36a; box-shadow: 0 0 0 4px #e5f6ef; }
.status-dot.disabled { background: #d85a66; }
.tenant-main, .connection-state { display: grid; }
.tenant-main small, .connection-state small { margin-top: 4px; color: var(--muted); }
.connection-state { text-align: right; }
.success-text { color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .badge { padding: 5px 9px; display: inline-flex; border-radius: 999px; color: #175da8; background: var(--blue-soft); font-size: 12px; font-weight: 700; }
.badge-success { color: var(--green); background: var(--green-soft); }
.badge-muted { color: var(--muted); background: #edf0f3; }
.chevron { color: #99a4ae; font-size: 26px; }
.empty { padding: 60px 24px !important; text-align: center; color: var(--muted); }
.empty.compact { padding: 26px !important; }
.empty p { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { border-top: 0; color: var(--muted); background: #fafbfc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td:last-child { white-space: normal; }
code { color: #155ca9; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.breadcrumbs { margin-bottom: 22px; display: flex; gap: 9px; color: var(--muted); font-size: 13px; }
.breadcrumbs a:hover { color: var(--blue); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); align-items: start; gap: 22px; }
.side-stack { display: grid; gap: 22px; }
.side-stack .card { margin: 0; }
.side-stack .card-header { margin: -24px -24px 20px; }
.form-stack { display: grid; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
label { display: grid; gap: 7px; color: #4e5a66; font-size: 13px; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input, select { width: 100%; height: 44px; padding: 0 13px; border: 1px solid #ced6de; border-radius: 10px; color: var(--text); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,114,229,.12); }
select:disabled { color: #8a96a2; background: #f3f5f7; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.module-list { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.module-row { padding: 17px; display: grid; grid-template-columns: minmax(190px, .75fr) 1.25fr; align-items: center; gap: 22px; border-top: 1px solid var(--line); }
.module-row:first-child { border-top: 0; }
.switch-label { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-label > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-label > span:last-child { display: grid; }
.switch-label small { margin-top: 2px; }
.switch { width: 42px; height: 24px; position: relative; flex: 0 0 42px; border-radius: 999px; background: #c9d0d7; transition: .2s; }
.switch::after { content: ""; width: 18px; height: 18px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch-label input:checked + .switch { background: var(--blue); }
.switch-label input:checked + .switch::after { transform: translateX(18px); }
.binding-field { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.pairing-card { margin-bottom: 22px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: var(--radius); color: #fff; background: var(--blue); }
.pairing-card .eyebrow { color: #cfe5ff; }
.pairing-card strong { display: block; margin: 4px 0 8px; font: 800 clamp(28px, 5vw, 44px) ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.pairing-card p:last-child { margin-bottom: 0; color: #ddecff; }
.installation { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.installation > div:first-child { display: flex; align-items: center; gap: 9px; }
.capabilities { margin: 0 0 18px; }
.capabilities .chips { margin-top: 10px; }
.capabilities .chip { font-size: 10px; }
dl { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px 14px; margin: 18px 0; font-size: 13px; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.danger-zone { display: grid; gap: 16px; }
.danger-zone p { margin: 7px 0 0; }
.connection-summary { padding: 12px 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; }
.connection-summary.is-online { color: var(--green); background: var(--green-soft); }
.connection-summary.is-error { color: var(--red); background: var(--red-soft); }
.iiko-wizard__body { padding: 24px; }
.iiko-wizard .card-header { min-height: 88px; }
.iiko-wizard .connection-summary { min-width: 240px; }
.iiko-setup-steps { margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; }
.iiko-setup-steps li { min-width: 0; position: relative; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.iiko-setup-steps li::after { content: ""; height: 1px; position: absolute; z-index: 0; right: 10px; left: 38px; background: var(--line); }
.iiko-setup-steps li:last-child::after { display: none; }
.iiko-setup-steps b { width: 30px; height: 30px; position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 30px; border: 1px solid var(--line); border-radius: 50%; background: #fff; }
.iiko-setup-steps span { position: relative; z-index: 1; padding-right: 10px; overflow: hidden; background: #fff; text-overflow: ellipsis; white-space: nowrap; }
.iiko-setup-steps li.is-active { color: var(--blue); }
.iiko-setup-steps li.is-active b { color: #fff; border-color: var(--blue); background: var(--blue); }
.iiko-setup-steps li.is-complete { color: var(--green); }
.iiko-setup-steps li.is-complete b { color: #fff; border-color: var(--green); background: var(--green); }
.iiko-wizard__step[hidden] { display: none; }
.section-heading { margin-bottom: 20px; }
.section-heading h3 { margin-bottom: 5px; font-size: 19px; }
.section-heading p { margin-bottom: 0; }
.iiko-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.iiko-fields--credentials { grid-template-columns: repeat(3, minmax(0,1fr)); }
.iiko-field-wide { grid-column: 1 / -1; }
.iiko-auto-value { min-height: 72px; padding: 12px 14px; display: grid; align-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.iiko-auto-value span, .iiko-auto-value small { color: var(--muted); font-size: 11px; }
.iiko-auto-note, .iiko-security-note { margin-top: 18px; padding: 15px 17px; display: grid; gap: 4px; border-radius: 12px; }
.iiko-auto-note { color: #245a93; background: var(--blue-soft); }
.iiko-security-note { border: 1px solid var(--line); background: #fafbfc; }
.iiko-auto-note strong, .iiko-security-note strong { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.iiko-auto-note span, .iiko-security-note span, .iiko-security-note small { color: var(--muted); font-size: 12px; }
.iiko-result { min-height: 48px; margin-top: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fafbfc; }
.iiko-result.is-loading { color: var(--blue); background: var(--blue-soft); }
.iiko-result.is-success { color: var(--green); background: var(--green-soft); }
.iiko-result.is-error { color: var(--red); background: var(--red-soft); }
.iiko-wizard .form-actions { margin-top: 18px; }
.waiter-settings-presets { display: flex; flex-wrap: wrap; gap: 10px; }
.waiter-settings-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.waiter-settings fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.waiter-settings legend { padding: 0 7px; font-weight: 800; }
.waiter-feature { margin: 4px 0; cursor: pointer; }
.waiter-feature > input { position: absolute; opacity: 0; pointer-events: none; }
.waiter-feature > span { min-height: 42px; display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; }
.waiter-feature i { width: 20px; height: 20px; display: grid; place-items: center; border: 2px solid #aab5c0; border-radius: 50%; }
.waiter-feature input:checked + span i { border-color: var(--blue); }
.waiter-feature input:checked + span i::after { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); content: ""; }
.waiter-feature b { font-size: 13px; }
.waiter-feature small { grid-column: 2; margin-top: -7px; }
.status-label { padding: 4px 8px; border-radius: 999px; background: #edf0f3; font-size: 12px; font-weight: 700; }
.status-completed { color: var(--green); background: var(--green-soft); }
.status-failed, .status-timed_out { color: var(--red); background: var(--red-soft); }
.notice { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 11px; }
.notice-success { border-color: #bce5d4; color: #0c6c45; background: var(--green-soft); }
.notice-error { border-color: #f1c2c8; color: #9d2633; background: var(--red-soft); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 30px 0; }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(33,53,75,.12); }
.login-brand { margin-bottom: 24px; }
.login-card h1 { font-size: 30px; }
.login-card .button { margin-top: 4px; }
.narrow-card { max-width: 680px; }
details summary { cursor: pointer; color: var(--blue); }
pre { max-width: 440px; padding: 10px; overflow: auto; border-radius: 8px; color: #d7e4f3; background: #17212b; font-size: 11px; }

@media (max-width: 820px) {
  .topbar { height: 64px; padding: 0 18px; }
  .brand small, .topbar nav > a { display: none; }
  .topbar nav { gap: 14px; }
  .page { width: min(100% - 28px, 680px); padding: 28px 0 60px; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 28px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .health-hero { grid-template-columns: 13px 1fr; }
  .health-hero > small { grid-column: 2; }
  .health-issue { grid-template-columns: 12px 1fr; }
  .health-issue-meta { grid-column: 2; justify-items: start; text-align: left; }
  .tenant-row { grid-template-columns: 10px 1fr 16px; gap: 12px; }
  .tenant-row .chips { grid-column: 2; }
  .connection-state { grid-column: 2; text-align: left; }
  .chevron { grid-column: 3; grid-row: 1 / span 3; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid, .module-row { grid-template-columns: 1fr; }
  .module-row { gap: 14px; }
  .pairing-card { align-items: stretch; flex-direction: column; }
  .pairing-card strong { font-size: 30px; }
  .pairing-card .button { align-self: flex-start; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .iiko-wizard .connection-summary { width: 100%; min-width: 0; }
  .iiko-fields, .iiko-fields--credentials { grid-template-columns: 1fr; }
  .waiter-settings-groups { grid-template-columns: 1fr; }
  .iiko-field-wide { grid-column: auto; }
}
@media (max-width: 480px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading > .button { width: 100%; }
  .stats-grid { gap: 9px; }
  .stat { padding: 15px; }
  .stat strong { font-size: 24px; }
  .card > form, .side-stack .card { padding: 18px; }
  .side-stack .card-header { margin: -18px -18px 18px; }
  .login-card { padding: 28px 22px; }
  .iiko-wizard__body { padding: 18px; }
  .iiko-setup-steps span { font-size: 10px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}
