/* JunPanel — one stylesheet, light and dark, modelled on the 1Panel / Element Plus look. */
:root {
  --primary: #005eeb; --primary-hover: #337eef; --primary-active: #0054d4;
  --primary-soft: #e5eefd; --primary-softer: #f2f7fe; --primary-line: #b2cef9;
  --bg: #f4f5f7; --card: #fff; --sidebar: #fff; --fill: #f5f7fa; --hover: #f5f7fa;
  --line: #dcdfe6; --line-soft: #ebeef5; --text: #1f2329; --text-2: #4e5969; --muted: #8f959e;
  --success: #34a853; --success-soft: #edf8f0; --success-line: #c9ebd2;
  --warning: #e6a23c; --warning-soft: #fdf6ec; --warning-line: #f5dab1;
  --danger: #f54a45; --danger-soft: #fef0f0; --danger-line: #fbc4c4;
  --info-soft: #f4f4f5; --info-line: #e9e9eb;
  --log-bg: #1b1b1b; --log-text: #e5e6eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06); --shadow-pop: 0 8px 28px rgba(0, 0, 0, .14);
  --radius: 4px; --radius-card: 8px; --sidebar-width: 200px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
:root[data-theme=dark] {
  --primary: #3d8eff; --primary-hover: #5c9fff; --primary-active: #2f7de6;
  --primary-soft: rgba(61, 142, 255, .16); --primary-softer: rgba(61, 142, 255, .08); --primary-line: rgba(61, 142, 255, .4);
  --bg: #0f1014; --card: #1b1c21; --sidebar: #16171b; --fill: #24252b; --hover: #26272e;
  --line: #34363e; --line-soft: #2a2b31; --text: #e5e6eb; --text-2: #b6b8bf; --muted: #868a93;
  --success: #4cc46c; --success-soft: rgba(76, 196, 108, .12); --success-line: rgba(76, 196, 108, .3);
  --warning: #f0b252; --warning-soft: rgba(240, 178, 82, .12); --warning-line: rgba(240, 178, 82, .3);
  --danger: #ff6b66; --danger-soft: rgba(255, 107, 102, .12); --danger-line: rgba(255, 107, 102, .3);
  --info-soft: rgba(255, 255, 255, .06); --info-line: rgba(255, 255, 255, .1);
  --log-bg: #111214; --shadow: 0 2px 12px rgba(0, 0, 0, .3); --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 1px; }
[hidden] { display: none !important; }
code, pre, kbd, .mono { font-family: "JetBrains Mono", "Cascadia Code", Consolas, Menlo, monospace; }
code { font-size: 12.5px; color: var(--text-2); word-break: break-all; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.icon { display: inline-flex; flex: none; }
svg.icon { width: 16px; height: 16px; }
.status-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.status-dot.off { background: var(--muted); }
.eyebrow { color: var(--muted); font-size: 12px; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); font-size: 14px; white-space: nowrap; transition: color .15s, background .15s, border-color .15s; }
.button svg.icon { width: 14px; height: 14px; }
.button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary-line); background: var(--primary-softer); }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.danger:hover:not(:disabled) { opacity: .88; background: var(--danger); color: #fff; border-color: var(--danger); }
.button.small { height: 26px; padding: 0 11px; font-size: 13px; }
.button.wide { width: 100%; height: 38px; font-size: 15px; }
.button.quiet { border-color: transparent; background: none; color: var(--primary); padding: 0 6px; }
.button.quiet:hover:not(:disabled) { background: none; border-color: transparent; color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.button.quiet.danger-text { color: var(--danger); }
.button.quiet.active { color: var(--primary); font-weight: 600; }
.icon-button, .text-button { display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--text-2); border-radius: var(--radius); }
.icon-button { width: 32px; height: 32px; }
.icon-button svg.icon { width: 18px; height: 18px; }
.icon-button:hover { background: var(--hover); color: var(--primary); }
.text-button { font-size: 12px; padding: 2px 6px; color: var(--muted); }

/* Tags */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-soft); color: var(--muted); font-size: 12px; white-space: nowrap; line-height: 1; }
.tag.ok { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.tag.warn { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.tag.bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.tag.blue { background: var(--primary-softer); border-color: var(--primary-line); color: var(--primary); }

/* Alerts / notes */
.info, .banner { display: flex; align-items: flex-start; gap: 8px; padding: 9px 14px; border-radius: var(--radius); background: var(--primary-softer); color: var(--text-2); font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
.info > .icon, .banner > .icon { color: var(--primary); margin-top: 2px; }
.info.warning, .banner.danger { background: var(--warning-soft); }
.info.warning > .icon { color: var(--warning); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.info .button.quiet { height: auto; margin-left: auto; padding: 0; }
.form-error { color: var(--danger); font-size: 13px; min-height: 0; }
.form-error:not(:empty) { margin: 6px 0 2px; }
.error-text { color: var(--danger); font-size: 13px; margin: 8px 0; }
.help { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.6; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty svg.icon { width: 40px; height: 40px; stroke-width: 1.2; color: var(--line); margin-bottom: 6px; }
.empty h3 { font-weight: 500; color: var(--text-2); }
.empty p { font-size: 13px; max-width: 460px; }
.view > .empty, .view > div > .empty { background: var(--card); border-radius: var(--radius-card); border: 1px solid var(--line-soft); }
.skeleton { padding: 60px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius-card); }

/* Forms */
.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text); }
.field input, .field select, .field textarea, .login-form input { width: 100%; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); outline: none; transition: border-color .15s; }
.field textarea { height: auto; padding: 7px 11px; resize: vertical; line-height: 1.6; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus, .login-form input:focus { border-color: var(--primary); }
.field input[readonly] { background: var(--fill); }
.code-editor { font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace; font-size: 13px !important; tab-size: 2; }
textarea.code-editor { min-height: 180px; }
.modal textarea.code-editor { min-height: 420px; }

/* Shell */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line-soft); }
.sidebar > .brand { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px; color: var(--text); font-size: 17px; flex: none; border-bottom: 1px solid var(--line-soft); }
.sidebar > .brand strong { font-weight: 650; letter-spacing: .2px; }
.sidebar > .brand img { border-radius: 8px; }
#nav { flex: 1; overflow-y: auto; padding: 10px 10px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; margin-bottom: 2px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 14px; text-align: left; }
.nav-link svg.icon { width: 17px; height: 17px; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 500; }
.nav-badge.count { background: var(--fill); color: var(--muted); }
.nav-divider { height: 1px; margin: 8px 12px; background: var(--line-soft); }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.sidebar-version { margin-left: auto; font-family: Consolas, monospace; }
.sidebar-mask { display: none; }
.main-shell { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line-soft); }
.mobile-menu { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); min-width: 0; }
.breadcrumb strong { color: var(--text); font-weight: 500; }
.breadcrumb .sep { color: var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.search-launch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; margin-right: 6px; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--fill); color: var(--muted); font-size: 13px; }
.search-launch:hover { border-color: var(--primary-line); }
.search-launch kbd { font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--card); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; margin-left: 4px; border-left: 1px solid var(--line-soft); font-size: 14px; }
.user-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; }
main { padding: 16px 24px 12px; max-width: 1680px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; margin-bottom: 14px; background: var(--card); border-radius: var(--radius-card); border: 1px solid var(--line-soft); }
.subnav-item { height: 32px; padding: 0 16px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 14px; }
.subnav-item:hover { color: var(--primary); }
.subnav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; min-height: 32px; }
.page-bar h1 { font-size: 16px; }
.page-bar p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions .button.primary { order: 2; }
.page-actions .button:not(.primary) { order: 1; }
.view { min-height: 300px; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 22px 2px 6px; color: var(--muted); font-size: 12px; }
footer span { display: inline-flex; align-items: center; gap: 6px; }

