/* UTU Engine: dual theme. Preserve the technical SVG background in both modes. */
:root[data-theme="light"]{
  --bg:#edf6fb;--bg-deep:#e8f1f8;--surface:#fff;--surface-strong:#fff;
  --surface-soft:#f4fafc;--ink:#13253b;--muted:#526a7c;--line:#cbdae6;
  --line-strong:#abc6d8;--blue:#00aebf;--blue-2:#0885a4;
  --orange:#e3a63e;--shadow:0 18px 45px rgba(20,66,84,.12);
  --shadow-soft:0 8px 28px rgba(20,66,84,.07);
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#090f17;--bg-deep:#080f17;--surface:#0d1722;--surface-strong:#122334;
  --surface-soft:#101e2d;--ink:#edf5fb;--muted:#a7b4c6;--line:#223242;
  --line-strong:#30485b;--blue:#00bbd0;--blue-2:#008eac;
  --orange:#e7b253;--shadow:0 18px 45px rgba(0,0,0,.32);
  --shadow-soft:0 8px 22px rgba(0,0,0,.2);
}
html,body{min-height:100%}
body{
  background:radial-gradient(circle at 82% 4%,rgba(0,195,211,.09),transparent 31%),
             radial-gradient(circle at 11% 2%,rgba(229,167,60,.06),transparent 29%),
             linear-gradient(160deg,var(--bg),var(--bg-deep));
  color:var(--ink);
}
body::before{opacity:.11;background-size:44px 44px}
body::after{
  background-size:537px 403px!important; /* ~2x motifs per visible area */
  background-position:center 12px;
  opacity:.29;
}
:root[data-theme="dark"] body::after{opacity:.23;filter:brightness(1.5) sepia(.35) hue-rotate(130deg)}
.ambient-one{background:#06d0dc;opacity:.12}
.ambient-two{background:#e4ab46;opacity:.09}
.topbar{
  max-width:calc(100% - 24px);margin:8px 12px 0;border-radius:20px;
  background:linear-gradient(120deg,#0a1928,#101e2c 70%,#0a1827)!important;
  border:1px solid #203e51!important;
  grid-template-columns:minmax(345px,1fr) auto minmax(144px,1fr);
  min-height:78px;box-shadow:0 15px 30px rgba(3,13,24,.25);
}
.brand{gap:10px}
.brand-mark,.auth-mark{
  background:none;border:0;box-shadow:none;
  border-radius:0;flex-shrink:0;
}
.brand-mark{width:53px;height:63px}
.brand-mark img,.auth-mark img{height:100%;width:100%;object-fit:contain}
.auth-mark{height:82px;width:82px}
.brand-copy strong{font-size:22px;white-space:nowrap;letter-spacing:.015em;color:#f5f9fc}
.brand-copy strong em{font-style:normal;font-weight:450;color:#e7ad45}
.brand-copy>span{font-size:10px;color:#8cb6c6;font-weight:600}
.brand-slogan{
  margin:0 0 0 7px;padding:0 0 0 15px;
  border-left:1px solid rgba(156,183,204,.38);
  color:#d9e7f0;line-height:1.35;font-size:12px;white-space:nowrap;letter-spacing:0;
}
.topnav{gap:2px;background:rgba(33,58,79,.48);border-color:#263e51;padding:4px}
.topnav button{padding:9px 10px;font-size:11px;color:#daeaf4}
.topnav button:hover,.topnav button.active{
  background:linear-gradient(120deg,#057d93,#075067)!important;
  color:white;border:1px solid #00d3e1;
}
main{max-width:1510px;padding:38px 28px 70px}
.eyebrow{color:var(--blue);font-size:10px}
h1,h2,h3,h4,strong{color:var(--ink)}
.hero-head{margin-bottom:24px}
.hero-head h1{font-size:clamp(34px,3.5vw,45px)}
p,.meta,.hint,small{color:var(--muted)}
button.primary{
  background:linear-gradient(135deg,#00cddd,#0086a8)!important;
  border:1px solid #00d7e5!important;color:#fff!important;
  box-shadow:0 6px 17px rgba(0,162,182,.24)!important;
}
button.primary:hover{filter:brightness(1.08)}
:root[data-theme="light"] button.primary{background:linear-gradient(135deg,#09c1d1,#008aa4)!important}
.card,.panel{
  background:var(--surface);border-color:var(--line);
  color:var(--ink);box-shadow:var(--shadow-soft);
}
.card{border-radius:16px;min-height:154px}
.card::after{background:radial-gradient(circle,rgba(0,201,221,.07),transparent 72%)}
.card:hover{border-color:var(--blue);box-shadow:var(--shadow)}
:root[data-theme="dark"] :is(
  .card,.panel,.subpanel,.auth-card,.modal-dialog,.settings-nav-card,
  .investigation-table-wrap,.investigation-detail-header,.settings-content>section,
  .tool-row,.topology-builder-card,.topology-settings-card,.connection-detail,
  .investigation-result-card,.investigation-path-compact,.investigation-summary,
  .llm-settings-panel,.timeline-card,.execution-timeline-shell
){
  background:var(--utu-panel,#0d1722)!important;border-color:var(--utu-stroke,#223647)!important;color:var(--ink);
  box-shadow:0 8px 24px rgba(0,0,0,.12);
}
:root[data-theme="dark"] :is(
  .card,.panel,.subpanel,.settings-content,.investigation-table-wrap,
  .modal-dialog,.auth-card,.tool-row,.topology-builder-card,
  .investigation-detail-header,.execution-timeline-shell
) :is(h1,h2,h3,h4,strong,label){color:#ecf6fc}
:root[data-theme="dark"] :is(
  .card,.panel,.subpanel,.settings-content,.investigation-table-wrap,.modal-dialog,
  .auth-card,.tool-row,.topology-builder-card,.investigation-detail-header,.execution-timeline-shell
) :is(p,small,.meta,.hint){color:#afc1d1}
:root[data-theme="dark"] :is(
  button:not(.primary):not(.danger),input,select,textarea,pre,code,.settings-nav-card button,
  .investigation-pagination button
){
  background:var(--utu-field,#101e2d);color:#e8f4fd;border-color:var(--utu-stroke,#223647);
}
:root[data-theme="dark"] :is(input,select,textarea)::placeholder{color:#95aebf}
:root[data-theme="dark"] button:hover:not(.primary):not(.danger){background:var(--utu-panel-hover,#1a3044);color:#fff}
:root[data-theme="dark"] :is(.badge.ok,.investigation-status.ok){color:#93f0bd;background:#16473f;border-color:#24634e}
:root[data-theme="dark"] :is(.badge.warn,.investigation-status.warn){color:#f3d27a;background:#4e3b22;border-color:#6b5023}
:root[data-theme="dark"] .badge.error-badge{color:#ffc3bc;background:#5d292d;border-color:#7c343c}
:root[data-theme="dark"] .badge:not(.ok):not(.warn):not(.error-badge){background:#244053;color:#d7eaf5;border-color:#3b5b70}
:root[data-theme="dark"] :is(
  .investigation-table th,.investigation-table td,.cross-app-table-wrap,
  .investigation-table tr,.settings-nav-card,.settings-nav-card button
){border-color:#345064;color:#dbeaf5}
:root[data-theme="dark"] .investigation-table th{background:#152232;color:#aac4d5}
:root[data-theme="dark"] .investigation-table tbody tr:hover{background:var(--utu-panel-hover,#1a3044)}
:root[data-theme="dark"] .investigation-table tbody tr:hover td{background:transparent}
:root[data-theme="dark"] .settings-nav-card button.active{background:#145066;color:#5ee1ec}
:root[data-theme="dark"] :is(.card .meta,.investigation-query,.settings-nav-group){color:#adc5d5}
:root[data-theme="dark"] .application-card .badge.ok{color:#9ef3bd}
:root[data-theme="dark"] a{color:#46d9e8}
:root[data-theme="dark"] :is(hr,.subpanel){border-color:#385268}
:root[data-theme="dark"] .topology-node-card{background:var(--utu-panel-soft,#122334);border-color:var(--utu-stroke,#223647);color:#edf6fc}
:root[data-theme="dark"] .topology-node-card :is(strong,span){color:#e7f4fc}
:root[data-theme="dark"] .investigation-path-leg{background:var(--utu-panel-soft,#122334);color:#eef5f8;border-color:var(--utu-stroke,#223647)}
:root[data-theme="light"] .topbar{
  background:rgba(255,255,255,.93)!important;
  border-color:#c7e1e8!important;
  color:#19364a;
  box-shadow:0 12px 32px rgba(35,76,94,.11);
}
:root[data-theme="light"] .brand-copy strong{color:#173044}
:root[data-theme="light"] .brand-copy>span{color:#587b8e}
:root[data-theme="light"] .brand-slogan{color:#24495f;border-color:#b4d3dd}
:root[data-theme="light"] .topnav{background:rgba(233,247,250,.7);border-color:#d1e7ed}
:root[data-theme="light"] .topnav button{color:#2c5369}
:root[data-theme="light"] .topnav button:hover{color:#fff}
:root[data-theme="light"] .session-controls :is(.session-user,.ghost-button){color:#315168}
:root[data-theme="light"] .ghost-button{border-color:#bcd6e0;background:rgba(245,252,253,.8)}
:root[data-theme="light"] .ghost-button:hover{background:#daf4fa}

:root[data-theme="light"] .card{background:rgba(255,255,255,.88)}
:root[data-theme="light"] .topnav button.active{background:linear-gradient(120deg,#00a6ba,#087489)!important}
:root[data-theme="light"] .settings-nav-card button.active{background:#d9f7fa;color:#007d93}
:root[data-theme="light"] .application-card{border-color:#c8e3ed}
:root[data-theme="light"] .investigation-table th{background:#ebf7fc}
:root[data-theme="light"] .investigation-table tbody tr:hover{background:#eafaff}
.settings-nav-card{background:var(--surface);border-color:var(--line)}
.settings-nav-card button.active{color:var(--blue)}
:where(.application-card,.connection-card,.user-card,.investigation-app-card){
  display:flex;flex-direction:column;
}
:where(.application-card,.connection-card,.user-card,.investigation-app-card) > .actions{
  margin-top:auto;align-self:flex-end;justify-content:flex-end;
  padding-top:18px;width:100%;
}
.application-card>.actions{justify-content:flex-end}
.investigation-app-card>.investigation-app-stats{margin-bottom:auto}
#investigations-list .cross-app-card-wide-copy{display:flex;flex-direction:column;align-self:stretch}
#investigations-list .cross-app-card-wide-copy>.actions{margin-top:auto;justify-content:flex-end;width:100%}
#investigations-list .investigation-app-card:not(.cross-app-card-wide)>.actions{justify-content:flex-end}

.card .actions button{padding:7px 12px;border-radius:8px;font-size:11px}
.investigation-export-control{position:relative}
.investigation-export-options{
  position:absolute;right:0;top:calc(100% + 6px);z-index:45;
  min-width:278px;padding:6px;border-radius:12px;
  background:var(--surface-strong);border:1px solid var(--line-strong);
  box-shadow:var(--shadow);
}
.investigation-export-options button{
  display:flex;flex-direction:column;gap:2px;align-items:flex-start;
  width:100%;padding:10px 12px;background:transparent;border:0;box-shadow:none;
}
.investigation-export-options small{font-size:10px;font-weight:400}
.general-settings-card{max-width:780px;padding:24px}
.general-settings-card h2{margin:0 0 7px;font-size:22px}
.general-settings-card .general-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-top:22px}
.general-settings-card .general-fields label:last-child{grid-column:1/-1;max-width:360px}
.general-settings-card .field-help{font-size:11px;font-weight:400;line-height:1.5;color:var(--muted)}
.general-settings-card .actions{justify-content:flex-end}
.cross-app-investigation-table{min-width:620px;table-layout:auto}
.cross-app-investigation-table th,.cross-app-investigation-table td{
  padding:9px 13px!important;vertical-align:middle!important;font-size:12px;
}
.cross-app-investigation-table th{font-size:9px}
.cross-app-investigation-table th:first-child,.cross-app-investigation-table td:first-child{width:95px}
.cross-app-investigation-table th:nth-child(3),.cross-app-investigation-table td:nth-child(3){width:125px}
.cross-app-investigation-table th:nth-child(4),.cross-app-investigation-table td:nth-child(4){width:190px}
.cross-app-investigation-table th:last-child,.cross-app-investigation-table td:last-child{width:92px}
.cross-app-investigation-table td button{padding:5px 11px;min-height:27px}
.cross-app-table-wrap{width:100%;max-width:100%;border-radius:13px}
.cross-app-table-wrap .badge{font-size:10px;padding:2px 7px;min-height:20px}
@media(max-width:1250px){
  .topbar{grid-template-columns:1fr auto;grid-template-areas:"brand session" "nav nav"}
  .topnav{grid-area:nav;justify-content:center;flex-wrap:wrap}
  .brand{grid-area:brand}.session-controls{grid-area:session}
}
@media(max-width:720px){
  main{padding:28px 14px 65px}.topbar{margin:5px;max-width:calc(100% - 10px);padding:10px}
  .brand-mark{width:40px;height:50px}.brand-copy strong{font-size:16px}
  .brand-slogan{font-size:10px;padding-left:9px;margin-left:0}
  .topnav button{font-size:10px;padding:7px}
  .general-settings-card .general-fields{grid-template-columns:1fr}
  .general-settings-card .general-fields label:last-child{grid-column:1}
  body::after{background-size:438px 329px!important}
}

/* Child Cross-App investigation handoff: use the native UTU dark palette.
   Keep the technical audit content in PDF, never in on-screen handoff fields. */
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-details.compact-disclosure{
  background:var(--surface-strong);
  border-color:var(--line);
  box-shadow:none;
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-details>summary{
  background:var(--surface-soft);
  border-bottom:1px solid var(--line);
  color:var(--ink);
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-details>summary strong{
  color:var(--ink);
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-body{
  background:var(--surface-strong);
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-field{
  background:var(--surface-soft);
  border-color:var(--line-strong);
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-field span{
  color:var(--muted);
}
:root[data-theme="dark"] #investigation-detail .cross-app-transfer-field strong{
  color:var(--ink);
}
:root[data-theme="dark"] #investigation-detail .cross-app-raw-context{
  border-top-color:var(--line);
}
:root[data-theme="dark"] #investigation-detail .cross-app-raw-context pre{
  color:var(--ink);
  background:var(--surface-soft);
  border:1px solid var(--line);
}
