/* Appearance and shared navigation. Mail and PDF previews retain their authored colors. */
:root { color-scheme: dark; }
:root[data-theme="light"] {
    color-scheme: light;
    --rp-bg: #f3f5f8; --rp-panel: #fff; --rp-card: #fff; --rp-card-2: #e9edf3; --rp-inset: #f6f8fb;
    --rp-line: #dfe4ec; --rp-line-2: #cbd3df;
    --rp-text: #182338; --rp-text-2: #35445a; --rp-text-3: #5a6a7e;
    --rp-accent: #d62920; --rp-accent-hover: #b72119;
    --rp-info: #265ea8; --rp-info-bg: #eaf1fc; --rp-info-line: #aac4e9;
    --rp-danger: #ae2922; --rp-danger-bg: #fff0ee; --rp-danger-line: #ecc0ba;
    --rp-ok: #187545; --rp-ok-soft: #e8f4ed;
    --rp-shadow: 0 12px 36px rgba(30,47,72,.10);
}
.auth-language { margin-top:12px; }
.auth-language select { width:100%; height:52px; }
/* Keep one compact appearance action at the top right, clear of page actions. */
.shell-appearance,.auth-appearance { position:fixed; right:32px; z-index:30; }
.shell-appearance { top:calc((var(--rp-topbar-h) - 44px) / 2); }
.auth-appearance { top:24px; }
.app .page-head-inner { padding-right:100px; }
.theme-toggle { display:grid; place-items:center; position:relative; width:44px; height:44px; padding:0; border:1px solid var(--rp-line); border-radius:50%; background:var(--rp-panel); color:var(--rp-text-2); cursor:pointer; flex:none; -webkit-tap-highlight-color:transparent; transition:background-color .2s ease,border-color .2s ease,box-shadow .2s ease; }
.theme-toggle:hover { border-color:var(--rp-line-2); background:var(--rp-card); box-shadow:0 3px 14px rgba(0,0,0,.1); }
.theme-toggle:focus-visible { outline:2px solid var(--rp-info); outline-offset:4px; }
.theme-icon { grid-area:1 / 1; width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; pointer-events:none; transition:transform .32s cubic-bezier(.2,.8,.2,1),opacity .22s ease; }
.theme-icon-sun { color:#f4c66a; transform:rotate(0) scale(1); opacity:1; }
.theme-icon-moon { color:#5064ad; transform:rotate(-75deg) scale(.45); opacity:0; }
[data-theme="light"] .theme-icon-sun { transform:rotate(90deg) scale(.45); opacity:0; }
[data-theme="light"] .theme-icon-moon { transform:rotate(0) scale(1); opacity:1; }
/* Avoid animating authored mail/attachment previews or every node in large tables. */
.theme-changing body,.theme-changing .side,.theme-changing .side-session,
.theme-changing .main,.theme-changing .page-head,.theme-changing .dashboard-panel,.theme-changing .auth-card,
.theme-changing .workflow-dialog,.theme-changing .workflow-dialog-head,
.theme-changing input,.theme-changing select,.theme-changing textarea,
.theme-changing .nav-item,.theme-changing .page-title,.theme-changing .theme-toggle {
    transition:background-color .24s ease,color .24s ease,border-color .24s ease;
}
@media (prefers-reduced-motion:reduce) {
    .theme-icon,.theme-toggle,.theme-changing .theme-toggle,.theme-changing body,.theme-changing .side,
    .theme-changing .side-session,.theme-changing .main,.theme-changing .page-head,.theme-changing .dashboard-panel,
    .theme-changing .auth-card,.theme-changing .workflow-dialog,.theme-changing .workflow-dialog-head,
    .theme-changing input,.theme-changing select,.theme-changing textarea,
    .theme-changing .nav-item,.theme-changing .page-title { transition:none; }
}
@media (max-width:1120px) and (min-width:761px) {
    .shell-appearance { right:24px; }
    .app .page-head-inner { padding-right:88px; }
}
@media (max-width:760px) {
    .shell-appearance,.auth-appearance { position:absolute; top:12px; right:16px; }
    .app .page-head-inner { padding-right:18px; }
    .app .side-brand { padding-right:72px; min-height:68px; }
}
.side-nav { min-height:0; overflow-y:auto; }
.nav-settings { margin:0; }
.nav-settings summary { list-style:none; cursor:pointer; align-items:center; }
.nav-settings summary::-webkit-details-marker { display:none; }
.nav-chevron { width:20px; height:20px; margin-left:auto; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; transition:transform .18s ease; }
.nav-settings[open] .nav-chevron { transform:rotate(180deg); }
.nav-submenu { margin:0 0 8px 25px; padding-left:19px; border-left:1px solid var(--rp-line-2); }
.nav-submenu .nav-item { min-height:38px; margin:2px 0; padding:8px 12px; border-radius:8px; }
.nav-submenu .nav-text { font-size:13px; }
:where(a,button,summary,select,input,textarea):focus-visible { outline:2px solid var(--rp-info); outline-offset:3px; }
[data-theme="light"] .auth-card { background:var(--rp-panel); border-color:var(--rp-line); }
[data-theme="light"] .auth-body { background:var(--rp-bg); }
[data-theme="light"] .side, [data-theme="light"] .page-head { background:var(--rp-panel); }
[data-theme="light"] .input-wrap, [data-theme="light"] .recipient-row,
[data-theme="light"] .target-textarea, [data-theme="light"] .template-code-editor,
[data-theme="light"] .target-method-option > span { background:var(--rp-inset); }
[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select { color:var(--rp-text); background-color:var(--rp-inset); }
[data-theme="light"] .workflow-management-row:hover { background:var(--rp-info-bg); }
[data-theme="light"] .tone-green { color:var(--rp-ok); }
[data-theme="light"] .tone-red { color:var(--rp-danger); }
[data-theme="light"] .tone-amber { color:#8c5a09; }
[data-theme="light"] .tone-blue, [data-theme="light"] .tone-slate { color:var(--rp-info); }
[data-theme="light"] .tone-violet { color:#7046a3; }
[data-theme="light"] .template-code-editor .token-mark { color:var(--rp-info); background:var(--rp-info-bg); }
[data-theme="light"] .template-code-editor .token-mark.is-open { color:var(--rp-ok); background:var(--rp-ok-soft); }
.management-sections { display:grid; align-content:start; gap:20px; max-width:1280px; }
.management-sections h3 { margin:0 0 16px; font-size:17px; }
.management-sections p { line-height:1.7; color:var(--rp-text-3); }
.info-facts { display:grid; grid-template-columns:minmax(150px,1fr) 3fr; margin:0; }
.info-facts dt,.info-facts dd { padding:13px 0; border-bottom:1px solid var(--rp-line); margin:0; overflow-wrap:anywhere; }
.info-facts dt { color:var(--rp-text-3); }
.info-facts dd { padding-left:16px; }
.info-links { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }
@media (min-width:761px) and (max-width:1120px) {
    :root { --rp-side-w-rail:214px; }
    .nav-item { justify-content:flex-start; }
    .nav-item .nav-text,.side-domain,.side-user-copy,.logout-btn span { display:block; }
    .side-brand-rest { display:inline; }
    .side-brand-name,.side-brand-mark { font-size:23px; }
    .nav-item { gap:8px; }
    .side-user { justify-content:flex-start; }
    .side-user-icon { display:none; }
    .logout-btn { width:100%; }
    .side-countdown { flex-direction:row; }
}
@media (max-width:760px) {
    .side { position:relative; height:auto; flex-wrap:wrap; align-items:stretch; }
    .side-brand { width:auto; min-height:54px; padding:14px 18px; flex:1; border:0; }
    .side-session { order:1; flex-wrap:wrap; padding:10px 16px; width:100%; border:0; gap:10px; }
    .side-nav { order:2; flex:0 0 100%; display:flex; flex-wrap:wrap; gap:3px; overflow:visible; padding:8px 12px; border-top:1px solid var(--rp-line); }
    .side-nav > .nav-item,.nav-settings { flex:1 1 auto; }
    .side-nav .nav-item { width:auto; padding:8px 10px; min-height:38px; justify-content:flex-start; gap:6px; }
    .side-nav .nav-text { display:block; font-size:12px; }
    .side-nav .nav-icon { width:20px; height:20px; background:none; }
    .nav-settings[open] { flex-basis:100%; }
    .nav-submenu { display:flex; flex-wrap:wrap; margin:0; padding-left:12px; }
    .side-user { display:none; }
    .side-countdown { margin:0; flex-direction:row; gap:6px; }
    .logout-btn { width:auto; height:32px; gap:6px; }
    .logout-btn span { display:inline; font-size:12px; }
    .info-facts { grid-template-columns:1fr; }
    .info-facts dt { padding-bottom:0; border-bottom:0; }
    .info-facts dd { padding-left:0; }
}
@media print { .theme-toggle { display:none; } }

.system-sample-meta { margin:12px 0 0; font-size:11px; line-height:1.6; color:var(--rp-text-3); overflow-wrap:anywhere; }

.system-settings-form,.log-filters { display:flex; flex-wrap:wrap; align-items:end; gap:14px; margin-top:18px; }
.system-settings-form label,.log-filters label { display:grid; gap:7px; flex:1 1 180px; font-size:12px; color:var(--rp-text-3); }
.system-settings-form input,.system-settings-form select,.log-filters input,.log-filters select { width:100%; min-width:0; padding:10px; border:1px solid var(--rp-line-2); border-radius:7px; background:var(--rp-inset); color:var(--rp-text); font:inherit; }
.log-table-wrap { overflow-x:auto; }
.log-table { min-width:850px; table-layout:fixed; }
.log-table td { vertical-align:top; overflow-wrap:anywhere; white-space:normal; }
.log-table small { display:block; margin-top:6px; color:var(--rp-text-3); font-size:11px; }
.log-table a { color:var(--rp-info); }

[data-theme="light"] a.nav-item:hover, [data-theme="light"] .nav-item.is-active { color:var(--rp-text); }
[data-theme="light"] .side-session { background:var(--rp-inset); }
[data-theme="light"] .tone-blue { --tone:38 94 168; }
[data-theme="light"] .tone-green { --tone:24 117 69; }
[data-theme="light"] .tone-amber { --tone:140 90 9; }
[data-theme="light"] .tone-red { --tone:174 41 34; }
[data-theme="light"] .tone-violet { --tone:112 70 163; }
[data-theme="light"] .tone-slate { --tone:77 94 118; }
[data-theme="light"] .dash-system-bar { background:var(--rp-line); }
.dash-system-meters { --tone:77 148 239; }
.dash-system-engines li { white-space:normal; flex-wrap:wrap; }
.dash-system-state { --tone:150 160 175; }
.log-table { width:100%; border-collapse:collapse; font-size:12px; }
.log-table th,.log-table td { padding:14px; border-bottom:1px solid var(--rp-line); text-align:left; }
.log-table th { color:var(--rp-text-2); font-weight:600; background:var(--rp-inset); }
.log-table td { color:var(--rp-text-2); }
.log-table th:nth-child(1) { width:17%; }
.log-table th:nth-child(2) { width:12%; }
.log-table th:nth-child(3) { width:20%; }
.log-table th:nth-child(4) { width:20%; }
.log-table th:nth-child(5) { width:11%; }
.workflow-pagination button { padding:8px 12px; border:1px solid var(--rp-line-2); border-radius:6px; background:var(--rp-panel); color:var(--rp-text); font:inherit; cursor:pointer; }
.workflow-pagination button:disabled { opacity:.5; cursor:default; }

.nav-item,.side-user-role { color:var(--rp-text-3); }

[data-theme="light"] .workflow-picker-card.is-selected,
[data-theme="light"] .workflow-attachment-options button[aria-pressed=true],
[data-theme="light"] .workflow-result-row:hover,
[data-theme="light"] .management-card:hover,
[data-theme="light"] .training-card.is-actionable:hover,
[data-theme="light"] .result-card:hover { background:var(--rp-info-bg); }
[data-theme="light"] .alert-warning { color:#865208; background:#fff7e7; border-color:#e5c487; }
[data-theme="light"] .btn-secondary,[data-theme="light"] .target-preview-btn { color:var(--rp-text); background:var(--rp-card-2); }
[data-theme="light"] .btn-secondary:hover,[data-theme="light"] .target-preview-btn:hover { background:var(--rp-line-2); }

.management-sections .field-hint { margin:10px 0 0; font-size:12px; line-height:1.5; }

/* Logs keep the query visible while only the results scroll. */
.log-content { display:flex; flex-direction:column; gap:20px; overflow:hidden; padding-top:0; }
.log-filter-panel { flex:none; padding:20px 24px; }
.log-filter-panel > p { margin:0; color:var(--rp-text-3); font-size:12px; }
.log-filters { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:12px; margin-top:14px; }
.log-filters label { grid-column:span 3; min-width:0; }
.log-filters label:nth-of-type(n+7) { grid-column:span 2; }
.log-filters > .btn { grid-column:span 2; min-height:42px; }
.log-filters input,.log-filters select { height:42px; }
.log-results-panel { display:flex; flex:1; flex-direction:column; min-height:0; padding:0 24px 18px; overflow:hidden; }
.log-results-panel > p { padding:24px 0; color:var(--rp-text-3); }
.log-table-wrap { flex:1; min-height:0; overflow:auto; scrollbar-color:var(--rp-line-2) transparent; }
.log-table th { position:sticky; top:0; z-index:1; }
.log-table th:nth-child(1) { width:15%; }
.log-table th:nth-child(2) { width:10%; }
.log-table th:nth-child(3) { width:20%; }
.log-table th:nth-child(4) { width:18%; }
.log-table th:nth-child(5) { width:8%; }
.log-table th:nth-child(6) { width:29%; }
.log-table td:first-child { font-variant-numeric:tabular-nums; }
.log-results-panel .workflow-pagination { flex:none; margin:0; padding-top:16px; }

/* RealMail's compact icon cards, using this product's available metadata. */
.info-content { display:flex; flex-direction:column; align-items:stretch; gap:24px; padding-top:16px; }
.info-overview { display:grid; grid-template-columns:1.25fr 1fr 1fr; gap:20px; }
.info-card { position:relative; min-width:0; padding:28px; }
.info-icon { display:grid; place-items:center; width:52px; height:52px; flex:none; border-radius:15px; background:var(--rp-info-bg); color:var(--rp-info); }
.info-icon svg { width:28px; height:28px; }
.info-card h3 { margin:22px 0 8px; font-size:16px; font-weight:600; }
.info-version { font-size:30px; line-height:1.3; font-weight:700; overflow-wrap:anywhere; }
.info-metadata { display:grid; gap:6px; margin-top:18px; font-size:12px; }
.info-metadata > div { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 16px; }
.info-metadata dt,.info-status { color:var(--rp-text-3); }
.info-metadata dd { color:var(--rp-text-2); }
.info-status { margin-top:8px; font-size:13px; line-height:1.6; }
.info-manual { display:flex; align-items:center; gap:20px; padding:24px 28px; }
.info-manual h3 { font-size:16px; }
.info-manual .secondary-button { margin-left:auto; white-space:nowrap; }

/* The pulse means a recent observation, never a fabricated healthy state. */
.dash-system-state { padding:0; background:transparent; color:var(--rp-text-3); font-weight:500; }
.dash-system [data-state] { --status-color:var(--rp-text-3); }
.dash-system [data-state="CURRENT"],.dash-system [data-state="RUNNING"],.dash-system [data-state="IDLE"] { --status-color:var(--rp-ok); }
.dash-system [data-state="FAILED"],.dash-system [data-state="STOPPED"] { --status-color:var(--rp-danger); }
.dash-system [data-state="STALE"] { --status-color:#b98432; }
.dash-system [data-state]::before { width:7px; height:7px; background:var(--status-color); box-shadow:0 0 0 3px color-mix(in srgb,var(--status-color) 15%,transparent); }
.dash-system-engines b { color:var(--rp-text-2); font-weight:500; }
.dash-system [data-state="CURRENT"]::before,.dash-system [data-state="RUNNING"]::before,.dash-system [data-state="IDLE"]::before { animation:system-status-pulse 2s ease-in-out infinite; }
@keyframes system-status-pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@media(prefers-reduced-motion:reduce) { .dash-system [data-state]::before { animation:none; } }
@media(max-width:1100px) {
    .info-overview { grid-template-columns:1fr 1fr; }
    .info-product { grid-column:1/-1; }
}
@media(max-width:760px),(max-height:620px) {
    /* At small heights let the page flow, so the filter never hides the results. */
    .log-content { overflow:auto; }
    .log-results-panel { flex:none; overflow:visible; }
    .log-table-wrap { flex:none; max-height:65vh; }
    .log-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .log-filters label,.log-filters label:nth-of-type(n+7),.log-filters > .btn { grid-column:auto; }
}
@media(max-width:600px) {
    .info-overview { grid-template-columns:minmax(0,1fr); gap:16px; }
    .info-card { padding:22px; }
    .info-manual { padding:22px; gap:14px; flex-wrap:wrap; }
    .log-filter-panel { padding:18px; }
    .log-results-panel { padding:0 14px 14px; }
}

@media(prefers-reduced-motion:reduce) { .nav-chevron { transition:none; } }