/* Cards */
.panel { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); padding: 0 20px 16px; margin-bottom: 14px; min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin: 0 -20px 14px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-header .table-ops { flex-wrap: nowrap; }
.panel > h2:first-child { padding: 16px 0 12px; }
.panel-note, .chart-caption { color: var(--muted); font-size: 12px; margin-top: 10px; }
.panel > .table-wrap { margin: -14px -20px -16px; border: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.panel > .table-wrap:not(:nth-child(2)) { margin-top: 0; }
.panel > .info { margin-top: 0; }
.panel > .log-view { margin-bottom: 12px; }
.panel > p.muted { margin-bottom: 12px; font-size: 13px; }
.panel > .field select, .panel > .field input { max-width: 480px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.form-grid > .span-2 { grid-column: 1 / -1; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); margin-bottom: 14px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 11px 16px; background: var(--fill); color: var(--text-2); font-weight: 500; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.data-table td small, .data-table td .domain-links { white-space: normal; }
.data-table td code { white-space: pre; word-break: normal; }
.data-table td small { min-width: 160px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--hover); }
.data-table td strong { display: block; font-weight: 500; }
.data-table td small { display: block; color: var(--muted); }
.data-table td code { white-space: pre-line; }
.table-ops { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.data-table td:last-child .table-ops { flex-wrap: nowrap; }
.data-table td:last-child:has(.table-ops) { width: 1%; white-space: nowrap; }
.table-ops a { padding: 0 6px; font-size: 14px; }
.table-ops a:hover { text-decoration: underline; text-underline-offset: 3px; }
.table-name { display: flex; align-items: center; gap: 10px; }
.table-name > .icon { color: var(--muted); }
.table-name small { display: block; color: var(--muted); }
.site-title strong { display: block; font-weight: 500; }
.domain-links { display: flex; gap: 2px 10px; flex-wrap: wrap; margin-top: 2px; }
.domain-link { font-size: 12.5px; }

/* Rows inside cards */
.resource-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.resource-row:last-child { border-bottom: 0; }
.resource-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.resource-name, .resource-row strong { font-weight: 500; overflow-wrap: anywhere; }
.resource-row small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.activity-button { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; padding-left: 0; padding-right: 0; }
.activity-button:hover .resource-name { color: var(--primary); }
.round-initial, .job-icon { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 13px; }
.job-icon.success { background: var(--success-soft); color: var(--success); }
.job-icon.failed { background: var(--danger-soft); color: var(--danger); }
.details-row { display: flex; gap: 16px; padding: 7px 0; font-size: 14px; }
.details-row > span:first-child { width: 110px; flex: none; }
dl.details { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; margin: 0 0 16px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }
.jobs-list { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); padding: 4px 20px; }
.jobs-list > .info { margin: 14px 0 6px; }

/* Tabs & chips */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.field.toolbar { display: block; max-width: 320px; }
.field.toolbar > label { display: none; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.tab { height: 38px; padding: 0 !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; background: none !important; color: var(--text-2) !important; text-decoration: none !important; }
.tab.active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; font-weight: 500; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { height: 28px !important; padding: 0 14px !important; border: 1px solid var(--line) !important; border-radius: 14px !important; background: var(--card) !important; color: var(--text-2) !important; text-decoration: none !important; }
.chip.active { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: 6px; background: var(--fill); margin-bottom: 10px; }
.segmented .button.quiet { height: 26px; padding: 0 12px; border-radius: 5px; color: var(--text-2); text-decoration: none; }
.segmented .button.quiet.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 500; }

/* App store */
.app-logo { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 22px; font-weight: 700; }
.app-logo.wordpress { background: #21759b; } .app-logo.gitea { background: #609926; } .app-logo.kuma { background: #5cdd8b; color: #0b3d1f; }
.app-logo.postgres { background: #336791; } .app-logo.mysql { background: #00758f; } .app-logo.redis { background: #d82c20; }
.catalog-grid, .installed-grid, .project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.app-card, .installed-card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); transition: box-shadow .2s, border-color .2s; }
.app-card:hover, .installed-card:hover { border-color: var(--primary-line); box-shadow: var(--shadow); }
.app-card-head, .installed-header { display: flex; align-items: center; gap: 14px; }
.app-card-head > div:not(.app-logo), .installed-header > div:not(.app-logo) { flex: 1; min-width: 0; }
.app-card-head h3, .installed-header h3 { font-size: 15px; }
.app-card > p { font-size: 13px; color: var(--muted); line-height: 1.6; flex: 1; }
.app-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line-soft); }
.app-card-bottom code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.installed-meta { font-size: 13px; color: var(--muted); }
.installed-actions { display: flex; flex-wrap: wrap; gap: 2px 4px; padding-top: 10px; margin-top: auto; border-top: 1px solid var(--line-soft); }
.installed-actions .button.primary { height: 26px; }
.project-members { margin-bottom: 12px; }
.project-controls { display: flex; gap: 8px; }

