:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --hover: #f1f5fd;
  --text: #0b1220;
  --text-2: #334155;
  --muted: #6b7a90;
  --border: #e5e9f0;
  --border-strong: #d3dae5;
  --primary: #3b5bfd;
  --primary-2: #6d4dfa;
  --primary-hover: #2f4ae0;
  --primary-soft: rgba(59, 91, 253, 0.09);
  --ring: rgba(59, 91, 253, 0.22);
  --ok: #0f9d58;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --bad: #d92d20;
  --bad-soft: rgba(217, 45, 32, 0.09);
  --side-1: #0b1020;
  --side-2: #111a33;
  --side-text: #a5b1c8;
  --side-line: rgba(255, 255, 255, 0.07);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -6px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 64px -12px rgba(16, 24, 40, 0.28);
  --font: 'Segoe UI Variable Text', 'Segoe UI', Inter, system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e17;
    --surface: #111726;
    --surface-2: #0e1421;
    --hover: #172036;
    --text: #e8edf6;
    --text-2: #c3cddd;
    --muted: #8391a8;
    --border: #1e2840;
    --border-strong: #2a3654;
    --primary: #5b78ff;
    --primary-2: #8b6cff;
    --primary-hover: #4a66f0;
    --primary-soft: rgba(91, 120, 255, 0.14);
    --ring: rgba(91, 120, 255, 0.35);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.12);
    --side-1: #070a12;
    --side-2: #0c1222;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 15.5px; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 0.93em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
::selection { background: var(--ring); }

/* Icons */
.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 34px; height: 34px; stroke-width: 1.6; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-hover)); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 4px 12px -2px rgba(59, 91, 253, .35); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn-dark { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #cbd5e1; box-shadow: none; }
.btn-dark:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .16); }
.btn-block { width: 100%; }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn .i { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--hover); color: var(--primary); border-color: var(--border-strong); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.icon-btn-dark { background: transparent; border-color: transparent; color: var(--side-text); }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.group.end { justify-content: flex-end; }

/* Inputs */
input[type=email], input[type=password], input[type=text], select {
  height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; }
input::placeholder { color: var(--muted); opacity: .7; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.val-edit { width: 100%; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 17px; height: 17px; }
.input-icon input { width: 100%; height: 46px; padding-left: 42px; font-size: 14.5px; }

/* Notices */
.notice { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 20%, transparent); }
.notice.error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.main > .notice { margin-bottom: 16px; }

