:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  color-scheme: dark;
  color: #eef0ed;
  background: #121416;
  --green: #78e1b8;
  --green-hover: #a0eccd;
  --lime: #cfdf88;
  --blue: #87ccd5;
  --amber: #e4ba77;
  --red: #f09b91;
  --ink: #eef0ed;
  --muted: #9da5a4;
  --line: #2c3032;
  --surface: #191c1e;
  --surface-raised: #212527;
  --focus: #87ccd5;
}

*, *::before, *::after { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; min-width: 320px; background: #121416; }
button, input, select, textarea, a { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
a { color: inherit; text-decoration: none; }
button, img { flex-shrink: 0; }
img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.25; font-weight: 650; }
h2 { font-size: 20px; line-height: 1.35; font-weight: 600; }
label { display: block; font-size: 12px; font-weight: 600; margin: 20px 0 8px; color: #cfd4d1; }
input { width: 100%; min-width: 0; height: 44px; border: 1px solid #3b4142; border-radius: 6px; background: #141719; padding: 0 12px; color: var(--ink); outline: none; transition: border-color 150ms ease, box-shadow 150ms ease; }
input::placeholder { color: #7c8582; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #78e1b817; }
input[readonly] { background: #171b1c; color: #c5ceca; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
::selection { color: #101b17; background: #a0eccd; }

.brand { display: flex; gap: 11px; align-items: center; font-size: 23px; line-height: 1; font-weight: 650; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--green); border-radius: 7px; box-shadow: 0 0 0 1px #b7f5dc45 inset; }
.brand-mark img { width: 20px; height: 20px; filter: none; opacity: 0.9; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 9px 15px; font-size: 12px; line-height: 20px; font-weight: 600; border-radius: 6px; border: 1px solid transparent; white-space: normal; text-align: center; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease; }
.button.primary { color: #10271e; background: var(--green); box-shadow: 0 1px 0 #c8ffea35 inset; }
.button.primary:hover:not(:disabled) { background: var(--green-hover); box-shadow: 0 0 0 3px #78e1b80d; }
.button.primary img { filter: none; opacity: 0.85; }
.button.secondary { color: #e3e7e4; background: #24292a; border-color: #3e4545; }
.button.secondary:hover:not(:disabled) { background: #2e3534; border-color: #63716a; }
.button.quiet { color: #b0bab5; background: transparent; }
.button.quiet:hover:not(:disabled) { color: var(--ink); background: #282e2b; }
.button.danger { color: #ffece7; background: #853e3c; border-color: #a05550; }
.button.danger:hover:not(:disabled) { background: #a34a44; border-color: #c66a60; }
.button.danger img { filter: brightness(0) invert(1); }
.wide { width: 100%; margin-top: 25px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 6px; color: var(--ink); background: transparent; transition: background-color 150ms ease, border-color 150ms ease; }
.icon-button img { opacity: 0.64; transition: opacity 150ms ease; }
.icon-button:hover:not(:disabled) { background: #2b3130; border-color: #3c4541; }
.icon-button:hover:not(:disabled) img { opacity: 1; }
.section-tag { font-size: 10px; font-weight: 600; color: #98a79d; line-height: 1.5; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.form-error { font-size: 12px; line-height: 1.6; background: #30201e; border: 1px solid #784841; color: #f3b2a8; border-radius: 6px; padding: 11px 13px; margin-top: 16px; overflow-wrap: anywhere; }
.loading-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 24px; }
.loading-screen .brand { animation: surface-enter 350ms ease both; }
.loading-screen p { color: var(--muted); font-size: 12px; }

.auth-layout { min-height: 100vh; display: flex; flex-direction: column; background: #121416; }
.auth-header { height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 0 44px; border-bottom: 1px solid var(--line); background: #171a1b; }
.auth-label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #a6b3ac; }
.auth-label img { width: 16px; height: 16px; opacity: 0.7; }
.auth-main { width: min(380px, calc(100% - 48px)); margin: 76px auto 90px; flex: 1; animation: surface-enter 350ms ease both; }
.auth-heading { margin-bottom: 32px; }
.auth-heading h1 { font-size: 32px; margin-top: 12px; }
.auth-heading p { font-size: 13px; line-height: 1.6; margin-top: 12px; color: #a4aea8; }
.auth-footer { display: flex; justify-content: space-between; gap: 16px; padding: 24px 44px; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.5; color: #8f9994; }
.password-field, .copy-field { position: relative; display: flex; align-items: center; }
.password-field input, .copy-field input { padding-right: 45px; }
.password-field button, .copy-field button { position: absolute; right: 4px; }
.code-input { max-width: 175px; font-family: Consolas, monospace; font-size: 18px; }
.totp-setup { margin-top: 25px; padding-top: 4px; border-top: 1px solid var(--line); }
.totp-setup input { font-size: 12px; font-family: Consolas, monospace; }
.text-link { display: flex; align-items: center; gap: 7px; width: max-content; max-width: 100%; font-size: 12px; line-height: 1.5; margin-top: 11px; color: var(--green); font-weight: 600; }
.text-link:hover { color: var(--green-hover); }
.text-link img { width: 14px; height: 14px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: #181b1c; border-right: 1px solid var(--line); padding: 29px 18px 0; }
.sidebar .brand { padding-left: 8px; }
.workspace-label { display: flex; align-items: center; gap: 7px; font-size: 9px; line-height: 1.5; font-weight: 600; color: #88948e; margin: 39px 10px 16px; }
.workspace-label .status-dot { width: 5px; height: 5px; background: #c4d486; }
.main-nav { display: grid; gap: 7px; }
.nav-item { min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid transparent; border-radius: 6px; color: #adb6b1; font-size: 12px; background: transparent; text-align: left; transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.nav-item img { width: 18px; height: 18px; opacity: 0.58; }
.nav-item:hover { color: var(--ink); background: #242a27; }
.nav-item.selected { background: #23372e; border-color: #344c3d; color: #a4edcd; font-weight: 600; }
.nav-item.selected img { opacity: 0.9; }
.nav-count { font-size: 10px; line-height: 15px; margin-left: auto; min-width: 21px; padding: 1px 5px; border-radius: 4px; background: #36513f; text-align: center; color: #bcebc9; }
.sidebar-bottom { margin-top: auto; }
.connection-health { display: flex; align-items: center; gap: 7px; font-size: 10px; color: #a0ada5; margin: 23px 10px; }
.connection-health .status-dot { width: 5px; height: 5px; }
.connection-health.offline { color: var(--amber); }
.connection-health.offline .status-dot { background: var(--amber); }
.account-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 18px 4px; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #576044; background: #303527; border-radius: 50%; font-size: 12px; font-weight: 600; color: #d6e4a1; }
.account-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.account-meta strong { font-size: 11px; line-height: 1.4; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta span { font-size: 10px; color: #88958e; }
.workspace { min-width: 0; }
.workspace-header { height: 76px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 40px; background: #151819; }
.breadcrumb { display: flex; gap: 13px; align-items: center; font-size: 11px; color: #8f9b94; }
.breadcrumb strong { font-weight: 500; color: #d8ded9; }
.breadcrumb > span { color: #57635b; }
.workspace-header-meta { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.workspace-title { display: flex; align-items: center; gap: 6px; color: #99a79e; font-size: 10px; line-height: 1.5; }
.workspace-title img { width: 13px; height: 13px; opacity: 0.62; }
.version-tag { font-size: 9px; line-height: 16px; color: #a8b4ad; border: 1px solid #36413b; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.page-view { max-width: 1510px; padding: 36px 40px 25px; animation: surface-enter 300ms ease both; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 29px; }
.page-heading h1 { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.heading-count { font-size: 12px; background: #2a352b; color: #cedc9a; min-width: 26px; height: 25px; padding: 5px 8px; border-radius: 5px; font-weight: 500; line-height: 15px; }
.workspace-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.overview-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; min-height: 106px; padding: 21px 26px; border-right: 1px solid var(--line); }
.overview-item:first-child { padding-left: 0; }
.overview-item:last-child { border-right: 0; padding-right: 0; }
.overview-item > div { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; grid-column: 1; grid-row: 1 / 3; }
.overview-label { color: #909e95; font-size: 10px; line-height: 1.5; grid-column: 1; }
.overview-value { font-size: 26px; font-weight: 600; line-height: 1.2; color: #edf0e7; grid-column: 1; overflow-wrap: anywhere; }
.overview-item:last-child .overview-value { font-size: 14px; line-height: 1.4; color: #d5ddc1; }
.overview-symbol { display: grid; place-items: center; width: 34px; height: 34px; color: var(--lime); grid-column: 2; grid-row: 1 / 3; }
.overview-symbol img { width: 24px; height: 24px; opacity: 0.65; }
.overview-item:nth-child(2) .overview-value { color: var(--green); }
.overview-item:nth-child(2) .overview-symbol { color: var(--green); }
.overview-item:nth-child(3) .overview-symbol { color: var(--lime); }
.devices-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.filter-group { display: flex; gap: 5px; align-items: center; }
.filter { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid transparent; background: transparent; color: #97a49c; border-radius: 5px; font-size: 11px; white-space: nowrap; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.filter:hover { color: var(--ink); background: #202724; }
.filter.active { color: #e6ecdf; background: #282e29; border-color: #38433a; font-weight: 600; }
.filter-count { font-size: 9px; line-height: 14px; background: #2d4538; min-width: 18px; padding: 1px 5px; border-radius: 3px; text-align: center; color: #a3dfbe; }
.device-table-head { display: grid; grid-template-columns: 44px minmax(140px, 1fr) 115px 160px 148px; gap: 16px; align-items: center; min-height: 47px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: #818e86; font-size: 10px; line-height: 1.5; }
.device-table-head > :first-child { grid-column: span 2; }
.device-table-head > :last-child { text-align: right; padding-right: 38px; }
.device-row { position: relative; display: grid; grid-template-columns: 44px minmax(140px, 1fr) 115px 160px 148px; gap: 16px; align-items: center; min-height: 100px; border-bottom: 1px solid var(--line); padding: 19px 4px; transition: background-color 160ms ease; }
.device-row::before { content: ""; position: absolute; left: -12px; top: 20px; bottom: 20px; width: 2px; background: var(--green); opacity: 0; transition: opacity 150ms ease; }
.device-row:hover { background: #181e1a; }
.device-row:hover::before, .device-row:focus-within::before { opacity: 1; }
.device-icon { width: 44px; height: 44px; display: grid; place-items: center; background: #222925; border: 1px solid #3c4940; border-radius: 7px; transition: border-color 150ms ease, background-color 150ms ease; }
.device-icon img { width: 22px; height: 22px; opacity: 0.74; }
.device-row:hover .device-icon { background: #28342b; border-color: #597052; }
.device-info { min-width: 0; }
.device-info strong { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.5; }
.device-info span { display: block; color: #8d9b92; font-size: 10px; line-height: 1.6; margin-top: 5px; }
.device-status { display: flex; align-items: center; gap: 7px; color: #8be3b6; font-size: 10px; line-height: 1.5; }
.device-status.offline { color: #959f9a; }
.device-status.offline .status-dot { background: #727e77; }
.device-status.paused { color: var(--amber); }
.device-status.paused .status-dot { background: var(--amber); }
.device-status.busy { color: var(--blue); }
.device-status.busy .status-dot { background: var(--blue); }
.device-last { font-size: 10px; line-height: 1.6; color: #9aaba0; overflow-wrap: anywhere; }
.device-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.connect-button { min-width: 102px; min-height: 34px; padding: 6px 11px; font-size: 11px; background: #253b2e; border-color: #456247; color: #c4edca; }
.connect-button:hover:not(:disabled) { background: #354d33; border-color: #789262; color: #e7f5c4; }
.connect-button img { width: 14px; height: 14px; opacity: 0.8; }
.connect-button:disabled { color: #89968e; border-color: #313d35; background: #202722; cursor: not-allowed; opacity: 1; }
.device-remove img { width: 15px; height: 15px; opacity: 0.45; }
.device-remove:hover:not(:disabled) { background: #392522; border-color: #67423b; }
.device-remove:hover:not(:disabled) img { opacity: 0.9; }
.empty-state { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 45px 20px; }
.empty-icon { width: 62px; height: 62px; background: #212a24; border: 1px solid #435743; border-radius: 8px; display: grid; place-items: center; margin-bottom: 23px; }
.empty-icon img { width: 27px; height: 27px; opacity: 0.74; }
.empty-state h2 { font-size: 17px; font-weight: 550; }
.empty-state p { font-size: 12px; line-height: 1.6; color: #a3afa6; margin-top: 10px; }
.empty-state .button { margin-top: 23px; font-size: 11px; }
.page-footer { display: flex; justify-content: space-between; align-items: center; font-size: 10px; line-height: 1.5; color: #7f9186; border-top: 1px solid var(--line); padding-top: 19px; gap: 12px; margin-top: 22px; }
.page-footer > span:first-child { display: flex; align-items: center; gap: 7px; }
.page-footer img { width: 13px; height: 13px; opacity: 0.6; }
.page-error { margin-bottom: 20px; }
.activity-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: start; gap: 15px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.activity-icon { width: 32px; height: 32px; display: grid; place-items: center; background: #252e29; border: 1px solid #36443b; border-radius: 6px; }
.activity-icon img { width: 15px; height: 15px; opacity: 0.7; }
.activity-content strong { font-size: 12px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.activity-content p { font-size: 11px; line-height: 1.7; color: #a0ada4; margin-top: 5px; overflow-wrap: anywhere; }
.activity-row time { font-size: 10px; color: #8c9b91; line-height: 22px; white-space: nowrap; }

.dialog { width: min(450px, calc(100% - 32px)); border: 1px solid #465149; border-radius: 8px; box-shadow: 0 24px 80px #0009, 0 1px 0 #a0b9a61a inset; padding: 27px; color: var(--ink); max-height: calc(100dvh - 36px); overflow: auto; background: #1d2220; }
.dialog[open] { animation: dialog-enter 200ms ease both; }
.dialog::backdrop { background: #080b0acc; backdrop-filter: blur(5px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.dialog-header h2 { margin-top: 7px; font-size: 21px; }
.dialog-header .icon-button { margin: -5px -7px 0 0; }
.dialog label { font-size: 11px; }
.dialog .copy-field input { font-size: 12px; }
.pair-ready { display: flex; align-items: center; gap: 8px; font-size: 11px; line-height: 1.5; padding: 11px 12px; background: #213b2c; border: 1px solid #3d6349; border-radius: 5px; color: #b9e9c8; margin-bottom: 23px; }
.pair-ready.expired { background: #3a3020; color: #e2c593; border-color: #6b5735; }
.pair-ready.expired .status-dot { background: var(--amber); }
.dialog #pair-done { margin-top: 6px; }
.compact-dialog p { font-size: 12px; line-height: 1.8; color: #b4c0b7; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }
.install-note { font-size: 11px; line-height: 1.7; color: #a6b6a9; margin-top: 12px; text-align: center; }
.toast { position: fixed; z-index: 100; bottom: 25px; left: 50%; transform: translateX(-50%); background: #263e2e; color: #e5f4e8; padding: 12px 19px; font-size: 11px; line-height: 1.6; box-shadow: 0 6px 24px #0006; border: 1px solid #59795b; border-radius: 6px; max-width: calc(100% - 30px); text-align: center; animation: toast-enter 180ms ease both; }

.viewer { position: fixed; inset: 0; background: #0d100f; display: grid; grid-template-rows: 66px minmax(0, 1fr); z-index: 50; color: #e5ece6; }
.viewer-toolbar { display: flex; justify-content: space-between; align-items: center; background: #1c2420; padding: 0 18px; border-bottom: 1px solid #36443a; gap: 14px; }
.viewer-identity, .viewer-actions { display: flex; align-items: center; gap: 16px; min-width: 0; }
.viewer-device { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.viewer-device strong { font-size: 12px; line-height: 1.5; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.viewer-device > span { display: flex; gap: 6px; align-items: center; font-size: 10px; line-height: 1.4; color: #a5d6b5; }
.viewer-device .status-dot { width: 5px; height: 5px; }
.viewer-actions { flex-shrink: 0; gap: 10px; }
.light-icon img, .disconnect img { filter: brightness(0) invert(1); }
.light-icon:hover:not(:disabled) { background: #303e33; border-color: #4a5c4b; }
.toolbar-divider { height: 21px; width: 1px; background: #46554a; margin: 0 2px; }
.disconnect { min-height: 34px; padding: 5px 10px; font-size: 11px; background: #303a32; color: #e5eee5; border-color: #526253; }
.disconnect:hover { background: #404f41; }
.disconnect img { width: 15px; height: 15px; opacity: 0.75; }
.control-toggle { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 400; margin: 0; color: #d6dfd6; cursor: pointer; position: relative; min-height: 32px; }
.control-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle-track { width: 28px; height: 16px; background: #4d5b50; border-radius: 8px; position: relative; flex-shrink: 0; transition: background-color 150ms ease; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: #c8d4ca; transition: transform 150ms ease, background-color 150ms ease; }
.control-toggle input:checked + .toggle-track { background: var(--green); }
.control-toggle input:checked + .toggle-track::after { transform: translateX(12px); background: #173725; }
.control-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.control-toggle input:disabled { cursor: not-allowed; }
.control-toggle input:disabled ~ span { opacity: 0.5; }
.viewer-stage { position: relative; display: flex; justify-content: center; align-items: center; min-width: 0; min-height: 0; overflow: hidden; outline: none; touch-action: none; }
.viewer-stage:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.viewer-stage canvas { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; user-select: none; }
.viewer-stage.control-active { cursor: default; }
.viewer-stage.vm-mouse-locked { cursor: none; }
#viewer-vm-mouse[aria-pressed="true"] { background: #334c3c; border-color: #587b5f; }
#viewer-vm-mouse:disabled { cursor: not-allowed; }
.viewer-message { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 28px; text-align: center; background: #0e1512f2; gap: 14px; pointer-events: none; }
.connecting-mark { width: 64px; height: 64px; background: #26382c; border: 1px solid #48614b; display: grid; place-items: center; border-radius: 8px; margin-bottom: 6px; }
.connecting-mark img { width: 26px; height: 26px; filter: brightness(0) invert(1); opacity: 0.66; }
.viewer-message h2 { font-size: 19px; font-weight: 550; }
.viewer-message p { font-size: 12px; color: #acc7b4; max-width: 440px; line-height: 1.7; overflow-wrap: anywhere; }
.viewer-content { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; }
.viewer-content.ai-open { grid-template-columns: minmax(0, 1fr) 350px; }
#ai-toggle[aria-expanded="true"] { background: #334c3c; border-color: #587b5f; }
.ai-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-y: auto; background: #191e1b; border-left: 1px solid #344438; }
.ai-heading { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid #303e34; flex-shrink: 0; }
.ai-heading h2 { font-size: 15px; font-weight: 600; margin: 0 0 5px; }
.ai-unconfigured { padding: 18px; margin: 0; color: #a5b3a9; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.local-codex { padding: 18px; min-width: 0; }
.bridge-connection { display: flex; align-items: center; gap: 8px; }
.bridge-connection > span { flex: 1; min-width: 0; font-size: 11px; color: var(--blue); overflow-wrap: anywhere; }
.bridge-connection .button { min-height: 34px; font-size: 11px; padding: 6px 12px; }
.bridge-connection .icon-button { height: 34px; width: 34px; }
.local-codex label { font-size: 11px; color: #c5d0c7; margin: 21px 0 8px; }
.local-codex textarea { width: 100%; min-width: 0; min-height: 100px; max-height: 180px; resize: vertical; font: inherit; font-size: 12px; line-height: 1.7; color: #e1e9e2; background: #121715; border: 1px solid #3b4b3f; border-radius: 5px; padding: 11px; }
.local-codex textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bridge-answer-section { border-top: 1px solid #303e34; padding-top: 19px; margin-top: 22px; }
#bridge-setup { border: 0; padding: 0; background: transparent; font-size: 11px; margin-top: 10px; cursor: pointer; }
#bridge-setup-dialog .wide { margin-top: 18px; }
.ai-status { font-size: 11px; color: #a5b3a9; }
.ai-status[data-state="ready"] { color: var(--green); }
.ai-status[data-state="thinking"], .ai-status[data-state="capturing"] { color: var(--blue); }
.ai-settings { padding: 10px 18px 16px; border-bottom: 1px solid #303e34; flex-shrink: 0; }
.ai-settings label { font-size: 11px; margin: 12px 0 7px; color: #c5d0c7; }
.ai-provider-line { display: flex; justify-content: space-between; align-items: center; min-height: 30px; gap: 8px; color: var(--blue); font-size: 11px; }
.ai-provider-line > span { overflow-wrap: anywhere; }
.ai-provider-line .icon-button { height: 27px; width: 27px; }
.ai-companion { border-bottom: 1px solid #303e34; padding: 4px 0 12px; margin-bottom: 12px; }
.ai-companion-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ai-companion-line > div, .companion-current > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ai-companion-line strong { font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.ai-companion-line span { font-size: 10px; color: #98a79c; }
.ai-companion-line .icon-button, .ai-companion-actions .icon-button { width: 32px; height: 32px; }
.ai-companion-actions { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.ai-companion-actions .button { min-height: 32px; padding: 5px 10px; font-size: 11px; flex: 1; justify-content: center; }
.companion-current { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #344438; padding-bottom: 17px; margin-bottom: 18px; }
.companion-current strong { font-size: 13px; overflow-wrap: anywhere; }
.companion-current span { font-size: 11px; color: #9caf9e; }
.companion-warning { font-size: 12px; line-height: 1.7; color: var(--amber); margin: 0 0 16px; overflow-wrap: anywhere; }
.companion-download { margin-top: 18px; }
#ai-companion-result input { font-size: 12px; }
.ai-connect-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.ai-connect-reason { font-size: 11px; line-height: 1.6; color: #a5b3a9; margin: 8px 0 0; overflow-wrap: anywhere; }
.ai-connect-row select, .ai-settings textarea { width: 100%; min-width: 0; font: inherit; color: #e1e9e2; background: #121715; border: 1px solid #3b4b3f; border-radius: 5px; padding: 8px; font-size: 11px; line-height: 1.6; }
.ai-connect-row select { height: 34px; }
.ai-settings textarea { resize: vertical; min-height: 80px; max-height: 180px; }
.ai-connect-row select:focus-visible, .ai-settings textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ai-connect-row .button, .ai-actions .button, .ai-login .button { min-height: 34px; font-size: 11px; padding: 6px 10px; }
.ai-login { margin-top: 10px; }
.ai-login code { display: block; font-size: 17px; padding: 12px 0; color: #e4ede5; overflow-wrap: anywhere; }
.ai-login .text-link { font-size: 11px; }
.ai-arm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.ai-arm-row label { margin: 0; }
.ai-arm-row > span { max-width: 180px; font-size: 10px; color: #9aad9d; text-align: right; overflow-wrap: anywhere; }
.ai-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.ai-actions .button { flex: 1; justify-content: center; }
.ai-actions .icon-button { width: 34px; height: 34px; border: 1px solid #414f43; border-radius: 5px; }
.ai-panel button:disabled { cursor: not-allowed; }
.ai-panel .form-error { font-size: 11px; margin: 12px 0 0; overflow-wrap: anywhere; }
.ai-answer-section { flex: 1; min-height: 150px; padding: 19px 18px; }
.ai-answer-label { color: #899e8e; font-size: 9px; }
.ai-empty { color: #8a9e8e; font-size: 12px; margin: 16px 0; }
.ai-answer { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8; color: #e3ebe4; margin-top: 13px; user-select: text; }
.ai-footer { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid #303e34; padding: 12px 18px; color: #98aa9c; font-size: 10px; line-height: 1.6; flex-shrink: 0; }
.ai-footer > span { overflow-wrap: anywhere; }

body[data-design-preview]::after { content: "Design preview / Sample devices"; display: block; width: 100%; padding: 12px 24px; border-top: 1px solid #46523c; background: #1e251d; color: #c8d69b; font-size: 10px; line-height: 1.5; text-align: right; pointer-events: none; }

@keyframes surface-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(7px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-enter { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }

@media (min-width: 1500px) {
  .page-view { padding-right: 56px; padding-left: 56px; }
  .workspace-header { padding-right: 56px; padding-left: 56px; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .workspace-header { padding-right: 28px; padding-left: 28px; }
  .page-view { padding-right: 28px; padding-left: 28px; }
  .device-row, .device-table-head { grid-template-columns: 40px minmax(110px, 1fr) 100px 125px 136px; gap: 12px; }
  .device-icon { width: 40px; height: 40px; }
  .connect-button { min-width: 94px; }
  .device-actions { gap: 4px; }
  .overview-item { padding-right: 20px; padding-left: 20px; }
}
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 194px minmax(0, 1fr); }
  .sidebar .brand { font-size: 21px; padding-left: 3px; gap: 9px; }
  .workspace-label { font-size: 8px; margin-right: 3px; margin-left: 3px; }
  .workspace-title { display: none; }
  .page-view { padding-top: 30px; }
  .device-row, .device-table-head { grid-template-columns: 40px minmax(100px, 1fr) 91px 130px; gap: 12px; }
  .device-last, .device-table-head > :nth-child(3) { display: none; }
  .connect-button { min-width: 88px; }
  .overview-item { padding-right: 14px; padding-left: 14px; gap: 8px; }
  .overview-symbol { width: 26px; }
  .overview-symbol img { width: 21px; height: 21px; }
}
@media (max-width: 900px) {
  .viewer-content.ai-open { grid-template-columns: minmax(0, 1fr) 320px; }
  .overview-item:last-child .overview-value { font-size: 12px; }
}
@media (max-width: 700px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 64px minmax(0, 1fr); }
  .sidebar { height: 64px; position: sticky; z-index: 5; top: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 18px; flex-direction: row; align-items: center; gap: 12px; }
  .sidebar .brand { font-size: 19px; padding: 0; }
  .brand-mark { height: 29px; width: 29px; }
  .brand-mark img { height: 18px; width: 18px; }
  .workspace-label { display: none; }
  .main-nav { display: flex; gap: 4px; margin-left: auto; }
  .nav-item { width: 36px; min-height: 36px; justify-content: center; padding: 0; }
  .nav-item > span { display: none; }
  .sidebar-bottom { margin: 0; }
  .account-row { border: 0; padding: 0; }
  .account-row .avatar, .account-meta, .connection-health { display: none; }
  .account-row > .icon-button { width: 30px; }
  .workspace-header { height: 49px; padding: 0 21px; gap: 10px; }
  .breadcrumb { font-size: 10px; gap: 10px; }
  .version-tag { font-size: 9px; }
  .page-view { padding: 28px 21px 20px; }
  .page-heading { gap: 12px; margin-bottom: 25px; }
  .page-heading h1 { font-size: 26px; margin-top: 7px; }
  .page-heading > .button { padding: 8px 11px; min-height: 37px; font-size: 11px; gap: 5px; }
  .page-heading > .button img { width: 15px; height: 15px; }
  .section-tag { font-size: 9px; }
  .heading-count { height: 22px; min-width: 23px; font-size: 10px; line-height: 12px; padding: 5px 7px; }
  .workspace-overview { margin-bottom: 25px; }
  .overview-item { min-height: 94px; padding: 18px 14px; }
  .overview-label { font-size: 9px; }
  .overview-value { font-size: 23px; }
  .overview-symbol { display: none; }
  .overview-item:last-child .overview-value { font-size: 11px; }
  .devices-toolbar { padding-bottom: 12px; }
  .filter { font-size: 10px; padding: 0 10px; }
  .device-table-head { grid-template-columns: minmax(0, 1fr) auto; min-height: 42px; padding: 11px 0; font-size: 9px; }
  .device-table-head > :first-child { grid-column: auto; }
  .device-table-head > :nth-child(2), .device-table-head > :nth-child(3) { display: none; }
  .device-table-head > :last-child { padding-right: 30px; }
  .device-row { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; min-height: 105px; padding: 20px 0 33px; }
  .device-row::before { left: -10px; }
  .device-icon { width: 38px; height: 38px; }
  .device-icon img { width: 20px; height: 20px; }
  .device-info strong { font-size: 12px; }
  .device-info > span { font-size: 10px; margin-top: 4px; }
  .device-status { position: absolute; bottom: 12px; left: 49px; font-size: 9px; gap: 5px; }
  .device-status .status-dot { width: 5px; height: 5px; }
  .device-actions { gap: 3px; }
  .device-actions > .icon-button { width: 27px; height: 30px; }
  .connect-button { min-width: 74px; font-size: 10px; padding: 5px 8px; min-height: 30px; gap: 5px; }
  .connect-button img { width: 12px; height: 12px; }
  .empty-state { min-height: 300px; padding: 40px 8px; }
  .empty-state h2 { font-size: 16px; }
  .page-footer { font-size: 9px; align-items: flex-start; line-height: 1.6; }
  .page-footer > span:last-child { text-align: right; }
  .activity-row { gap: 10px; grid-template-columns: 28px minmax(0, 1fr); }
  .activity-row time { grid-column: 2; font-size: 9px; margin-top: -6px; }
  .activity-content strong { font-size: 12px; }
  .activity-content p { font-size: 11px; }
  .activity-icon { width: 27px; height: 27px; }
  .auth-header { height: 76px; padding: 0 24px; }
  .auth-header .brand { font-size: 21px; }
  .auth-label { font-size: 10px; gap: 6px; }
  .auth-label img { width: 15px; height: 15px; }
  .auth-main { margin-top: 48px; margin-bottom: 50px; }
  .auth-heading h1 { font-size: 29px; }
  .auth-footer { padding: 20px 24px; font-size: 9px; }
  .dialog { padding: 22px; }
  .dialog-header h2 { font-size: 20px; }
  .dialog-header { margin-bottom: 20px; }
  .viewer { grid-template-rows: 62px minmax(0, 1fr); }
  .viewer-toolbar { padding: 0 8px; gap: 8px; }
  .viewer-identity { gap: 6px; flex: 1; min-width: 0; }
  .viewer-actions { gap: 7px; }
  .viewer-device strong { font-size: 11px; max-width: 115px; }
  .viewer-device > span { font-size: 9px; }
  .control-toggle { font-size: 10px; gap: 5px; }
  .toolbar-divider { display: none; }
  .viewer-actions .icon-button, .viewer-identity .icon-button { width: 29px; }
  .disconnect { width: 31px; padding: 0; min-height: 31px; }
  .disconnect > span { display: none; }
  .toast { bottom: 16px; font-size: 11px; }
  .viewer-message h2 { font-size: 17px; }
  .viewer-message p { font-size: 11px; }
  .viewer-content.ai-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(110px, 1fr) minmax(0, 2fr); }
  .ai-panel { border-left: 0; border-top: 1px solid #344438; }
  .ai-heading { padding: 12px 16px; }
  .ai-settings, .ai-answer-section { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 520px) {
  .workspace-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-overview-account { display: none; }
  .overview-item:nth-child(2) { border-right: 0; padding-right: 0; }
  .viewer { grid-template-rows: 96px minmax(0, 1fr); }
  .viewer-toolbar { flex-wrap: wrap; align-content: center; gap: 4px; padding: 5px 10px; }
  .viewer-identity { flex-basis: 100%; min-height: 36px; }
  .viewer-device { flex: 1; }
  .viewer-device strong { max-width: none; }
  .viewer-actions { width: 100%; justify-content: flex-end; gap: 6px; min-height: 36px; }
  .viewer-actions .control-toggle { margin-right: auto; }
  .viewer-actions .icon-button { width: 30px; height: 32px; }
}
@media (max-width: 420px) {
  .sidebar { padding-right: 14px; padding-left: 14px; gap: 8px; }
  .sidebar .brand { font-size: 18px; }
  .sidebar:has(#workspace-ai-companion:not([hidden])) { gap: 7px; padding: 0 12px; }
  .sidebar:has(#workspace-ai-companion:not([hidden])) .brand-mark { display: none; }
  .sidebar:has(#workspace-ai-companion:not([hidden])) .nav-item { width: 32px; }
  .page-view { padding-right: 16px; padding-left: 16px; }
  .workspace-header { padding-right: 16px; padding-left: 16px; }
  .overview-item { padding-right: 10px; padding-left: 10px; gap: 7px; }
  .overview-item:last-child .overview-value { font-size: 10px; }
  .device-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 9px; }
  .device-icon { width: 32px; height: 34px; }
  .device-icon img { width: 18px; height: 18px; }
  .device-status { left: 41px; }
  .device-actions { gap: 1px; }
  .connect-button { min-width: 65px; padding-right: 6px; padding-left: 6px; }
  .device-actions > .icon-button { width: 25px; }
  .auth-label { font-size: 9px; }
  .auth-header { padding-right: 20px; padding-left: 20px; }
  .auth-header .brand { font-size: 19px; }
  .dialog-actions { gap: 7px; }
  .dialog-actions .button { padding-right: 12px; padding-left: 12px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* The fullscreen target is the screen itself, so no toolbar or sidebar takes space. */
.viewer.viewer-fullscreen { grid-template-rows: minmax(0, 1fr); }
.viewer-fullscreen .viewer-toolbar { display: none; }
.viewer-fullscreen .viewer-content { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.viewer-fullscreen .ai-panel { display: none; }
.viewer-stage.is-fullscreen { width: 100%; height: 100%; background: #0d100f; }
.viewer-stage.is-fullscreen:focus-visible { outline: none; }
.viewer-fullscreen-exit { position: absolute; z-index: 3; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; border: 1px solid #ffffff45; border-radius: 8px; background: #17221cd9; opacity: 0.22; transition: opacity 150ms ease; touch-action: manipulation; }
.viewer-fullscreen-exit:hover, .viewer-fullscreen-exit:focus-visible { opacity: 1; }
@media (hover: none) { .viewer-fullscreen-exit { opacity: 0.7; } }
.viewer-information { margin: 0 0 20px; font-size: 12px; line-height: 1.6; }
.viewer-information > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid #344438; }
.viewer-information dt { color: #a6b6a9; }
.viewer-information dd { margin: 0; overflow-wrap: anywhere; }
