:root{
  --background:#f6f7f8;--surface:#ffffff;--raised:#f5f7fa;--text:#172438;--muted:#58677a;
  --border:#e7ecf2;--control:#c3cdd9;--primary:#471aff;--primary-hover:#3911dc;
  --selected:#eee9ff;--danger:#8c2828;--backdrop:#191c2066;--radius:8px;
  --scroll-thumb:#b4bfc9;--scroll-track:#f4f6f8;--scroll-hover:#8897a5;--scroll-active:#62707c;
  --sidebar-width:216px;--notice-height:52px;--accent:#471aff;--nav-active:#ececf2;--accent-ink:#471aff;--on-primary:#fff;--table-head:#eeecf7;--shadow-soft:0 2px 8px #0000000a;--shadow-float:0 12px 36px #00000026;
}
:root[data-theme=dark]{
 color-scheme:dark;--background:#111114;--surface:#1c1c21;--raised:#25252d;--text:#eeeef4;--muted:#b5b5c5;
 --border:#34343e;--control:#626270;--selected:#302746;--danger:#ff9caa;--backdrop:#0009;
 --scroll-thumb:#555560;--scroll-track:#17171c;--scroll-hover:#737381;--scroll-active:#9898a5;
 --nav-active:#2b2b34;--accent-ink:#bcadff;--table-head:#292633;--shadow-soft:0 3px 10px #0003;--shadow-float:0 14px 40px #0007;
}

