:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: #292d2b;
  background: #f5f6f5;
  font-synthesis: none;
  --muted: #68706b;
  --border: #dce1dd;
  --accent: #28784e;
  --surface: #fff;
  --subtle: #f2f4f2;
}
* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
.header, main, footer { width: min(1600px, 100%); margin: auto; padding: 20px 24px; }
.header { display: flex; justify-content: space-between; align-items: center; min-height: 72px; border-bottom: 1px solid var(--border); gap: 12px; padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 18px; }
.brand { color: inherit; display: inline-flex; gap: 10px; text-decoration: none; align-items: center; font-size: 15px; font-weight: 700; min-width: 0; }
.brand img { flex: 0 0 32px; border-radius: 7px; }
.brand span { overflow-wrap: anywhere; }
.connection { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.connection::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #929992; margin-right: 7px; }
.connection.online { color: var(--accent); }
.connection.online::before { background: var(--accent); }
h1 { font-size: 24px; line-height: 1.35; margin: 0 0 20px; font-weight: 650; }
h2 { font-size: 15px; line-height: 1.5; margin: 0; font-weight: 650; }
p { line-height: 1.65; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.icon, .entry-icon { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon { width: 17px; height: 17px; }
.entry-icon { width: 28px; height: 28px; color: var(--accent); margin-bottom: 16px; }
.connect-panel { max-width: 540px; margin: 48px auto 64px; }
.connect-panel .hint { margin-top: 16px; }
.button-link { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 10px 16px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
label { display: block; font-size: 12px; font-weight: 600; margin: 16px 0 7px; }
input, select, textarea, button { font: inherit; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; min-height: 42px; background: var(--surface); color: #292d2b; border: 1px solid #c9d0ca; border-radius: 5px; padding: 10px 11px; font-size: 16px; }
textarea { resize: vertical; min-height: 170px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #7b837d; font-size: 13px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; max-width: 100%; min-height: 40px; border: 1px solid transparent; border-radius: 5px; padding: 9px 13px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4; cursor: pointer; }
button:hover:not(:disabled), .button-link:hover { background: #216341; }
button:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.button-secondary { background: var(--surface); border-color: #cfd5d0; color: #505951; }
.button-secondary:hover:not(:disabled) { background: #eef1ee; }
.button-danger { background: #fff3f2; color: #ac423b; border-color: #ebcfcb; margin-left: auto; }
.button-danger:hover:not(:disabled) { background: #fbe7e4; }
.icon-button { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; }
.button-with-icon span { overflow-wrap: anywhere; }
.connect-row, .token-row { display: flex; align-items: stretch; gap: 8px; }
.connect-row input, .token-row input { min-width: 0; flex: 1; }
.connect-row button { flex: 0 0 auto; }
.token-row .icon-button { height: 42px; }
details { margin-top: 10px; }
summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px 0; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 2px 0 18px; gap: 10px 16px; }
.workspace-heading h1 { font-size: 22px; margin: 0; }
.heading-title { min-width: 0; }
.heading-title .hint { margin: 5px 0 0; }
.deployment-panel { padding: 12px 0; border-bottom: 1px solid var(--border); }
.deployment-panel .workspace-heading { margin: 0; flex-wrap: nowrap; }
.workspace-actions, .toolbar-actions { display: flex; gap: 6px; flex: 0 0 auto; }
#workspace-title:focus { outline: none; }
.active-device { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.workspace-overview { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 18px; }
.workspace-overview > .hint { margin: 0; }
.workspace-stats { display: flex; align-items: center; gap: 20px; margin: 0; }
.workspace-stats > div { display: flex; align-items: baseline; gap: 9px; }
.workspace-stats > div + div { padding-left: 20px; border-left: 1px solid var(--border); }
.workspace-stats dt { font-size: 12px; color: var(--muted); }
.workspace-stats dd { font-size: 20px; font-weight: 650; margin: 0; font-variant-numeric: tabular-nums; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.workspace-column { min-width: 0; padding: 20px; }
.runs-card { border-left: 1px solid var(--border); }
.output-card { grid-column: 1 / -1; border-top: 1px solid var(--border); }
.section-heading { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.section-heading > .icon { color: var(--muted); }
.target-summary { font-size: 12px; line-height: 1.65; color: #376246; border-left: 2px solid #6b9b77; background: #f2f7f2; padding: 10px 11px; margin: 16px 0 0; overflow-wrap: anywhere; }
#target-summary { min-height: 60px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.form-footer .hint { font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.form-footer button { margin-left: auto; }
.risk-note { color: #767067; font-size: 11px; line-height: 1.65; margin: 16px 0 0; overflow-wrap: anywhere; }
.count { margin-left: auto; min-width: 24px; color: var(--muted); background: var(--subtle); border-radius: 4px; padding: 3px 7px; font-size: 12px; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.checkbox-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 400; min-height: 28px; margin: 10px 0 12px; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.run-filters { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.run-filters > div, .device-filters > div { min-width: 0; }
.run-filters label, .device-filters label { margin-top: 0; font-size: 11px; }
.run-filters input, .run-filters select { padding: 9px 8px; }
.search-field { position: relative; }
.search-field > .icon { position: absolute; left: 10px; top: 13px; color: #818a83; pointer-events: none; }
.search-field input, .run-filters .search-field input { padding-left: 34px; }
.runs-list { list-style: none; margin: 14px 0 0; padding: 0; max-height: 420px; overflow-y: auto; scrollbar-gutter: stable; }
.run-button { display: block; width: 100%; min-height: 108px; text-align: left; background: var(--surface); color: inherit; border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 8px; font-weight: 400; }
.run-button:hover:not(:disabled) { background: #f6f8f5; }
.run-button[aria-pressed="true"] { border-color: #81ab8b; background: #f0f7f0; }
.run-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.run-name { min-width: 0; font-size: 12px; line-height: 1.55; font-weight: 600; overflow-wrap: anywhere; }
.run-description { display: block; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: 9px; }
.run-time { display: block; font-size: 10px; line-height: 1.5; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.badge, .device-state, .device-status { flex: 0 0 auto; white-space: nowrap; color: #657065; font-size: 10px; line-height: 1.5; padding: 3px 6px; border-radius: 4px; background: #edf0ec; }
.badge.queued, .badge.running, .badge.stopping, .device-state.pending, .device-status.pending { color: #986b19; background: #fff3d8; }
.badge.completed, .device-state.online, .device-status.online { color: #277349; background: #e9f4e9; }
.badge.failed, .device-state.expired, .device-status.expired { color: #a4413a; background: #fceceb; }
.badge.stopped, .device-state.revoked, .device-status.revoked { color: #777; background: #eee; }
.empty { text-align: center; color: #788078; font-size: 12px; line-height: 1.6; padding: 48px 14px; margin: 12px 0; overflow-wrap: anywhere; }
.output-target { font-size: 12px; line-height: 1.65; margin: 14px 0 5px; overflow-wrap: anywhere; }
#output-meta { font-size: 11px; margin: 0 0 8px; }
.output-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.output-toolbar .checkbox-label { margin: 0; }
.output-toolbar .icon-button { width: 34px; height: 34px; min-height: 34px; flex-basis: 34px; }
.terminal { background: #222724; border: 1px solid #343c36; border-radius: 5px; padding: 16px; height: 380px; margin: 10px 0 0; overflow: auto; color: #dce4dd; font: 12px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-gutter: stable; tab-size: 2; }
.run-prompt { color: #505a52; background: #f4f6f3; padding: 12px; border-radius: 4px; font-family: inherit; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.notice { border: 1px solid #ebd4a4; color: #8b6521; background: #fff8e8; border-radius: 5px; padding: 11px 14px; font-size: 12px; line-height: 1.6; margin: 4px 0 18px; overflow-wrap: anywhere; }
.account-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); }
.account-tabs [role="tab"] { position: relative; background: transparent; color: var(--muted); border: 0; border-radius: 0; min-height: 44px; padding: 10px 2px; font-size: 13px; }
.account-tabs [role="tab"]:hover { background: transparent; color: #292d2b; }
.account-tabs [aria-selected="true"] { color: var(--accent); }
.account-tabs [aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.account-view { padding-top: 20px; }
.device-enrollment { padding: 0 0 20px; border-bottom: 1px solid var(--border); }
.device-enrollment .section-heading { min-height: 24px; }
#enroll-form { max-width: 650px; }
#enroll-form label { margin-top: 12px; }
#enrollment-panel { max-width: 760px; margin-top: 18px; padding: 16px 0 0; border-top: 1px solid var(--border); }
#enrollment-panel > label { margin-top: 0; }
#enrollment-token { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
#enrollment-expiry, #enrollment-status { margin: 7px 0 0; }
#enrollment-status:empty { display: none; }
#dismiss-enrollment { margin-top: 12px; }
.list-toolbar { display: flex; align-items: flex-end; gap: 16px; margin-top: 20px; }
.device-filters { display: grid; grid-template-columns: minmax(180px, 380px) 140px; gap: 10px; min-width: 0; }
.list-toolbar > .count { margin-bottom: 9px; }
.devices-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; list-style: none; margin: 12px 0 24px; padding: 0; }
.device-card { border: 1px solid var(--border); border-radius: 6px; padding: 18px; background: var(--surface); min-width: 0; min-height: 180px; }
.device-card h2, .device-card p { overflow-wrap: anywhere; }
.device-card[aria-current="true"] { border-color: #81ab8b; }
.device-top, .device-heading { display: flex; align-items: center; gap: 9px; }
.device-top .device-title, .device-heading .device-title { flex: 1; min-width: 0; }
.device-icon, .device-top > .icon { color: var(--muted); }
.device-info { margin: 10px 0 6px; }
.device-card > .hint { margin: 6px 0; font-size: 11px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.device-actions .icon-button { width: 36px; height: 36px; min-height: 36px; flex-basis: 36px; }
.device-actions button:not(.icon-button) { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.audit-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-list { list-style: none; margin: 12px 0 24px; padding: 0; }
.audit-item { padding: 14px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.audit-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }
.audit-action { font-size: 13px; font-weight: 600; }
.audit-meta, .audit-time { color: var(--muted); font-size: 11px; }
.audit-target { color: #566057; font-size: 12px; margin: 7px 0 0; overflow-wrap: anywhere; }
.audit-item p { margin: 6px 0 0; overflow-wrap: anywhere; }
footer { color: #858d86; font-size: 10px; padding-top: 12px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
dialog { background: var(--surface); color: #292d2b; border: 1px solid #cfd6d0; border-radius: 8px; padding: 24px; width: min(540px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; }
dialog::backdrop { background: #17251bbc; }
dialog h2 { font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@media (min-width: 1100px) {
  .workspace-grid { grid-template-columns: minmax(270px, .95fr) minmax(270px, .95fr) minmax(360px, 1.4fr); align-items: stretch; }
  .output-card { grid-column: auto; border-top: 0; border-left: 1px solid var(--border); }
  .terminal { height: min(58vh, 640px); min-height: 420px; }
  .runs-list { max-height: min(62vh, 660px); }
  .devices-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .header, main, footer { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .header { min-height: 66px; }
  .brand { gap: 8px; font-size: 13px; }
  .brand img { width: 28px; height: 28px; flex-basis: 28px; }
  .connection { font-size: 11px; }
  main { padding-top: 16px; }
  .connect-panel { margin: 30px auto 48px; }
  .workspace-heading { margin-bottom: 14px; }
  .workspace-heading h1 { font-size: 20px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace-column { padding: 18px 16px; }
  .runs-card { border-left: 0; border-top: 1px solid var(--border); }
  .output-card { grid-column: auto; }
  .workspace-stats { gap: 12px; }
  .workspace-stats > div { gap: 6px; }
  .workspace-stats > div + div { padding-left: 12px; }
  .workspace-stats dt { font-size: 11px; }
  .workspace-stats dd { font-size: 18px; }
  .workspace-overview { gap: 10px; }
  .workspace-overview > .hint { flex-basis: 100%; font-size: 11px; }
  button, .button-link { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
  .output-toolbar .icon-button, .device-actions .icon-button { width: 44px; height: 44px; min-height: 44px; flex-basis: 44px; }
  .device-actions button:not(.icon-button) { min-height: 44px; }
  .terminal { height: 340px; padding: 12px; }
  .runs-list { max-height: 370px; }
  .devices-list { grid-template-columns: minmax(0, 1fr); }
  .device-card { padding: 16px; }
  .device-filters { grid-template-columns: minmax(0, 1fr) 120px; flex: 1; }
  .list-toolbar { flex-wrap: wrap; gap: 8px; }
  .list-toolbar > .count { margin-bottom: 0; }
  .token-row .icon-button { height: 44px; }
}
@media (max-width: 420px) {
  .connect-row { flex-direction: column; }
  .connect-row button { width: 100%; }
  .device-filters { width: 100%; flex-basis: 100%; grid-template-columns: minmax(0, 1fr) 110px; }
  .device-filters input::placeholder { font-size: 11px; }
  .workspace-stats { gap: 10px; }
  .workspace-stats > div + div { padding-left: 10px; }
  .workspace-stats dt { font-size: 10px; }
  .workspace-stats dd { font-size: 17px; }
  .form-footer { align-items: center; }
  .form-footer button { padding: 9px 10px; font-size: 12px; }
  .output-toolbar .toolbar-actions { gap: 4px; }
  .dialog-actions { flex-wrap: wrap; }
}