/* Files */
.file-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 8px 12px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); }
.file-breadcrumb .button.quiet { color: var(--text-2); }
.file-breadcrumb .button.quiet:last-child { color: var(--primary); }
.file-name.button.quiet { color: var(--text); padding: 0; }
.file-name.button.quiet .icon { color: var(--warning); }
.file-name.button.quiet:hover { color: var(--primary); }

/* Logs, terminal, databases */
.log-view, .terminal-output { margin: 0; padding: 12px 14px; max-height: 460px; overflow: auto; border-radius: var(--radius); background: var(--log-bg); color: var(--log-text); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.log-toolbar { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.log-toolbar .field { margin: 0; min-width: 160px; }
.terminal-panel { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); padding: 14px; }
.terminal-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.terminal-toolbar .field { margin: 0; min-width: 280px; }
.terminal-output { height: 460px; max-height: none; border-radius: var(--radius) var(--radius) 0 0; }
.terminal-input { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--log-bg); border-top: 1px solid #2a2a2a; border-radius: 0 0 var(--radius) var(--radius); color: var(--log-text); }
.terminal-input input { flex: 1; border: 0; background: none; color: var(--log-text); outline: none; font-family: Consolas, monospace; }
.database-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
.database-selector { display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-card); }
.database-card { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; padding: 10px 12px; border: 0; border-radius: 6px; background: none; text-align: left; }
.database-card > .icon { grid-row: span 2; color: var(--muted); }
.database-card small { color: var(--muted); }
.database-card:hover { background: var(--hover); }
.database-card.selected { background: var(--primary-soft); }
.database-card.selected strong, .database-card.selected > .icon { color: var(--primary); }
.database-layout > .panel > h2 { padding: 16px 0 14px; margin: 0 -20px 14px; padding-left: 20px; border-bottom: 1px solid var(--line-soft); }
.database-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