*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:var(--scroll-thumb) var(--scroll-track)}
*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:var(--scroll-track)}
*::-webkit-scrollbar-thumb{background:var(--scroll-thumb);border:2px solid var(--scroll-track);border-radius:8px}
*::-webkit-scrollbar-thumb:hover{background:var(--scroll-hover)}*::-webkit-scrollbar-thumb:active{background:var(--scroll-active)}
body{margin:0;background:var(--background);color:var(--text);font:14px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
h1,h2,p{margin:0}h1{font-size:24px;line-height:1.3;font-weight:650;letter-spacing:-.025em}h2{font-size:19px;font-weight:600}
button,input,select,textarea{font:inherit}button,.button-link{min-height:40px;padding:9px 14px;border:1px solid var(--control);border-radius:var(--radius);color:var(--text);background:var(--surface);cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;line-height:1.4}
button:hover:enabled,.button-link:hover{background:var(--raised);border-color:var(--muted)}button:active:enabled{transform:translateY(1px)}button:disabled{opacity:.6;cursor:default}
.primary{background:var(--primary);border-color:var(--primary);color:var(--on-primary)}.primary:hover:enabled{background:var(--primary-hover);border-color:var(--primary-hover)}.danger{color:var(--danger);border-color:var(--danger)}
:focus-visible{outline:2px solid var(--accent-ink);outline-offset:3px}::selection{background:var(--selected);color:var(--text)}
input:not([type=checkbox]),select{width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--control);border-radius:var(--radius);background:var(--surface);color:var(--text);caret-color:var(--accent)}
input::placeholder{color:var(--muted);opacity:1}input[aria-invalid=true],select[aria-invalid=true]{border-color:var(--danger)}
input[type=checkbox]{accent-color:var(--primary);width:18px;height:18px;flex:none;margin:3px 0 0}
label{display:block;font-size:14px;font-weight:550}form{display:grid;gap:0}form>label{margin-top:20px}form>label:first-child{margin-top:0}
label+input,label+select,label+.secret{margin-top:8px}.secret{display:flex;gap:8px}.secret input{min-width:0;flex:1}.secret button{flex:none;font-size:13px}
.check{display:flex;align-items:flex-start;gap:12px;font-weight:400;line-height:1.6}.check input{margin-top:4px}
fieldset{min-width:0;margin:24px 0 0;padding:20px;border:1px solid var(--border);border-radius:12px}legend{font-weight:600;padding:0 8px}
.choices{display:grid;gap:12px;max-height:280px;overflow:auto}.choices label{margin:0}.hint{color:var(--muted);font-size:13px;line-height:1.6;max-width:76ch}
.form-error{color:var(--danger);min-height:24px;margin-top:16px;overflow-wrap:anywhere}.status-space{min-height:48px;margin-top:14px;font-size:13px;color:var(--muted)}
.network-policy{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;margin-bottom:24px;background:var(--selected);border-radius:var(--radius)}.network-policy>div{min-width:0}.network-policy strong{font-size:14px}.network-policy .hint{margin:6px 0 0}.network-policy button{flex:none}@media(max-width:650px){.network-policy{align-items:stretch;flex-direction:column}.network-policy button{width:100%}}
form .hint{margin-top:8px}
.entry{min-height:100dvh;display:grid;place-items:center;padding:32px 24px;background:var(--surface)}
.login-box{width:min(100%,340px)}
#setupFields{display:grid}#setupFields label:not(:first-child){margin-top:20px}#setupConfirmation{margin-top:20px}
.login-box h1:not(.sr-only){margin:0 0 12px;font-size:26px}.login-box>p{margin-bottom:28px;color:var(--muted);font-size:14px}.login-box form>button{margin-top:8px;min-height:46px}
.login-box .form-error:empty{display:none}.login-box form>button{margin-top:24px}
.brand{font-size:17px;font-weight:700;letter-spacing:-.03em;white-space:nowrap}
#shell{display:grid;grid-template-columns:var(--sidebar-width) minmax(0,1fr);grid-template-rows:auto 1fr;min-height:100dvh}
.app-sidebar{grid-column:1;grid-row:1/3;position:sticky;top:0;height:100dvh;display:flex;flex-direction:column;padding:28px 12px 16px;background:var(--surface);border-right:1px solid var(--border);min-width:0}
.topbar{padding:0 16px 32px}.tabs{display:grid;gap:4px}.tabs button{justify-content:flex-start;gap:12px;min-height:44px;padding:10px 14px;background:transparent;border-color:transparent;font-size:14px;color:var(--muted)}
.tabs button:hover:enabled{background:var(--raised);border-color:transparent;color:var(--text)}.tabs [aria-current=page]{background:var(--nav-active);color:var(--text);font-weight:600}
.tabs svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.sidebar-user{margin-top:auto;padding:20px 12px 0;display:grid;gap:14px;border-top:1px solid var(--border)}#viewer{font-size:13px;white-space:pre-line;line-height:1.65;overflow-wrap:anywhere}.sidebar-user button{justify-self:start;font-size:13px;padding:6px 12px;min-height:36px}
.mobile-section{display:none}.app-main{grid-column:2;grid-row:2;min-width:0}
.notice{grid-column:2;grid-row:1;min-height:var(--notice-height);padding:14px 32px;background:var(--selected);color:var(--text);font-size:13px;overflow-wrap:anywhere}.notice:empty{display:none}.notice.error{color:var(--danger)}
/* A 216px app sidebar; account tabs above the iframe keep the messenger at two panes. */
.workspace{display:flex;flex-direction:column;height:100dvh;min-height:480px;background:var(--surface)}
#shell:has(.notice:not(:empty)) .workspace{height:calc(100dvh - var(--notice-height))}
.account-list{padding:14px 24px;display:flex;align-items:center;gap:20px;border-bottom:1px solid var(--border);flex:none;min-width:0}
.account-list #workTitle{font-size:13px;font-weight:500;letter-spacing:0;flex:none;color:var(--muted);line-height:1.4}
#accountLinks{display:flex;gap:8px;overflow-x:auto;min-width:0;padding:3px}#accountLinks button{min-height:40px;text-align:left;justify-content:flex-start;flex:none;max-width:300px;padding:8px 12px;font-size:13px;background:transparent;border-color:transparent;overflow-wrap:anywhere}
#accountLinks button:hover{background:var(--raised)}#accountLinks [aria-current=true]{background:var(--selected);color:var(--accent-ink);font-weight:600}
.account-list .hint:empty{display:none}.conversation{flex:1;min-height:0;min-width:0;overflow:hidden;background:var(--surface)}
iframe{display:block;border:0;width:100%;height:100%;background:var(--surface)}.empty{display:grid;place-items:center;height:100%;padding:32px;color:var(--muted);text-align:center}
.panel{max-width:1440px;margin:0 auto;padding:36px 32px 48px}
.section-heading{display:flex;gap:24px;justify-content:space-between;align-items:flex-start;margin-bottom:28px}.section-heading .hint{margin-top:10px}.section-heading>button{flex:none}
.list-tools{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:0 0 24px}.list-tools label{font-size:13px;font-weight:400}.list-tools input{flex:1;min-width:180px;max-width:340px;margin:0;background:var(--surface)}.list-tools>button:last-child{margin-left:auto}
.table-wrap{overflow-x:auto;scrollbar-gutter:stable;background:var(--surface);border:1px solid var(--border);border-radius:12px}table{width:100%;border-collapse:collapse;text-align:left;font-variant-numeric:tabular-nums}th{font-size:12px;color:var(--muted);font-weight:600;background:var(--table-head);white-space:nowrap}
th,td{padding:18px 16px;border-bottom:1px solid var(--border);vertical-align:top}td{min-width:150px;font-size:14px;max-width:340px;overflow-wrap:anywhere}td:first-child{min-width:180px;font-weight:500}td:last-child{min-width:200px}td .hint{display:block;margin-top:7px;font-weight:400}td button{margin:0 8px 8px 0;font-size:13px;min-height:36px;padding:7px 10px}tbody tr:last-child td{border-bottom:0}tbody tr:hover{background:var(--raised)}td code{font:13px ui-monospace,monospace}.cell-list{list-style:none;padding:0;margin:0;display:grid;gap:8px}
th{padding-top:14px;padding-bottom:14px}td .verified-at{font-size:11px;line-height:1.45;margin-top:4px}
.pager{display:flex;align-items:center;gap:14px;justify-content:flex-end;min-height:60px;font-size:13px;color:var(--muted)}
.editor{max-width:720px;margin-top:32px;padding:28px;background:var(--surface);border-radius:12px;box-shadow:var(--shadow-soft)}.editor h2{margin-bottom:28px}.actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:24px}
.two-columns{display:grid;grid-template-columns:2fr 1fr;gap:20px;margin-top:20px}.two-columns label{margin:0}#proxyCredentials{display:grid;gap:0}#proxyCredentials>label{margin-top:20px}#showStoredProxyPassword{justify-self:start;margin-top:12px}#checkProxy{justify-self:start;margin-top:24px}
.import-box{padding:24px;background:var(--selected);margin-bottom:28px;border-radius:12px}.import-box p{max-width:74ch;margin-bottom:16px}
.journal-toolbar{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin:0 0 24px}.journal-toolbar select{max-width:340px}.journal-toolbar label{font-weight:400}.journal-toolbar .button-link{margin-left:auto}
#logFilePath{font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere;margin:0 0 12px}#networkLogStatus{min-height:28px;font-size:13px;color:var(--muted)}#networkLogOutput{max-height:560px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:20px;background:var(--raised);border:1px solid var(--border);border-radius:12px;font:12px/1.9 ui-monospace,monospace}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
dialog{width:min(480px,calc(100% - 32px));max-height:calc(100dvh - 48px);overflow:auto;border:0;border-radius:16px;padding:28px;color:var(--text);background:var(--surface);box-shadow:var(--shadow-float)}dialog::backdrop{background:var(--backdrop)}dialog p{margin:16px 0;line-height:1.7}
[hidden]{display:none!important}