/* Logo */
.logo { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
.logo b { font-weight: 750; }
.logo-light { color: #fff; }
.logo-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 6px 16px -4px rgba(91, 95, 253, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}

/* Sign in */
.login-screen {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 16px;
  background:
    radial-gradient(420px 320px at 50% 42%, color-mix(in srgb, var(--primary-2) 26%, transparent), transparent 70%),
    radial-gradient(520px 360px at 50% 58%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 70%),
    var(--bg);
}
.login-card {
  position: relative; width: 100%; max-width: 330px; padding: 28px 24px 24px; border-radius: 22px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(150deg, color-mix(in srgb, var(--primary) 70%, transparent), color-mix(in srgb, var(--border) 60%, transparent) 45%, color-mix(in srgb, var(--primary-2) 60%, transparent)) border-box;
  box-shadow: 0 20px 50px -18px color-mix(in srgb, var(--primary) 45%, transparent), 0 2px 6px rgba(0, 0, 0, .08);
  animation: rise .35s ease-out;
}
.login-brandmark { display: flex; justify-content: center; margin-bottom: 14px; }
.login-logo { width: 150px; height: auto; display: block; filter: drop-shadow(0 6px 14px rgba(239, 68, 68, .28)); }
.side-logo { width: 90px; height: auto; display: block; }
.side-tag { padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .08); color: #cbd5e1; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.logo-mark-lg { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary-2) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
.login-name { font-size: 18px; font-weight: 800; letter-spacing: .22em; padding-left: .22em; }
.login-title { margin-bottom: 14px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.login-card .notice { margin-bottom: 12px; font-size: 12.5px; padding: 9px 12px; }
.login-card .form label { font-size: 12px; margin-top: 6px; }
.login-card .input-icon input { height: 42px; font-size: 14px; border-radius: 12px; }
.login-card .btn-lg { height: 42px; font-size: 14px; border-radius: 12px; }
.login-card #code { height: 54px; font-size: 24px; letter-spacing: 12px; padding-left: 20px; border-radius: 12px; }
.login-copy { font-size: 11.5px; color: var(--muted); opacity: .8; }
.form { display: flex; flex-direction: column; gap: 7px; }
.form label { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form .btn { margin-top: 18px; }
.form .link-btn { margin-top: 12px; text-align: center; }
#code { text-align: center; font-family: var(--mono); font-weight: 700; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 20px 14px 14px;
  background: linear-gradient(180deg, var(--side-2), var(--side-1)); color: var(--side-text); border-right: 1px solid var(--side-line);
}
.sidebar > .logo { padding: 2px 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #5d6a85; }
.nav-label:first-child { margin-top: 0; }
.nav button {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--side-text); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav button .i { opacity: .85; }
.nav button:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav button.active { background: linear-gradient(90deg, rgba(91, 120, 255, .24), rgba(91, 120, 255, .05)); color: #fff; }
.nav button.active .i { color: #9db0ff; opacity: 1; }
.nav button.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--primary), var(--primary-2)); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--side-line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; font-size: 13px; font-weight: 700; }
.me-text { flex: 1; min-width: 0; }
.me-text strong { display: block; color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { display: block; font-size: 11.5px; color: #6f7c96; }

.main { min-width: 0; padding: 0 32px 56px; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 -32px 22px; padding: 16px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.page-head p { margin-top: 3px; font-size: 13.5px; }
.srv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 5px 5px 5px 7px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.srv-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.srv-ico .i { width: 16px; height: 16px; }
.srv select { min-width: 230px; height: 34px; border-color: transparent; background-color: transparent; font-weight: 600; box-shadow: none; }
.srv select:hover { background-color: var(--hover); }
.srv select:focus { box-shadow: none; border-color: transparent; background-color: var(--hover); }
.srv select option { background: var(--surface); color: var(--text); }
.srv-key { display: block; margin: -14px 0 14px; text-align: right; color: var(--muted); font-size: 11px; }
.srv-key:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.pill.on { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.on::before { background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

.panel { display: flex; flex-direction: column; gap: 16px; }
.sub { margin-top: 8px; }
.hint { font-size: 12.5px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-title { display: flex; gap: 14px; align-items: flex-start; }
.card-title p { margin-top: 4px; font-size: 13.5px; }
.card-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.form-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.inline-form #setting-key { width: 230px; }
.inline-form #setting-value { flex: 1; min-width: 220px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.callout { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 80px 24px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty h2 { font-size: 17px; }
.empty p { max-width: 380px; }
.empty-ico { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 6px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); }
.empty-ico .i { width: 28px; height: 28px; }

/* Tables */
.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 18px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions > .btn, td.actions > .icon-btn { margin-left: 4px; }
td.key { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
td.val { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.masked { color: var(--muted); letter-spacing: 3px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bad-soft); color: var(--bad); }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--ok-soft); color: var(--ok); }

/* Files */
.pathbar { display: flex; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.crumbs { display: flex; flex: 1; flex-wrap: wrap; align-items: center; min-width: 0; padding: 0 4px; font-family: var(--mono); font-size: 13.5px; }
.crumbs button { padding: 5px 8px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: inherit; cursor: pointer; }
.crumbs button:hover { background: var(--hover); color: var(--primary); }
.crumbs button:last-child { color: var(--text); font-weight: 650; }
.crumbs .sep { color: var(--border-strong); }
.addr { flex: 1; }
.addr input { width: 100%; height: 34px; font-family: var(--mono); }

table.files td { padding-top: 9px; padding-bottom: 9px; }
table.files .name { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.fi { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.fi .i { width: 16px; height: 16px; }
.fi.dir { background: rgba(245, 158, 11, .13); color: #d97706; border-color: transparent; }
.fi.code { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.fi.image { background: rgba(236, 72, 153, .11); color: #db2777; border-color: transparent; }
.fi.archive { background: rgba(139, 92, 246, .13); color: #8b5cf6; border-color: transparent; }
.fi.package { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
table.files tr.dir .name button { color: var(--text); font-weight: 600; }
table.files tr.dir .name button:hover { color: var(--primary); text-decoration: none; }
table.files td.mono { font-size: 12px; color: var(--muted); white-space: nowrap; }
td.date { white-space: nowrap; color: var(--muted); }
.row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .12s; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
.row-actions .icon-btn { width: 30px; height: 30px; }

.dropzone { position: relative; min-height: 140px; }
.drop-overlay { position: absolute; inset: 6px; display: none; place-items: center; text-align: center; border: 2px dashed var(--primary); border-radius: 12px; background: color-mix(in srgb, var(--primary-soft) 85%, var(--surface)); font-size: 15px; color: var(--primary); pointer-events: none; }
.drop-overlay p { margin-top: 8px; }
.dropzone.dragging .drop-overlay { display: grid; }

.progress { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .2s; }
.results-box { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.results-box summary { cursor: pointer; font-weight: 600; }
.results { margin: 10px 0 0; padding-left: 18px; max-height: 240px; overflow: auto; font-family: var(--mono); font-size: 12px; }
.results .fail { color: var(--bad); }

/* Terminal */
.term-ui { display: flex; flex-direction: column; gap: 10px; }
.term-window { border-radius: var(--radius); overflow: hidden; background: #0a0d14; border: 1px solid #1c2333; box-shadow: var(--shadow-lg); }
.term-bar { display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 14px; background: linear-gradient(180deg, #161c2a, #11161f); border-bottom: 1px solid #1c2333; color: #9aa6bd; font-size: 12.5px; }
.term-bar #term-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: inline-flex; gap: 7px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.term { height: calc(100vh - 250px); min-height: 380px; padding: 12px 14px; }

/* Apps */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stats .card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.stats .card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); opacity: .8; }
.stats span { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats strong { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.stats small { color: var(--muted); font-size: 12px; }

/* Projects */
.env-list { display: flex; flex-wrap: wrap; gap: 10px; }
.env-list .group { gap: 6px; padding: 6px 6px 6px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.env-list .group strong { margin-right: 6px; font-size: 13.5px; }
.env-list .btn { height: 30px; padding: 0 12px; box-shadow: none; }
.env-list .btn.active { background: linear-gradient(180deg, var(--primary), var(--primary-hover)); border-color: transparent; color: #fff; }

/* Migrations */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.collections { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 10px; }
.confirm { display: flex; flex-direction: column; gap: 6px; max-width: 360px; font-size: 13px; }
.job { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; margin-bottom: 10px; }
.job.failed { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.job .fail { color: var(--bad); }

code.cmd { padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 12px; word-break: break-all; }
.output { margin-top: 18px; padding: 16px; border-radius: var(--radius); background: #0a0d14; color: #d6deeb; border: 1px solid #1c2333; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }

/* Connect dialog */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 18, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .15s ease-out; }
.modal-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 8px; padding: 26px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.modal-head p { margin-top: 3px; }
.modal-card label { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.modal-card input { height: 44px; }
.modal-card .group { margin-top: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-label { display: none; }
  .nav button { width: auto; padding: 7px 10px; }
  .nav button.active::before { display: none; }
  .me { margin: 0; padding: 0; border: 0; }
  .me-text { display: none; }
  .main { padding: 0 16px 40px; }
  .topbar { margin: 0 -16px 16px; padding: 12px 16px; }
  .srv { width: 100%; }
  .srv select { min-width: 0; flex: 1; }
  .row-actions { opacity: 1; }
}

/* Dropdowns: one consistent arrow */
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238391a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
}
.srv select { background-color: transparent; }
.srv-key { display: none !important; }
#srv-bar[hidden] { display: none !important; }
.topbar { min-height: 76px; }

/* Filter bars */
.filter { position: relative; display: inline-flex; align-items: center; }
.filter .i { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.filter input {
  width: 220px; height: 34px; padding: 0 12px 0 33px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
}
.filter input:focus { background: var(--surface); }
.filter input::-webkit-search-cancel-button { cursor: pointer; }

/* Toolbars line up on one row */
.toolbar { align-items: center; }
.toolbar > .group { align-items: center; }
.tb-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--border-strong); }
.card-head .group { align-items: center; }

/* Upload queue */
.queue { overflow: hidden; border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.queue .card-head { background: linear-gradient(90deg, var(--primary-soft), transparent 70%); }
.queue-title { display: flex; align-items: center; gap: 12px; }
.queue-title p { margin-top: 2px; }
.queue-list { list-style: none; margin: 0; padding: 6px; max-height: 260px; overflow: auto; }
.queue-list li { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; }
.queue-list li:hover { background: var(--hover); }
.q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.q-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.queue-list .icon-btn { width: 28px; height: 28px; border-color: transparent; background: transparent; }
.queue-list .icon-btn:hover { color: var(--bad); background: var(--bad-soft); }

/* Account box */
.me { margin-top: auto; gap: 10px; padding: 10px; border: 1px solid var(--side-line); border-top: 1px solid var(--side-line); border-radius: 14px; background: rgba(255, 255, 255, .035); }
.me-text strong { line-height: 1.3; }
.me-text small { line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; font-size: 13px; letter-spacing: .02em; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }

@media (max-width: 860px) {
  .filter input { width: 100%; }
  .filter { flex: 1; }
}

/* Title on the left, server bar on the right, one row */
.topbar { flex-wrap: nowrap; }
.page-head { flex: 1; min-width: 0; }
.page-head h1, .page-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv { flex-wrap: nowrap; flex-shrink: 0; margin-left: auto; }
.srv select { min-width: 0; width: 250px; }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; }
  .srv { flex-wrap: wrap; margin-left: 0; }
  .srv select { width: auto; flex: 1; }
}

/* Consistent spacing inside every page */
.files-ui, #apps-ui, #logs-ui, .term-ui, .split-main { display: flex; flex-direction: column; gap: 14px; }
.files-ui[hidden], #apps-ui[hidden], #logs-ui[hidden], .term-ui[hidden] { display: none !important; }
.toolbar { min-height: 38px; }
.pathbar { min-height: 48px; }
.srv select { width: 190px; }
.pad { padding: 18px; }

/* Usage meters (CPU, memory, disk) */
.meter-card { gap: 6px !important; }
.meter-card::after { display: none; }
.meter-top { display: flex; align-items: center; justify-content: space-between; }
.meter-pct { font-size: 12px; font-weight: 700; color: var(--primary); }
.meter-pct.warn { color: #d97706; }
.meter-pct.bad { color: var(--bad); }
.meter { height: 8px; margin-top: 4px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .4s ease; }
.meter.warn > div { background: linear-gradient(90deg, #f59e0b, #f97316); }
.meter.bad > div { background: linear-gradient(90deg, #f97316, var(--bad)); }

/* Segmented buttons */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); border: 1px solid var(--border); }

/* Projects: list on the left, settings on the right */
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.side-list { position: sticky; top: 96px; overflow: hidden; }
.proj-items { display: flex; flex-direction: column; padding: 8px; gap: 4px; max-height: calc(100vh - 200px); overflow: auto; }
.proj { padding: 8px; border-radius: 12px; }
.proj + .proj { border-top: 1px solid var(--border); border-radius: 0; padding-top: 12px; }
.proj-name { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.proj-name b { flex: 1; font-size: 14px; }
.proj-name small { color: var(--muted); font-size: 11.5px; }
.proj-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 12px; font-weight: 800; }
.proj-envs { display: flex; flex-direction: column; gap: 2px; padding-left: 36px; }
.env-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; }
.env-btn small { min-width: 24px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 11px; text-align: center; }
.env-btn:hover { background: var(--hover); color: var(--text); }
.env-btn.active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--primary); font-weight: 650; }
.env-head { display: flex; align-items: center; gap: 12px; }
.env-head p { margin-top: 2px; }
.split-main .empty { min-height: 340px; justify-content: center; }

/* Migrations: numbered steps */
.mig-card { padding: 6px 0; }
.mig-step { display: flex; gap: 16px; padding: 18px 22px; }
.mig-step + .mig-step { border-top: 1px solid var(--border); }
.step-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); font-weight: 750; font-size: 13.5px; border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.step-body > p { margin-top: -6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 9px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; transition: border-color .15s, background .15s; }
.chip small { color: var(--muted); font-weight: 500; font-size: 12px; }
.chip:hover { border-color: var(--primary); }
.chip.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.mig-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; }
.mig-end { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.mig-end.to { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.mig-end select { width: 100%; }
.mig-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); }
.mig-end.to .mig-tag { color: var(--bad); }
.mig-arrow { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.confirm-row { display: flex; flex-wrap: wrap; gap: 10px; }
.confirm-row input { flex: 1; min-width: 200px; max-width: 360px; font-family: var(--mono); }
.jobs { padding: 6px; }
.jobs .job { margin: 0; padding: 12px 14px; border-radius: 10px; }
.jobs .job + .job { border-top: 1px solid var(--border); }

/* Activity tiles */
.tile { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.tile::after { display: none; }
.tile > div { display: flex; flex-direction: column; }
.tile-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.tile.ok .tile-ico { background: var(--ok-soft); color: var(--ok); }
.tile.bad .tile-ico { background: var(--bad-soft); color: var(--bad); }
.tile.bad strong { color: var(--bad); }

/* Logs */
.logs-view { margin: 0; height: calc(100vh - 300px); min-height: 360px; overflow: auto; padding: 14px 16px; color: #d6deeb; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.logs-view.err { color: #fca5a5; }
.logs-at { margin-left: auto; color: #6b7a90; font-size: 12px; }
#logs-app { min-width: 260px; }

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .side-list { position: static; }
  .mig-flow { grid-template-columns: 1fr; }
  .mig-arrow { transform: rotate(90deg); justify-self: center; }
}
#audit-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#audit td:nth-child(3), #audit td:nth-child(1) { white-space: nowrap; }

/* Projects list: tighter, aligned */
.side-list .card-head { padding: 12px 14px; }
.side-list .card-head h2 { font-size: 14px; }
.proj-items { padding: 6px; gap: 0; }
.proj { padding: 10px 8px; }
.proj + .proj { padding-top: 10px; }
.proj-name { margin-bottom: 6px; gap: 10px; }
.proj-envs { padding-left: 0; }
.env-btn { padding: 7px 10px 7px 44px; }
.split-main .empty { min-height: 260px; }
.mig-step .chip-row:empty::before { content: 'Loading projects…'; color: var(--muted); font-size: 13px; }

/* Upload panel */
.upload-drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 14px; padding: 28px 16px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); transition: border-color .15s, background .15s, padding .15s;
}
.upload-drop p { font-size: 14px; color: var(--text-2); }
.upload-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.drop-ico .i { width: 22px; height: 22px; }
.upload-drop.compact { flex-direction: row; justify-content: center; flex-wrap: wrap; padding: 12px 16px; gap: 14px; }
.upload-drop.compact .drop-ico { width: 34px; height: 34px; border-radius: 10px; }
.upload-drop.compact .drop-ico .i { width: 17px; height: 17px; }
.queue-list { margin: 0 14px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; }
.queue-list[hidden] { display: none; }
.queue-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin-top: 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.queue-foot[hidden] { display: none; }
.queue .card-head { padding: 12px 14px 12px 18px; }

/* Pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pager select { height: 32px; font-size: 13px; }
.pager .icon-btn { width: 32px; height: 32px; font-size: 16px; font-weight: 600; }
.pages { display: inline-flex; align-items: center; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.page-btn:hover { border-color: var(--border-strong); background: var(--hover); }
.page-btn.active { background: linear-gradient(180deg, var(--primary), var(--primary-hover)); border-color: transparent; color: #fff; }
.pages .gap { padding: 0 4px; color: var(--muted); }

/* Compact stat tiles: icon at the side */
.stats .tile, .kpis .tile { flex-direction: row !important; align-items: center; gap: 12px !important; padding: 12px 14px !important; }
.tile-ico { width: 36px !important; height: 36px !important; border-radius: 10px !important; flex-shrink: 0; }
.tile-ico .i { width: 17px; height: 17px; }
.tile > div { gap: 0; min-width: 0; }
.tile span { font-size: 11px !important; letter-spacing: .05em; }
.tile strong { font-size: 19px !important; line-height: 1.2; }
.tile small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#audit-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { position: relative; display: flex; border: 1px solid var(--border); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
.kpi:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-1px); }
.kpi.ok .tile-ico { background: var(--ok-soft); color: var(--ok); }
.kpi.bad .tile-ico { background: var(--bad-soft); color: var(--bad); }
.kpi.bad strong { color: var(--bad); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dash-wide { grid-column: 1 / -1; }
.dash-card .card-head { padding: 12px 16px; }
.dash-card .card-head h2 { font-size: 14.5px; }
.dash-card .link-btn { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; }
.dash-list { list-style: none; margin: 0; padding: 6px; }
.dash-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 10px; }
.dash-list li + li { border-top: 1px solid var(--border); border-radius: 0; }
.dash-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dash-main > div { min-width: 0; }
.dash-main b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-main small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-side { flex-shrink: 0; }
.nowrap { white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--border-strong); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.env-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.env-chip { padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.dash-body { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.dash-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px; text-align: center; }
.dash-empty .empty-ico { width: 46px; height: 46px; border-radius: 14px; margin: 0; }
.dash-empty .empty-ico .i { width: 22px; height: 22px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.hbar-top span { color: var(--muted); font-weight: 600; }
.health-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.health-foot .link-btn { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* New project */
.deploy-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.kind-seg { align-self: flex-start; }
.kind-seg button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 16px; }
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; min-width: 0; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.checks [hidden] { display: none !important; }
.grid [hidden] { display: none !important; }
.deploy-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.deploy-url { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deploy-url b { color: var(--primary); word-break: break-all; }
.deploy-preview { position: sticky; top: 96px; overflow: hidden; }
.plan-list { list-style: none; margin: 0; padding: 8px 10px; }
.plan-list li { display: flex; gap: 10px; padding: 8px 6px; }
.plan-list li + li { border-top: 1px solid var(--border); }
.plan-list li > div { display: flex; flex-direction: column; min-width: 0; }
.plan-list small { font-size: 11.5px; word-break: break-all; white-space: pre-wrap; }
.plan-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.plan-ico .i { width: 13px; height: 13px; stroke-width: 2.5; }
.plan-list li.done .plan-ico { background: var(--ok-soft); color: var(--ok); }
.plan-list li.fail .plan-ico { background: var(--bad-soft); color: var(--bad); }
.plan-list li.fail > div > span { color: var(--bad); font-weight: 600; }
.dp-files { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.dp-file { border-radius: 10px; overflow: hidden; border: 1px solid #1c2333; }
.dp-file-head { padding: 6px 12px; background: #161c2a; color: #9aa6bd; font-size: 11.5px; }
.dp-file pre { margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto; background: #0a0d14; color: #d6deeb; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
#dp-result .card-head a[hidden] { display: none; }
.link-ext { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); font-weight: 600; text-decoration: none; word-break: break-all; }
.link-ext:hover { text-decoration: underline; }
@media (max-width: 1100px) { .deploy-grid { grid-template-columns: 1fr; } .deploy-preview { position: static; } }

/* Upload rows with live progress */
.queue-list li { position: relative; }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.q-body .q-name { flex: none; }
.q-bar { height: 5px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.q-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .2s; }
.queue-list li.q-active { background: var(--primary-soft); }
.queue-list li.q-failed { background: var(--bad-soft); }
.q-error { color: var(--bad); font-size: 12px; white-space: normal; word-break: break-word; }
.q-spacer { width: 28px; flex-shrink: 0; }
.q-progress { flex: 1; min-width: 240px; }
.q-progress[hidden], #queue-options[hidden], #upload-drop[hidden] { display: none !important; }
.dp-status { display: flex; flex-direction: column; gap: 4px; max-width: 280px; }
.dp-status small { font-size: 11.5px; line-height: 1.35; white-space: normal; }
.status-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.live { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-pill.warn { background: rgba(245, 158, 11, .14); color: #d97706; border-color: transparent; }
.status-pill.down { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Dialog */
.modal { z-index: 60; }
.dlg-card { max-width: 440px; gap: 12px; padding: 24px; }
.dlg-head { display: flex; align-items: center; gap: 14px; }
.dlg-head h2 { font-size: 16.5px; line-height: 1.35; word-break: break-word; }
.dlg-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.dlg-ico .i { width: 20px; height: 20px; }
#dlg.danger .dlg-ico { background: var(--bad-soft); color: var(--bad); }
.dlg-msg { display: flex; flex-direction: column; gap: 6px; margin-left: 56px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.dlg-msg:empty { display: none; }
#dlg-label { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
#dlg-input { width: 100%; height: 42px; }
#dlg.danger #dlg-input:focus { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.dlg-actions { margin-top: 6px; }
.btn-danger-solid { background: linear-gradient(180deg, #ef4444, #dc2626); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -2px rgba(220, 38, 38, .4); }
.btn-danger-solid:hover { background: #dc2626; color: #fff; border-color: transparent; }
.btn-danger-solid:disabled { opacity: .45; box-shadow: none; }

/* Select several files */
table.files th.sel, table.files td.sel { width: 44px; padding-right: 0; }
table.files .sel input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
table.files tr.selected td { background: var(--primary-soft); }
.sel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border)); background: var(--primary-soft); }
.sel-bar[hidden] { display: none; }
.sel-bar b { flex: 1; font-size: 13.5px; }
.sel-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: #fff; }

/* Project files in the New project form */
.dp-upload { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.dp-up-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.dp-up-head b { font-size: 13.5px; }
.dp-upload .upload-drop { margin: 0; }
#dp-queue-box { display: flex; flex-direction: column; gap: 8px; }
#dp-queue-box[hidden] { display: none; }
.dp-queue-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
#dp-queue { margin: 0; max-height: 200px; }
#dp-strip-row[hidden] { display: none; }
#dp-progress[hidden] { display: none !important; }
/* "Working" bar: moving stripes while the server is busy */
.q-progress.working .bar > div {
  background: repeating-linear-gradient(-45deg, var(--primary) 0 14px, var(--primary-2) 14px 28px);
  background-size: 40px 40px;
  animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 40px 0; } }

/* Code editor */
.editor-modal { padding: 24px; }
.editor-card { width: 100%; max-width: 1200px; height: calc(100vh - 48px); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: #0a0d14; border: 1px solid #1f2738; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.editor-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: linear-gradient(180deg, #161c2a, #11161f); border-bottom: 1px solid #1f2738; color: #e2e8f0; }
.editor-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.editor-title b { font-size: 14px; }
.editor-title small { color: #7d8aa3; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-head .pill { background: rgba(255, 255, 255, .05); border-color: #263043; color: #9aa6bd; }
.editor-head .pill.on { background: rgba(52, 211, 153, .12); color: #34d399; }
.editor-head .pill.warn { background: rgba(245, 158, 11, .14); color: #fbbf24; border-color: transparent; }
.editor-head .pill.warn::before { background: #fbbf24; }
.editor-head .btn:not(.btn-primary) { background: rgba(255, 255, 255, .06); border-color: #263043; color: #cbd5e1; box-shadow: none; }
.editor-head .icon-btn { background: transparent; border-color: transparent; color: #9aa6bd; }
.editor-body { flex: 1; min-height: 0; display: flex; }
.ed-lines { margin: 0; padding: 14px 10px 14px 14px; min-width: 52px; overflow: hidden; text-align: right; color: #475569; background: #0d111a; border-right: 1px solid #1a2130; font: 13px/1.6 var(--mono); user-select: none; white-space: pre; }
#ed-text { flex: 1; min-width: 0; margin: 0; padding: 14px 16px; border: 0; outline: none; resize: none; background: transparent; color: #e2e8f0; font: 13px/1.6 var(--mono); tab-size: 2; white-space: pre; overflow: auto; caret-color: #93c5fd; }
#ed-text::selection { background: #334155; }
.editor-foot { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; border-top: 1px solid #1a2130; background: #0d111a; color: #64748b; font-size: 11.5px; }
.file-link { color: var(--text) !important; font-weight: 500 !important; text-align: left; }
.file-link:hover { color: var(--primary) !important; text-decoration: none !important; }

/* Drop anywhere on the Files page */
.files-ui { position: relative; }
.files-ui.dragging #dropzone .drop-overlay { display: grid; }
.files-ui.dragging #dropzone { min-height: 220px; }

/* Dialog: busy + error */
.spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.dlg-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500; }
.dlg-status[hidden], .dlg-error[hidden] { display: none; }
.dlg-error { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; font-family: var(--mono); }
#dlg-ok { min-width: 110px; }

.ed-msg { padding: 9px 16px; background: rgba(248, 113, 113, .12); color: #fca5a5; border-bottom: 1px solid #3b1d24; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; max-height: 200px; overflow: auto; }
.ed-msg.ok { background: rgba(52, 211, 153, .1); color: #6ee7b7; border-bottom-color: #14352b; }
.ed-msg[hidden] { display: none; }
/* Icon beside the name in every list (not only Files) */
td .name { display: flex; align-items: center; gap: 12px; }
td .name > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
td .name b, td .name .file-link { font-weight: 600; }

/* ── Sidebar, redesigned ─────────────────────────────────────────────── */
.shell { transition: grid-template-columns .2s ease; }
.sidebar { gap: 14px; padding: 18px 12px 12px; overflow: hidden; background: radial-gradient(420px 260px at 0% 0%, rgba(91, 120, 255, .14), transparent 60%), linear-gradient(180deg, #0d1428, #080c16); }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 10px 8px; border-bottom: 1px solid var(--side-line); }
.side-toggle { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--side-line); background: rgba(255, 255, 255, .03); color: var(--side-text); cursor: pointer; transition: background .15s, color .15s, transform .2s; transform: rotate(180deg); }
.side-toggle:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-toggle .i { width: 15px; height: 15px; }
.nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; gap: 3px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #253048 transparent; }
.nav-label { margin: 16px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #56647f; white-space: nowrap; }
.nav button { gap: 12px; height: 42px; padding: 0 10px 0 6px; border-radius: 12px; font-size: 13.5px; color: #aab5cb; white-space: nowrap; }
.nav button::before { display: none !important; }
.nav-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; color: #8b98b3; transition: background .15s, color .15s, box-shadow .15s; }
.nav-ico .i { width: 17px; height: 17px; opacity: 1 !important; }
.nav button:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.nav button:hover .nav-ico { color: #fff; background: rgba(255, 255, 255, .06); }
.nav button.active { background: linear-gradient(90deg, rgba(91, 120, 255, .18), rgba(139, 108, 255, .06)); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(124, 140, 255, .18); }
.nav button.active .nav-ico { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 16px -6px rgba(91, 95, 253, .8); }
.nav button.active .i { color: #fff !important; }
.nav-text { overflow: hidden; text-overflow: ellipsis; }
.side-bottom { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--side-line); }
.side-server { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--side-line); background: rgba(255, 255, 255, .03); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.side-server:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
.side-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: #475569; box-shadow: 0 0 0 3px rgba(71, 85, 105, .25); }
.side-dot.on { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .22); animation: pulse 2s infinite; }
.side-server-text { min-width: 0; display: flex; flex-direction: column; }
.side-server-text b { color: #e6ebf3; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-server-text small { color: #6f7c96; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me { margin-top: 0; padding: 9px 10px; border-radius: 12px; }

/* Collapsed: icons only */
.shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
.shell.collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
.shell.collapsed .side-top { flex-direction: column; padding: 2px 0 10px; }
.shell.collapsed .side-logo { width: 46px; }
.shell.collapsed .side-tag, .shell.collapsed .nav-text, .shell.collapsed .nav-label, .shell.collapsed .side-server-text, .shell.collapsed .me-text { display: none; }
.shell.collapsed .side-toggle { transform: none; }
.shell.collapsed .nav button { justify-content: center; padding: 0; }
.shell.collapsed .nav-label + button { margin-top: 12px; }
.shell.collapsed .side-server { justify-content: center; padding: 10px 0; }
.shell.collapsed .me { flex-direction: column; padding: 8px 0; gap: 6px; }

@media (max-width: 860px) {
  .side-top { border: 0; padding: 0; }
  .side-toggle, .side-bottom .side-server { display: none; }
  .side-bottom { border: 0; padding: 0; }
  .nav { overflow: visible; }
  .nav button { height: 36px; }
  .shell.collapsed { grid-template-columns: 1fr; }
}

/* ── Top bar, redesigned ─────────────────────────────────────────────── */
.topbar { min-height: 84px; padding: 16px 32px; gap: 20px; background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 12px 24px -20px rgba(0, 0, 0, .5); }
.page-head { display: flex; align-items: center; gap: 14px; }
.page-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 10px 22px -10px rgba(91, 95, 253, .75), inset 0 1px 0 rgba(255, 255, 255, .25); }
.page-ico .i { width: 21px; height: 21px; }
.page-text { min-width: 0; display: flex; flex-direction: column; }
.page-crumb { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-text h1 { margin-top: 1px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.page-text p { margin-top: 1px; font-size: 13px; }

.srv { gap: 6px; padding: 5px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .45); }
.srv-pick { display: flex; align-items: center; gap: 4px; padding-left: 4px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.srv-pick:hover { background: var(--hover); }
.srv-pick .srv-ico { width: 30px; height: 30px; border-radius: 9px; }
.srv select { width: 180px; height: 34px; padding-left: 6px; border: 0 !important; background-color: transparent !important; box-shadow: none !important; font-weight: 650; font-size: 13.5px; }
.srv-sep { width: 1px; height: 22px; background: var(--border); }
.srv .pill { height: 30px; border: 0; padding: 0 12px; font-size: 12.5px; }
.srv .btn { height: 34px; border-radius: 10px; }
.srv-off { color: var(--muted); }
.srv-off:hover { color: var(--bad); background: var(--bad-soft); }
#srv-bar[hidden] + * { margin-top: 0; }

@media (max-width: 860px) {
  .topbar { min-height: 0; padding: 12px 16px; }
  .page-ico { width: 38px; height: 38px; }
  .page-text p { display: none; }
  .srv select { width: auto; flex: 1; }
  .srv-sep { display: none; }
}

/* ── Compact header ─────────────────────────────────────────────────── */
.topbar { min-height: 0; padding: 10px 28px; margin: 0 -28px 18px; gap: 16px; }
.page-head { gap: 11px; }
.page-ico { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 14px -8px rgba(91, 95, 253, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.page-ico .i { width: 17px; height: 17px; }
.page-crumb { font-size: 10px; letter-spacing: .12em; line-height: 1.3; }
.page-text h1 { margin: 0; font-size: 17px; line-height: 1.25; }
.page-text p { margin: 0; font-size: 12px; line-height: 1.35; }
.srv { padding: 4px; gap: 4px; border-radius: 12px; }
.srv-pick .srv-ico { width: 26px; height: 26px; border-radius: 8px; }
.srv-pick .srv-ico .i { width: 14px; height: 14px; }
.srv select { height: 30px; font-size: 13px; }
.srv .pill { height: 26px; font-size: 12px; }
.srv .btn { height: 30px; padding: 0 11px; font-size: 12.5px; }
.main { padding-left: 28px; padding-right: 28px; }

/* ── Menu items: same size, even spacing, active aligned with the rest ── */
.sidebar { padding-left: 10px; padding-right: 10px; }
.nav { padding: 0; gap: 2px; }
.nav button { height: 38px; margin: 0; padding: 0 10px 0 5px; gap: 11px; border-radius: 10px; border: 1px solid transparent; }
.nav-ico { width: 28px; height: 28px; border-radius: 8px; }
.nav-ico .i { width: 16px; height: 16px; }
.nav button.active { background: rgba(91, 120, 255, .13); border-color: rgba(124, 140, 255, .22); box-shadow: none; }
.nav button.active .nav-ico { box-shadow: 0 4px 12px -6px rgba(91, 95, 253, .9); }
.nav-label { margin: 14px 10px 5px 12px; }
.shell.collapsed .nav button { width: 44px; margin: 0 auto; }

@media (max-width: 860px) {
  .topbar { margin: 0 -16px 14px; padding: 10px 16px; }
  .main { padding-left: 16px; padding-right: 16px; }
}

#pe .modal-card label:not(.check) { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
#pe .input-btn input { height: 40px; }
#pe .dlg-head > div { min-width: 0; }

#pe .node-field[hidden] { display: none !important; }

/* Sortable column headings */
th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
th.sortable:hover, th.sortable:focus-visible { color: var(--text); outline: none; }
th.sortable::after { content: '↕'; margin-left: 6px; font-size: 11px; opacity: .35; }
th.sort-asc::after { content: '↑'; opacity: 1; color: var(--primary); }
th.sort-desc::after { content: '↓'; opacity: 1; color: var(--primary); }
th.sort-asc, th.sort-desc { color: var(--text); }
th.num.sortable::after { margin-left: 4px; }

/* Sign-in: verifying */
#code-status { margin-top: 10px; justify-content: center; }
#code-status[hidden] { display: none; }
.login-card .btn .spinner { margin-right: 2px; }