/* Security */
.security-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.security-grid > .info { grid-column: 1 / -1; }
.security-actions { display: flex; gap: 10px; margin-top: 16px; }
.security-list { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.security-list:last-child { border-bottom: 0; }
.security-list p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Overview (1Panel-style home) */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.home-col { min-width: 0; }
.count-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.count-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 4px; border: 0; background: none; border-right: 1px solid var(--line-soft); }
.count-item:last-child { border-right: 0; }
.count-item span { color: var(--muted); font-size: 13px; }
.count-item strong { font-size: 26px; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.count-item:hover strong { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.count-item.alarm strong { color: var(--danger); }
.gauge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.gauge-ring { position: relative; width: 112px; height: 112px; }
.gauge-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-ring circle { fill: none; stroke-width: 9; }
.gauge-ring .track { stroke: var(--fill); }
.gauge-ring .value { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.gauge-ring.warn .value { stroke: var(--warning); }
.gauge-ring.bad .value { stroke: var(--danger); }
.gauge-ring .gauge-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-ring .gauge-text strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gauge-ring .gauge-text small { color: var(--muted); }
.gauge > span { font-size: 14px; font-weight: 500; }
.gauge > small { color: var(--muted); }
.monitor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.monitor-now { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.monitor-now b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; height: 220px; }
.sysinfo .details-row { padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.sysinfo .details-row:last-child { border-bottom: 0; }
.sysinfo .details-row > span:last-child { overflow-wrap: anywhere; }
.service-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.service-item:last-child { border-bottom: 0; }
.service-title { display: flex; align-items: center; gap: 8px; }
.service-title .icon { color: var(--muted); }
.progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--fill); }
.progress::-webkit-progress-value { background: var(--primary); }
.progress::-moz-progress-bar { background: var(--primary); }

/* Modal, toast, search */
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 0; border-radius: var(--radius-card); background: var(--card); color: var(--text); box-shadow: var(--shadow-pop); }
.modal.large { width: min(960px, calc(100vw - 32px)); }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop, .search-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-content { padding: 20px; overflow-y: auto; }
.modal-content > form > .info:first-child { margin-bottom: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.modal-footer:empty { display: none; }
.toasts { position: fixed; top: 18px; left: 50%; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { min-width: 240px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border: 1px solid var(--success-line); border-radius: var(--radius); background: var(--success-soft); color: var(--success); box-shadow: var(--shadow); font-size: 14px; pointer-events: auto; backdrop-filter: blur(8px); }
:root:not([data-theme=dark]) .toast { background: #f0f9eb; }
.toast.error { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
:root:not([data-theme=dark]) .toast.error { background: #fef0f0; }
.search-dialog { width: min(560px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 0; border-radius: var(--radius-card); background: var(--card); color: var(--text); box-shadow: var(--shadow-pop); }
.search-dialog-field { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.search-dialog-field input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; color: var(--text); }
#search-results { max-height: 380px; overflow-y: auto; padding: 6px; }
.search-result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: none; text-align: left; }
.search-result:hover, .search-result:focus { background: var(--primary-softer); color: var(--primary); }
.search-result small { margin-left: auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

/* Login */
.login-layout { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; background: radial-gradient(circle at 15% 10%, var(--primary-soft), transparent 45%), radial-gradient(circle at 85% 90%, var(--primary-soft), transparent 40%), var(--bg); }
.login-card { display: grid; grid-template-columns: 1fr 1fr; width: min(900px, 100%); min-height: 500px; overflow: hidden; border-radius: 12px; background: var(--card); box-shadow: 0 12px 40px rgba(0, 40, 120, .12); }
.login-brand { display: flex; flex-direction: column; padding: 44px 40px; color: #fff; background: linear-gradient(150deg, #1a73ff 0%, #005eeb 55%, #0047b3 100%); }
.login-brand .brand { display: flex; align-items: center; gap: 12px; font-size: 22px; }
.login-brand .brand img { border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.login-brand h1 { margin-top: auto; font-size: 26px; font-weight: 600; line-height: 1.4; }
.login-brand > p { margin-top: 12px; opacity: .85; line-height: 1.7; }
.login-points { margin: 28px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 13px; opacity: .9; }
.login-points li::before { content: "✓"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 10px; border-radius: 50%; background: rgba(255, 255, 255, .2); font-size: 11px; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 44px 48px; }
.login-form h2 { font-size: 22px; font-weight: 600; }
.login-form > p.muted { margin: 6px 0 22px; }
.login-form label { margin: 0 0 6px; font-size: 14px; }
.login-form input { height: 40px; margin-bottom: 16px; }
.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-field button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.password-field button:hover { color: var(--primary); }
.login-form .button.wide { margin-top: 6px; }
.login-boundary { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.demo-hint { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); font-size: 12.5px; line-height: 1.7; }
.login-footer { color: var(--muted); font-size: 12px; }

/* Responsive */
@media (max-width: 1200px) {
  .home-grid { grid-template-columns: 1fr; }
  .gauge-grid { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-mask { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
  .main-shell { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .search-launch > span:not([data-icon]), .search-launch kbd, #current-user { display: none; }
  .search-launch { width: 32px; padding: 0; justify-content: center; margin-right: 0; }
  main { padding: 12px; }
  .page-bar { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }
  .database-layout, .security-grid, .form-grid { grid-template-columns: 1fr; }
  .catalog-grid, .installed-grid, .project-grid { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; min-height: 0; }
  .login-brand { padding: 28px; }
  .login-brand h1 { margin-top: 24px; font-size: 21px; }
  .login-points { display: none; }
  .login-form { padding: 28px; }
  .count-grid { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
  .count-item:nth-child(2) { border-right: 0; }
  .data-table th, .data-table td { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .gauge-ring { width: 96px; height: 96px; }
}
.terminal-toolbar .tag { height: 26px; }
