/* DirectPanel UI. No external resources; light/dark follows the OS. */
:root {
  --bg: #eef2f6; --surface: #ffffff; --surface-2: #f1f5f9; --text: #14232f; --muted: #5a6b7b;
  --border: #dbe3ea; --accent: #0b7a8a; --accent-text: #ffffff; --accent-soft: #dff1f4;
  --danger: #c0392b; --danger-soft: #fdeceb; --ok: #1a7f4b; --ok-soft: #e4f5ec; --warn: #a66100; --warn-soft: #fff3de;
  --side: #0f2230; --side-text: #b9c8d4; --side-active: #ffffff; --side-hi: #1a3447;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 36, 56, .06), 0 2px 8px rgba(16, 36, 56, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --c-blue: #2f6fdc; --c-amber: #d98a0b; --c-violet: #7a4fd1; --c-green: #1f9d62; --c-slate: #5b6b7d; --c-rose: #d6456b; --c-teal: #0b7a8a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141c; --surface: #131f2a; --surface-2: #1a2835; --text: #e5edf3; --muted: #92a4b3;
    --border: #25384a; --accent: #3fb6c6; --accent-text: #05161a; --accent-soft: #14323a;
    --danger: #ff7b6e; --danger-soft: #3a1d1b; --ok: #4cc38a; --ok-soft: #14301f; --warn: #f0b04a; --warn-soft: #382a10;
    --side: #08111a; --side-text: #8fa3b3; --side-hi: #14232f; --shadow: none;
    --c-blue: #6b9bf0; --c-amber: #f0b04a; --c-violet: #a384ee; --c-green: #4cc38a; --c-slate: #93a4b5; --c-rose: #f0789a; --c-teal: #3fb6c6;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .mono { font-family: var(--mono); font-size: .9em; word-break: break-all; }
.small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 1rem .7rem; display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; padding: .3rem .6rem 1.1rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #14b4c8, #0b7a8a); display: grid; place-items: center; color: #fff; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 9px; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-hi); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-hi); color: var(--side-active); box-shadow: inset 3px 0 0 #14b4c8; }
.col { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.usermenu { display: flex; align-items: center; gap: .7rem; }
.usermenu .who { display: flex; flex-direction: column; line-height: 1.15; } .usermenu small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.usermenu button { display: inline-flex; align-items: center; gap: .3rem; }
.tsearch { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 1rem; color: var(--muted); }
.tsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tsearch-in { border: 0; background: transparent; padding: .55rem 0; outline: none; color: var(--text); }
.tsearch-in:focus-visible { outline: none; }
.tsearch-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); padding: .3rem; z-index: 30; }
.tsearch-hit { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 8px; color: var(--text); }
.tsearch-hit:hover { background: var(--accent-soft); text-decoration: none; }
.tsearch-hit span { display: flex; flex-direction: column; } .tsearch-hit small { color: var(--muted); }
.tsearch-none { padding: .7rem; color: var(--muted); }
.main { padding: 1.6rem 2rem 3rem; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .5rem; gap: .3rem; }
  .brand { padding: .2rem .4rem; } .nav { flex-direction: row; flex-wrap: wrap; } .nav a span { display: none; } .nav a { padding: .5rem; }
  .topbar { padding: .6rem 1rem; } .usermenu .who { display: none; } .main { padding: 1rem; }
}

