:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #16324f;
  background: #f3f7fc;
  font-synthesis: none;
  --ink: #16324f;
  --muted: #52667e;
  --quiet: #60738a;
  --surface: #fff;
  --surface-soft: #f0f6fc;
  --line: #dbe5f0;
  --line-strong: #a5b9cf;
  --primary: #245ec9;
  --primary-hover: #174baf;
  --info: #245ec9;
  --info-bg: #edf4ff;
  --info-line: #bdd3fb;
  --success: #147247;
  --success-bg: #eaf8f0;
  --success-line: #a9ddbf;
  --warning: #935000;
  --warning-bg: #fff5e5;
  --warning-line: #edce96;
  --danger: #bd3645;
  --danger-bg: #fff0f2;
  --danger-line: #efbdc6;
  --neutral: #52667e;
  --neutral-bg: #f0f4f8;
  --neutral-line: #cbd6e2;
  --manual: #7356a8;
  --manual-bg: #f5f0fc;
  --manual-line: #dac9f0;
  --teal: #087889;
  --teal-bg: #e9f8fb;
  --teal-line: #ace0e9;
  --radius: 14px;
  --radius-small: 7px;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, input, textarea { border-radius: var(--radius-small); }
button, a, summary, input, textarea { touch-action: manipulation; }
button, input, textarea, a, summary { scroll-margin-top: 104px; }
[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: fixed; z-index: 30; top: 12px; left: 18px; padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 7px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 36px; line-height: 1.25; font-weight: 650; letter-spacing: -1.3px; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 650; letter-spacing: -.45px; }
h3 { font-size: 16px; line-height: 1.5; font-weight: 650; }
a { color: var(--ink); text-underline-offset: 4px; }
button { cursor: pointer; }
button, a, input, textarea, summary { transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
button:disabled { color: #777; border-color: #ddd; background: #f0f0f0; cursor: not-allowed; }
button:disabled.primary { color: #eee; border-color: #777; background: #777; }
button { min-height: 44px; padding: 10px 15px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 550; line-height: 1.5; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--info-bg); border-color: var(--info); }
.primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 5px #245ec919; }
.primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; border-color: var(--primary-hover); }

header { box-shadow: 0 1px 8px #245ec906; position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { max-width: 1416px; min-height: 76px; margin: 0 auto; padding: 0 48px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
header > .brand { margin: 22px 0 22px 40px; }
header > .header-right { margin-right: 40px; }
header:not(:has(.header-inner)) { min-height: 76px; display: flex; align-items: center; justify-content: space-between; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-size: 13px; font-weight: 750; letter-spacing: 1.05px; white-space: nowrap; }
.brand span:not(.brand-mark) { color: var(--muted); font-size: 13px; font-weight: 450; letter-spacing: 0; margin-left: 1px; }
.brand-mark { width: 30px; height: 30px; border: 1px solid var(--primary); border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(145deg, var(--primary), var(--teal)); color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.5px; }
.header-right, .header-actions { display: flex; align-items: center; gap: 20px; }
.header-right > a, .header-actions > a { min-height: 44px; display: inline-flex; align-items: center; font-size: 13px; color: var(--muted); text-decoration: none; }
.header-right > a:hover, .header-actions > a:hover { color: var(--ink); }
#connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.connection-dot { width: 6px; height: 6px; border: 1px solid var(--ink); border-radius: 50%; background: var(--ink); flex: 0 0 auto; }
#connection[data-state="offline"] .connection-dot, #connection[data-state="stale"] .connection-dot { background: transparent; }
.workspace-tag { background: var(--teal-bg); color: var(--teal); display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; color: var(--muted); font-size: 11px; letter-spacing: .4px; }

main { width: 100%; max-width: 1416px; min-height: calc(100vh - 76px); margin: 0 auto; padding: 0 48px; display: flex; flex-direction: column; }
main > section { margin-bottom: 48px; min-width: 0; }
#breadcrumb { min-height: 54px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--quiet); }
#breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; }
#breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
#breadcrumb span:last-child { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0 29px; }
.title-block { min-width: 0; }
.page-heading h1 { margin: 7px 0 10px; overflow-wrap: anywhere; }
.eyebrow { color: var(--teal); font-size: 11px; line-height: 1.5; font-weight: 650; letter-spacing: 1.65px; }
.subtle, .hint, .field-help { color: var(--muted); font-size: 13px; line-height: 1.75; }
.hint { margin: 8px 0 14px; }
.heading-actions, .actions, .status-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.actions { margin-top: 15px; }
.page-heading > .actions, .heading-actions, .status-actions { margin-top: 0; flex-shrink: 0; }
.heading-actions > .subtle { margin-right: 4px; }

.overview-grid, .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.overview-grid { margin-bottom: 32px; }
.metric { min-width: 0; padding: 22px 24px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-value { display: block; color: var(--ink); font-size: 30px; font-weight: 650; line-height: 1.25; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.metric-label { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 550; }
.metric-note { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.summary-grid { margin-top: 20px; }
.summary-grid .metric { padding: 19px 22px; }
.summary-grid .metric-value { font-size: 25px; }
.stats { display: flex; gap: 28px; }
.stat { padding-left: 22px; border-left: 1px solid var(--line); }
.stat strong { display: block; font-size: 29px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 29px 0 17px; }
.section-head .actions { margin: 0; }
.section-head > div:first-child { min-width: 0; }
.section-caption { margin-top: 3px; color: var(--muted); font-size: 13px; }
.section-count { color: var(--muted); font-size: 13px; font-weight: 450; margin-left: 9px; }
.toolbar, .task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.task-toolbar { margin-top: 27px; }
.filter-group { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 4px; background: #e9eff7; border-radius: 9px; }
.filter-button { min-height: 44px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; padding: 8px 12px; }
.filter-button:hover:not(:disabled) { border-color: transparent; background: #dae7fa; color: var(--info); }
.filter-button[aria-pressed="true"] { background: var(--surface); border-color: var(--info-line); color: var(--info); box-shadow: 0 1px 2px #00000008; }
.search-field { display: block; position: relative; width: 266px; max-width: 100%; margin: 0; }
.search-field::before { content: ""; position: absolute; width: 11px; height: 11px; left: 15px; top: 14px; border: 1.5px solid #777; border-radius: 50%; pointer-events: none; }
.search-field::after { content: ""; position: absolute; width: 5px; height: 1.5px; left: 25px; top: 26px; background: #777; transform: rotate(45deg); pointer-events: none; }
.search-field input { min-height: 44px; padding: 9px 13px 9px 38px; margin-top: 0; font-size: 13px; background: var(--surface); border-color: var(--line); }

.device-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.device-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; column-gap: 16px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 18px; color: inherit; text-decoration: none; }
.device-card:hover { border-color: var(--info-line); box-shadow: 0 8px 24px #245ec912; }
.device-card:focus-visible { outline-offset: 4px; }
.device-card .top { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-end; align-self: start; gap: 12px; margin: 0; }
.device-card .top > div { display: flex; align-items: center; gap: 11px; }
.phone-icon { width: 24px; height: 35px; flex: 0 0 24px; position: relative; border: 1.5px solid #353535; border-radius: 5px; }
.phone-icon::before { content: ""; width: 8px; height: 2px; position: absolute; left: 6.5px; top: 3px; background: #353535; border-radius: 2px; }
.phone-icon::after { content: ""; width: 7px; height: 1.5px; position: absolute; left: 7px; bottom: 3px; background: #353535; }
.device-kicker { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 550; letter-spacing: .9px; }
.device-card h3 { grid-column: 1; grid-row: 2; font-size: 21px; line-height: 1.35; font-weight: 650; letter-spacing: -.5px; margin: 3px 0 6px; overflow-wrap: anywhere; }
.device-meta { grid-column: 2; grid-row: 3; align-self: center; justify-content: flex-end; display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; max-width: 200px; color: var(--muted); font-size: 12px; text-align: right; }
.device-account, .device-card .account { grid-column: 1; grid-row: 3; min-width: 0; min-height: 24px; display: flex; align-items: center; gap: 7px; margin-top: 0; color: #454545; font-size: 13px; overflow-wrap: anywhere; }
.account-verified { display: inline-flex; align-items: center; justify-content: center; width: auto; height: auto; padding: 2px 6px; border: 1px solid #c6c6c6; border-radius: 4px; background: #f3f7fc; font-size: 11px; font-weight: 500; line-height: 1.5; white-space: nowrap; flex: 0 0 auto; }
.device-message { grid-column: 1 / -1; grid-row: 4; min-height: 26px; color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 8px; overflow-wrap: anywhere; }
.device-progress { grid-column: 1 / -1; grid-row: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 12px; min-width: 0; margin-top: 8px; color: var(--muted); font-size: 12px; }
.device-progress > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-progress > span:nth-child(2) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.device-progress > .progress-track { grid-column: 1 / -1; }
.status-strip > .device-progress { width: 240px; max-width: 100%; margin-top: 0; flex-shrink: 0; }
.device-progress > div:first-child:not(.progress-track) { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.progress-track { height: 5px; border-radius: 4px; background: #e4ecf6; overflow: hidden; }
.progress-fill { display: block; height: 100%; max-width: 100%; background: linear-gradient(90deg, var(--primary), #19a1b5); border-radius: inherit; }
.device-card .bottom { grid-column: 1 / -1; grid-row: 6; margin-top: 12px; padding-top: 10px; border-top: 1px solid #ebebeb; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.device-card .bottom span:last-child { color: var(--ink); font-weight: 550; white-space: nowrap; }
.device-card[data-state="offline"] { border-style: dashed; background: #fcfcfc; }
.device-card[data-state="offline"] .phone-icon { border-color: #777; border-style: dashed; }
.device-card[data-state="needs_attention"] { border-color: #999; }
.usb-note { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 12px; }

[data-tone="info"] { --tone: var(--info); --tone-bg: var(--info-bg); --tone-line: var(--info-line); }
[data-tone="success"] { --tone: var(--success); --tone-bg: var(--success-bg); --tone-line: var(--success-line); }
[data-tone="warning"] { --tone: var(--warning); --tone-bg: var(--warning-bg); --tone-line: var(--warning-line); }
[data-tone="danger"] { --tone: var(--danger); --tone-bg: var(--danger-bg); --tone-line: var(--danger-line); }
[data-tone="neutral"] { --tone: var(--neutral); --tone-bg: var(--neutral-bg); --tone-line: var(--neutral-line); }
[data-tone="manual"] { --tone: var(--manual); --tone-bg: var(--manual-bg); --tone-line: var(--manual-line); }
[data-tone="teal"] { --tone: var(--teal); --tone-bg: var(--teal-bg); --tone-line: var(--teal-line); }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; border: 1px solid var(--tone-line, var(--line)); border-radius: 7px; padding: 4px 9px; background: var(--tone-bg, var(--surface-soft)); color: var(--tone, var(--muted)); font-size: 11px; font-weight: 600; line-height: 1.55; white-space: nowrap; }
.state-icon { display: inline-flex; align-items: center; justify-content: center; width: 13px; min-width: 13px; height: 15px; font-size: 12px; font-weight: 800; line-height: 1; }
.badge[data-state="offline"], .badge[data-state="stopped"], .badge[data-state="skipped"] { border-style: dashed; }
.device-card[data-tone] { border-top: 3px solid var(--tone-line); }
.device-card[data-tone] .phone-icon { border-color: var(--tone); background: var(--tone-bg); }
.device-card[data-tone] .phone-icon::before { background: var(--tone); }
.device-card[data-tone] .bottom span:last-child { color: var(--primary); }
.status-strip[data-tone] { border-left: 4px solid var(--tone); }
.metric[data-tone] { background: linear-gradient(140deg, var(--tone-bg), #fff 80%); }
.metric[data-tone] .metric-value { color: var(--tone); }
#connection[data-state="online"] { color: var(--success); }
#connection[data-state="online"] .connection-dot { background: var(--success); border-color: var(--success); }
#connection[data-state="attention"] { color: var(--warning); }
#connection[data-state="attention"] .connection-dot { background: var(--warning); border-color: var(--warning); }
#connection[data-state="error"] { color: var(--danger); }
#connection[data-state="error"] .connection-dot { background: var(--danger); border-color: var(--danger); }
#connection[data-state="offline"] { color: var(--neutral); }
.status-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 11px; margin: -16px 0 23px; }
.status-legend span { color: var(--tone); font-weight: 550; }

.status-strip { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 13px; line-height: 1.7; }
.status-strip .actions { margin: 0; flex-shrink: 0; }
.status-copy { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.status-copy > .badge { margin-top: 1px; flex-shrink: 0; }
.status-copy p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.status-copy > .hint { max-width: 450px; margin: 0; font-size: 12px; }
.status-text { min-width: 0; }
.status-text strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.6; }
.status-text p { margin-top: 3px; }
.status-actions { flex-shrink: 0; }
.callout, .recovery-panel { border: 1px solid var(--warning-line); border-left: 3px solid var(--warning); border-radius: var(--radius-small); background: var(--warning-bg); padding: 18px 21px; margin: 18px 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.callout strong, .recovery-panel strong { display: block; font-size: 14px; font-weight: 650; }
.callout p, .recovery-panel p { color: #505050; margin-top: 5px; }
.callout .actions { margin-top: 12px; }
.callout > :last-child, .recovery-panel > :last-child { margin-bottom: 0; }

.table-wrap { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; overscroll-behavior-x: contain; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 18px 22px; text-align: left; border-bottom: 1px solid #eaeaea; vertical-align: middle; }
th { padding-top: 13px; padding-bottom: 13px; background: #f3f7fc; color: var(--muted); font-size: 11px; font-weight: 550; letter-spacing: .15px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f5f9ff; }
td:last-child { text-align: right; min-width: 150px; }
td a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 550; }
td a:hover { text-decoration: underline; }
td button { min-height: 44px; font-size: 12px; padding: 9px 12px; margin: 3px 0 3px 5px; }
.row-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.5; }
td a.row-title { display: flex; min-height: 25px; }
.row-meta, .task-message { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.65; overflow-wrap: anywhere; }
.task-message { max-width: 400px; }
.batch-table td:first-child { width: 30%; min-width: 200px; }
.batch-table .progress-track { margin-top: 8px; width: 100%; max-width: 130px; }
.task-table { margin-top: 20px; }
.task-toolbar + #task-list .task-table { margin-top: 0; }
.task-table td { vertical-align: top; }
.task-table td:first-child { min-width: 160px; font-weight: 550; padding-top: 22px; }
.task-table td:nth-child(2) { min-width: 240px; width: 47%; }
.task-table td:last-child { min-width: 190px; }
.task-table td:last-child details { text-align: left; margin-top: 9px; }
.task-table td:last-child details button { margin-left: 0; margin-right: 5px; }
.recovery-guide { max-width: 450px; margin-top: 8px; font-size: 12px; white-space: normal; }
.recovery-guide p { margin-top: 8px; color: #505050; line-height: 1.75; }
.recovery-guide summary { margin-top: 0; color: #454545; font-size: 12px; }
details[open].recovery-guide { padding: 11px 12px; background: #f4f4f4; border: 1px solid var(--line); border-radius: 7px; }

.recent-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recent-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 22px; border-bottom: 1px solid #eaeaea; color: var(--ink); text-decoration: none; min-height: 80px; }
.recent-row:last-child { border-bottom: 0; }
a.recent-row:hover { background: #f9f9f9; }
.recent-main { min-width: 0; }
.recent-main strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.recent-main p, .recent-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.recent-meta { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px 18px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.empty { grid-column: 1 / -1; min-height: 240px; padding: 45px 24px; border: 1px dashed #c5c5c5; border-radius: var(--radius); background: #fcfcfc; text-align: center; color: var(--muted); font-size: 13px; }
.empty-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 auto 13px; border: 1px solid #c4c4c4; border-radius: 10px; color: #555; }
.empty strong { display: block; margin-bottom: 7px; color: #353535; font-size: 16px; font-weight: 600; }
.empty p { max-width: 460px; margin: 0 auto; color: var(--muted); line-height: 1.8; }
.empty button { margin-top: 17px; }
#notice, #system-errors { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border: 1px solid #c9c9c9; border-radius: var(--radius-small); background: #ededed; padding: 14px 18px; margin: 0 0 18px; color: #353535; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
#system-errors { border-color: var(--warning-line); border-left: 3px solid var(--warning); background: var(--warning-bg); color: var(--warning); }
#system-errors[data-tone="danger"] { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
#system-errors a { color: inherit; flex-shrink: 0; font-weight: 600; }
#notice { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.notice-content { min-width: 0; }
#notice button { min-width: 44px; flex-shrink: 0; background: transparent; border: 0; padding: 0 9px; font-size: 19px; margin: -6px -9px -6px 0; }

dialog { width: min(580px, calc(100vw - 40px)); max-height: min(90vh, 960px); max-height: min(90dvh, 960px); padding: 28px 30px; border: 1px solid #bcbcbc; border-radius: 15px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px #00000026; overflow: auto; }
dialog::backdrop { background: #10274266; backdrop-filter: blur(3px); }
dialog .section-head { margin: 0 0 21px; align-items: center; }
dialog .section-head h2 { font-size: 20px; }
dialog .section-head button[data-close] { min-width: 44px; min-height: 44px; border: 0; padding: 0 10px; margin-right: -10px; font-size: 24px; font-weight: 400; }
.dialog-intro { margin: -8px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.form-section { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.form-section h3 { margin-bottom: 16px; font-size: 14px; }
label { display: block; margin-bottom: 17px; color: #353535; font-size: 13px; font-weight: 550; }
input, textarea { display: block; width: 100%; min-width: 0; min-height: 46px; border: 1px solid #c6c6c6; margin-top: 7px; padding: 10px 12px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: #767676; opacity: 1; }
input:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #858585; }
input:disabled, textarea:disabled { background: #f4f4f4; color: #777; cursor: not-allowed; }
textarea { min-height: 160px; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field-help { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; }
.field-error { display: block; margin-top: 5px; font-size: 12px; color: var(--danger); font-weight: 550; }
.field-error::before { content: "!"; display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; margin-right: 5px; border: 1px solid currentColor; border-radius: 50%; font-size: 9px; }
.form-error { color: var(--danger); border: 1px solid var(--danger-line); border-left: 3px solid var(--danger); border-radius: 7px; background: var(--danger-bg); padding: 11px 13px; font-size: 13px; line-height: 1.7; margin-bottom: 18px; overflow-wrap: anywhere; }
.check { min-height: 44px; display: flex; align-items: center; gap: 9px; margin-top: 9px; margin-bottom: 10px; font-size: 13px; font-weight: 450; }
.check input { width: 17px; min-height: 17px; height: 17px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.two-cols .check { align-self: center; padding-top: 17px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.form-actions .hint { margin: 0 auto 0 0; }
.divider { height: 1px; background: var(--line); margin: 25px 0; }
summary { min-height: 44px; display: list-item; color: #454545; font-size: 13px; line-height: 1.6; cursor: pointer; margin-top: 14px; padding: 11px 0; }
summary:hover { color: var(--ink); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #505050; background: #f4f4f4; border: 1px solid var(--line); border-radius: 7px; padding: 12px; font-size: 11px; line-height: 1.8; }

#job-dialog { width: min(880px, calc(100vw - 40px)); }
.job-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-top: 17px; }
.job-fact { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.job-fact:nth-child(3n) { border-right: 0; }
.job-fact:nth-last-child(-n + 3) { border-bottom: 0; }
.job-fact span { display: block; color: var(--muted); font-size: 11px; }
.job-fact strong { display: block; color: #353535; font-size: 13px; font-weight: 550; margin-top: 4px; overflow-wrap: anywhere; }
.evidence { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 23px 0; }
.evidence-card { min-width: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #f3f7fc; }
.evidence-card > h3 { padding: 12px 14px; font-size: 13px; background: #fff; border-bottom: 1px solid var(--line); }
.evidence img { display: block; width: 100%; max-width: 100%; max-height: 440px; object-fit: contain; background: #f2f2f2; }
.evidence-card p { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; padding: 10px 14px; font-size: 12px; }
.evidence-card p a { min-height: 32px; display: inline-flex; align-items: center; }
.evidence-placeholder { min-height: 160px; display: flex; align-items: center; justify-content: center; padding: 25px; border: 1px dashed #bcbcbc; border-radius: 9px; color: var(--muted); font-size: 13px; text-align: center; }
.event { position: relative; padding: 11px 0; border-bottom: 1px solid #eaeaea; color: #454545; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.event time { display: inline-block; min-width: 73px; margin-right: 10px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.event-stage { display: inline-block; font-weight: 600; color: #353535; margin-right: 8px; }
#job-content .section-head { flex-wrap: wrap; margin: 24px 0 10px; }
#job-content .section-head > a { font-size: 12px; margin-left: auto; min-height: 44px; display: inline-flex; align-items: center; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: auto; padding: 24px 0 26px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 11px; letter-spacing: .2px; }

.control-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; margin-bottom: 20px; background: linear-gradient(110deg, #eef5ff, #f0fafb 72%, #fff); border: 1px solid var(--info-line); border-radius: 16px; box-shadow: 0 3px 12px #245ec907; }
main > .control-panel { margin-bottom: 20px; }
.control-copy { min-width: 0; }
.control-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.control-title .badge { font-size: 14px; padding: 5px 10px; }
.control-copy > p:not(.eyebrow) { font-size: 13px; color: var(--ink); }
.control-help { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.control-actions { display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.stop-button:not(:disabled) { color: var(--danger); border-color: var(--danger-line); background: #fff; }
.stop-button:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
.version-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 20px; background: #ffffffb3; }
.system-version { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; background: var(--info-bg); border: 1px solid var(--info-line); border-radius: 10px; padding: 14px 16px; margin-bottom: 24px; }
.system-version strong { color: var(--info); font-size: 15px; }
.system-version span { color: var(--muted); font-size: 12px; }
.update-status { margin-top: 20px; }
.update-status > div { padding: 14px 16px; background: var(--tone-bg); border: 1px solid var(--tone-line); border-radius: 10px; color: var(--tone); }
.update-status p { margin-top: 5px; font-size: 12px; }
.file-field input { padding: 10px; font-size: 12px; max-width: 100%; }
.file-field input::file-selector-button { border: 0; background: var(--info-bg); color: var(--info); border-radius: 5px; padding: 8px 10px; margin-right: 8px; cursor: pointer; }
#system-dialog a { color: var(--primary); }
#system-dialog .form-section:first-of-type { border-top: 0; }

@media (min-width: 1600px) {
  main { padding-top: 8px; }
  .page-heading { padding-bottom: 34px; }
  .device-card { padding: 20px 24px 18px; }
  #home-view .page-heading { padding-top: 6px; padding-bottom: 20px; }
  #home-view .overview-grid { margin-bottom: 22px; }
  #home-view .overview-grid .metric { padding-top: 16px; padding-bottom: 16px; }
  #home-view .section-head { margin-top: 17px; margin-bottom: 11px; }
}

@media (max-width: 1100px) {
  main, .header-inner { padding-right: 32px; padding-left: 32px; }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 20px; }
  .header-right, .header-actions { gap: 10px; }
  .header-inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 4px 14px; }
  .status-strip { align-items: flex-start; }
  .status-copy { flex-wrap: wrap; }
  .status-copy > .hint { flex-basis: 100%; }
}

@media (max-width: 800px) {
  main, .header-inner { padding-right: 24px; padding-left: 24px; }
  .header-inner { min-height: 70px; }
  .workspace-tag { background: var(--teal-bg); color: var(--teal); display: none; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 32px; }
  .overview-grid, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .toolbar, .task-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .search-field { width: 100%; }
  .filter-group { max-width: 100%; }
  .control-panel { align-items: flex-start; flex-direction: column; gap: 16px; }
  .status-strip { flex-direction: column; gap: 16px; }
  .status-actions { width: 100%; }
  .recent-row { gap: 12px; }
  .recent-meta { max-width: 42%; gap: 7px; }
  .table-wrap table { min-width: 650px; }
  .task-table table { min-width: 660px; }
  .job-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-fact:nth-child(3n) { border-right: 1px solid var(--line); }
  .job-fact:nth-child(2n) { border-right: 0; }
  .job-fact:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .job-fact:nth-last-child(-n + 2) { border-bottom: 0; }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  .header-inner { min-height: 68px; padding: 10px 18px; gap: 4px; }
  .header-actions { width: 100%; justify-content: space-between; gap: 4px; }
  .header-actions button { font-size: 11px; padding: 8px 9px; }
  .control-panel { padding: 20px; }
  .control-actions { width: 100%; }
  .control-actions button { flex: 1; }
  .status-legend { gap: 8px 14px; font-size: 10px; }
  header:not(:has(.header-inner)) { padding: 0 18px; }
  header > .brand, header > .header-right { margin: 0; }
  .brand { font-size: 11px; letter-spacing: .7px; gap: 8px; }
  .brand span:not(.brand-mark) { display: none; }
  .brand-mark { width: 27px; height: 27px; border-radius: 7px; }
  .header-right, .header-actions { gap: 10px; }
  .header-right > a, .header-actions > a { font-size: 12px; }
  .header-right > #connection, .header-actions > #connection { display: none; }
  #settings-open { min-width: 44px; padding: 9px 11px; font-size: 12px; }
  main { padding: 0 18px; }
  main > section { margin-bottom: 36px; }
  #breadcrumb { min-height: 48px; gap: 7px; font-size: 11px; }
  .page-heading { flex-wrap: wrap; gap: 15px; padding: 16px 0 23px; }
  .page-heading h1 { margin: 6px 0 8px; font-size: 29px; letter-spacing: -.9px; }
  .page-heading .heading-actions, .page-heading > .actions { width: 100%; }
  .eyebrow { font-size: 10px; }
  .subtle, .section-caption { font-size: 12px; }
  .overview-grid { margin-bottom: 26px; }
  .metric, .summary-grid .metric { padding: 17px 16px; }
  .metric-value { font-size: 27px; }
  .metric-label, .metric-note { font-size: 11px; }
  .summary-grid .metric-value { font-size: 23px; }
  .section-head { flex-wrap: wrap; gap: 12px; margin-top: 24px; }
  h2 { font-size: 18px; }
  .section-head .actions { width: 100%; }
  .toolbar, .task-toolbar { gap: 10px; }
  .filter-group { width: 100%; }
  .filter-button { flex: 1; padding: 8px 9px; }
  .device-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .device-card { display: flex; flex-direction: column; padding: 22px; }
  .device-card .top { justify-content: space-between; align-self: stretch; margin-bottom: 18px; }
  .device-card h3 { font-size: 21px; }
  .device-account { margin-top: 5px; }
  .device-meta { justify-content: flex-start; align-self: flex-start; text-align: left; margin-top: 4px; max-width: 100%; }
  .device-message { min-height: 0; }
  .status-strip { padding: 19px 18px; gap: 14px; }
  .status-copy { gap: 11px; }
  .status-copy .status-text { flex-basis: 100%; }
  .status-copy > .hint { max-width: 100%; }
  .status-actions button { flex: 1; }
  .callout, .recovery-panel { padding: 16px; font-size: 12px; }
  .recent-row { align-items: flex-start; padding: 16px 18px; }
  .recent-main strong { font-size: 13px; }
  .recent-meta { max-width: 40%; flex-direction: column; align-items: flex-end; font-size: 11px; }
  .empty { min-height: 225px; padding: 35px 20px; }
  #notice, #system-errors { font-size: 12px; padding: 12px 14px; gap: 8px; }
  th, td { padding-left: 16px; padding-right: 16px; }
  dialog, #job-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 32px); padding: 22px 20px; border-radius: 12px; }
  dialog .section-head { flex-wrap: nowrap; }
  .two-cols { grid-template-columns: minmax(0, 1fr); }
  .two-cols .check { padding-top: 0; }
  input, textarea { font-size: 16px; }
  .form-actions { justify-content: stretch; }
  .form-actions button { flex: 1; }
  .evidence { grid-template-columns: minmax(0, 1fr); }
  .job-fact { padding: 11px 12px; }
  .evidence img { max-height: 420px; }
  #job-content .section-head { gap: 8px; }
  #job-content .section-head > a { margin-left: 0; }
  footer { padding: 19px 0 21px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Keep setup and task creation focused on one current step. */
.flow-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0 0 22px; }
.flow-steps li { display: flex; align-items: center; gap: 8px; padding: 10px 8px; color: var(--muted); font-size: 12px; border-bottom: 2px solid var(--line); }
.flow-steps li > span { flex: 0 0 23px; width: 23px; height: 23px; border-radius: 50%; text-align: center; line-height: 23px; background: var(--neutral-bg); color: var(--neutral); font-weight: 700; }
.flow-steps li.current { color: var(--info); border-bottom-color: var(--info); font-weight: 700; }
.flow-steps li.current > span { color: #fff; background: var(--info); }
.flow-steps li.done { color: var(--success); border-bottom-color: var(--success-line); }
.flow-steps li.done > span { color: var(--success); background: var(--success-bg); }
.wizard-panel h3 { margin-top: 0; }
.wizard-panel[hidden], .form-actions [hidden] { display: none; }
.mode-choice { padding: 16px; background: var(--info-bg); border: 1px solid var(--info-line); border-radius: 10px; font-size: 15px; }
.task-options { margin-top: 18px; }
.task-review { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.task-review dl { margin: 0; }
.task-review dl > div { display: grid; grid-template-columns: 85px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-review dl > div:last-child { border-bottom: none; }
.task-review dt { color: var(--muted); }
.task-review dd { margin: 0; overflow-wrap: anywhere; }
.review-mode { font-weight: 700; color: var(--info); }
#batch-back { margin-right: auto; }
.control-panel { padding: 12px 18px; border-radius: 12px; background: var(--surface); box-shadow: none; }
.control-copy { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.control-title { margin: 0; }
.control-help { font-size: 12px; }
#device-status details { margin-top: 8px; }
#device-status details p { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .flow-steps { gap: 4px; }
  .flow-steps li { padding: 9px 2px; font-size: 11px; gap: 5px; flex-direction: column; }
  .control-panel { padding: 14px 16px; gap: 10px; }
  .control-copy { gap: 8px; }
  .control-actions { width: auto; }
  .task-review { padding: 12px 15px; }
}
.mode-options { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.mode-options .mode-choice { margin: 0; background: var(--surface); border-color: var(--line); }
.mode-options .mode-choice:has(input:checked) { background: var(--info-bg); border-color: var(--info); }
