:root {
  --mars: #174f43;
  --mars-strong: #0d3b32;
  --tiffany: #67cfc3;
  --tiffany-soft: #e1f5f2;
  --ink: #17211d;
  --muted: #65716b;
  --faint: #8e9993;
  --line: #dce5e1;
  --surface: #ffffff;
  --bg: #f3f6f4;
  --danger: #a43f3a;
  font-family: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100dvh; margin: 0; background: var(--bg); letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(103, 207, 195, .42); outline-offset: 2px; }
button:active { transform: translateY(1px); }
[hidden] { display: none !important; }
.pair-view { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-rows: auto 1fr auto; background: var(--mars); color: #f5fffc; }
.pair-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 650; }
.pair-brand img { width: 30px; height: 30px; }
.pair-main { width: min(420px, 100%); margin: auto; padding: 38px 0 62px; }
.eyebrow { margin: 0 0 8px; color: var(--tiffany); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.pair-main h1 { margin: 0 0 38px; font-size: clamp(34px, 10vw, 48px); line-height: 1.05; font-weight: 720; }
.pair-main form { display: grid; gap: 12px; }
.pair-main label { color: #cbe0da; font-size: 11px; font-weight: 650; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; overflow: hidden; border: 1px solid rgba(255,255,255,.26); border-radius: 7px; background: rgba(255,255,255,.08); }
.key-row input { min-width: 0; height: 50px; padding: 0 14px; border: 0; outline: 0; background: transparent; color: #fff; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.key-row button { padding: 0 14px; border: 0; background: transparent; color: var(--tiffany); font-size: 11px; font-weight: 700; }
.pair-view footer { color: rgba(238,255,250,.55); font-size: 10px; }
.form-error { min-height: 18px; margin: 0; color: #ffc2bc; font-size: 11px; }
.primary, .secondary, .danger, .service-action { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 700; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.primary { background: var(--mars); color: #fff; }
.pair-view .primary { background: var(--tiffany); color: var(--mars-strong); }
.primary.wide { width: 100%; min-height: 50px; }
.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.danger { border-color: #e7c8c5; background: #fff8f7; color: var(--danger); }
.remote-app { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
.topbar { position: sticky; top: 0; z-index: 8; height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(220,229,225,.86); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup img { width: 34px; height: 34px; }
.brand-lockup div { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 14px; }
.brand-lockup span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.brand-lockup span b { color: var(--mars); font: 700 8px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.brand-lockup i { width: 6px; height: 6px; border-radius: 50%; background: var(--tiffany); box-shadow: 0 0 0 3px var(--tiffany-soft); }
.top-actions { display: flex; gap: 5px; }
.icon-button, .add-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--mars); font-size: 20px; transition: background-color .2s ease; }
.icon-button:hover, .add-button:hover { background: var(--tiffany-soft); }
.icon-button.update-ready { background: var(--tiffany-soft); color: var(--mars-strong); box-shadow: inset 0 0 0 1px var(--tiffany); }
.app-main { width: min(760px, 100%); margin: 0 auto; padding: 0 15px 88px; }
.overview { margin: 18px 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.overview button { min-width: 0; min-height: 70px; padding: 12px; display: grid; align-content: center; gap: 3px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.overview button:last-child { border-right: 0; }
.overview button:hover { background: #f7faf8; }
.overview button.active { background: var(--tiffany-soft); box-shadow: inset 0 -2px 0 var(--mars); }
.overview span { color: var(--muted); font-size: 9px; }
.overview strong { font: 700 23px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; font-variant-numeric: tabular-nums; }
.main-tabs { position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 7; padding: 5px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 7px; background: rgba(243,246,244,.96); backdrop-filter: blur(12px); }
.main-tabs button { min-height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.main-tabs button.active { background: var(--surface); color: var(--mars); box-shadow: 0 1px 4px rgba(18,64,54,.09); }
.section-heading { min-height: 92px; display: flex; align-items: flex-end; justify-content: space-between; padding: 23px 2px 14px; }
.section-heading h1 { margin: 0; font-size: 27px; line-height: 1; }
.section-heading .eyebrow { margin-bottom: 7px; color: var(--mars); }
.add-button { background: var(--mars); color: #fff; }
.task-tools { margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 8px; }
.search { min-width: 0; height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--faint); }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.task-tools select { min-width: 0; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 11px; }
.task-list, .monitor-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.task-row { width: 100%; min-height: 112px; padding: 15px 14px; display: grid; gap: 9px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #f7faf8; }
.task-row-top, .task-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-row-reference { display: grid; justify-items: end; gap: 3px; }
.task-row-reference strong { color: #52665f; font: 700 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #93a19a; }
.status.running i { background: var(--tiffany); box-shadow: 0 0 0 3px var(--tiffany-soft); }
.status.interrupted i, .status.blocked i { background: #ca7a48; }
.status.completed i { background: var(--mars); }
.task-row time, .task-row-meta { color: var(--faint); font-size: 9px; }
.task-row h2 { margin: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; font-weight: 680; }
.task-row p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.task-row-meta span:last-child { font-variant-numeric: tabular-nums; }
.monitor-row { min-height: 74px; padding: 13px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.monitor-row:last-child { border-bottom: 0; }
.monitor-row > div { min-width: 0; display: grid; gap: 7px; }
.monitor-row header { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.monitor-row header strong { color: var(--ink); font-size: 11px; }
.monitor-row > strong { min-width: 48px; color: var(--mars); font: 700 18px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; text-align: right; }
.meter { height: 5px; overflow: hidden; border-radius: 3px; background: #e8efec; }
.meter i { height: 100%; display: block; border-radius: inherit; background: var(--mars); }
.monitor-meta { margin-top: 9px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 9px; }
.notification-row { margin-top: 14px; min-height: 68px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.notification-row > div { display: grid; gap: 5px; }
.notification-row strong { font-size: 11px; }
.notification-row span { color: var(--muted); font-size: 9px; }
.switch { position: relative; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: #cbd5d0; transition: background-color .2s ease; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(13,59,50,.2); transition: transform .2s ease; }
.switch input:checked + i { background: var(--mars); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid rgba(103,207,195,.42); outline-offset: 2px; }
.switch input:disabled + i { opacity: .5; }
.empty { min-height: 170px; padding: 36px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--faint); text-align: center; }
.empty strong { color: var(--muted); font-size: 12px; }
.empty span { font-size: 10px; }
.sheet-backdrop, .dialog-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(11,27,21,.42); opacity: 0; transition: opacity .2s ease; backdrop-filter: blur(3px); }
.sheet-backdrop.visible, .dialog-backdrop.visible { opacity: 1; }
.detail-sheet { position: fixed; inset: auto 0 0; z-index: 21; max-height: 92dvh; display: grid; grid-template-rows: 58px minmax(0,1fr); border-radius: 10px 10px 0 0; background: var(--surface); transform: translateY(102%); transition: transform .24s ease; box-shadow: 0 -16px 50px rgba(13,59,50,.2); }
.detail-sheet[aria-hidden="true"] { visibility: hidden; pointer-events: none; box-shadow: none; }
.detail-sheet.visible { transform: translateY(0); }
.detail-sheet > header { padding: 0 16px 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; }
.detail-content { overflow-y: auto; padding: 18px 16px max(28px, env(safe-area-inset-bottom)); }
.detail-hero { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-hero h1 { margin: 10px 0; overflow-wrap: anywhere; font-size: 22px; line-height: 1.35; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--faint); font-size: 9px; }
.detail-tabs { position: sticky; top: 0; z-index: 2; margin: 14px 0 0; padding: 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.detail-tabs button { min-width: 0; min-height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.detail-tabs button[aria-selected="true"] { background: var(--mars); color: #fff; }
.detail-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-section h2 { margin: 0 0 12px; font-size: 13px; }
.empty.compact { min-height: 96px; padding: 22px; }
.result-block { margin: 0; padding: 15px; border-left: 3px solid var(--mars); background: #f3f7f5; color: #34423c; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.history details { border-top: 1px solid var(--line); }
.history details:first-child { border-top: 0; }
.history summary { padding: 12px 0; color: var(--muted); font-size: 10px; cursor: pointer; }
.history p { margin: 0 0 14px; color: #34423c; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation { display: grid; gap: 18px; }
.conversation > h2 { margin-bottom: 0; }
.conversation-turn { display: grid; gap: 10px; }
.conversation-turn > header { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.conversation-turn > header strong { font-size: 11px; }
.conversation-turn > header span { color: var(--faint); font-size: 8px; }
.message-list { display: grid; gap: 9px; }
.conversation-message { padding: 11px 12px; border-left: 3px solid #c5d0cb; background: #f7f9f8; }
.conversation-message.assistant { border-left-color: var(--mars); background: #f1f7f4; }
.conversation-message > header { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conversation-message > header strong { font-size: 10px; }
.conversation-message > header span { color: var(--faint); font-size: 8px; }
.conversation-message pre { margin: 0; color: #34423c; font: inherit; font-size: 11px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-list, .queue-list { display: grid; gap: 7px; }
.file-row, .queue-row { min-height: 56px; padding: 10px 11px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; }
.file-row > div, .queue-row > div { min-width: 0; display: grid; gap: 4px; }
.file-row strong, .queue-row strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-row span, .queue-row span { color: var(--faint); font-size: 8px; }
.file-actions { display: flex; gap: 5px; }
.mini-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--mars); font-size: 9px; font-weight: 700; }
.queue-row button { width: 30px; height: 30px; border: 0; border-radius: 5px; background: #fff3f1; color: var(--danger); }
.continue-form { display: grid; gap: 9px; }
.continue-form textarea, .dialog textarea, .dialog select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; line-height: 1.5; resize: vertical; }
.continue-form footer, .detail-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.share-output { margin-top: 10px; padding: 11px; display: grid; gap: 7px; border: 1px solid #a9d7d0; border-radius: 6px; background: var(--tiffany-soft); }
.share-output a { overflow: hidden; color: var(--mars); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dialog-backdrop { display: grid; place-items: end center; padding: 14px; }
.dialog { width: min(520px,100%); border-radius: 9px; background: var(--surface); transform: translateY(24px); transition: transform .2s ease; }
.dialog-backdrop.visible .dialog { transform: translateY(0); }
.dialog > header { min-height: 70px; padding: 14px 14px 12px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog > header span { color: var(--muted); font-size: 9px; }
.dialog h2 { margin: 3px 0 0; font-size: 18px; }
.dialog form { padding: 18px; display: grid; gap: 14px; }
.dialog label, .attachment-field { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 650; }
.attachment-field > input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.attachment-picker { min-height: 52px; padding: 9px 11px; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; border: 1px dashed #aac0b9; border-radius: 6px; background: #f8fbfa; color: var(--ink); cursor: pointer; }
.attachment-picker:hover { border-color: var(--mars); background: var(--tiffany-soft); }
.attachment-picker b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--mars); color: #fff; font-size: 18px; font-weight: 500; }
.attachment-picker strong { font-size: 11px; }
.attachment-picker small { color: var(--faint); font-size: 8px; font-weight: 500; white-space: nowrap; }
.selected-files { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.selected-file { min-height: 48px; padding: 8px 8px 8px 11px; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.selected-file:last-child { border-bottom: 0; }
.selected-file > div { min-width: 0; display: grid; gap: 3px; }
.selected-file strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.selected-file span { color: var(--faint); font-size: 8px; font-weight: 500; }
.selected-file button { width: 32px; height: 32px; border: 0; border-radius: 5px; background: transparent; color: var(--danger); font-size: 18px; }
.selected-file button:hover { background: #fff1f0; }
.dialog footer { display: flex; justify-content: flex-end; gap: 7px; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40; max-width: calc(100% - 34px); padding: 10px 14px; border-radius: 6px; background: var(--mars-strong); color: #fff; font-size: 10px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 720px) {
  .app-main { padding-left: 24px; padding-right: 24px; }
  .detail-sheet { inset: 0 0 0 auto; width: min(620px, 88vw); max-height: none; border-radius: 0; transform: translateX(102%); }
  .detail-sheet.visible { transform: translateX(0); }
  .dialog-backdrop { place-items: center; }
}
@media (max-width: 380px) {
  .attachment-picker { grid-template-columns: 30px minmax(0, 1fr); }
  .attachment-picker small { grid-column: 2; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