/* home */
.greeting h1 { font-size: 1.7rem; letter-spacing: -.01em; } .greeting p { margin: .2rem 0 1.3rem; }
.homegrid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.4rem; align-items: start; }
@media (max-width: 1100px) { .homegrid { grid-template-columns: 1fr; } }
.tile-section { margin-bottom: 1.5rem; --c: var(--c-blue); }
.tile-section.c-blue { --c: var(--c-blue); } .tile-section.c-amber { --c: var(--c-amber); } .tile-section.c-violet { --c: var(--c-violet); }
.tile-section.c-green { --c: var(--c-green); } .tile-section.c-slate { --c: var(--c-slate); } .tile-section.c-rose { --c: var(--c-rose); } .tile-section.c-teal { --c: var(--c-teal); }
.tile-section h2 { font-size: .95rem; margin: 0 0 .6rem; padding-left: .6rem; border-left: 4px solid var(--c); color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.tile { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: border-color .12s, transform .12s; }
.tile:hover { border-color: var(--c); transform: translateY(-1px); text-decoration: none; }
.ticon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ttext { display: flex; flex-direction: column; min-width: 0; } .ttext small { color: var(--muted); line-height: 1.3; }
.summary .kv { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); } .summary .kv span { color: var(--muted); }
.summary .bar { margin: .7rem 0 .2rem; }
.actions.left { justify-content: flex-start; margin-top: .9rem; }
.picklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.pick { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface-2); }
.pick:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); } .pick span { flex: 1; font-weight: 600; word-break: break-all; }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--muted); font-size: .85rem; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* controls */
button, .btn { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .45rem .9rem; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.danger:hover { background: var(--danger-soft); }
button.sm { padding: .25rem .6rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
input, select, textarea { font: inherit; width: 100%; padding: .5rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
input[type=checkbox] { width: auto; margin-right: .4rem; }
textarea { min-height: 5rem; font-family: var(--mono); font-size: .9rem; }
.field { margin-bottom: .9rem; } .field .hint { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.inline { display: flex; align-items: center; gap: .5rem; } .inline label { margin: 0; font-weight: 500; }

/* badges, tabs, toasts, dialogs */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.blue { background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; } .tabs a:hover { text-decoration: none; color: var(--text); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: min(420px, 92vw); }
.toast { padding: .7rem 1rem; border-radius: 8px; background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.error { background: var(--danger); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
.notice { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(8, 12, 20, .55); }
dialog .dh { padding: 1rem 1.2rem .2rem; font-weight: 700; font-size: 1.05rem; } dialog .db { padding: .6rem 1.2rem; max-height: 70vh; overflow: auto; }
dialog .df { padding: .8rem 1.2rem 1.1rem; display: flex; justify-content: flex-end; gap: .5rem; }
.secret { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; padding: .6rem .8rem; word-break: break-all; user-select: all; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .box { width: min(400px, 100%); } .login .brand { justify-content: center; font-size: 1.4rem; padding-bottom: 1.2rem; }
.login .card { padding: 1.5rem; }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.15em; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.hidden-input { display: none; }
textarea.editor { min-height: 55vh; width: 100%; font-size: .85rem; white-space: pre; tab-size: 4; }
dialog:has(textarea.editor) { width: min(900px, 96vw); }
hr { border: 0; border-top: 1px solid var(--border); margin: .8rem 0; }
.card table th { text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.bar .fill { height: 100%; background: var(--accent); } .bar .fill.bad { background: var(--danger); }
pre.logview { max-height: 60vh; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: .7rem; font: .8rem/1.4 var(--mono); white-space: pre-wrap; word-break: break-all; margin: 0; }
.card.inner { box-shadow: none; background: var(--surface-2); margin-bottom: .6rem; }
table.grid-result td { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: start; } @media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.split > .card { min-width: 0; }
td.over { color: var(--danger); font-weight: 600; }
td.barcell { width: 45%; min-width: 8rem; }

/* webmail */
.split.wm { grid-template-columns: 190px 1fr; }
.wm-folders { display: flex; flex-direction: column; gap: .25rem; }
.wm-folder { display: flex; justify-content: space-between; padding: .4rem .6rem; border-radius: 8px; color: var(--text); }
.wm-folder:hover { background: var(--surface-2); text-decoration: none; } .wm-folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wm-row.unread td { font-weight: 700; } .wm-who { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-bar { justify-content: flex-start; margin: .4rem 0 .8rem; }
.wm-frame { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
pre.wm-text { white-space: pre-wrap; word-break: break-word; font: .9rem/1.5 var(--mono); margin: 0; }
textarea.wm-compose { min-height: 18rem; font-family: system-ui, sans-serif; font-size: .95rem; }
.wm-head div { margin-bottom: .15rem; }

/* ssl */
.ssl-opts { display: grid; gap: .6rem; } .ssl-opt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ssl-switches { display: grid; gap: .4rem; margin-top: .6rem; } textarea.pem { font-family: var(--mono); font-size: .8rem; min-height: 4rem; white-space: pre; }
.brand .logo-img { object-fit: contain; background: #fff; border-radius: 8px; width: 30px; height: 30px; }

/* ---------- polish ---------- */
:root { --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.65rem; letter-spacing: -.015em; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; }
.card { padding: 1.25rem 1.35rem; border-radius: 14px; }
.card > h2:first-child, .card > .head:first-child h2 { margin-bottom: .55rem; }
button, .btn { font-weight: 550; transition: background .12s, border-color .12s, transform .06s; }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
.btn { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
input, select, textarea { transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
table td, table th { padding: .7rem .8rem; }

/* page chrome */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--accent); } .crumbs .sep { opacity: .5; } .crumbs .here { color: var(--text); font-weight: 600; }
.titleblock h1 { word-break: break-all; margin-bottom: .35rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { padding: .15rem .6rem; font-size: .75rem; }
.tabs { gap: .25rem; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; padding: .65rem 1rem; }
.pillnav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; position: sticky; top: 58px; z-index: 10; padding: .5rem 0; background: var(--bg); }
.pill { border-radius: 999px; padding: .3rem .85rem; font-size: .85rem; background: var(--surface); color: var(--muted); }
.pill:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.card[id] { scroll-margin-top: 110px; }

/* empty and loading states */
.empty { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 2.4rem 1rem; color: var(--muted); }
.empty svg { opacity: .55; } .empty p { margin: 0; max-width: 36ch; text-align: center; }
.skeletons { display: grid; gap: 1rem; max-width: 900px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 55%, var(--surface)), var(--surface-2)); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
.sk-title { height: 28px; width: 38%; } .sk-line { height: 14px; width: 60%; } .sk-card { height: 150px; }
@keyframes shimmer { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* home: attention and getting started */
.callouts { display: grid; gap: .6rem; margin-bottom: 1.3rem; }
.callout { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); border-left: 4px solid var(--warn); }
.callout.bad { border-left-color: var(--danger); } .callout.info { border-left-color: var(--accent); }
.callout .ctext { flex: 1; display: flex; flex-direction: column; } .callout small { color: var(--muted); }
.steps { counter-reset: step; display: grid; gap: .5rem; padding: 0; margin: .4rem 0 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.steps li::before { counter-increment: step; content: counter(step); width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; }
.steps li.done::before { content: "\2713"; background: var(--ok-soft); color: var(--ok); } .steps li.done { opacity: .65; }
.steps li span { flex: 1; }

/* toasts and dialogs */
.toast { border-radius: 10px; padding: .75rem 1rem; box-shadow: 0 10px 30px rgba(0,0,0,.28); font-weight: 500; }
dialog { border-radius: 16px; animation: pop .14s ease-out; } @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }
@media (prefers-reduced-motion: reduce) { dialog { animation: none; } }
dialog .dh { font-size: 1.15rem; padding-top: 1.2rem; }
.wizard-opts { display: grid; gap: .5rem; margin-top: .4rem; } .wizard-opts label { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.wizard-opts label:hover { border-color: var(--accent); } .wizard-opts small { display: block; color: var(--muted); font-weight: 400; }
.wizard-opts input { margin-top: .25rem; }

.dname { font-weight: 600; } .quick { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.quick:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.tfilter { max-width: 320px; margin-bottom: .8rem; } tr[hidden] { display: none; }
.badge { white-space: nowrap; } td { vertical-align: middle; }

/* ---------- server console ---------- */
.cb-nodes { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.cb-node { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; }
.cb-node small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.cb-node:hover { text-decoration: none; border-color: var(--accent); }
.cb-node.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cb-node.peer { opacity: .65; border-style: dashed; cursor: default; }
.cb-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); }
.cb-dot.ok { background: var(--ok); } .cb-dot.bad { background: var(--danger); }
.cb-facts { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin-bottom: 1rem; padding: .2rem .2rem .6rem; }
.cb-tasks { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
.cb-tasklist { display: flex; flex-direction: column; gap: .4rem; max-height: 76vh; overflow-y: auto; padding-right: .2rem; }
.cb-task { display: block; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.cb-task:hover { text-decoration: none; border-color: var(--accent); }
.cb-task.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.cb-task-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.cb-term { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #0a1118; box-shadow: var(--shadow); }
.cb-term-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cb-term-head label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-weight: 500; color: var(--muted); }
.cb-out { margin: 0; padding: .9rem 1rem; height: 64vh; min-height: 320px; overflow: auto; color: #cfe3ea; font: .8rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.cb-out:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.cb-card-actions { display: flex; gap: .5rem; }
@media (max-width: 900px) { .cb-tasks { grid-template-columns: 1fr; } .cb-tasklist { max-height: 30vh; } .cb-out { height: 55vh; } }
.card table td .actions { flex-wrap: nowrap; justify-content: flex-end; }
.cb-chips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.cb-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.cb-opt { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-weight: 500; margin: 0; }
.cb-opt:hover { border-color: var(--accent); }
.cb-opt input { margin-top: .2rem; }
.cb-opt small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; line-height: 1.35; }
.cb-opt small.cb-warn { color: var(--warn); }
.cb-savebar { position: sticky; top: 3.4rem; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.cb-pend { display: inline-block; margin-right: .8rem; }
.cb-others { margin-top: 1rem; }

/* ---- sidebar groups, the menu under your name ---- */
.navgroup { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .6rem; }
.navlabel { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--side-text); opacity: .55; padding: .5rem .75rem .15rem; }
.nav a[aria-current="page"] { font-weight: 600; }
@media (max-width: 900px) { .navlabel { display: none; } .navgroup { flex-direction: row; flex-wrap: wrap; margin: 0; } }
.usermenu { position: relative; }
.um-btn { display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; padding: .2rem .5rem .2rem .2rem; border-radius: 999px; color: var(--text); }
.um-btn:hover { background: var(--surface-2); }
.um-btn svg { color: var(--muted); }
.popmenu { position: fixed; z-index: 200; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 36px rgba(0, 0, 0, .24); padding: .35rem; }
.popmenu[hidden] { display: none; }
.popmenu a, .popmenu button { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; border: 0; background: transparent; padding: .45rem .65rem; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.popmenu a:hover, .popmenu button:hover { background: var(--accent-soft); text-decoration: none; }
.popmenu button.danger { color: var(--danger); }
.popmenu svg { color: var(--muted); flex: none; }
.popmenu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.um-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; } .popmenu a, .popmenu button { white-space: nowrap; }
.um-head { display: flex; flex-direction: column; padding: .5rem .65rem .4rem; }

/* ---- file manager ---- */
.fm-top { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.fm-crumbs { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.fm-crumbs .sep { color: var(--muted); } .fm-crumbs .here { font-weight: 600; } .fm-crumbs a { display: inline-flex; align-items: center; }
.fm-jump { width: auto; max-width: 100%; }
.fm-tools { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem; }
.fm-tools button { display: inline-flex; align-items: center; gap: .3rem; }
.fm-spacer { flex: 1; }
.fm-search { width: min(260px, 100%); }
.fm-bulk { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .5rem .7rem; background: var(--accent-soft); border-radius: 10px; margin-bottom: .7rem; }
.fm-bulk button { display: inline-flex; align-items: center; gap: .3rem; }
.fm-table .fm-cb { width: 34px; padding-right: 0; }
.fm-table .right { text-align: right; }
.fm-name { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); min-width: 0; }
.fm-name:hover { color: var(--accent); text-decoration: none; }
.fm-nm { word-break: break-all; }
.fm-ico { display: grid; place-items: center; color: var(--muted); flex: none; }
.fm-ico.k-dir { color: var(--c-amber); } .fm-ico.k-image { color: var(--c-violet); } .fm-ico.k-archive { color: var(--c-rose); } .fm-ico.k-code { color: var(--c-blue); } .fm-ico.k-link { color: var(--c-teal); }
.fm-table tr.sel { background: var(--accent-soft); }
.fm-table tr.dot .fm-nm { opacity: .72; }
.fm-more { padding: .15rem .4rem; }
.fm-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .8rem; }
.fm.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.linkish { border: 0; background: none; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; font-weight: inherit; cursor: pointer; }
.linkish:hover { background: none; color: var(--text); }
.uploads { position: fixed; left: 1rem; bottom: 1rem; z-index: 90; width: min(340px, 92vw); display: flex; flex-direction: column; gap: .4rem; }
.upr { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; box-shadow: var(--shadow); }
.upr .upn { font-weight: 600; font-size: .85rem; word-break: break-all; } .upr.bad { border-color: var(--danger); }
.permgrid { display: grid; gap: .5rem; margin-bottom: .8rem; }
.permrow { display: grid; grid-template-columns: 90px repeat(3, 1fr); align-items: center; gap: .5rem; }
.permrow label { margin: 0; font-weight: 500; }
dialog.fm-wide { width: min(980px, 96vw); }
.fm-previewbox { text-align: center; }
.fm-preview { max-width: 100%; max-height: 65vh; background: var(--surface-2); border-radius: 8px; }

/* ---- code editor ---- */
:root { --tk: #8250df; --ts: #0a7a45; --tc: #6e7b88; --tn: #b35900; --tv: #0b6fb8; --tt: #c0392b; --ta: #9a6700; --tm: #a0268f; --tp: #6e7b88; }
@media (prefers-color-scheme: dark) { :root { --tk: #c4a3ff; --ts: #7ee0a8; --tc: #7d8c99; --tn: #f0b04a; --tv: #6bb8f5; --tt: #ff8f84; --ta: #e8c36a; --tm: #f08ad8; --tp: #8fa3b3; } }
.tok-k { color: var(--tk); font-weight: 600; } .tok-s { color: var(--ts); } .tok-c { color: var(--tc); font-style: italic; } .tok-n { color: var(--tn); }
.tok-v { color: var(--tv); } .tok-t { color: var(--tt); } .tok-a { color: var(--ta); } .tok-m { color: var(--tm); } .tok-p { color: var(--tp); }
dialog.fm-editor { width: min(1240px, 97vw); height: min(90vh, 940px); max-width: none; max-height: none; }
dialog.fm-editor[open] { display: flex; flex-direction: column; }
.ed-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.ed-title { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.ed-title .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }
.ed-tools { display: flex; align-items: center; gap: .5rem; }
.ed-lang { width: auto; padding: .25rem .5rem; font-size: .85rem; }
.ed-body { flex: 1; display: flex; min-height: 0; background: var(--surface); font: 13px/1.55 var(--mono); }
.ed-gutter { margin: 0; padding: 12px 8px 40px 12px; text-align: right; color: var(--muted); user-select: none; overflow: hidden; border-right: 1px solid var(--border); background: var(--surface-2); font: inherit; min-width: 3.4em; }
.ed-code { position: relative; flex: 1; min-width: 0; }
.ed-hl, .ed-ta { position: absolute; inset: 0; margin: 0; border: 0; border-radius: 0; font: inherit; letter-spacing: 0; tab-size: 2; white-space: pre; word-wrap: normal; }
.ed-hl { padding: 12px 40px 40px 12px; overflow: hidden; pointer-events: none; color: var(--text); }
.ed-ta { padding: 12px; width: 100%; height: 100%; min-height: 0; overflow: auto; resize: none; background: transparent; color: transparent; caret-color: var(--text); outline: none; }
.ed-ta:focus-visible { outline: none; }
.ed-ta::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: transparent; }
.ed-foot { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem .9rem; border-top: 1px solid var(--border); }

/* ---- settings: suspend pages, bandwidth ---- */
.sp-frame { width: 100%; height: 55vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sp-ta { min-height: 50vh; width: 100%; font: 13px/1.5 var(--mono); white-space: pre; tab-size: 2; }
.sp-assign { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .75rem 0; border-bottom: 1px dashed var(--border); }
.sp-assign select { width: auto; min-width: 16rem; max-width: 100%; }
.sp-sub { margin: 1.4rem 0 .4rem; }
ul.plain { margin: .3rem 0 .8rem 1.1rem; padding: 0; } ul.plain li { margin: .35rem 0; }

[hidden] { display: none !important; }

/* ---------- polish 2: brand-aware chrome, motion, finish ---------- */
.brand .logo { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); color: var(--accent-text); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent); }
.nav a { transition: background .12s, color .12s; position: relative; }
.nav a.active { box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active svg { color: var(--accent); }
.side { scrollbar-width: thin; scrollbar-color: var(--side-hi) transparent; border-right: 1px solid rgba(255, 255, 255, .04); }
html { scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
body { font-feature-settings: "cv11", "ss01"; }
td, .stat .n, .kv, .badge, .mono { font-variant-numeric: tabular-nums; }

/* topbar glass, page enter, calmer shadows */
.topbar { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.main > * { animation: rise .22s ease-out both; } .main > *:nth-child(2) { animation-delay: .03s; } .main > *:nth-child(3) { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
.toast { animation: slidein .18s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }
@media (prefers-reduced-motion: reduce) { .main > *, .toast { animation: none; } }

/* controls */
button.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent)); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 50%, transparent); }
button.primary:hover { filter: brightness(1.07); }
button.primary:focus-visible { outline-offset: 3px; }
button.danger:focus-visible { outline-color: var(--danger); }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
input:disabled, select:disabled { opacity: .6; background: var(--surface-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* cards and tiles */
.card { transition: box-shadow .15s; }
.tile { transition: border-color .12s, transform .12s, box-shadow .15s; }
.tile:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 18%, transparent); }
.tile:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .85; }
.bar .fill { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); transition: width .4s ease; }
.badge::before { content: ""; display: inline-block; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; margin-right: .38rem; opacity: .7; vertical-align: .08em; }
.badge.blue::before, .badge:not(.ok):not(.bad):not(.warn):not(.blue)::before { display: none; }

/* tables */
.fm-table thead th { position: sticky; top: 56px; background: var(--surface); z-index: 1; box-shadow: 0 1px 0 var(--border); }
table tbody tr { transition: background .1s; }
tbody tr:nth-child(even) { background: transparent; }
tbody tr:hover { background: var(--accent-soft); }

/* login */
.login { background: radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
.login .card { box-shadow: 0 18px 50px rgba(8, 20, 32, .14); border-radius: 18px; padding: 1.8rem; }
.login .brand { color: var(--text); font-size: 1.5rem; padding-bottom: 1.4rem; }
.login .brand .logo, .login .brand .logo-img { width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem; }
.login .brand .logo-img { object-fit: contain; }

/* dialogs and menus */
dialog { box-shadow: 0 24px 70px rgba(0, 0, 0, .4); }
dialog::backdrop { backdrop-filter: blur(2px); }
.popmenu { animation: pop .12s ease-out; }
.popmenu a:focus-visible, .popmenu button:focus-visible { outline-offset: -2px; }
kbd { font: .75rem var(--mono); padding: .05rem .4rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.cb-term { box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
@media print { .side, .topbar, .toasts, .uploads { display: none !important; } .shell { display: block; } .main { padding: 0; max-width: none; } .card { box-shadow: none; break-inside: avoid; } }

/* mail admin: queue, limits, troubleshooting */
.tabs.sub { margin-top: -.3rem; }
.tabs.sub a { padding: .4rem .8rem; font-size: .9rem; }
.qbar { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .9rem; }
td.why { max-width: 26rem; overflow-wrap: anywhere; color: var(--muted); }
form.tool { align-items: end; gap: .6rem; flex-wrap: wrap; }
form.tool input, form.tool select { min-width: 14rem; }
form.tool > button { flex: none; width: auto; }
form.tool > .field, form.tool > input, form.tool > select { flex: 1 1 14rem; }
td.addr { min-width: 11rem; overflow-wrap: anywhere; }

/* system admin, cron, console */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
td.cmd { max-width: 17rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.cmdwrap { overflow-wrap: anywhere; max-width: 32rem; }
tr.dim td { opacity: .6; }
pre.logview { max-height: 65vh; overflow: auto; white-space: pre; font-size: .78rem; line-height: 1.35; }
.tool-result { scroll-margin-top: 1rem; }
.tabs.sub .console { margin-left: auto; align-self: center; }
form.tool select, form.tool input[type=search] { flex: 1 1 11rem; }
.qbar select { flex: none; width: auto; min-width: 10rem; }
form.tool { display: flex; }

.wc-ta { width: 100%; min-height: 10rem; height: 11rem; font-size: .82rem; line-height: 1.4; resize: vertical; }
.ns-row { align-items: end; }
.ns-row > button { align-self: end; height: auto; margin-bottom: .35rem; }

.imp-bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .55rem 1rem; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); font-size: .9rem; }

.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tabs { flex-wrap: wrap; }

/* apps (installer) */
.app-h { margin: 1.4rem 0 .7rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: .9rem; }
.app-card { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.app-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.app-card.installed { flex-wrap: wrap; }
.app-card.failed { border-color: var(--danger); }
.app-card .app-body { flex: 1 1 10rem; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.app-card .actions { flex: 0 0 auto; }
.app-name { font-weight: 650; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.app-tile { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--c-slate); }
.app-tile.lg { width: 60px; height: 60px; border-radius: 16px; }
.app-tile.c-blue { background: linear-gradient(135deg, var(--c-blue), #5b8ff0); } .app-tile.c-violet { background: linear-gradient(135deg, var(--c-violet), #9a78e6); }
.app-tile.c-green { background: linear-gradient(135deg, var(--c-green), #46c08a); }
.app-tile.c-slate { background: linear-gradient(135deg, var(--c-slate), #7c8da0); }
.app-hero { display: flex; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.app-dlg { width: min(36rem, 94vw); }
.app-form .field { margin-bottom: .7rem; }
.app-auto { display: flex; align-items: center; gap: .4rem; color: var(--muted); margin: .2rem 0 .8rem; }
.app-plan { margin: .3rem 0 .6rem; }
.app-plan .notice { margin-bottom: .5rem; }
.app-plan ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.app-steps summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.app-steps pre { background: var(--surface-2); padding: .6rem .8rem; border-radius: 8px; overflow: auto; max-height: 14rem; white-space: pre; }
.app-status { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; font-weight: 600; }
.app-log { background: #0b141c; color: #cfe0ea; padding: .8rem 1rem; border-radius: 10px; min-height: 8rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; margin: 0 0 .8rem; }
.app-creds { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: .6rem 0; }
.app-creds dt { color: var(--muted); } .app-creds dd { margin: 0; overflow-wrap: anywhere; }
.app-secret { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
label.check { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; }
@media (max-width: 640px) { .app-grid { grid-template-columns: 1fr; } .app-card { flex-wrap: wrap; } }
