:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --text: #18221f;
  --muted: #68736f;
  --line: #dde4e1;
  --line-soft: #e9eeec;
  --green: #147a5d;
  --green-strong: #0e674d;
  --green-soft: #e8f5f0;
  --amber: #b86b09;
  --amber-soft: #fff3dc;
  --red: #c64843;
  --red-soft: #fdecea;
  --blue: #287791;
  --blue-soft: #e8f3f7;
  --ink: #202a27;
  --shadow: 0 8px 30px rgba(31, 48, 42, 0.06);
  --sidebar: 230px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, input, select { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible { box-shadow: 0 0 0 3px rgba(20, 122, 93, 0.18); }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }
.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; }

.app-shell { min-height: 100vh; }
body.overlay-open { overflow: hidden; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 23px 14px 16px;
  color: #dce5e1;
  background: #1e2926;
  border-right: 1px solid #2d3935;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px 23px; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px 7px; border-radius: 7px; background: #e3f5ed; }
.brand-mark span { display: block; width: 4px; border-radius: 3px; background: var(--green); }
.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; }
.brand strong { display: block; font-size: 17px; color: #fff; }
.brand small { display: block; margin-top: 2px; color: #8fa19b; font-size: 10px; text-transform: uppercase; }

.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  width: 100%; height: 43px; display: flex; align-items: center; gap: 11px; padding: 0 12px;
  color: #aebdb8; background: transparent; border: 0; border-radius: 6px; text-align: left;
}
.nav-item:hover { color: #fff; background: #283530; }
.nav-item.active { color: #fff; background: #34453f; box-shadow: inset 3px 0 #4fc196; }
.nav-item span { flex: 1; }
.nav-item b, .nav-item em { min-width: 24px; padding: 2px 6px; border-radius: 10px; font-size: 10px; text-align: center; font-style: normal; }
.nav-item b { color: #94a7a0; background: #293632; }
.nav-item em { min-width: 18px; color: #fff; background: var(--red); }

.sidebar-foot { margin-top: auto; }
.control-health { display: flex; align-items: center; gap: 9px; padding: 12px; margin-bottom: 10px; border: 1px solid #34443f; border-radius: 7px; background: #24312d; }
.health-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #57c99d; box-shadow: 0 0 0 4px rgba(87,201,157,.1); }
.health-pulse::after { content: ""; position: absolute; inset: -4px; border: 1px solid #57c99d; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.control-health strong, .control-health small { display: block; }
.control-health strong { color: #e8efec; font-size: 11px; }
.control-health small { margin-top: 2px; color: #83958f; font-size: 9px; }
.profile-button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; color: #b4c1bd; background: transparent; border: 0; border-radius: 6px; text-align: left; }
.profile-button:hover { background: #283530; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #23302b; background: #b8d9cc; font-weight: 700; }
.profile-button > span:nth-child(2) { flex: 1; }
.profile-button strong, .profile-button small { display: block; }
.profile-button strong { color: #f5f7f6; font-size: 11px; }
.profile-button small { margin-top: 2px; color: #81938d; font-size: 9px; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); padding: 0 30px 38px; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; }
h1 { margin: 0; font-size: 23px; line-height: 1.2; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.sync-state { display: flex; align-items: center; gap: 7px; margin-right: 6px; color: var(--muted); font-size: 11px; }
.sync-state span { width: 7px; height: 7px; border-radius: 50%; background: #3fb788; }
.sync-state b { font-weight: 400; }
.sync-state.warning span { background: var(--amber); }
.sync-state.offline span { background: var(--red); }
.icon-button, .notification-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: #46534e; background: var(--surface); }
.icon-button:hover, .notification-button:hover { border-color: #b9c7c1; background: #fafcfb; }
.notification-button { position: relative; }
.notification-button span { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); border-radius: 9px; color: #fff; background: var(--red); font-size: 8px; font-weight: 700; }
.primary-button, .secondary-button, .danger-button, .dark-button, .text-button, .wide-secondary { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: 6px; font-weight: 600; }
.primary-button { border: 1px solid var(--green); color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-strong); }
.secondary-button, .wide-secondary { color: #37443f; background: var(--surface); border: 1px solid var(--line); }
.secondary-button:hover, .wide-secondary:hover { border-color: #aebeb7; background: #fbfdfc; }
.secondary-button.active { border-color: #78ad99; color: var(--green); background: var(--green-soft); }
.danger-button { border: 1px solid #d05a55; color: #fff; background: var(--red); }
.danger-button:hover { border-color: #aa3733; background: #b53e39; }
.danger-button:focus-visible { box-shadow: 0 0 0 3px rgba(198,72,67,.18); }
.dark-button { border: 1px solid #283632; color: #fff; background: #283632; }
.text-button { border: 0; color: #43544e; background: transparent; }
.wide-secondary { width: 100%; }
.link-button { padding: 4px; border: 0; color: var(--green); background: transparent; font-weight: 600; }

.view { display: none; animation: viewIn .22s ease both; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: .2; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.incident-banner { min-height: 66px; display: flex; align-items: center; gap: 13px; padding: 11px 13px; margin-bottom: 16px; border: 1px solid #f0cfa8; border-radius: 7px; background: #fff8ea; }
.incident-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 6px; color: var(--amber); background: #ffebc7; }
.incident-copy { flex: 1; min-width: 0; }
.incident-copy strong, .incident-copy span { display: block; }
.incident-copy strong { font-size: 12px; }
.incident-copy span { margin-top: 4px; color: #7a6b55; font-size: 10px; line-height: 1.5; }
.incident-actions { display: flex; align-items: center; }
.incident-banner.live-ok { border-color: #bcdccc; background: #f0faf5; }
.incident-banner.live-ok .incident-icon { color: var(--green); background: #dff3e9; }
.incident-banner.live-ok .incident-copy span { color: #5e766d; }
.incident-banner.live-ok .incident-actions { display: none; }
.incident-banner.live-error { border-color: #ebc3c0; background: #fff5f4; }
.incident-banner.live-error .incident-icon { color: var(--red); background: var(--red-soft); }
.incident-banner.live-error .incident-copy span { color: #845f5d; }
.control-health.offline .health-pulse { background: #d87873; box-shadow: 0 0 0 4px rgba(198,72,67,.1); }
.control-health.offline .health-pulse::after { border-color: #d87873; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card { min-width: 0; padding: 16px; border: 1px solid var(--line-soft); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.metric-head svg { width: 17px; }
.metric-card strong { display: block; margin: 10px 0 6px; font-size: 27px; line-height: 1; }
.metric-card small { color: #7b8581; font-size: 9px; }
.metric-card small b { color: var(--green); }
.metric-card.running .metric-head svg, .metric-card.done .metric-head svg { color: var(--green); }
.metric-card.warning .metric-head svg { color: var(--amber); }
.metric-card.offline .metric-head svg { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line-soft); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 17px; border-bottom: 1px solid var(--line-soft); }
.panel-heading.compact { min-height: 62px; }
.panel-heading h2, .section-title h2 { margin: 0; font-size: 14px; }
.panel-heading p, .section-title p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 6px; background: #f0f3f2; }
.segmented button { min-height: 29px; padding: 0 10px; border: 0; border-radius: 4px; color: #6d7874; background: transparent; font-size: 10px; }
.segmented button.active { color: var(--text); background: #fff; box-shadow: 0 1px 5px rgba(32,42,39,.1); }
.segmented button span { color: var(--red); }

.machine-table-wrap { overflow-x: auto; }
.machine-table { width: 100%; border-collapse: collapse; }
.machine-table th { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: #8a9490; background: #fafcfb; font-size: 9px; font-weight: 500; text-align: left; white-space: nowrap; }
.machine-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.machine-table tbody tr { transition: background .18s ease; }
.machine-table tbody tr:hover { background: #fafcfb; }
.machine-id { display: flex; align-items: center; gap: 9px; min-width: 170px; }
.machine-avatar { position: relative; width: 33px; height: 33px; display: grid; place-items: center; flex: none; border: 1px solid var(--line); border-radius: 6px; color: #53635d; background: #f4f7f6; font-size: 9px; font-weight: 700; }
.machine-avatar::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%; background: var(--green); }
.machine-avatar.offline::after { background: #9da8a4; }
.machine-avatar.warning::after { background: var(--amber); }
.machine-id strong, .machine-id small { display: block; }
.machine-id strong { font-size: 11px; }
.machine-id small { max-width: 190px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 4px; font-size: 9px; font-weight: 600; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.status-badge.running { color: #166c52; background: var(--green-soft); }
.status-badge.running::before { background: var(--green); animation: pulseDot 1.5s infinite; }
.status-badge.done { color: #287087; background: var(--blue-soft); }
.status-badge.done::before { background: var(--blue); }
.status-badge.warning { color: #99600e; background: var(--amber-soft); }
.status-badge.warning::before { background: var(--amber); }
.status-badge.offline { color: #7c8682; background: #eef1f0; }
.status-badge.offline::before { background: #99a39f; }
@keyframes pulseDot { 50% { opacity: .35; } }
.progress-cell { min-width: 90px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: 8px; }
.progress-track { height: 4px; overflow: hidden; border-radius: 3px; background: #e9eeec; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.time-cell { color: var(--muted); font-size: 9px; white-space: nowrap; }
.row-menu { width: 29px; height: 29px; display: grid; place-items: center; border: 0; border-radius: 5px; color: var(--muted); background: transparent; }
.row-menu:hover { background: #edf2f0; }
.panel-footer { width: 100%; height: 43px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; color: var(--green); background: #fbfdfc; font-size: 10px; font-weight: 600; }
.panel-footer:hover { background: #f5faf8; }
.right-stack { display: grid; gap: 16px; }

.switch { position: relative; width: 38px; height: 22px; display: inline-block; flex: none; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: #b8c3bf; transition: .2s ease; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s ease; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }

.automation-brief { overflow: hidden; }
.auto-visual { display: grid; grid-template-columns: 1fr 28px 1fr 28px 1fr; align-items: center; padding: 17px 14px 13px; }
.auto-node { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; color: #4b5954; font-size: 8px; text-align: center; }
.auto-node svg { width: 16px; height: 16px; }
.auto-node.source svg { color: #596a64; }
.auto-node.agent svg { color: var(--green); }
.auto-node.cloud svg { color: var(--blue); }
.auto-link { display: flex; align-items: center; color: #a3b0ab; }
.auto-link span { flex: 1; border-top: 1px dashed #c8d1ce; }
.auto-link svg { width: 11px; height: 11px; }
.rule-list { padding: 0 14px 11px; }
.rule-list > div { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.rule-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; }
.rule-icon svg { width: 13px; }
.rule-icon.reconnect { color: var(--green); background: var(--green-soft); }
.rule-icon.relay { color: var(--amber); background: var(--amber-soft); }
.rule-icon.stalled { color: var(--blue); background: var(--blue-soft); }
.rule-list strong, .rule-list small { display: block; }
.rule-list strong { font-size: 9px; }
.rule-list small { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.rule-list > div > b { color: var(--green); font-size: 8px; }
.rule-list > div > b.manual { color: var(--amber); }
.automation-brief .wide-secondary { width: calc(100% - 28px); margin: 0 14px 14px; min-height: 34px; font-size: 9px; }

.activity-list { padding: 0 14px 5px; }
.activity-item { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; align-items: start; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.activity-icon svg { width: 12px; }
.activity-icon.done { color: var(--green); background: var(--green-soft); }
.activity-icon.warning { color: var(--amber); background: var(--amber-soft); }
.activity-icon.info { color: var(--blue); background: var(--blue-soft); }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { font-size: 9px; line-height: 1.45; }
.activity-item small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.activity-item time { color: #919b97; font-size: 8px; white-space: nowrap; }

.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.search-field { height: 39px; width: min(380px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.search-field svg { width: 16px; color: var(--muted); }
.search-field input { width: 100%; border: 0; color: var(--text); background: transparent; }
.search-field input::placeholder { color: #98a39f; }
.toolbar-group { display: flex; gap: 8px; }
.select-control { position: relative; height: 39px; display: flex; align-items: center; gap: 6px; padding: 0 7px 0 10px; border: 1px solid var(--line); border-radius: 6px; color: #52615c; background: var(--surface); }
.select-control:focus-within { box-shadow: 0 0 0 3px rgba(20, 122, 93, 0.18); }
.select-control svg { width: 14px; }
.select-control select { height: 100%; padding: 0 20px 0 0; border: 0; color: #37443f; background: transparent; font-size: 10px; cursor: pointer; }
.batch-action-bar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 12px; margin: -3px 0 14px; border: 1px solid #bcdccc; border-radius: 7px; background: #f0faf5; }
.batch-action-bar[hidden] { display: none; }
.batch-action-bar > div, .batch-actions, .batch-actions label { display: flex; align-items: center; gap: 8px; }
.batch-action-bar > div > svg { width: 16px; color: var(--green); }
.batch-action-bar strong { font-size: 10px; }
.batch-actions label { color: var(--muted); font-size: 9px; }
.batch-actions select { min-height: 32px; padding: 0 26px 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #fff; font-size: 9px; }
.batch-actions button { min-height: 32px; font-size: 9px; }
.fleet-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .55fr); gap: 14px; align-items: start; }
.fleet-panel { padding: 16px; }
.fleet-group-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 13px; border-bottom: 1px solid var(--line-soft); }
.fleet-group-head h2 { display: inline; margin: 0 8px 0 0; font-size: 14px; }
.fleet-group-head > div > span { color: var(--muted); font-size: 9px; }
.mini-avatars { display: flex; align-items: center; }
.mini-avatars span { width: 25px; height: 25px; display: grid; place-items: center; margin-left: -5px; border: 2px solid #fff; border-radius: 50%; color: #52615c; background: #eaf0ee; font-size: 7px; }
.mini-avatars b { margin-left: 5px; color: var(--muted); font-size: 9px; }
.device-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.device-card { position: relative; min-height: 135px; padding: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-align: left; }
.device-card:hover, .device-card.selected { border-color: #75a996; box-shadow: 0 0 0 2px rgba(20,122,93,.08); }
.device-card.batch-selected { border-color: var(--green); background: #f7fcfa; box-shadow: 0 0 0 2px rgba(20,122,93,.1); }
.selection-check { position: absolute; top: 11px; right: 11px; z-index: 2; width: 20px; height: 20px; display: none; place-items: center; border: 1px solid #aebbb6; border-radius: 4px; color: transparent; background: #fff; }
.selection-check svg { width: 13px; height: 13px; }
.batch-mode .selection-check { display: grid; }
.batch-mode .device-card-top .status-badge { margin-right: 27px; }
.batch-mode .device-card.batch-selected .selection-check { border-color: var(--green); color: #fff; background: var(--green); }
.device-card-top { display: flex; justify-content: space-between; align-items: center; }
.device-card .machine-avatar { width: 30px; height: 30px; }
.device-card h3 { margin: 12px 0 4px; font-size: 11px; }
.device-card p { height: 28px; margin: 0 0 10px; overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.6; }
.device-card-foot { display: flex; justify-content: space-between; align-items: center; color: #87928e; font-size: 8px; }
.device-detail { position: sticky; top: 14px; min-height: 390px; overflow: hidden; }
.empty-detail { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); text-align: center; }
.empty-list { grid-column: 1 / -1; min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--muted); text-align: center; }
.empty-list.compact { min-height: 250px; }
.empty-list svg { width: 24px; height: 24px; margin-bottom: 3px; color: #9caaa5; }
.empty-list strong { color: #55625d; font-size: 11px; }
.empty-list span { font-size: 9px; }
.empty-detail svg { width: 25px; height: 25px; margin-bottom: 4px; color: #9caaa5; }
.empty-detail strong { color: var(--text); }
.empty-detail span { max-width: 190px; font-size: 9px; line-height: 1.6; }
.detail-head { padding: 17px; border-bottom: 1px solid var(--line-soft); }
.detail-title { display: flex; align-items: center; gap: 10px; }
.detail-title h2 { margin: 0 0 3px; font-size: 14px; }
.detail-title small { color: var(--muted); font-size: 8px; }
.detail-body { padding: 15px 17px; }
.detail-section { margin-bottom: 17px; }
.detail-section > span { display: block; margin-bottom: 7px; color: #89948f; font-size: 8px; text-transform: uppercase; }
.task-block { padding: 10px; border-radius: 6px; background: #f7faf8; }
.task-block strong { display: block; font-size: 10px; }
.task-block small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.detail-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-kv div { padding: 9px; border: 1px solid var(--line-soft); border-radius: 5px; }
.detail-kv span, .detail-kv strong { display: block; }
.detail-kv span { color: var(--muted); font-size: 8px; }
.detail-kv strong { margin-top: 4px; font-size: 10px; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 0 17px 17px; }
.detail-actions button { min-height: 34px; border-radius: 5px; font-size: 9px; }

.automation-summary { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px 16px; margin-bottom: 14px; border: 1px solid #bcdccc; border-radius: 7px; background: #f0faf5; }
.automation-summary > div { display: flex; align-items: center; gap: 11px; }
.summary-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: #dff3e9; }
.automation-summary strong { display: block; font-size: 12px; }
.automation-summary p { margin: 4px 0 0; color: #5e766d; font-size: 9px; }
.automation-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .55fr); gap: 14px; align-items: start; }
.policy-column { display: grid; gap: 12px; }
.policy-card { padding: 17px; }
.policy-top { display: grid; grid-template-columns: 39px minmax(0, 1fr) 38px; align-items: start; gap: 11px; }
.policy-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 6px; }
.policy-symbol.green { color: var(--green); background: var(--green-soft); }
.policy-symbol.amber { color: var(--amber); background: var(--amber-soft); }
.policy-symbol.blue { color: var(--blue); background: var(--blue-soft); }
.policy-top h2 { margin: 1px 0 4px; font-size: 13px; }
.policy-top p { max-width: 590px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.condition-flow { display: flex; align-items: center; gap: 8px; padding: 12px; margin: 14px 0 11px; border-radius: 6px; background: #f6f8f7; }
.condition-flow span { flex: 1; color: #64716c; font-size: 9px; text-align: center; }
.condition-flow span b { display: block; margin-bottom: 3px; color: var(--text); font-size: 8px; }
.condition-flow svg { width: 13px; color: #a4afab; }
.policy-settings { display: flex; gap: 24px; align-items: center; }
.policy-settings label { color: var(--muted); font-size: 9px; }
.policy-settings select { margin-left: 5px; padding: 4px 22px 4px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--text); background: #fff; font-size: 9px; }
.channel-pills { display: flex; gap: 7px; }
.channel-pills button { min-height: 30px; display: flex; align-items: center; gap: 5px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; color: #6d7773; background: #fff; font-size: 9px; }
.channel-pills button.selected { border-color: #78ad99; color: var(--green); background: var(--green-soft); }
.channel-pills svg { width: 13px; }
.safety-panel { position: sticky; top: 14px; overflow: hidden; }
.safety-score { display: flex; flex-direction: column; align-items: center; padding: 20px 14px 14px; }
.safety-score > div { width: 98px; height: 98px; display: grid; place-content: center; border-radius: 50%; background: conic-gradient(var(--green) 0 92%, #e5ebe8 92% 100%); box-shadow: inset 0 0 0 9px #fff; text-align: center; }
.safety-score span { font-size: 25px; font-weight: 800; }
.safety-score small { font-size: 9px; color: var(--muted); }
.safety-score > strong { margin-top: 9px; color: var(--green); font-size: 10px; }
.check-list { list-style: none; padding: 0 16px; margin: 0; }
.check-list li { display: flex; gap: 9px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.check-list li > svg { width: 15px; height: 15px; padding: 2px; border-radius: 50%; color: #fff; background: var(--green); }
.check-list strong, .check-list small { display: block; }
.check-list strong { font-size: 9px; }
.check-list small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.danger-setting { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 16px; margin-top: 5px; background: #fff8ea; }
.danger-setting strong, .danger-setting small { display: block; }
.danger-setting strong { font-size: 9px; }
.danger-setting small { max-width: 190px; margin-top: 3px; color: #806f57; font-size: 8px; line-height: 1.4; }

.messages-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .55fr); gap: 14px; align-items: start; }
.inbox-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.notification-feed { padding: 0 16px; }
.feed-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 11px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.feed-item.unread::after { content: ""; position: absolute; }
.feed-symbol { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 6px; }
.feed-symbol.done { color: var(--green); background: var(--green-soft); }
.feed-symbol.warning { color: var(--amber); background: var(--amber-soft); }
.feed-symbol.info { color: var(--blue); background: var(--blue-soft); }
.feed-copy h3 { margin: 0 0 4px; font-size: 11px; }
.feed-copy p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.feed-copy button { padding: 5px 0; margin-top: 5px; border: 0; color: var(--green); background: transparent; font-size: 9px; font-weight: 600; }
.inbox-head .link-button:disabled { color: var(--muted); }
.feed-meta { min-width: 64px; color: #8a9591; font-size: 8px; text-align: right; }
.feed-meta b { display: block; width: 6px; height: 6px; margin: 8px 0 0 auto; border-radius: 50%; background: var(--green); }
.delivery-panel { position: sticky; top: 14px; overflow: hidden; }
.delivery-number { padding: 18px 17px; border-bottom: 1px solid var(--line-soft); }
.delivery-number strong, .delivery-number span { display: block; }
.delivery-number strong { font-size: 28px; }
.delivery-number span { margin-top: 5px; color: var(--muted); font-size: 9px; }
.channel-list { padding: 5px 17px; }
.channel-list > div { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.channel-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; color: var(--green); background: var(--green-soft); }
.channel-icon.wechat { color: #3b8d46; background: #ebf7eb; }
.channel-icon.browser { color: var(--blue); background: var(--blue-soft); }
.channel-icon svg { width: 14px; }
.channel-list strong, .channel-list small { display: block; }
.channel-list strong { font-size: 9px; }
.channel-list small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.online-dot { color: var(--green); font-size: 8px; }
.channel-state { color: var(--muted); font-size: 8px; }
.channel-state.online { color: var(--green); }
.channel-state.error { color: var(--red); }
.delivery-panel .wide-secondary { width: calc(100% - 34px); margin: 8px 17px 0; min-height: 35px; font-size: 9px; }
.delivery-panel .wide-secondary:last-child { margin-bottom: 17px; }

.blueprint-intro { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 22px 25px; border-radius: 7px 7px 0 0; color: #edf6f2; background: #26342f; }
.blueprint-intro > div:first-child { max-width: 680px; }
.blueprint-intro > div:first-child > span { display: inline-block; padding: 4px 7px; border-radius: 4px; color: #aee1cc; background: #344b43; font-size: 8px; font-weight: 700; }
.blueprint-intro h2 { margin: 9px 0 7px; color: #fff; font-size: 18px; }
.blueprint-intro p { margin: 0; color: #b5c5bf; font-size: 10px; line-height: 1.7; }
.scale-badge { display: grid; grid-template-columns: 32px auto; grid-template-rows: auto auto; align-items: center; column-gap: 9px; min-width: 160px; padding: 13px; border: 1px solid #43554f; border-radius: 6px; background: #2d3d38; }
.scale-badge svg { grid-row: 1 / span 2; width: 28px; height: 28px; color: #63c69f; }
.scale-badge strong { font-size: 15px; }
.scale-badge span { color: #9fb1aa; font-size: 8px; }
.architecture-map { min-height: 245px; display: grid; grid-template-columns: minmax(150px, 1fr) minmax(100px, .55fr) minmax(180px, 1.15fr) minmax(65px, .35fr) minmax(150px, .85fr); align-items: center; gap: 8px; padding: 25px; border: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 7px 7px; background-color: #fff; background-image: radial-gradient(#dfe6e3 1px, transparent 1px); background-size: 15px 15px; box-shadow: var(--shadow); }
.arch-column > p { margin: 0 0 8px; color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.arch-column > small { display: block; margin-top: 7px; color: #89948f; font-size: 8px; text-align: center; }
.computer-stack, .client-stack { display: grid; gap: 5px; }
.computer-stack > div, .client-stack > div { min-height: 37px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; box-shadow: 0 3px 12px rgba(31,48,42,.06); }
.computer-stack svg, .client-stack svg { width: 14px; color: #52645d; }
.computer-stack span, .client-stack span { flex: 1; font-size: 9px; font-weight: 600; }
.computer-stack b { color: var(--green); font-size: 7px; }
.server-core { min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; border: 1px solid #7faf9b; border-radius: 6px; background: #edf8f3; box-shadow: 0 8px 25px rgba(20,122,93,.1); text-align: center; }
.server-core svg { width: 27px; height: 27px; margin-bottom: 9px; color: var(--green); }
.server-core strong { font-size: 11px; }
.server-core span { margin-top: 5px; color: #668078; font-size: 8px; }
.arch-connection { color: #91a09a; text-align: center; }
.arch-connection > span, .arch-connection > small { display: block; font-size: 7px; }
.arch-connection > div { display: flex; justify-content: space-around; margin: 6px 0; border-top: 1px dashed #a9bab4; }
.arch-connection svg { width: 15px; margin-top: -8px; padding: 1px; background: #fff; }
.arch-connection.short > div { justify-content: center; }
.comparison-section, .rollout-section { margin-top: 23px; }
.section-title { margin-bottom: 11px; }
.comparison-table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.comparison-table { width: 100%; border-collapse: collapse; }
.comparison-table th, .comparison-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.comparison-table th { color: var(--muted); background: #f8faf9; font-size: 9px; font-weight: 500; }
.comparison-table td { font-size: 9px; }
.comparison-table td:first-child { min-width: 190px; }
.comparison-table td strong, .comparison-table td small { display: block; }
.comparison-table td strong { font-size: 10px; }
.comparison-table td small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.comparison-table tr:last-child td { border-bottom: 0; }
.comparison-table tr.recommended td { background: #f2faf6; }
.rating { display: inline-block; min-width: 42px; padding: 3px 6px; border-radius: 4px; text-align: center; }
.rating.good { color: var(--green); background: var(--green-soft); }
.rating.okay { color: var(--amber); background: var(--amber-soft); }
.rating.bad { color: var(--red); background: var(--red-soft); }
.recommend-tag { display: inline-block; padding: 4px 7px; border-radius: 4px; color: #fff; background: var(--green); }
.rollout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rollout-grid article { min-height: 135px; display: grid; grid-template-columns: 34px 1fr; gap: 11px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.rollout-grid article > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.rollout-grid small { color: var(--green); font-size: 8px; }
.rollout-grid h3 { margin: 6px 0; font-size: 11px; }
.rollout-grid p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.65; }

.mobile-nav { display: none; }
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 60; opacity: 0; visibility: hidden; background: rgba(16,24,21,.45); transition: .2s ease; }
.drawer-backdrop.open, .modal-backdrop.open { opacity: 1; visibility: visible; }
.action-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(390px, 100%); padding: 24px; overflow-y: auto; background: #fff; box-shadow: -15px 0 50px rgba(20,30,27,.18); transform: translateX(105%); transition: transform .25s ease; }
.action-drawer.open { transform: none; }
.drawer-handle { display: none; }
.drawer-close { position: absolute; top: 14px; right: 14px; }
.drawer-device-head { display: flex; align-items: center; gap: 11px; padding: 15px 45px 18px 0; border-bottom: 1px solid var(--line-soft); }
.drawer-device-head h2 { margin: 0 0 3px; font-size: 16px; }
.drawer-device-head p { margin: 0; color: var(--muted); font-size: 9px; }
.drawer-status { padding: 16px 0; }
.drawer-status h3 { margin: 0 0 10px; font-size: 10px; color: var(--muted); }
.event-steps { position: relative; display: grid; gap: 0; }
.event-step { position: relative; display: grid; grid-template-columns: 23px 1fr auto; gap: 9px; min-height: 50px; }
.event-step::before { content: ""; position: absolute; left: 10px; top: 19px; bottom: -4px; border-left: 1px solid var(--line); }
.event-step:last-child::before { display: none; }
.event-step > i { width: 21px; height: 21px; display: grid; place-items: center; z-index: 1; border-radius: 50%; color: #fff; background: var(--green); font-size: 8px; font-style: normal; }
.event-step.pending > i { color: #7b8782; background: #e7ecea; }
.event-step strong, .event-step small { display: block; }
.event-step strong { font-size: 9px; }
.event-step small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.event-step time { color: #8c9793; font-size: 8px; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.drawer-delete-button { width: 100%; margin-top: 8px; }

.modal-backdrop { display: grid; place-items: center; padding: 18px; }
.modal { position: relative; width: min(420px, 100%); padding: 29px; border-radius: 8px; background: #fff; box-shadow: 0 25px 80px rgba(17,26,23,.25); text-align: center; transform: translateY(10px) scale(.98); transition: .2s ease; }
.modal-backdrop.open .modal { transform: none; }
.modal-close { position: absolute; top: 12px; right: 12px; border: 0; }
.modal-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.modal-icon svg { width: 23px; height: 23px; }
.modal-icon.danger { color: var(--red); background: var(--red-soft); }
.modal h2 { margin: 0; font-size: 17px; }
.modal > p { margin: 8px auto 18px; max-width: 300px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.pairing-code { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px; border: 1px dashed #aebdb7; border-radius: 6px; background: #f7faf9; }
.pairing-code span { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.pairing-code button { width: 29px; height: 29px; display: grid; place-items: center; margin-left: 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--green); background: #fff; }
.modal-note { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 9px 0 17px; color: var(--muted); font-size: 8px; }
.modal-note svg { width: 12px; }
.modal-primary { width: 100%; }
.delete-device-modal > p strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 11px; }
.delete-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.auth-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(16,24,21,.72); }
.auth-backdrop[hidden] { display: none; }
.auth-dialog { width: min(360px, 100%); padding: 28px; border-radius: 8px; background: #fff; box-shadow: 0 25px 80px rgba(17,26,23,.3); }
.auth-dialog h2 { margin: 0 0 20px; text-align: center; font-size: 17px; }
.auth-dialog label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.auth-dialog input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: #fff; font-size: 16px; }
.auth-dialog input:focus { outline: 2px solid rgba(20,122,93,.18); border-color: var(--green); }
.auth-dialog .primary-button { width: 100%; margin-top: 15px; }
.auth-error { margin: 8px 0 0; color: var(--red); font-size: 9px; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast { position: relative; min-width: 290px; max-width: 390px; display: flex; align-items: center; gap: 9px; padding: 12px 10px 12px 14px; overflow: hidden; border: 1px solid #cdd9d4; border-radius: 6px; color: #fff; background: #26332f; box-shadow: 0 12px 35px rgba(16,24,21,.22); animation: toastIn .25s ease both; }
.toast::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #65caa3; transform-origin: left; animation: toastTimer var(--toast-duration, 10s) linear both; }
.toast svg { width: 16px; color: #6fd0aa; }
.toast span { flex: 1; font-size: 10px; line-height: 1.5; }
.toast-close { width: 28px; height: 28px; display: grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 5px; color: #b8c7c1; background: transparent; }
.toast-close:hover { color: #fff; background: rgba(255,255,255,.1); }
.toast-close svg { width: 14px; color: currentColor; }
.toast.closing { opacity: 0; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastTimer { to { transform: scaleX(0); } }
.spin { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  :root { --sidebar: 78px; }
  .sidebar { padding-inline: 10px; }
  .brand { padding-inline: 12px; }
  .brand > div:last-child, .nav-item span, .nav-item b, .nav-item em, .control-health > div, .profile-button > span:nth-child(2), .profile-button > svg { display: none; }
  .brand-mark { flex: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item svg { width: 19px; height: 19px; }
  .control-health { justify-content: center; padding: 13px 0; }
  .profile-button { justify-content: center; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(285px, .7fr); }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-card:nth-child(4), .metric-card:nth-child(5) { display: block; }
  .device-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .main-content { padding-inline: 20px; }
  .dashboard-grid, .automation-layout, .messages-layout { grid-template-columns: 1fr; }
  .right-stack { grid-template-columns: 1fr 1fr; }
  .safety-panel, .delivery-panel { position: static; }
  .fleet-layout { grid-template-columns: 1fr; }
  .device-detail { display: none; }
  #batchModeButton { width: 38px; padding: 0; font-size: 0; }
  #batchModeButton svg { margin: 0; }
  .architecture-map { grid-template-columns: 1fr 70px 1.1fr; }
  .client-layer { grid-column: 3; }
  .arch-connection.short { grid-column: 2; grid-row: 2; }
  .client-layer { grid-row: 2; }
  .rollout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { font-size: 13px; }
  .sidebar { display: none; }
  .main-content { margin: 0; padding: 0 12px 84px; }
  .topbar { min-height: 72px; }
  .eyebrow { display: none; }
  h1 { font-size: 20px; }
  .top-actions { gap: 6px; }
  .sync-state, .top-actions .primary-button span { display: none; }
  .top-actions .primary-button { width: 38px; padding: 0; }
  .incident-banner { align-items: flex-start; padding: 12px; }
  .incident-icon { width: 33px; height: 33px; }
  .incident-copy span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .incident-actions { display: none; }
  .metric-grid { grid-template-columns: repeat(5, 132px); gap: 8px; margin-inline: -12px; padding: 0 12px 5px; overflow-x: auto; scrollbar-width: none; }
  .metric-card { padding: 13px; }
  .metric-card:nth-child(4), .metric-card:nth-child(5) { display: block; }
  .metric-card strong { font-size: 24px; }
  .dashboard-grid { display: block; }
  .machine-panel { margin-bottom: 12px; }
  .panel-heading { min-height: 62px; padding: 11px 12px; }
  .panel-heading .segmented button { padding: 0 7px; }
  .panel-heading .segmented button:first-child { display: none; }
  .machine-table thead { display: none; }
  .machine-table-wrap { width: 100%; overflow-x: hidden; }
  .machine-table, .machine-table tbody, .machine-table tr { display: block; width: 100%; min-width: 0; max-width: 100%; }
  .machine-table td { display: block; width: auto; min-width: 0; max-width: 100%; }
  .machine-id { min-width: 0; }
  .machine-table tr { position: relative; padding: 12px; border-bottom: 1px solid var(--line-soft); }
  .machine-table td { padding: 0; border: 0; }
  .machine-table td:nth-child(2) { position: absolute; top: 13px; right: 39px; }
  .machine-table td:nth-child(3) { margin: 10px 38px 5px 42px; }
  .machine-table td:nth-child(4) { margin-left: 42px; }
  .machine-table td:nth-child(5) { position: absolute; top: 14px; right: 7px; }
  .machine-id small { max-width: 160px; }
  .right-stack { grid-template-columns: 1fr; }
  .activity-panel { display: none; }
  .auto-visual { padding-top: 14px; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(64px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 7px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
  .mobile-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; color: #7d8884; background: transparent; font-size: 8px; }
  .mobile-nav button.active { color: var(--green); }
  .mobile-nav svg { width: 18px; height: 18px; }
  .mobile-nav b { position: absolute; top: 2px; left: calc(50% + 7px); min-width: 14px; height: 14px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--red); font-size: 7px; }
  .view-toolbar { align-items: stretch; }
  .view-toolbar .search-field { min-width: 0; }
  .toolbar-group { flex: none; }
  .select-control { width: 38px; padding: 0; justify-content: center; }
  .select-control select { position: absolute; inset: 0; width: 100%; padding: 0; opacity: 0; }
  .toolbar-group .secondary-button { width: 38px; padding: 0; font-size: 0; }
  .toolbar-group .secondary-button svg { margin: 0; }
  .batch-action-bar { align-items: flex-start; flex-direction: column; padding: 10px 11px; }
  .batch-actions { width: 100%; }
  .batch-actions label { flex: 1; }
  .batch-actions select { min-width: 0; width: 100%; }
  .batch-actions .text-button { padding-inline: 7px; }
  .fleet-panel { padding: 12px; }
  .device-card-grid { grid-template-columns: 1fr; }
  .device-card { min-height: 118px; }
  .automation-summary { align-items: flex-start; }
  .automation-summary .secondary-button { width: 38px; padding: 0; font-size: 0; }
  .automation-summary p { line-height: 1.45; }
  .policy-card { padding: 14px; }
  .condition-flow { align-items: stretch; gap: 3px; padding: 9px 5px; }
  .condition-flow span { font-size: 8px; }
  .policy-settings { display: grid; gap: 8px; }
  .channel-pills { flex-wrap: wrap; }
  .messages-layout { grid-template-columns: 1fr; }
  .inbox-head { padding-inline: 12px; }
  .inbox-head .segmented button { padding-inline: 7px; }
  .notification-feed { padding-inline: 12px; }
  .feed-item { grid-template-columns: 34px minmax(0, 1fr); }
  .feed-meta { grid-column: 2; text-align: left; }
  .feed-meta b { display: none; }
  .blueprint-intro { align-items: flex-start; padding: 18px; }
  .scale-badge { display: none; }
  .blueprint-intro h2 { font-size: 16px; line-height: 1.45; }
  .architecture-map { grid-template-columns: 1fr; padding: 16px; }
  .arch-connection, .arch-connection.short { grid-column: 1; grid-row: auto; transform: rotate(90deg); margin: 8px auto; width: 70px; }
  .server-layer, .client-layer { grid-column: 1; grid-row: auto; }
  .arch-column > p { text-align: center; }
  .comparison-section, .rollout-section { margin-top: 18px; }
  .comparison-table { min-width: 680px; }
  .action-drawer { top: auto; width: 100%; max-height: 88vh; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; transform: translateY(105%); }
  .action-drawer.open { transform: none; }
  .drawer-handle { display: block; width: 38px; height: 4px; margin: -10px auto 9px; border-radius: 2px; background: #d6deda; }
  .toast-region { left: 12px; right: 12px; bottom: 76px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}

@media (max-width: 400px) {
  .main-content { padding-inline: 10px; }
  .metric-grid { margin-inline: -10px; padding-inline: 10px; }
  .incident-copy strong { font-size: 11px; }
  .panel-heading h2 { font-size: 13px; }
  .policy-top { grid-template-columns: 34px minmax(0, 1fr) 38px; gap: 8px; }
  .policy-symbol { width: 34px; height: 34px; }
}