@media(max-width:1200px){:root{--sidebar-width:200px}.panel{padding:28px 24px}.table-wrap td{min-width:120px}.table-wrap td:first-child{min-width:150px}.table-wrap td:last-child{min-width:180px}th,td{padding:16px 12px}}
@media(max-width:900px){
 #shell{display:flex;flex-direction:column}.app-sidebar{position:static;height:auto;display:flex;flex-direction:row;align-items:center;gap:16px;padding:12px 20px;border-right:0;border-bottom:1px solid var(--border)}.topbar{padding:0}.tabs{display:none}.sidebar-user{display:flex;align-items:center;gap:16px;margin:0 0 0 auto;padding:0;border:0}#viewer{font-size:12px;line-height:1.4}.sidebar-user button{min-height:44px}
 .mobile-section{display:flex;gap:12px;align-items:center;min-height:58px;padding:6px 20px;background:var(--surface);border-bottom:1px solid var(--border)}.mobile-section label{font-size:12px;font-weight:400;color:var(--muted);white-space:nowrap}.mobile-section select{flex:1;min-width:0;min-height:44px;padding:8px 12px}
 .notice{padding:14px 20px}.panel{padding:28px 20px}.section-heading{gap:20px;flex-wrap:wrap;margin-bottom:24px}.section-heading h1,.section-heading h2{font-size:22px}.section-heading>button{min-height:44px}
 .workspace{height:calc(100dvh - 127px)}#shell:has(.notice:not(:empty)) .workspace{height:calc(100dvh - 127px - var(--notice-height))}.account-list{padding:10px 16px;gap:12px}.account-list #workTitle{font-size:12px;max-width:64px}.account-list button{min-height:44px}
 .table-wrap{overflow:visible;margin:0;background:transparent;border:0;border-radius:0}.table-wrap table{display:block;min-width:0}.table-wrap thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.table-wrap tbody{display:block}
 .table-wrap tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px 16px;padding:20px 16px;margin-bottom:12px;background:var(--surface);border:1px solid var(--border);border-radius:12px}
 .table-wrap td,.table-wrap td:first-child,.table-wrap td:last-child{position:static;min-width:0;max-width:none;padding:0;border:0;background:transparent}.table-wrap td:first-child{grid-column:1/-1;font-size:16px}.table-wrap td:last-child{grid-column:1/-1;display:flex;gap:12px;flex-wrap:wrap;align-items:center}
 .table-wrap td:not(:first-child):not(:last-child)::before{content:attr(data-label);display:block;margin-bottom:8px;color:var(--muted);font-size:12px}.table-wrap td button{margin:0;min-height:44px}.table-wrap tbody[data-kind=activity] td:last-child{display:block}.table-wrap tbody[data-kind=activity] td:last-child::before{content:attr(data-label);display:block;font-size:12px;color:var(--muted);margin-bottom:8px}.table-wrap td[colspan]{grid-column:1/-1}
 .pager{justify-content:flex-start;flex-wrap:wrap;min-height:64px}.pager button{min-height:44px}.editor{padding:24px;max-width:none;margin-top:24px}.actions button,.button-link{min-height:44px}.list-tools{gap:12px}.list-tools input{max-width:none}.list-tools>button{min-height:44px}
}
@media(max-width:480px){
 .app-sidebar{padding:12px 16px;gap:12px}.brand{font-size:16px}.sidebar-user{gap:12px}#viewer{max-width:140px;font-size:11px}.sidebar-user button{padding:8px 10px}.mobile-section{padding:6px 16px}.panel{padding:24px 16px}.notice{padding:14px 16px}
 .list-tools input{width:100%;flex-basis:100%}.list-tools>button:last-child{margin-left:0}.section-heading .hint{margin-top:8px}.editor{padding:20px 16px;margin:24px -4px 0}.editor h2{margin-bottom:24px}.two-columns{gap:16px}.journal-toolbar{gap:12px}.journal-toolbar select{max-width:none}.journal-toolbar .button-link{margin-left:0}.secret{gap:6px}.secret button{padding:8px 10px}fieldset{padding:16px}.login-box h1:not(.sr-only){margin-top:0}input:not([type=checkbox]),select{font-size:16px}
}
@media(prefers-reduced-motion:reduce){button:active:enabled{transform:none}}
@media(forced-colors:active){*{scrollbar-color:auto}button,input,select{forced-color-adjust:auto}.tabs [aria-current=page],#accountLinks [aria-current=true]{outline:2px solid Highlight}}

.theme-toggle{gap:10px}.theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.theme-sun{display:none}:root[data-theme=dark] .theme-sun{display:block}:root[data-theme=dark] .theme-moon{display:none}
@media(max-width:900px){.sidebar-user .theme-toggle{width:44px;min-height:44px;padding:10px}.theme-toggle [data-theme-label]{display:none}.sidebar-user{gap:12px}}
@media(forced-colors:active){.table-wrap,.table-wrap tr{border-color:CanvasText}.primary{color:ButtonText;background:ButtonFace}dialog{border:1px solid CanvasText}}

@media(max-width:480px){.app-sidebar{gap:8px}.sidebar-user{min-width:0;flex:1;gap:8px}.sidebar-user #viewer{flex:1;min-width:0;max-width:100px}.sidebar-user button{flex:none}.theme-toggle{margin-left:auto}}
