* { box-sizing: border-box; }
:root { --portal-header-height: 60px; }
body { margin: 0; font: 14px/1.4 system-ui, sans-serif; color: #1e293b; background: #f1f5f9; }
button, input, select, textarea { font: inherit; }
.hidden { display: none; }

.toast-container { position: fixed; top: 16px; right: 18px; z-index: 10000; display: grid; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid #cbd5e1; border-left: 5px solid #3b82f6; border-radius: 8px; background: #fff; color: #1e293b; box-shadow: 0 8px 28px #0003; font-size: 14px; line-height: 1.5; pointer-events: auto; animation: toast-in .18s ease-out; }
.toast.success { border-left-color: #16a34a; }
.toast.error { border-left-color: #dc2626; }
.toast.info { border-left-color: #2563eb; }
.toast-close { flex: 0 0 auto; border: 0; background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.login { max-width: 340px; margin: 12vh auto; padding: 24px; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px #0002; }
.login h1 { margin: 0 0 16px; font-size: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.login-brand img { width: 44px; height: 44px; flex: 0 0 44px; }
.login-brand h1 { margin: 0; font-size: 20px; }
.login-brand p { margin: 2px 0 0; color: #64748b; font-size: 12px; }
.login-portal { margin: 0 0 18px; color: #64748b; font-size: 12px; }
html[data-theme=dark] .login-brand p, html[data-theme=dark] .login-portal { color: #94a3b8; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0f172a; color: #cbd5e1; padding: 12px 0; }
.side h1 { margin: 0 16px 12px; font-size: 16px; color: #fff; }
.side .group { margin: 14px 16px 4px; font-size: 11px; text-transform: uppercase; color: #64748b; }
.side a { display: block; padding: 6px 16px; color: inherit; text-decoration: none; cursor: pointer; }
.side a:hover { background: #1e293b; }
.side a.active { background: #2563eb; color: #fff; }

.main { padding: 16px 24px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.top h2 { margin: 0; }
.worker-status-widget { position: relative; margin-left: auto; margin-right: auto; }
.worker-status-button { padding: 7px 12px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #334155; cursor: pointer; white-space: nowrap; }
.worker-status-button.is-running { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.worker-status-button.has-pending { border-color: #eab308; background: #fefce8; color: #854d0e; }
.worker-status-button.is-idle { border-color: #86efac; background: #f0fdf4; color: #166534; }
.worker-status-popover { position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: min(440px, 85vw); max-height: 60vh; overflow: auto; padding: 14px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1e293b; box-shadow: 0 8px 28px #0003; }
.worker-current-task { margin: 0 0 10px; font-weight: 600; }
.worker-pending-heading { margin-top: 8px; font-size: 12px; font-weight: 700; color: #64748b; }
.worker-pending-list { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 7px; }
.worker-pending-list li { overflow-wrap: anywhere; }
.worker-update-due { display: block; color: #64748b; font-size: 12px; }
.bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }

.btn { padding: 6px 12px; border: 1px solid #cbd5e1; background: #fff; border-radius: 4px; cursor: pointer; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.small { padding: 2px 8px; font-size: 12px; }

input[type=text], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
    width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff;
}
.bar input[type=search] { width: 260px; }
textarea { min-height: 90px; font-family: ui-monospace, monospace; }

.tablewrap { overflow-x: auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 3px #0001; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
th { background: #f8fafc; font-weight: 600; }
.actions { display: flex; gap: 4px; }
.system-errors-panel { margin-bottom: 16px; }
.system-errors-panel.has-format-warning { border: 1px solid #eab308; box-shadow: 0 0 0 2px #eab30833; }
.system-errors-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.system-errors-heading h3 { margin: 0; }
.system-errors-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.system-error-item { padding: 10px 12px; border: 1px solid #e2e8f0; border-left: 4px solid #ef4444; border-radius: 6px; min-width: 0; }
.system-error-item.severity-warning { border-left-color: #eab308; }
.system-error-item.severity-info { border-left-color: #3b82f6; }
.system-error-item.resolved { opacity: .75; border-left-color: #94a3b8; }
.system-error-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 5px; }
.system-error-actions { flex-wrap: wrap; justify-content: flex-end; }
.system-error-status { margin: 6px 0 0; color: #64748b; font-size: 12px; }
.system-error-meta { color: #64748b; font-size: 12px; }
.system-error-item strong { display: block; overflow-wrap: anywhere; }
.system-error-item details { margin-top: 8px; }
.system-error-item pre { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.45 ui-monospace, Consolas, monospace; }
.error-search input[type=search] { width: min(420px, 100%); }
.error-resolved-toggle { display: inline-flex; gap: 6px; align-items: center; }
.error-resolved-toggle input { width: auto; }
.error-result-count { margin: 4px 0 12px; }
.dns-not-transferred td { background: #fffbeb; }
.dns-not-transferred td:first-child { box-shadow: inset 3px 0 #eab308; }
.quota-unknown { color: #64748b; }
.quota-exceeded { display: inline-block; padding: 2px 6px; border: 1px solid #b91c1c; border-radius: 4px; background: #fee2e2; color: #991b1b; font-weight: 700; }
.quota-suspension-notice { margin: 0 0 16px; border: 1px solid #f59e0b; background: #fffbeb; }
.quota-suspension-notice p { margin: 6px 0 0; }
.quota-suspension { max-width: 260px; white-space: normal; }
html[data-theme=dark] .quota-unknown { color: #cbd5e1; }
html[data-theme=dark] .quota-exceeded { background: #7f1d1d; color: #fff; border-color: #fca5a5; }
html[data-theme=dark] .quota-suspension-notice { background: #422006; border-color: #a16207; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e2e8f0; }
.badge.healthy { background: #bbf7d0; color: #166534; }
.badge.starting { background: #fef08a; color: #854d0e; }
.badge.error { background: #fecaca; color: #991b1b; }
.badge.off { background: #cbd5e1; color: #334155; }
.badge.yes { background: #bbf7d0; color: #166534; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.msg { padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; background: #fecaca; color: #7f1d1d; }
.msg.ok { background: #bbf7d0; color: #14532d; }
.view-as-label { padding: .3rem .6rem; border-radius: .3rem; background: #fef3c7; color: #78350f; font-weight: 700; min-width: 0; max-width: min(320px, 40vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock-indicator { font-size: 1.15em; font-weight: 700; }
.lock-indicator.locked { color: #b91c1c; }
.lock-indicator.unlocked { color: #15803d; }
html[data-theme=dark] .lock-indicator.locked { color: #fca5a5; }
html[data-theme=dark] .lock-indicator.unlocked { color: #86efac; }
.admin-action-dropdown { position: fixed; inset: auto; margin: 0; padding: 6px; border: 1px solid; border-radius: 6px; box-shadow: 0 4px 12px #0003; max-height: 45vh; overflow: auto; }
.admin-action-dropdown:popover-open { display: grid; gap: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.card { background: #fff; padding: 14px; border-radius: 6px; box-shadow: 0 1px 3px #0001; }
.card .n { font-size: 26px; font-weight: 700; }
.card .l { color: #64748b; }
.caddy-diagnostics { margin-bottom: 16px; }
.caddy-diagnostics.has-format-warning { border: 1px solid #eab308; box-shadow: 0 0 0 2px #eab30833; }
.caddy-diagnostics-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.caddy-diagnostics-heading h3 { margin: 0; }
.caddy-diagnostics-list { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.caddy-diagnostics-list li { white-space: pre-wrap; overflow-wrap: anywhere; }
.caddy-diag-warning { color: #92400e; }
.caddy-diag-error { color: #b91c1c; font-weight: 600; }
.caddy-diag-success { color: #166534; }
.caddy-route-warning { margin-bottom: 12px; background: #fef3c7; color: #78350f; }
.caddy-route-dialog { width: min(760px, 96vw); max-height: 92vh; overflow: auto; }
.caddy-macro-dialog { width: min(1120px, 96vw); }
.caddy-macro-dialog textarea.hl-area { min-height: min(55vh, 550px); }
.caddy-macro-dialog details { margin-top: 12px; }
.caddy-macro-dialog .msg pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.caddy-macro-dialog .dlgbtns { flex-wrap: wrap; }
.caddy-route-checkboxes { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.caddy-route-checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.caddy-route-checkbox input { width: auto; }
.caddy-route-acl { padding: 12px; margin: 8px 0 14px; border: 1px solid #cbd5e1; border-radius: 6px; }
.caddy-route-acl h4 { margin: 0 0 8px; }
.caddy-route-account-results, .caddy-route-selected { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.caddy-route-account-option { padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; color: inherit; cursor: pointer; }
.caddy-route-account-option:disabled { opacity: .55; cursor: default; }
.caddy-route-error { color: #b91c1c; }

dialog { border: 0; border-radius: 8px; padding: 20px; width: min(640px, 94vw); box-shadow: 0 10px 40px #0005; }
dialog::backdrop { background: #0006; }
.cron-dialog { width: min(1050px, 96vw); max-height: 92vh; overflow: auto; }
.cron-output { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 500px; max-height: 250px; overflow: auto; }
dialog h3 { margin-top: 0; }
.record-dialog { max-height: 92dvh; overflow: auto; }
.record-dialog.has-json { width: min(900px, 96vw); }
.record-dialog > .dlgbtns { position: sticky; bottom: -20px; padding: 12px 0; background: inherit; }
.json-editor { min-width: 0; }
.json-toolbar, .json-dialog-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.json-status { flex: 1 1 220px; font-size: 12px; color: #64748b; overflow-wrap: anywhere; }
.json-status.json-invalid { color: #dc2626; }
.json-area { display: block; line-height: 1.55; tab-size: 2; resize: vertical; }
.json-area[aria-invalid=true] { border-color: #dc2626; }
.json-code-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.json-code-tools.hidden { display: none; }
.json-dialog { width: min(1120px, 96vw); height: min(820px, 90dvh); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); min-width: min(360px, calc(100vw - 24px)); min-height: min(420px, 85dvh); padding: 0; resize: both; overflow: auto; }
.json-dialog-layout { height: 100%; display: flex; flex-direction: column; padding: 20px; gap: 12px; }
.json-dialog-heading { flex-shrink: 0; margin: 0; }
.json-dialog-heading h3 { flex: 1; margin: 0; overflow-wrap: anywhere; }
.json-dialog-layout > .hint { margin: 0; }
.json-dialog-layout > .json-editor { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.json-dialog .json-area { flex: 1; min-height: 100px; resize: none; }
.json-dialog .dlgbtns { margin-top: 0; flex-wrap: wrap; }
.json-dialog.json-fullscreen { width: calc(100vw - 24px); height: calc(100dvh - 24px); }
html[data-theme=dark] .json-status { color: #94a3b8; }
html[data-theme=dark] .json-status.json-invalid { color: #fca5a5; }
.dns-dialog { width: min(1080px, 96vw); max-height: 92vh; overflow: auto; padding: clamp(20px, 3vw, 34px); }
.dns-dialog > h3 { margin-bottom: 20px; font-size: 22px; }
.dns-section { padding: 22px; margin-bottom: 20px; }
.dns-section h3 { font-size: 17px; margin-bottom: 14px; }
.dns-section .hint { margin-bottom: 16px; line-height: 1.6; }
.dns-section .field { margin-bottom: 16px; }
.dns-section .field label { margin-bottom: 7px; }
.dns-section input:not([type=checkbox]), .dns-section select { min-height: 42px; }
.dns-import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 220px); gap: 16px; align-items: end; }
.dns-import-grid .field { margin-bottom: 0; }
.dns-import-buttons { display: flex; gap: 10px; align-items: center; justify-content: flex-start; margin-top: 16px; flex-wrap: wrap; }
.dns-import-buttons .btn { min-height: 40px; white-space: nowrap; }
.dns-add-record { margin-top: 14px; margin-bottom: 0; }
.dns-dyndns-row { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 8px; align-items: center; min-width: 260px; }
.dns-dyndns-status { display: grid; gap: 3px; min-width: 190px; white-space: normal; font-size: 12px; line-height: 1.35; cursor: pointer; border-radius: 6px; }
.dns-dyndns-status:hover, .dns-dyndns-status:focus-visible { outline: 2px solid #94a3b8; outline-offset: 3px; }
.dns-dynamic-edit-dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 12px; padding: 24px; box-shadow: 0 20px 60px #0f172a55; }
.dns-dynamic-edit-dialog::backdrop { background: #0f172a88; }
.dns-dynamic-edit-dialog h3 { margin: 0 0 12px; overflow-wrap: anywhere; }
.dns-dynamic-edit-dialog .hint { margin-bottom: 16px; }
.dns-dynamic-edit-dialog .dlgbtns { margin-top: 20px; }
.dns-validation-field { display: grid; gap: 4px; min-width: 160px; }
.dns-validation-hint { display: block; color: #b91c1c; font-size: 11px; line-height: 1.3; white-space: normal; }
.dns-section input.dns-invalid, .dns-section select.dns-invalid { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626; }
.dns-wildcard { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12px; }
.dns-wildcard input { width: auto; }
.dns-acl-add { margin-bottom: 12px; }
.dns-acl-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.dns-acl-actions .btn { min-height: 36px; }
.dns-record-table { min-width: 760px; }
.dns-record-table th, .dns-record-table td { padding: 10px; }
.dns-dialog .tablewrap { margin-top: 12px; margin-bottom: 8px; }
.dns-dialog-actions { position: sticky; bottom: -24px; z-index: 2; padding: 16px 0 2px; background: inherit; border-top: 1px solid #cbd5e1; }
.dns-dialog-actions .btn { min-height: 42px; padding-inline: 16px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-weight: 600; margin-bottom: 3px; }
.dlgbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; background: #dbeafe; border-radius: 12px; }

.tsection { margin-bottom: 14px; }
.tsection h3 { margin: 0 0 10px; }
.hint { color: #64748b; margin-top: 0; }
.code { font-family: ui-monospace, monospace; white-space: pre; min-height: 120px; }
.code.tall { min-height: 340px; }
.filesplit { display: grid; grid-template-columns: 240px 1fr; gap: 12px; margin-top: 8px; }
.filelist { border: 1px solid #e2e8f0; border-radius: 4px; max-height: 460px; overflow: auto; }
.fileitem { display: block; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; word-break: break-all; }
.fileitem:hover { background: #f1f5f9; }
.fileitem.active { background: #dbeafe; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.phbox { line-height: 2; }
.btn.ph { margin: 0 3px 0 0; font-family: ui-monospace, monospace; }

/* Syntax-Highlighting: farbige Kopie (pre) unter transparenter Textarea */
.hl { position: relative; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; }
.hl-pre, .hl textarea.hl-area {
    margin: 0; padding: 8px; border: 0; border-radius: 4px; font: 13px/1.5 ui-monospace, Consolas, monospace;
    white-space: pre; tab-size: 4; letter-spacing: 0; word-spacing: 0;
}
.hl-pre { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: #1e293b; }
.hl textarea.hl-area { position: relative; display: block; width: 100%; min-height: 140px; overflow: auto; resize: vertical; background: transparent; color: transparent; caret-color: #1e293b; }
.hl textarea.hl-area.tall { min-height: 340px; }
.hl textarea.hl-area::selection { background: #2563eb55; color: transparent; }
.tok-c { color: #6b7280; font-style: italic; }
.tok-s { color: #047857; }
.tok-k { color: #1d4ed8; }
.tok-v { color: #b45309; }
.tok-n { color: #7c3aed; }
.tok-p { color: #be185d; font-weight: 600; }

/* Darkmode */
html[data-theme=dark] { color-scheme: dark; }
html[data-theme=dark] body { color: #e2e8f0; background: #0b1220; }
html[data-theme=dark] .worker-status-button { background: #1e293b; border-color: #475569; color: #e2e8f0; }
html[data-theme=dark] .worker-status-button.is-running { background: #172554; border-color: #3b82f6; color: #bfdbfe; }
html[data-theme=dark] .worker-status-button.has-pending { background: #422006; border-color: #eab308; color: #fde68a; }
html[data-theme=dark] .worker-status-button.is-idle { background: #052e16; border-color: #22c55e; color: #bbf7d0; }
html[data-theme=dark] .worker-status-popover { background: #1e293b; color: #e2e8f0; border-color: #475569; box-shadow: 0 8px 28px #0007; }
html[data-theme=dark] .worker-pending-heading, html[data-theme=dark] .worker-update-due { color: #94a3b8; }
html[data-theme=dark] .toast { background: #1e293b; color: #e2e8f0; border-color: #475569; box-shadow: 0 8px 28px #0007; }
html[data-theme=dark] .toast.success { border-left-color: #22c55e; }
html[data-theme=dark] .toast.error { border-left-color: #f87171; }
html[data-theme=dark] .toast.info { border-left-color: #60a5fa; }
html[data-theme=dark] .login, html[data-theme=dark] .card, html[data-theme=dark] .tablewrap, html[data-theme=dark] dialog { background: #1e293b; color: #e2e8f0; }
html[data-theme=dark] .btn { background: #1e293b; border-color: #475569; color: #e2e8f0; }
html[data-theme=dark] .btn:hover { background: #334155; }
html[data-theme=dark] .btn.primary { background: #2563eb; border-color: #2563eb; }
html[data-theme=dark] .btn.danger { color: #fca5a5; border-color: #7f1d1d; }
html[data-theme=dark] input[type=text], html[data-theme=dark] input[type=password], html[data-theme=dark] input[type=search],
html[data-theme=dark] input[type=date], html[data-theme=dark] input[type=datetime-local], html[data-theme=dark] input[type=number],
html[data-theme=dark] select, html[data-theme=dark] textarea { background: #0f172a; color: #e2e8f0; border-color: #475569; }
html[data-theme=dark] th { background: #0f172a; }
html[data-theme=dark] th, html[data-theme=dark] td { border-color: #334155; }
html[data-theme=dark] .system-error-item { border-color: #475569; }
html[data-theme=dark] .system-error-item.severity-error, html[data-theme=dark] .system-error-item.severity-critical { border-left-color: #f87171; }
html[data-theme=dark] .system-error-item.severity-warning { border-left-color: #facc15; }
html[data-theme=dark] .system-error-item.resolved { border-left-color: #64748b; }
html[data-theme=dark] .system-error-meta { color: #94a3b8; }
html[data-theme=dark] .dns-not-transferred td { background: #302813; }
html[data-theme=dark] .dns-not-transferred td:first-child { box-shadow: inset 3px 0 #eab308; }
html[data-theme=dark] .dns-validation-hint { color: #fca5a5; }
html[data-theme=dark] .dns-section input.dns-invalid, html[data-theme=dark] .dns-section select.dns-invalid { border-color: #f87171; box-shadow: 0 0 0 1px #f87171; }
html[data-theme=dark] .badge { background: #334155; color: #e2e8f0; }
.worker-name-link { border: 0; background: transparent; color: #2563eb; padding: 0; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.worker-detail-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.worker-detail-subtitle { color: #64748b; margin-top: -8px; }
.worker-detail-tabs { margin-top: 16px; }
.worker-section-title { margin: 18px 0 8px; font-size: 0.95rem; font-weight: 800; }
.worker-system-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.worker-system-card { min-height: 82px; display: flex; flex-direction: column; gap: 5px; padding: 12px; border: 1px solid #dbe2ea; border-radius: 10px; background: #f8fafc; }
.worker-system-card span { color: #64748b; font-size: 0.78rem; }
.worker-system-card strong { font-size: 1.05rem; }
.worker-system-card small { color: #64748b; }
.worker-system-wide { grid-column: span 2; }
.worker-container-list { display: flex; flex-wrap: wrap; gap: 5px; }
.worker-container-state { border-radius: 999px; background: #e2e8f0; color: #334155 !important; padding: 3px 7px; }
.worker-container-state.running { background: #dcfce7; color: #166534 !important; }
.worker-container-state.error { background: #fee2e2; color: #991b1b !important; }
.worker-chart { margin: 8px 0; padding: 10px 12px; border: 1px solid #dbe2ea; border-radius: 10px; background: #fff; }
.worker-chart-title { display: flex; justify-content: space-between; color: #64748b; }
.worker-sparkline { width: 100%; height: 72px; }
.worker-sparkline polyline { fill: none; stroke: #2563eb; stroke-width: 3; vector-effect: non-scaling-stroke; }
.worker-usage { grid-column: span 1; padding: 12px; border: 1px solid #dbe2ea; border-radius: 10px; background: #f8fafc; }
.worker-usage-head { display: flex; justify-content: space-between; }
.worker-usage-track { height: 8px; margin: 9px 0 6px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.worker-usage-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #eab308 70%, #ef4444); }
.worker-usage small { color: #64748b; }
.worker-log-view, .worker-terminal-output { min-height: 180px; max-height: 280px; overflow: auto; white-space: pre-wrap; border-radius: 8px; background: #0f172a; color: #dbeafe; padding: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; }
.worker-terminal-output { min-height: 120px; max-height: 220px; }
.worker-terminal-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.worker-terminal-input { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.worker-provision-options { display: grid; gap: 8px; margin: 12px 0; }
.worker-provision-option { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid #dbe2ea; border-radius: 8px; cursor: pointer; }
.worker-provision-option input { margin-top: 3px; }
.worker-provision-option span { display: flex; flex-direction: column; gap: 2px; }
.worker-provision-option small { color: #64748b; }
.worker-resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.worker-resource-card { min-height: 110px; padding: 10px 12px; border: 1px solid #dbe2ea; border-radius: 8px; background: #f8fafc; overflow: hidden; }
.worker-resource-head { display: flex; justify-content: space-between; align-items: center; }
.worker-resource-head span { font-size: 0.82rem; color: #64748b; }
.worker-resource-card > small { display: block; min-height: 17px; margin-top: 2px; color: #64748b; }
.worker-resource-chart { height: 54px; margin-top: 2px; }
.worker-resource-chart .worker-sparkline { height: 54px; }
.worker-resource-chart .worker-sparkline polyline { stroke: var(--worker-accent); stroke-width: 2; }
.worker-resource-info { display: flex; flex-direction: column; gap: 5px; }
.worker-resource-info-row { display: flex; justify-content: space-between; border-top: 1px solid #e2e8f0; padding-top: 4px; }
.worker-resource-info-row span { color: #64748b; }
.worker-container-groups { max-height: 260px; overflow: auto; border: 1px solid #dbe2ea; border-radius: 8px; }
.worker-stack { border-bottom: 1px solid #dbe2ea; }
.worker-stack:last-child { border-bottom: 0; }
.worker-stack-toggle { width: 100%; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 6px; padding: 8px 10px; border: 0; background: #f8fafc; text-align: left; cursor: pointer; }
.worker-stack-toggle.error { background: #fff1f2; }
.worker-stack-toggle.warning { background: #fffbeb; }
.worker-stack-chevron { font-size: 0.9rem; }
.worker-stack-count { color: #64748b; font-size: 0.78rem; }
.worker-stack-content { max-height: 170px; overflow: auto; }
.worker-container-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.worker-container-table th, .worker-container-table td { padding: 6px 8px; border-top: 1px solid #e2e8f0; }
.worker-detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.worker-tty-dialog { width: min(920px, calc(100vw - 32px)); }
.worker-tty { height: min(60vh, 480px); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; padding: 12px; border-radius: 8px; background: #080d17; color: #d7e3f5; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; outline: none; }
@media (max-width: 800px) {
    .worker-system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .worker-system-wide { grid-column: span 2; }
    .worker-terminal-row { grid-template-columns: 1fr; }
}
html[data-theme=dark] .worker-detail-subtitle,
html[data-theme=dark] .worker-system-card span,
html[data-theme=dark] .worker-system-card small,
html[data-theme=dark] .worker-usage small,
html[data-theme=dark] .worker-chart-title { color: #94a3b8; }
html[data-theme=dark] .worker-system-card,
html[data-theme=dark] .worker-usage,
html[data-theme=dark] .worker-chart { background: #0f172a; border-color: #334155; }
html[data-theme=dark] .worker-provision-option { border-color: #334155; background: #0f172a; }
html[data-theme=dark] .worker-provision-option small { color: #94a3b8; }
html[data-theme=dark] .worker-resource-card,
html[data-theme=dark] .worker-stack-toggle { background: #0f172a; border-color: #334155; }
html[data-theme=dark] .worker-resource-card,
html[data-theme=dark] .worker-container-groups { border-color: #334155; }
html[data-theme=dark] .worker-resource-head span,
html[data-theme=dark] .worker-resource-card > small,
html[data-theme=dark] .worker-resource-info-row span,
html[data-theme=dark] .worker-stack-count { color: #94a3b8; }
html[data-theme=dark] .worker-stack { border-color: #334155; }
html[data-theme=dark] .worker-container-table th,
html[data-theme=dark] .worker-container-table td,
html[data-theme=dark] .worker-resource-info-row { border-color: #334155; }
html[data-theme=dark] .badge.healthy, html[data-theme=dark] .badge.yes { background: #14532d; color: #bbf7d0; }
html[data-theme=dark] .badge.starting { background: #713f12; color: #fef08a; }
html[data-theme=dark] .badge.error { background: #7f1d1d; color: #fecaca; }
html[data-theme=dark] .msg { background: #7f1d1d; color: #fecaca; }
html[data-theme=dark] .msg.ok { background: #14532d; color: #bbf7d0; }
html[data-theme=dark] .card .l, html[data-theme=dark] .hint { color: #94a3b8; }
html[data-theme=dark] .caddy-diagnostics.has-format-warning { border-color: #eab308; box-shadow: 0 0 0 2px #eab30822; }
html[data-theme=dark] .caddy-diag-warning { color: #fcd34d; }
html[data-theme=dark] .caddy-diag-error { color: #fca5a5; }
html[data-theme=dark] .caddy-diag-success { color: #86efac; }
html[data-theme=dark] .caddy-route-warning { background: #422006; color: #fde68a; }
html[data-theme=dark] .caddy-route-acl { border-color: #475569; }
html[data-theme=dark] .caddy-route-account-option { background: #1e293b; border-color: #475569; color: #e2e8f0; }
html[data-theme=dark] .caddy-route-error { color: #fca5a5; }
html[data-theme=dark] .chip { background: #1e3a8a; }
html[data-theme=dark] .filelist { border-color: #334155; }
html[data-theme=dark] .fileitem { border-color: #334155; }
html[data-theme=dark] .fileitem:hover { background: #334155; }
html[data-theme=dark] .fileitem.active { background: #1e3a8a; }
html[data-theme=dark] .hl { background: #0f172a; border-color: #475569; }
html[data-theme=dark] .hl-pre { color: #e2e8f0; }
html[data-theme=dark] .hl textarea.hl-area { background: transparent; color: transparent; caret-color: #e2e8f0; }
html[data-theme=dark] .tok-c { color: #94a3b8; }
html[data-theme=dark] .tok-s { color: #6ee7b7; }
html[data-theme=dark] .tok-k { color: #93c5fd; }
html[data-theme=dark] .tok-v { color: #fcd34d; }
html[data-theme=dark] .tok-n { color: #c4b5fd; }
html[data-theme=dark] .tok-p { color: #f9a8d4; }

.bars { width: 100%; height: 100px; display: block; }
.bars rect { fill: #2563eb; }
html[data-theme=dark] .bars rect { fill: #60a5fa; }

/* Abstaende zwischen Karten, Tabellen und Ueberschriften */
.cards { margin-bottom: 14px; }
.tablewrap { margin-bottom: 14px; }
.main > h3 { margin: 18px 0 8px; }
.gap { height: 14px; }

.logbox { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; max-height: 60vh; overflow: auto; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

html[data-theme=dark] .dns-dialog-actions { border-color: #475569; }

/* Reseller-Portal: eigenstaendige Navigation und kompakte Uebersicht */
.reseller-layout { grid-template-columns: 230px minmax(0, 1fr); }
.reseller-side { display: flex; flex-direction: column; padding: 26px 14px; }
.reseller-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 32px; color: #fff; }
.reseller-brand-mark { display: block; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; }
.reseller-brand strong, .reseller-brand small { display: block; }
.reseller-brand strong { font-size: 16px; letter-spacing: .05em; }
.reseller-brand small { color: #94a3b8; font-size: 12px; }
.reseller-nav-label { margin: 0 10px 10px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.reseller-nav-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; text-align: left; cursor: pointer; }
.reseller-nav-item:hover { background: #1e293b; color: #fff; }
.reseller-nav-item.active { background: #2563eb; color: #fff; font-weight: 600; }
.reseller-nav-item:focus-visible, .reseller-stat:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.reseller-nav-footer { margin: auto 10px 0; padding-top: 30px; color: #64748b; font-size: 12px; }
.reseller-main { padding: 28px clamp(20px, 3vw, 44px); }
.reseller-top { align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.reseller-top h2 { font-size: 26px; letter-spacing: -.03em; }
.reseller-top .bar { align-items: center; margin: 0; }
.reseller-user { padding: 5px 10px; border-radius: 6px; background: #e2e8f0; font-weight: 600; }
.reseller-eyebrow { margin-bottom: 4px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.reseller-description { margin: 4px 0 0; }
.reseller-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 26px; margin-bottom: 18px; border-radius: 12px; background: linear-gradient(120deg, #172554, #1d4ed8); color: #fff; }
.reseller-hero h3 { margin: 0 0 6px; font-size: 20px; }
.reseller-hero p { margin: 0; color: #dbeafe; }
.reseller-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reseller-hero .btn { border-color: #bfdbfe; background: #fff; color: #1e40af; }
.reseller-hero .btn.primary { border-color: #fff; background: #fff; color: #1e40af; }
.reseller-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.reseller-stat { display: grid; gap: 5px; padding: 18px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.reseller-stat:hover { border-color: #93c5fd; box-shadow: 0 6px 20px #1e40af0d; }
.reseller-stat strong { font-size: 28px; line-height: 1.2; }
.reseller-stat-label { font-weight: 600; }
.reseller-stat-note { color: #64748b; font-size: 12px; }
.reseller-stat-link { margin-top: 8px; color: #2563eb; font-size: 12px; font-weight: 600; }
.reseller-overview-note { padding: 18px; border: 1px solid #e2e8f0; border-radius: 10px; }
.reseller-overview-note p { margin: 6px 0 0; }
.reseller-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.reseller-section-heading h3 { margin: 0 0 2px; font-size: 17px; }
.reseller-section-heading .hint { font-size: 12px; }
.reseller-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.reseller-filters input[type=search] { flex: 1 1 240px; max-width: 420px; min-height: 38px; }
.reseller-filters select { flex: 0 1 220px; width: auto; min-height: 38px; }
.reseller-filter-count { margin: 0; font-size: 12px; }
.reseller-table { border: 1px solid #e2e8f0; border-radius: 10px; }
.reseller-table th, .reseller-table td { padding: 12px 14px; }
.reseller-table .actions { align-items: center; flex-wrap: wrap; }
.reseller-table .reseller-empty { padding: 32px; color: #64748b; text-align: center; }
html[data-theme=dark] .reseller-user { background: #334155; }
html[data-theme=dark] .reseller-stat { background: #1e293b; border-color: #334155; }
html[data-theme=dark] .reseller-stat:hover { border-color: #60a5fa; }
html[data-theme=dark] .reseller-stat-note { color: #94a3b8; }
html[data-theme=dark] .reseller-stat-link { color: #93c5fd; }
html[data-theme=dark] .reseller-overview-note, html[data-theme=dark] .reseller-table { border-color: #334155; }
html[data-theme=dark] .reseller-hero .btn, html[data-theme=dark] .reseller-hero .btn.primary { background: #fff; border-color: #fff; color: #1e40af; }

/* Admin-Portal: dieselbe Gestaltung, bestehende Verwaltungsfunktionen bleiben unveraendert. */
.admin-layout { grid-template-columns: 230px minmax(0, 1fr); }
.admin-side { padding: 26px 14px; }
.admin-side-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.admin-brand { padding-bottom: 24px; }
.admin-nav-toggle { display: none; padding: 8px 12px; border: 1px solid #475569; border-radius: 8px; background: #1e293b; color: #fff; cursor: pointer; }
.admin-nav-items .group { margin: 20px 10px 8px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.admin-group-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 12px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: #94a3b8; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; text-align: left; cursor: pointer; }
.admin-group-toggle:hover { background: #1e293b; color: #fff; }
.admin-group-toggle:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.admin-group-chevron { font-size: 16px; transition: transform .15s ease; }
.admin-group-toggle[aria-expanded=false] .admin-group-chevron { transform: rotate(-90deg); }
.admin-nav-item { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; text-align: left; cursor: pointer; }
.admin-nav-item:hover { background: #1e293b; color: #fff; }
.admin-nav-item.active { background: #2563eb; color: #fff; font-weight: 600; }
.admin-nav-item:focus-visible, .admin-nav-toggle:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.admin-main { padding: 28px clamp(20px, 3vw, 44px); }
.admin-top { align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.admin-top h2 { font-size: 26px; letter-spacing: -.03em; }
.admin-top .bar { align-items: center; margin: 0; }
.admin-top .worker-status-widget { margin: 0 auto; }
.admin-hero { margin-bottom: 18px; }
.admin-dashboard-stats { gap: 14px; margin-bottom: 18px; }
.admin-stat { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 18px; border: 1px solid #e2e8f0; border-radius: 10px; }
.admin-stat .n { font-size: 26px; overflow-wrap: anywhere; }
.admin-stat-label { min-height: 20px; font-weight: 600; }
.sftpgo-stat-note { margin: 0; font-size: 12px; }
.sftpgo-content > h3 { margin: 18px 0 8px; }
.admin-main .tablewrap { border: 1px solid #e2e8f0; border-radius: 10px; }
.admin-main .tablewrap th, .admin-main .tablewrap td { padding: 10px 12px; }
.admin-main .admin-data-table { width: max-content; min-width: 100%; table-layout: auto; }
.admin-main .admin-data-table th, .admin-main .admin-data-table td { width: 1%; max-width: 320px; }
.admin-main .admin-data-table .admin-actions-heading, .admin-main .admin-data-table .admin-actions-cell { width: auto; min-width: max-content; max-width: none; }
.admin-main .admin-data-table .actions { flex-wrap: wrap; min-width: 0; }
.admin-sort-button { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.admin-sort-button:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.admin-sort-indicator { color: #64748b; }
.admin-list-bar input[type=search] { flex: 1 1 240px; width: auto; max-width: 420px; min-height: 38px; }
.admin-list-bar .admin-status-filter { flex: 0 1 220px; width: auto; min-height: 38px; }
.admin-list-count { margin: 0; font-size: 12px; }
html[data-theme=dark] .admin-stat, html[data-theme=dark] .admin-main .tablewrap { border-color: #334155; }

@media (max-width: 760px) {
    .admin-layout { grid-template-columns: minmax(0, 1fr); }
    .admin-side { padding: 14px; }
    .admin-brand { padding: 0; }
    .admin-nav-toggle { display: block; }
    .admin-nav-items { display: none; padding-top: 12px; }
    .admin-nav-items.is-open { display: block; }
    .admin-main { padding: 20px 16px; }
    .admin-top .worker-status-widget { margin: 0; }
    .admin-top .worker-status-popover { left: 0; transform: none; }
    .reseller-layout { grid-template-columns: minmax(0, 1fr); }
    .reseller-side { padding: 14px; display: flex; flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap; }
    .reseller-brand { width: 100%; padding: 0 0 8px; }
    .reseller-nav-label, .reseller-nav-footer { display: none; }
    .reseller-nav-item { width: auto; padding: 8px 10px; }
    .reseller-main { padding: 20px 16px; }
    .reseller-hero { padding: 20px; }
    .dns-dialog { width: 96vw; max-height: 94vh; padding: 16px; }
    .dns-section { padding: 16px; }
    .dns-import-grid { grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; }
    .dns-import-buttons { padding-bottom: 0; }
    .dns-import-buttons .btn { flex: 1; }
    .dns-dialog-actions { bottom: -16px; }
}

.ticket-layout { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.7fr); gap: 16px; align-items: start; }
.ticket-list, .ticket-detail { min-width: 0; padding: 14px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.ticket-list { display: grid; gap: 8px; max-height: 72vh; overflow: auto; }
.ticket-list-item { display: grid; justify-items: start; gap: 5px; width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 9px; background: #f8fafc; color: inherit; text-align: left; cursor: pointer; }
.ticket-list-item:hover, .ticket-list-item:focus-visible { border-color: #60a5fa; outline: none; }
.ticket-list-title { font-weight: 700; }
.ticket-list-meta, .ticket-message-meta { color: #64748b; font-size: 12px; }
.ticket-detail { min-height: 280px; }
.ticket-detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid #e2e8f0; padding-bottom: 12px; }
.ticket-detail-heading h3 { margin: 0; }
.ticket-messages { display: grid; gap: 12px; max-height: 54vh; overflow: auto; padding: 16px 0; }
.ticket-message { max-width: 92%; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; overflow-wrap: anywhere; }
.ticket-message.mine { justify-self: end; border-color: #bfdbfe; background: #eff6ff; }
.ticket-message-meta { margin-bottom: 6px; }
.ticket-message-body { white-space: pre-wrap; }
.ticket-confirmation { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; color: #334155; }
.ticket-confirmation.confirmed { border-color: #86efac; background: #f0fdf4; color: #166534; }
.ticket-confirm-button:disabled { opacity: .58; cursor: not-allowed; }
.ticket-reply { display: grid; gap: 10px; }
.ticket-reply textarea { width: 100%; resize: vertical; }
.ticket-confirm-check { display: flex; gap: 8px; align-items: center; }
.ticket-closed-toggle { display: inline-flex; align-items: center; gap: 6px; color: #64748b; font-size: 13px; }
.admin-nav-item, .reseller-nav-item { display: flex; align-items: center; gap: 8px; }
.ticket-nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; }
.ticket-nav-badge.hidden { display: none; }
.ticket-dashboard-panel { margin: 0 0 18px; padding: 16px; }
.ticket-dashboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ticket-dashboard-heading h3 { margin: 0; }
.ticket-dashboard-heading p { margin: 4px 0 0; }
.ticket-dashboard-list { display: grid; gap: 8px; margin-top: 12px; }
.ticket-dashboard-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; color: inherit; text-align: left; cursor: pointer; }
.ticket-dashboard-item:hover { border-color: #60a5fa; }
.ticket-dashboard-meta { color: #64748b; font-size: 12px; }
.dashboard-announcement { margin: 0 0 12px; padding: 16px; border-left: 4px solid #2563eb; }
.dashboard-announcement h3 { margin: 0 0 6px; }
.dashboard-announcement-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.dashboard-announcement-editor { margin-bottom: 20px; padding: 18px; }
.dashboard-announcement-editor h3 { margin-top: 0; }
.dashboard-announcement-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dashboard-announcement-active { display: flex; align-items: center; gap: 8px; }
html[data-theme=dark] .dashboard-announcement { border-color: #60a5fa; }
@media (max-width: 650px) { .dashboard-announcement-dates { grid-template-columns: minmax(0, 1fr); gap: 0; } }
html[data-theme=dark] .ticket-list, html[data-theme=dark] .ticket-detail { border-color: #334155; background: #1e293b; }
html[data-theme=dark] .ticket-list-item, html[data-theme=dark] .ticket-message { border-color: #334155; background: #0f172a; }
html[data-theme=dark] .ticket-message.mine { border-color: #1d4ed8; background: #172554; }
html[data-theme=dark] .ticket-confirmation { border-color: #475569; background: #1e293b; color: #e2e8f0; }
html[data-theme=dark] .ticket-confirmation.confirmed { border-color: #166534; background: #052e16; color: #bbf7d0; }
html[data-theme=dark] .ticket-dashboard-item { border-color: #334155; background: #0f172a; }
@media (max-width: 900px) { .ticket-layout { grid-template-columns: minmax(0, 1fr); } .ticket-list { max-height: 35vh; } }

/* Shared list and account controls across all portals. */
.compact-list .secondary-column { display: none; }
.compact-list tbody tr:nth-child(even of :not(.list-detail-row)) { background: #f1f5f980; }
.compact-list tbody tr:hover { background: #eff6ff; }
.compact-list tbody tr { border-left: 3px solid transparent; }
.compact-list tbody tr.row-good { border-left-color: #16a34a; }
.compact-list tbody tr.row-bad { border-left-color: #dc2626; }
.compact-list tbody tr.row-pending { border-left-color: #d97706; }
.compact-list tbody tr.row-neutral { border-left-color: #64748b; }
.compact-list .list-status { width: 1%; }
.server-status { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #d97706; border: 1px solid #92400e; vertical-align: middle; }
.server-status.healthy { background: #16a34a; border-color: #166534; }
.server-status.error, .server-status.off { background: #dc2626; border-color: #991b1b; }
.server-status.inactive { background: #94a3b8; border-color: #64748b; }
.compact-list th, .compact-list td { font-size: 12px; }
.admin-main .compact-list th, .admin-main .compact-list td,
.reseller-table .compact-list th, .reseller-table .compact-list td { padding: 8px 10px; }
.compact-list td:has([popovertarget]) { overflow: visible; width: 1%; }
.list-expandable { cursor: pointer; }
.list-expandable:focus-visible { outline: 2px solid #3b82f6; outline-offset: -2px; }
.compact-list tbody .list-row-expanded, .compact-list tbody .list-detail-row { background: #eff6ff; }
.list-detail-row[hidden] { display: none; }
.list-detail-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px 16px; margin: 8px 0; white-space: normal; }
.list-detail-values dt { color: #64748b; font-size: 11px; }
.list-detail-values dd { margin: 0 0 7px; overflow-wrap: anywhere; }
.pki-dialog { width: min(680px, calc(100vw - 32px)); max-height: 90dvh; overflow-y: auto; }
.pki-dialog textarea { width: 100%; font-family: monospace; }
.icon-button, .compact-list button[popovertarget] { min-width: 32px; min-height: 30px; font-size: 19px; line-height: 1; }
.user-settings { flex-wrap: nowrap; margin-left: auto; }
.portal-shell { padding-top: var(--portal-header-height); }
.portal-shell > .layout { min-height: calc(100dvh - var(--portal-header-height)); }
.portal-header { position: fixed; inset: 0 0 auto; z-index: 1000; height: var(--portal-header-height); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #cbd5e1; box-shadow: 0 2px 8px #0f172a0a; }
.portal-brand { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.portal-brand img { width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px; }
.portal-brand-copy { min-width: 0; }
.portal-brand strong, .portal-brand small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-brand strong { font-size: 15px; }
.portal-brand small { font-size: 11px; color: #64748b; }
.portal-header > .user-settings { grid-column: 3; grid-row: 1; justify-self: end; margin: 0; min-width: 0; max-width: 100%; }
.portal-header .icon-button { flex-shrink: 0; }
.portal-header .worker-status-widget { grid-column: 2; grid-row: 1; justify-self: center; min-width: 0; max-width: 40vw; margin: 0; }
.portal-header .worker-status-button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.portal-header .worker-status-popover { left: 50%; transform: translateX(-50%); max-height: min(60vh, calc(100dvh - var(--portal-header-height) - 24px)); }
html:has(.portal-header) { scroll-padding-top: calc(var(--portal-header-height) + 12px); }
body:has(.portal-header) > .toast-container { top: calc(var(--portal-header-height) + 16px); }
html[data-theme=dark] .portal-header { background: #0f172a; border-color: #334155; }
html[data-theme=dark] .portal-brand small { color: #94a3b8; }
@media (max-width: 700px) {
    html:has(.portal-header .worker-status-widget) { --portal-header-height: 100px; }
    .portal-header { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 8px 12px; }
    .portal-brand { gap: 8px; }
    .portal-brand img { width: 30px; height: 30px; }
    .portal-brand strong { font-size: 13px; }
    .portal-header > .user-settings { grid-column: 2; }
    .portal-header .view-as-label { max-width: 20vw; }
    .portal-header .worker-status-widget { grid-column: 1 / -1; grid-row: 2; max-width: 100%; }
}
.user-icon { display: inline-block; width: 18px; height: 19px; position: relative; vertical-align: middle; }
.user-icon::before { content: ""; position: absolute; width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 50%; left: 5px; top: 0; }
.user-icon::after { content: ""; position: absolute; width: 15px; height: 8px; border: 1.5px solid currentColor; border-radius: 9px 9px 3px 3px; left: 1px; bottom: 0; }
.compact-card-list { padding: 0; list-style: none; }
.compact-card-list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #cbd5e1; }
.compact-card-list > li:nth-child(even) { background: #64748b0b; }
.user-menu-identity { padding: 8px 10px; max-width: 260px; overflow-wrap: anywhere; border-bottom: 1px solid #cbd5e1; font-size: 12px; }
.admin-action-dropdown { min-width: 155px; max-width: calc(100vw - 16px); background: #fff; color: #1e293b; border-color: #cbd5e1; }
.admin-action-dropdown .btn { text-align: left; padding: 7px 10px; border: 0; text-decoration: none; }
.admin-action-dropdown .btn:focus-visible, .icon-button:focus-visible, summary:focus-visible { outline: 2px solid #3b82f6; outline-offset: -2px; }
.admin-top, .reseller-top { align-items: center; margin-bottom: 18px; }
.admin-top h2, .reseller-top h2 { font-size: 23px; }
.admin-side, .reseller-side { padding: 16px 10px; }
.admin-brand, .reseller-brand { margin-bottom: 16px; }
.admin-nav-item, .reseller-nav-item { padding: 6px 10px; font-size: 12px; }
.admin-group-toggle { margin-top: 6px; padding: 7px 10px; font-size: 9px; letter-spacing: .06em; }
.admin-group-items { padding-left: 7px; border-left: 1px solid #334155; margin-left: 10px; }
.reseller-nav-label { margin: 16px 10px 5px; font-size: 9px; }
.reseller-nav-footer { padding-top: 16px; font-size: 10px; }
html[data-theme=dark] .compact-list tbody tr:nth-child(even of :not(.list-detail-row)) { background: #0f172a55; }
html[data-theme=dark] .compact-list tbody tr:hover { background: #26364f; }
html[data-theme=dark] .admin-action-dropdown { background: #1e293b; color: #e2e8f0; border-color: #475569; }
html[data-theme=dark] .compact-list tbody .list-row-expanded, html[data-theme=dark] .compact-list tbody .list-detail-row { background: #26364f; }
html[data-theme=dark] .list-detail-values dt { color: #94a3b8; }
@media (min-width: 901px) {
    .admin-side, .reseller-side { position: sticky; top: var(--portal-header-height); height: calc(100dvh - var(--portal-header-height)); overflow-y: auto; }
}
@media (max-width: 900px) {
    .admin-side, .reseller-side { padding: 10px; }
    .reseller-side .reseller-nav-label { display: none; }
    .admin-top, .reseller-top { gap: 10px; }
    .admin-top h2, .reseller-top h2 { font-size: 20px; }
    .reseller-description { display: none; }
}
