:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --border: #dfe3e7;
  --border-strong: #c9cfd6;
  --text: #1d232a;
  --text-soft: #68717d;
  --accent: #1769aa;
  --accent-soft: #eaf3fa;
  --green: #16784a;
  --green-soft: #e8f5ee;
  --amber: #9a6200;
  --amber-soft: #fff4d6;
  --red: #b4232c;
  --red-soft: #fdecee;
  --shadow: 0 8px 24px rgb(26 35 44 / 8%);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #20262c; color: #f8fafb; display: flex; flex-direction: column; padding: 18px 14px; }
.brand, .login-brand { display: flex; align-items: center; gap: 11px; }
.brand { padding: 4px 8px 22px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #f1f5f2; color: #176044; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy, .login-brand > div { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong, .login-brand strong { font-size: 15px; font-weight: 700; }
.brand-copy span, .login-brand span { color: #aab3bc; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 42px; border: 0; border-radius: 6px; padding: 0 11px; color: #cbd2d9; background: transparent; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 9px; text-align: left; }
.nav-item:hover { background: #2b333a; color: #fff; }
.nav-item.active { background: #f4f7f5; color: #20262c; }
.nav-count { min-width: 23px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: #37414a; color: #dbe1e5; font-size: 11px; }
.nav-item.active .nav-count { background: #dce9e3; color: #176044; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #353d44; padding: 15px 5px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.service-state { min-width: 0; display: flex; align-items: center; gap: 8px; color: #bdc5cc; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-soft); flex: none; }
.status-dot.ok { background: #38b679; box-shadow: 0 0 0 3px rgb(56 182 121 / 12%); }
.status-dot.warn { background: #d99a25; }
.status-dot.bad { background: #dc4f57; }
.sidebar .icon-button { color: #bdc5cc; }
.sidebar .icon-button:hover { background: #353d44; color: #fff; }

.main { min-width: 0; padding: 0 34px 50px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 5px; font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.last-refresh { color: var(--text-soft); font-size: 12px; }
.page { display: none; padding-top: 26px; }
.page.active { display: block; }

.button, .icon-button, .text-button { border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.button { min-height: 38px; border-radius: 6px; padding: 0 14px; font-weight: 650; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: #10598f; }
.button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.button.secondary:hover { background: var(--surface-muted); border-color: #abb3bc; }
.button.danger { background: var(--red); color: #fff; }
.button.danger:hover { background: #961b23; }
.button.wide { width: 100%; }
.icon-button { width: 38px; height: 38px; padding: 0; border-radius: 50%; background: transparent; color: var(--text-soft); }
.icon-button:hover { background: #e9ecef; color: var(--text); }
.text-button { padding: 6px 0; color: var(--accent); background: transparent; font-weight: 650; }
.text-button:hover { color: #0e527f; text-decoration: underline; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-width: 0; min-height: 112px; padding: 17px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); display: flex; flex-direction: column; justify-content: space-between; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); }
.stat-card-top span { font-size: 12px; font-weight: 650; }
.stat-icon { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-muted); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { font-size: 26px; font-weight: 720; line-height: 1; }
.stat-note { margin-top: 5px; color: var(--text-soft); font-size: 11px; }
.section-heading { min-height: 64px; margin-top: 18px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-heading.compact { min-height: auto; margin: 0; align-items: center; }
.section-heading h2, .pane-heading h2 { margin: 0; font-size: 15px; line-height: 1.3; }
.section-heading p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; }

.task-table-wrap, .history-table-wrap, .account-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th { height: 39px; padding: 0 14px; background: var(--surface-muted); color: var(--text-soft); font-size: 11px; font-weight: 700; text-align: left; }
td { height: 56px; padding: 8px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
.task-name { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.task-name-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.task-name-icon svg { width: 15px; height: 15px; }
.task-name strong { display: block; font-size: 13px; }
.task-name span { display: block; margin-top: 3px; color: var(--text-soft); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.badge { min-height: 22px; padding: 3px 8px; border-radius: 11px; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge.sent, .badge.completed, .badge.valid, .badge.enabled, .badge.connected { color: var(--green); background: var(--green-soft); }
.badge.failed, .badge.auth-expired, .badge.completion-timeout, .badge.auto-paused, .badge.invalid, .badge.expired { color: var(--red); background: var(--red-soft); }
.badge.duplicate, .badge.dry-run, .badge.paused, .badge.unknown, .badge.session-warning, .badge.expiring { color: var(--amber); background: var(--amber-soft); }
.badge.accepted, .badge.running, .badge.connecting, .badge.starting { color: var(--accent); background: var(--accent-soft); }
.badge.reconnecting { color: var(--amber); background: var(--amber-soft); }
.badge.off { color: var(--text-soft); background: var(--surface-muted); }
.badge-stack { display: flex; flex-wrap: wrap; gap: 5px; }
.badge.processing, .badge.synced { color: var(--accent); background: var(--accent-soft); }
.badge.pending { color: var(--amber); background: var(--amber-soft); }
.badge.finished { color: var(--green); background: var(--green-soft); }
.badge.error { color: var(--red); background: var(--red-soft); }
.muted { color: var(--text-soft); }
.credential-line, .validation-time { margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.empty-state { min-height: 160px; display: grid; place-items: center; padding: 25px; text-align: center; color: var(--text-soft); }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 8px; }
.empty-state p { margin: 0; }

.activity-list { border-top: 1px solid var(--border); }
.activity-item { min-height: 55px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.activity-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); }
.activity-icon svg { width: 14px; height: 14px; }
.activity-copy { min-width: 0; }
.activity-copy strong { font-size: 12px; }
.activity-copy p { margin: 3px 0 0; color: var(--text-soft); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: var(--text-soft); font-size: 11px; white-space: nowrap; }

.overview-alerts:empty { display: none; }
.overview-alerts { margin-top: 14px; border-top: 1px solid var(--border); }
.alert-row { width: 100%; min-height: 54px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; align-items: center; gap: 9px; text-align: left; }
.alert-row:hover { background: var(--surface); }
.alert-row > span:nth-child(2) { min-width: 0; }
.alert-row strong, .alert-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row strong { font-size: 12px; }
.alert-row small { margin-top: 3px; color: var(--text-soft); font-size: 10px; }
.alert-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); }
.alert-row.critical .alert-icon { background: var(--red-soft); color: var(--red); }
.alert-row.info .alert-icon { background: var(--accent-soft); color: var(--accent); }
.alert-icon svg { width: 14px; height: 14px; }

.task-workspace { min-height: calc(100vh - 148px); display: grid; grid-template-columns: 250px minmax(0, 1fr); border: 1px solid var(--border); border-radius: 7px; background: var(--surface); overflow: hidden; }
.account-heading { min-height: 42px; margin-top: 0; align-items: center; }
.account-table-wrap table { min-width: 1040px; }
.account-name { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.account-name strong, .account-name span { display: block; }
.account-name span { margin-top: 3px; color: var(--text-soft); font-size: 11px; }
.account-avatar { width: 32px; height: 32px; border-radius: 6px; background: var(--green-soft); color: var(--green); display: grid !important; place-items: center; flex: none; }
.account-avatar svg { width: 16px; height: 16px; }
.account-initial { font-weight: 750; text-transform: uppercase; }
.account-url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.quota-line { min-width: 150px; margin-top: 4px; display: flex; justify-content: space-between; gap: 10px; color: var(--text-soft); font-size: 10px; }
.quota-track { width: 100%; height: 4px; margin-top: 5px; overflow: hidden; border-radius: 2px; background: #e5e8eb; }
.quota-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .icon-button { width: 34px; height: 34px; }
.task-list-pane { border-right: 1px solid var(--border); background: var(--surface-muted); }
.pane-heading { height: 54px; padding: 0 13px 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.task-list { padding: 8px; display: grid; gap: 5px; }
.task-list-item { width: 100%; min-height: 60px; padding: 9px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.task-list-item:hover { background: #fff; border-color: var(--border); }
.task-list-item.active { background: #fff; border-color: var(--border-strong); box-shadow: 0 2px 7px rgb(27 38 48 / 6%); }
.task-list-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list-item small { display: block; margin-top: 4px; color: var(--text-soft); }
.task-editor { min-width: 0; }
.editor-placeholder { height: 100%; min-height: 480px; display: grid; place-items: center; color: var(--text-soft); text-align: center; }
.editor-placeholder svg { width: 34px; height: 34px; margin-bottom: 10px; }
.task-form { max-width: 1020px; margin: 0 auto; }
.editor-header { min-height: 70px; padding: 14px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 3; background: rgb(255 255 255 / 96%); }
.editor-header h2 { margin: 0; font-size: 17px; }
.editor-header p { margin: 4px 0 0; color: var(--text-soft); font-size: 11px; }
.editor-actions { display: flex; gap: 7px; }
.editor-section { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.editor-section:last-of-type { border-bottom: 0; }
.editor-section-title { margin-bottom: 15px; display: flex; justify-content: space-between; gap: 12px; }
.editor-section-title h3 { margin: 0; font-size: 14px; }
.editor-section-title p { margin: 4px 0 0; color: var(--text-soft); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; gap: 7px; }
.field > span:first-child, .compact-field > span { color: #424b55; font-size: 12px; font-weight: 650; }
.field.full { grid-column: 1 / -1; }
input, textarea, select { width: 100%; border: 1px solid var(--border-strong); border-radius: 5px; background: #fff; color: var(--text); outline: 0; }
input, select { height: 39px; padding: 0 10px; }
textarea { min-height: 98px; padding: 10px; line-height: 1.55; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(23 105 170 / 10%); }
.field-hint { color: var(--text-soft); font-size: 11px; }
.account-select-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.remote-select-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.manual-task-id { margin-top: 2px; }
.manual-task-id summary { width: max-content; color: var(--text-soft); font-size: 11px; cursor: pointer; }
.manual-task-id input { margin-top: 8px; }
.remote-selection-empty { min-height: 48px; margin-top: 5px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 5px; color: var(--text-soft); display: flex; align-items: center; gap: 8px; font-size: 11px; }
.remote-selection-empty svg { width: 16px; height: 16px; }
.remote-selection-summary { margin-top: 5px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.remote-selection-summary > div { min-width: 0; }
.remote-selection-summary > div > span:first-child { display: block; margin-bottom: 5px; color: var(--text-soft); font-size: 10px; }
.remote-selection-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.field-hint .badge { margin-right: 5px; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 42px; }
.password-wrap .icon-button { width: 34px; height: 34px; position: absolute; top: 2px; right: 2px; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.keeper-status { min-height: 52px; margin-top: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.keeper-icon { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: var(--accent); background: var(--surface); }
.keeper-icon svg { width: 15px; height: 15px; }
.keeper-status strong { display: block; font-size: 12px; }
.keeper-status small { display: block; margin-top: 3px; color: var(--text-soft); font-size: 10px; line-height: 1.4; }
.toggle-row { min-height: 54px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toggle-row strong { display: block; font-size: 12px; }
.toggle-row small { display: block; margin-top: 3px; color: var(--text-soft); font-size: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch span { width: 34px; height: 20px; border-radius: 10px; background: #aab1b9; position: relative; transition: background .15s; }
.switch span::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch em { font-style: normal; font-size: 12px; color: var(--text-soft); }
.weekday-row { display: flex; flex-wrap: wrap; gap: 7px; }
.weekday-check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.weekday-check span { width: 38px; height: 32px; border: 1px solid var(--border-strong); border-radius: 5px; display: grid; place-items: center; color: var(--text-soft); cursor: pointer; }
.weekday-check input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.event-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.event-check { min-height: 30px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.event-check input { width: 16px; height: 16px; padding: 0; }
.event-check span { font-size: 11px; }
#weekday-field.muted .weekday-row { pointer-events: none; opacity: .62; }
.prompt-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.variable-chip { border: 1px solid var(--border); border-radius: 12px; padding: 3px 8px; background: var(--surface-muted); color: var(--accent); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.variable-chip:hover { border-color: var(--accent); }
.prompt-area { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.prompt-meta { margin-top: 6px; display: flex; justify-content: space-between; color: var(--text-soft); font-size: 10px; }
.prompt-preview { min-height: 70px; margin-top: 12px; padding: 11px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-muted); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.session-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.session-meta { color: var(--text-soft); font-size: 11px; }
.history-versions { display: grid; gap: 7px; }
.version-row { min-height: 42px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 5px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.version-row p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.version-row time { color: var(--text-soft); font-size: 10px; }
.editor-footer { padding: 16px 22px 24px; display: flex; justify-content: space-between; gap: 10px; }

.filterbar { min-height: 64px; padding: 11px 13px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); display: flex; align-items: end; gap: 11px; }
.remote-toolbar { min-height: 64px; padding: 10px 0; display: flex; align-items: end; gap: 11px; border-bottom: 1px solid var(--border); }
.remote-toolbar .button { margin-left: auto; }
.remote-search { flex: 1; max-width: 360px; }
.search-input { position: relative; display: block; }
.search-input svg { width: 15px; height: 15px; position: absolute; left: 10px; top: 10px; color: var(--text-soft); }
.search-input input { height: 35px; padding-left: 33px; }
.remote-summary { min-height: 58px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; border-bottom: 1px solid var(--border); }
.remote-summary > div { padding: 0 16px; border-left: 1px solid var(--border); }
.remote-summary > div:first-child { padding-left: 0; border-left: 0; }
.remote-summary span { color: var(--text-soft); font-size: 10px; }
.remote-summary strong { display: block; margin-top: 3px; font-size: 17px; }
.text-danger { color: var(--red); }
.remote-workspace { min-height: 560px; margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) 350px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); overflow: hidden; }
.remote-task-list { min-width: 0; overflow: hidden; }
.remote-table-wrap { height: 100%; overflow: auto; }
.remote-table-wrap table { min-width: 850px; }
.remote-task-row { cursor: pointer; }
.remote-task-row.selected { background: var(--accent-soft); }
.remote-task-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.remote-task-row td:first-child { min-width: 250px; }
.remote-task-row td:first-child strong, .remote-task-row td:first-child span { display: block; }
.remote-task-row td:first-child span { max-width: 300px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); font-size: 10px; }
.remote-task-detail { min-width: 0; border-left: 1px solid var(--border); background: #fbfcfd; }
.remote-detail-empty { min-height: 100%; display: grid; align-content: center; justify-items: center; gap: 9px; padding: 25px; color: var(--text-soft); text-align: center; }
.remote-detail-empty svg { width: 30px; height: 30px; }
.remote-detail-empty p { margin: 0; }
.remote-detail-header { min-height: 93px; padding: 17px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; background: var(--surface); }
.remote-detail-header h2 { margin: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.remote-detail-header .mono { display: block; max-width: 250px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); font-size: 10px; }
.remote-detail-actions { display: flex; gap: 2px; }
.remote-detail-actions .icon-button { width: 34px; height: 34px; }
.remote-detail-badges { padding: 12px 17px; display: flex; flex-wrap: wrap; gap: 6px; }
.remote-detail-grid { margin: 0; padding: 4px 17px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.remote-detail-grid div { min-width: 0; }
.remote-detail-grid dt, .remote-metrics dt { color: var(--text-soft); font-size: 10px; }
.remote-detail-grid dd, .remote-metrics dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 650; }
.remote-detail-section { padding: 15px 0 2px; border-top: 1px solid var(--border); }
.remote-detail-title { padding: 0 17px 13px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.remote-detail-title h3 { margin: 0; font-size: 12px; }
.remote-detail-title span { color: var(--text-soft); font-size: 9px; text-align: right; }
.remote-metrics { margin: 0; padding: 0 17px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.remote-metrics > div { padding: 9px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.remote-detail-footer { padding: 15px 17px; border-top: 1px solid var(--border); }
.remote-detail-footer .button { width: 100%; }
.compact-field { min-width: 170px; display: grid; gap: 5px; }
.compact-field select { height: 35px; }
.filter-actions { margin-left: auto; display: flex; gap: 8px; }
.log-detail { max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }

.settings-layout { max-width: 960px; display: grid; gap: 12px; }
.settings-section { padding: 19px 20px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.settings-fields { margin-top: 16px; }
.settings-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.notification-list { margin-top: 14px; display: grid; }
.notification-row { min-height: 58px; padding: 7px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.notification-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--surface-muted); display: grid; place-items: center; color: var(--text-soft); }
.notification-icon svg { width: 15px; height: 15px; }
.notification-copy strong { font-size: 12px; }
.notification-copy p { margin: 3px 0 0; color: var(--text-soft); font-size: 10px; }
.notification-actions { display: flex; align-items: center; gap: 2px; }
.notification-actions .icon-button { width: 34px; height: 34px; }
.system-info { margin: 14px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.system-info > div { padding: 11px; border: 1px solid var(--border); border-radius: 5px; }
.system-info dt { color: var(--text-soft); font-size: 10px; }
.system-info dd { margin: 5px 0 0; font-weight: 700; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.dialog { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); overflow: auto; }
.dialog::backdrop { background: rgb(24 30 36 / 42%); }
.dialog-header { min-height: 66px; padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.dialog-header h2 { margin: 0; font-size: 17px; }
.dialog-body { padding: 17px; display: grid; gap: 14px; }
.dialog-footer { padding: 13px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.browser-bridge-dialog { width: min(660px, calc(100vw - 28px)); }
.bridge-section { display: grid; gap: 11px; }
.bridge-section + .bridge-section { padding-top: 15px; border-top: 1px solid var(--border); }
.bridge-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bridge-section-heading h3 { margin: 0; font-size: 13px; }
.bridge-section-heading p { margin: 3px 0 0; color: var(--text-soft); font-size: 11px; }
.pair-code { min-height: 58px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); display: grid; align-content: center; gap: 5px; }
.pair-code-row { display: flex; align-items: center; gap: 8px; }
.pair-code code { min-width: 0; flex: 1; font: 700 20px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.pair-code time { color: var(--text-soft); font-size: 10px; }
.browser-device-list { display: grid; }
.browser-device { min-height: 58px; padding: 8px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.browser-device:first-child { border-top: 0; }
.browser-device-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--surface-muted); color: var(--text-soft); display: grid; place-items: center; }
.browser-device-icon svg { width: 15px; height: 15px; }
.browser-device strong { display: block; font-size: 12px; }
.browser-device p { margin: 3px 0 0; color: var(--text-soft); font-size: 10px; }
.browser-device-actions { display: flex; align-items: center; gap: 5px; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 12px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; padding: 0; }
.confirm-dialog { width: min(410px, calc(100vw - 28px)); text-align: center; }
.confirm-dialog form { padding-top: 22px; }
.confirm-dialog h2 { margin: 10px 20px 6px; font-size: 17px; }
.confirm-dialog p { margin: 0 24px 20px; color: var(--text-soft); line-height: 1.5; }
.confirm-icon { width: 42px; height: 42px; margin: 0 auto; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: grid; place-items: center; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }

.login-view { min-height: 100vh; background: #eef1f3; display: grid; grid-template-columns: minmax(260px, 420px); align-content: center; justify-content: center; gap: 20px; padding: 24px; }
.login-brand { padding: 0 4px; }
.login-brand strong { color: var(--text); }
.login-brand span { color: var(--text-soft); }
.login-form { padding: 27px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 17px; }
.login-copy h1 { margin: 0; font-size: 22px; }
.login-copy p { margin: 7px 0 0; color: var(--text-soft); }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 30px)); min-height: 48px; padding: 11px 13px; border-radius: 6px; background: #222a31; color: #fff; box-shadow: var(--shadow); display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 8px; animation: toast-in .18s ease-out; }
.toast.error { background: #8f2027; }
.toast.success { background: #176345; }
.toast p { margin: 0; font-size: 12px; line-height: 1.4; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.is-spinning svg { animation: spin .8s linear infinite; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toggle-grid { grid-template-columns: 1fr; }
  .keeper-status { grid-template-columns: 30px minmax(0, 1fr); }
  .keeper-status > .badge { grid-column: 2; justify-self: start; }
  .remote-workspace { grid-template-columns: 1fr; }
  .remote-task-detail { min-height: 480px; border-top: 1px solid var(--border); border-left: 0; }
}

@media (max-width: 820px) {
  .app { display: block; padding-bottom: 66px; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 20; width: 100%; height: 64px; padding: 5px 8px; border-top: 1px solid #394149; }
  .brand, .sidebar-footer { display: none; }
  .nav { height: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .nav-item { min-height: 52px; padding: 4px; grid-template-columns: 1fr; grid-template-rows: 24px 16px; justify-items: center; gap: 1px; font-size: 11px; }
  .nav-item .nav-count { display: none; }
  .main { padding: 0 16px 28px; }
  .topbar { min-height: 78px; }
  .topbar h1 { font-size: 19px; }
  .page { padding-top: 18px; }
  .last-refresh { display: none; }
  .task-workspace { min-height: 0; display: block; border: 0; background: transparent; overflow: visible; }
  .task-list-pane { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); margin-bottom: 12px; }
  .task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-editor { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); overflow: hidden; }
  .editor-header { position: static; }
  .system-info { grid-template-columns: 1fr; }
  .remote-toolbar { align-items: stretch; flex-wrap: wrap; }
  .remote-toolbar .compact-field { flex: 1; }
  .remote-toolbar .button { margin-left: 0; align-self: end; }
}

@media (max-width: 560px) {
  .main { padding-left: 11px; padding-right: 11px; }
  .topbar-actions .button span { display: none; }
  .topbar-actions .button { width: 38px; padding: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 102px; padding: 13px; }
  .stat-value { font-size: 22px; }
  .task-list { grid-template-columns: 1fr; }
  .editor-header { align-items: flex-start; padding: 13px; }
  .editor-actions { flex-wrap: wrap; justify-content: flex-end; }
  .editor-actions .button span { display: none; }
  .editor-actions .button { width: 36px; min-height: 36px; padding: 0; }
  .editor-section { padding: 17px 13px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .account-select-line { grid-template-columns: 1fr; }
  .account-select-line .button { width: 100%; }
  .remote-select-line { grid-template-columns: 1fr; }
  .remote-select-line .button { width: 100%; }
  .toggle-grid { grid-template-columns: 1fr; }
  .editor-footer { padding: 14px 13px 20px; }
  .filterbar { align-items: stretch; flex-direction: column; }
  .remote-toolbar { flex-direction: column; }
  .remote-toolbar .compact-field, .remote-search { width: 100%; max-width: none; }
  .remote-toolbar .button { width: 100%; }
  .remote-summary { grid-template-columns: 1fr 1fr; }
  .remote-summary > div { min-height: 52px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
  .remote-summary > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .remote-workspace { margin-top: 10px; border-radius: 6px; }
  .remote-selection-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remote-detail-grid { grid-template-columns: 1fr; }
  .compact-field { min-width: 0; }
  .filter-actions { margin-left: 0; display: grid; grid-template-columns: 1fr 1fr; }
  .filter-actions .button { width: 100%; }
  .settings-section { padding: 16px 13px; }
  .section-heading.compact { align-items: flex-start; }
  .notification-row { grid-template-columns: 32px minmax(0, 1fr); }
  .notification-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .login-view { padding: 16px; }
  .login-form { padding: 21px 17px; }
  .activity-item { grid-template-columns: 30px minmax(0, 1fr); }
  .activity-time { grid-column: 2; }
  .browser-device { grid-template-columns: 32px minmax(0, 1fr); }
  .browser-device-actions { grid-column: 2; justify-content: space-between; }
}
