:root {
  color-scheme: light;
  --ink: #12372e;
  --ink-soft: #405c52;
  --canvas: #f1f6f3;
  --surface: #ffffff;
  --line: #d4e0da;
  --line-strong: #bdcec5;
  --teal: #167a5a;
  --teal-soft: #e0f2ea;
  --coral: #d65d4b;
  --coral-soft: #fde9e7;
  --gold: #a9731f;
  --gold-soft: #fff3d5;
  --green: #23805b;
  --green-soft: #dff3e9;
  --red: #c33f49;
  --red-soft: #fbe6e8;
  --shadow: 0 12px 36px rgba(18, 55, 46, .08);
  --radius: 8px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 12px clamp(18px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #fff;
  background: var(--ink);
  border-bottom: 4px solid var(--teal);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand-name { font-size: 21px; font-weight: 750; }
.brand-area { padding-left: 12px; border-left: 1px solid rgba(255,255,255,.28); color: #c7d4dd; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d6e1e8;
  font-size: 13px;
}
.connection-state::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e6ad42;
  box-shadow: 0 0 0 4px rgba(230,173,66,.15);
}
.connection-state[data-state="online"]::before { background: #52c997; box-shadow: 0 0 0 4px rgba(82,201,151,.15); }
.connection-state[data-state="offline"]::before { background: #f47878; box-shadow: 0 0 0 4px rgba(244,120,120,.15); }

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; transform: none; }
.button-primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { background: #0f6247; }
.button-secondary { background: var(--surface); border-color: var(--line-strong); }
.button-secondary:hover { border-color: var(--teal); color: var(--teal); }
.button-danger { color: var(--red); background: var(--red-soft); border-color: #efbfc4; }
.button-danger:hover { color: #fff; background: var(--red); border-color: var(--red); }
.button-quiet { min-height: 36px; padding: 7px 12px; color: #fff; background: transparent; border-color: rgba(255,255,255,.24); }
.button-block { width: 100%; }

.centered-view { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 58px 0 80px; }
.setup-header { max-width: 720px; margin-bottom: 28px; }
.setup-header h1, .login-view h1 { margin: 4px 0 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: 0; }
.setup-header > p:last-child, .login-view > p { margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.6; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; }

.stepper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0 0 18px;
  list-style: none;
}
.stepper li {
  min-height: 74px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  background: #e8edf1;
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.stepper li > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: #8c9aa7;
  font-weight: 800;
}
.stepper strong, .stepper small { display: block; }
.stepper small { margin-top: 3px; }
.stepper li[data-state="active"] { color: var(--ink); background: var(--teal-soft); border-color: #98cfce; }
.stepper li[data-state="active"] > span { background: var(--teal); }
.stepper li[data-state="complete"] { color: var(--green); background: var(--green-soft); }
.stepper li[data-state="complete"] > span { background: var(--green); }

.setup-panel, .editor-panel, .login-form {
  padding: clamp(20px, 4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-heading, .page-heading, .section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.panel-heading { margin-bottom: 20px; }
.panel-heading h2, .section-title h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.form-intro { max-width: 720px; margin: -4px 0 22px; color: var(--ink-soft); line-height: 1.55; }
.tag { align-self: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.tag-teal { color: #05606a; background: var(--teal-soft); }
.tag-coral { color: #a33d3c; background: var(--coral-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .search-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  scroll-margin-top: 84px;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .search-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8,127,140,.13);
}
.form-actions { margin-top: 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-status { display: block; min-height: 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.form-status[data-error="true"] { color: var(--red); }

.login-view { width: min(460px, calc(100% - 32px)); text-align: center; }
.login-mark { width: 80px; height: 80px; margin: 0 auto 20px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-view > p { font-size: 15px; }
.login-form { margin-top: 28px; display: grid; gap: 16px; text-align: left; }

.app-view { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  padding: 28px 18px;
  overflow-y: auto;
  color: #eef4f7;
  background: #164437;
}
.profile-block { padding: 0 8px 24px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.12); }
.profile-initials { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--coral); border-radius: 7px; font-weight: 800; }
.profile-block strong, .profile-block small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-block small { margin-top: 3px; color: #aebdc8; font-size: 11px; }
.side-nav { margin-top: 22px; display: grid; gap: 5px; }
.side-nav button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c9d5dc;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-weight: 650;
}
.nav-mark { width: 9px; height: 9px; flex: 0 0 auto; border: 2px solid currentColor; border-radius: 2px; }
.side-nav button:hover, .side-nav button[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); }
.side-nav button[aria-current="page"] .nav-mark { border-color: var(--coral); background: var(--coral); }
.status-link { display: block; margin: 30px 12px 0; color: #91d2d5; font-size: 13px; text-decoration: none; }
.workspace { min-width: 0; padding: clamp(24px, 4vw, 46px); }
.mobile-nav { display: none; }
.page { display: none; }
.page[data-active="true"] { display: block; }
.page-heading { margin-bottom: 28px; align-items: center; }
.page-heading h1 { margin: 2px 0 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: 0; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  min-height: 132px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(23,33,43,.04);
}
.stat-card[data-tone="teal"] { border-top: 4px solid var(--teal); }
.stat-card[data-tone="coral"] { border-top: 4px solid var(--coral); }
.stat-card[data-tone="gold"] { border-top: 4px solid #d59a32; }
.stat-card[data-tone="ink"] { border-top: 4px solid var(--ink); }
.stat-card strong { display: block; margin: 8px 0 5px; font-size: 30px; line-height: 1; }
.stat-card span, .stat-card small { display: block; color: var(--ink-soft); }
.stat-card span { font-size: 12px; font-weight: 800; text-transform: uppercase; }
.stat-card small { line-height: 1.4; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 20px; }
.data-section {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.section-title { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.section-title p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.component-list, .compact-list, .record-list { margin-top: 6px; }
.component-row, .compact-row, .record-row {
  min-height: 58px;
  padding: 13px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #edf1f4;
}
.component-row:last-child, .compact-row:last-child, .record-row:last-child { border-bottom: 0; }
.status-label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.status-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #93a1ad; }
.status-dot.operational, .status-dot.online { background: var(--green); }
.status-dot.degraded, .status-dot.offline { background: var(--red); }
.status-dot.initializing, .status-dot.setup_required { background: #d19732; }
.compact-row strong, .compact-row small { display: block; }
.compact-row small { margin-top: 3px; color: var(--ink-soft); }
.empty-state { padding: 30px 8px; color: var(--ink-soft); text-align: center; }

.split-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: 20px; align-items: start; }
.split-workspace-wide { grid-template-columns: minmax(0, 1.15fr) minmax(370px, .85fr); }
.editor-panel { position: sticky; top: 92px; display: grid; gap: 15px; border-top-color: var(--coral); }
.editor-divider { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.icon-close { width: 36px; height: 36px; padding: 0; color: var(--ink-soft); background: #eef2f5; border: 0; border-radius: 6px; font-size: 26px; line-height: 1; }
.toggle-row { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-weight: 700; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--teal); }
.record-row { align-items: flex-start; }
.record-primary { min-width: 0; }
.record-primary strong, .record-primary span { display: block; overflow-wrap: anywhere; }
.record-primary span { margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.record-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.record-action { min-height: 34px; padding: 6px 10px; color: var(--teal); background: var(--teal-soft); border: 0; border-radius: 6px; font-size: 12px; font-weight: 800; }
.role-badge { padding: 4px 7px; color: var(--ink-soft); background: #edf1f4; border-radius: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.role-badge.admin { color: #a33d3c; background: var(--coral-soft); }
.plan-badge { padding: 4px 7px; color: #05606a; background: var(--teal-soft); border-radius: 5px; font-size: 11px; font-weight: 800; }
.inactive-badge { padding: 4px 7px; color: var(--red); background: var(--red-soft); border-radius: 5px; font-size: 11px; font-weight: 800; }
.status-badge {
  padding: 5px 8px;
  color: var(--ink-soft);
  background: #edf1f4;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge[data-status="active"],
.status-badge[data-status="paid"],
.status-badge[data-status="resolved"] { color: var(--green); background: var(--green-soft); }
.status-badge[data-status="open"],
.status-badge[data-status="in_progress"],
.status-badge[data-status="pending_payment"],
.status-badge[data-status="contact_required"],
.status-badge[data-status="waiting_customer"] { color: var(--gold); background: var(--gold-soft); }
.status-badge[data-status="failed"],
.status-badge[data-status="cancelled"],
.status-badge[data-status="refunded"],
.status-badge[data-status="closed"] { color: var(--red); background: var(--red-soft); }

.compact-form-grid { gap: 10px; }
.catalog-editor { max-height: calc(100vh - 116px); overflow-y: auto; }
.catalog-list { display: grid; }
.catalog-row {
  min-height: 84px;
  padding: 14px 2px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(110px, .35fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #edf1f4;
}
.catalog-row:last-child { border-bottom: 0; }
.catalog-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.catalog-identity strong, .catalog-identity small, .catalog-price strong, .catalog-price small { display: block; }
.catalog-identity small, .catalog-price small { margin-top: 3px; color: var(--ink-soft); font-size: 12px; }
.catalog-type {
  width: 52px;
  min-height: 34px;
  padding: 6px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
}
.catalog-price { text-align: right; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.translation-stack { display: grid; gap: 10px; }
.translation-stack fieldset {
  padding: 13px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.translation-stack legend { padding: 0 6px; color: var(--teal); font-size: 12px; font-weight: 800; }
.order-row small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 12px; }
.order-amount { font-weight: 850; white-space: nowrap; }
.order-details { display: grid; gap: 9px; }
.order-details > div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-soft); }
.order-details > div strong { color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.order-details ul { padding: 12px 0 0; margin: 3px 0 0; border-top: 1px solid var(--line); list-style: none; }
.order-details li { padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }

.support-workspace { display: grid; grid-template-columns: minmax(300px, .42fr) minmax(440px, .58fr); gap: 20px; align-items: start; }
.ticket-list { display: grid; }
.ticket-row {
  width: 100%;
  padding: 14px 2px;
  display: grid;
  gap: 6px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
}
.ticket-row:hover { color: var(--teal); }
.ticket-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ticket-row small { color: var(--ink-soft); }
.ticket-thread { position: sticky; top: 92px; }
.ticket-customer { padding: 12px; display: grid; gap: 3px; background: #edf3f5; border-left: 4px solid var(--teal); border-radius: 6px; }
.ticket-customer span { color: var(--ink-soft); font-size: 13px; }
.message-thread { max-height: 390px; margin: 16px 0; overflow-y: auto; display: grid; gap: 10px; }
.message { width: min(88%, 640px); padding: 12px 14px; background: #edf1f4; border-radius: 6px; }
.message[data-author="support"] { margin-left: auto; background: var(--teal-soft); }
.message > div { display: flex; justify-content: space-between; gap: 12px; }
.message time { color: var(--ink-soft); font-size: 11px; }
.message p { margin: 8px 0 0; line-height: 1.5; overflow-wrap: anywhere; }

.settings-form { max-width: 1080px; }
.settings-grid { margin-top: 22px; }
.settings-toggles { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.settings-toggles .toggle-row { padding: 10px 12px; background: #edf3f5; border-radius: 6px; }
.settings-toggles .release-toggle {
  align-items: flex-start;
  border: 1px solid #ccd9d3;
  background: #f7faf8;
  padding: 14px;
}
.release-toggle span { display: grid; gap: 4px; }
.release-toggle strong { color: #15231d; }
.release-toggle small { color: #607069; font-weight: 500; line-height: 1.4; }

.filter-row { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search-field { width: min(420px, 100%); }
.filter-summary { color: var(--ink-soft); font-size: 13px; }
.cleanup-note { max-width: 900px; margin: -5px 0 18px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.device-card {
  min-height: 214px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px rgba(23,33,43,.04);
}
.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.device-icon { width: 40px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--ink); border-radius: 6px; font-size: 11px; font-weight: 800; }
.device-card h3 { margin: 16px 0 5px; font-size: 17px; overflow-wrap: anywhere; }
.device-number { min-height: 26px; margin: 0; color: var(--ink); font-size: 22px; font-weight: 800; letter-spacing: 0; overflow-wrap: anywhere; }
.device-address { min-height: 20px; margin: 4px 0 0; color: var(--teal); font-weight: 750; overflow-wrap: anywhere; }
.device-pending { margin: 6px 0 0; color: var(--gold); font-size: 12px; font-weight: 750; line-height: 1.35; }
.device-details { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.device-details span:last-child { text-align: right; }
.device-actions { margin-top: 16px; padding-top: 13px; border-top: 1px solid #edf1f4; }

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 22px;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 43, .56);
}
.modal-panel {
  width: min(500px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--coral);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(9, 17, 24, .24);
}
.device-editor-identity {
  margin: 0 0 18px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #edf3f5;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
}
.device-editor-identity strong,
.device-editor-identity span { overflow-wrap: anywhere; }
.device-editor-identity span { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.modal-note { margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }

.system-banner { min-height: 108px; padding: 22px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #fff; background: var(--teal); border-radius: var(--radius); }
.system-banner[data-state="degraded"] { background: var(--red); }
.system-banner[data-state="setup_required"] { color: var(--ink); background: #e9b853; }
.system-banner h2 { margin: 0 0 5px; font-size: 22px; }
.system-banner p { margin: 0; opacity: .9; }
.system-details { max-width: 920px; }
.detail-grid { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); margin: 10px 0 0; }
.detail-grid div { display: contents; }
.detail-grid dt, .detail-grid dd { margin: 0; padding: 13px 4px; border-bottom: 1px solid #edf1f4; overflow-wrap: anywhere; }
.detail-grid dt { color: var(--ink-soft); }
.detail-grid dd { font-weight: 700; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100% - 44px));
  padding: 13px 16px;
  color: #fff;
  background: var(--ink);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast[data-show="true"] { opacity: 1; transform: translateY(0); }
.toast[data-error="true"] { border-left-color: var(--coral); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-workspace { grid-template-columns: 1fr; }
  .ticket-thread { position: static; }
}

@media (max-width: 820px) {
  .brand-area, .connection-state { display: none; }
  .app-view { display: block; }
  .sidebar { display: none; }
  .workspace { padding: 22px 16px 44px; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: -4px 0 24px;
  }
  .mobile-nav button {
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    color: var(--ink-soft);
    background: #e6ebef;
    border: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .mobile-nav button[aria-current="page"] { color: #fff; background: var(--ink); }
  .dashboard-grid, .split-workspace { grid-template-columns: 1fr; }
  .editor-panel { position: static; }
  .catalog-editor { max-height: none; }
  .settings-toggles { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { min-height: 62px; padding: 9px 14px; }
  .brand img { width: 36px; height: 36px; }
  .brand-name { font-size: 19px; }
  .button-quiet { padding-inline: 9px; }
  .centered-view { width: calc(100% - 24px); max-width: 940px; padding-top: 34px; }
  .setup-header h1, .login-view h1 { font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
  .setup-header > p:last-child { font-size: 15px; overflow-wrap: anywhere; }
  .stepper { grid-template-columns: 1fr; }
  .stepper li { min-height: 62px; }
  .form-grid, .stat-grid, .device-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .panel-heading, .page-heading { align-items: stretch; flex-direction: column; }
  .modal-panel .panel-heading { align-items: flex-start; flex-direction: row; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions .button { flex: 1 1 180px; }
  .panel-heading .tag { align-self: flex-start; }
  .page-heading .button { width: 100%; }
  .stat-card { min-height: 112px; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .record-row { flex-direction: column; }
  .record-meta { justify-content: flex-start; }
  .catalog-row { grid-template-columns: 1fr; }
  .catalog-price { text-align: left; }
  .catalog-row .record-meta { justify-content: flex-start; }
  .toggle-grid { grid-template-columns: 1fr; }
  .system-banner { align-items: flex-start; flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid div { display: block; padding: 11px 2px; border-bottom: 1px solid #edf1f4; }
  .detail-grid dt, .detail-grid dd { padding: 0; border: 0; }
  .detail-grid dd { margin-top: 4px; }
}
