/* ==========================================================================
   PaaSbox dashboard - w3schools dark palette, appbox-style navigation
   ========================================================================== */
:root {
  --bg: #1d2a35;
  --surface: #282a35;
  --surface-2: #2f3d4a;
  --surface-3: #38444d;
  --border: #3e4c58;
  --text: #e7e9eb;
  --text-strong: #ffffff;
  --muted: #9aa8b4;
  --accent: #04aa6d;
  --accent-hover: #059862;
  --accent-soft: rgba(4, 170, 109, 0.14);
  --yellow: #fff4a3;
  --info: #2196f3;
  --warning: #ff9800;
  --danger: #f44336;
  --danger-soft: rgba(244, 67, 54, 0.14);
  --warning-soft: rgba(255, 152, 0, 0.14);
  --info-soft: rgba(33, 150, 243, 0.14);
  --radius: 8px;
  --radius-sm: 5px;
  --sidebar-w: 250px;
  --topbar-h: 60px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text-strong); margin: 0 0 .5rem; line-height: 1.2; font-weight: 700; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
::selection { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------------ layout */
.layout { display: flex; min-height: 100vh; width: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }
.view { flex: 1; padding: 28px 32px 48px; outline: none; width: 100%; }

/* ----------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 20px; border-bottom: 1px solid var(--border); color: var(--text-strong); }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: .2px; }
.brand-name span, .auth-brand-name span { color: var(--accent); }
.nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--radius-sm); border: 0; background: none;
  color: var(--text); font: inherit; font-size: .98rem; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-3); text-decoration: none; color: var(--text-strong); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active .nav-icon { color: #fff; }
.nav-icon { width: 20px; text-align: center; color: var(--muted); }
.nav-item:hover .nav-icon { color: var(--text-strong); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-caret { font-size: .75rem; color: var(--muted); transition: transform .15s; }
.nav-group.open > .nav-item .nav-caret { transform: rotate(90deg); }
.nav-sub { display: none; margin: 2px 0 6px 22px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-group.open .nav-sub { display: block; }
.nav-sub .nav-item { padding: 7px 10px; font-size: .92rem; }
.nav-sub .nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-sub .nav-item.active .nav-icon { color: var(--accent); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.nav-dot.active { background: var(--accent); }
.nav-dot.pending { background: var(--warning); }
.nav-dot.suspended, .nav-dot.cancel_requested { background: var(--danger); }
.nav-empty { padding: 6px 10px; font-size: .85rem; color: var(--muted); }
.badge-soon { font-size: .68rem; text-transform: uppercase; background: var(--yellow); color: #282a35; border-radius: 10px; padding: 1px 7px; font-weight: 700; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); font-size: .85rem; }
.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.05rem; font-weight: 600; color: var(--text-strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title .crumb { color: var(--muted); font-weight: 400; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: none; color: var(--text); cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { background: var(--surface-3); }
.menu-toggle { display: none; }
.bell-count {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}
.account-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 24px; }
.account-btn:hover { background: var(--surface-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.account-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: none; overflow: hidden;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dropdown-head strong { display: block; color: var(--text-strong); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-3); text-decoration: none; color: var(--text-strong); }
.dropdown-item i { width: 18px; color: var(--muted); }
.dropdown-sep { height: 1px; background: var(--border); }

.notif-menu { width: 360px; max-width: calc(100vw - 24px); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: default; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: rgba(4, 170, 109, .06); }
.notif.link { cursor: pointer; }
.notif.link:hover { background: var(--surface-3); }
.notif-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .85rem; }
.notif-icon.info { background: var(--info-soft); color: var(--info); }
.notif-icon.success { background: var(--accent-soft); color: var(--accent); }
.notif-icon.warning { background: var(--warning-soft); color: var(--warning); }
.notif-icon.error { background: var(--danger-soft); color: var(--danger); }
.notif-body { min-width: 0; flex: 1; }
.notif-title { color: var(--text-strong); font-weight: 600; font-size: .93rem; }
.notif-msg { color: var(--muted); font-size: .86rem; }
.notif-time { color: var(--muted); font-size: .75rem; margin-top: 2px; }
.notif-x { background: none; border: 0; color: var(--muted); cursor: pointer; align-self: flex-start; padding: 2px; }
.notif-x:hover { color: var(--text-strong); }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
  background: var(--surface-3); color: var(--text-strong); transition: background .12s, border-color .12s;
}
.btn:hover { background: #45525c; text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d7372b; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-icon.danger:hover { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------------- cards */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-apps { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-head h2 i, .card-head h3 i { color: var(--accent); }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: var(--accent); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 32px 0 14px; }
.section-title h2 { margin: 0; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-strong); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stats-row { display: flex; gap: 28px; flex-wrap: wrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i.big { font-size: 2.6rem; color: var(--surface-3); margin-bottom: 14px; display: block; }
.empty h3 { color: var(--text-strong); }

/* News */
.news-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: 0; padding-bottom: 0; }
.news-date { font-size: .8rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.news-title { color: var(--text-strong); font-weight: 700; font-size: 1.05rem; margin: 2px 0 6px; }
.news-body { color: var(--muted); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-body p { margin: 0 0 .4rem; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 16px; background: var(--surface-3); color: var(--text); font-size: .85rem; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.active { background: var(--accent); color: #fff; }
.chip .count { color: var(--muted); }
.chip.active .count { color: #e6fff4; }

/* ----------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--accent-soft); color: var(--accent); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge.pulse::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ------------------------------------------------------------ usage bars */
.usage { margin-bottom: 14px; }
.usage:last-child { margin-bottom: 0; }
.usage-top { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 5px; gap: 8px; }
.usage-top strong { color: var(--text-strong); }
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.bar.warn > span { background: var(--warning); }
.bar.crit > span { background: var(--danger); }
.bar.unlimited > span { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 6px, var(--accent-hover) 6px, var(--accent-hover) 12px); }

/* --------------------------------------------------------------- app store */
.store-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }
.app-card { display: flex; flex-direction: column; gap: 12px; transition: border-color .12s, transform .12s; }
.app-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.app-top { display: flex; gap: 14px; align-items: center; }
.app-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--surface-3); padding: 7px; object-fit: contain; flex: none; }
.app-icon.sm { width: 40px; height: 40px; border-radius: 10px; padding: 5px; }
.app-icon.fallback { display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--accent); font-size: 1.2rem; padding: 0; }
.app-name { font-weight: 700; color: var(--text-strong); font-size: 1.08rem; }
.app-cat { font-size: .8rem; color: var(--muted); }
.app-desc { color: var(--muted); font-size: .92rem; flex: 1; margin: 0; }
.app-specs { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.app-specs i { color: var(--accent); margin-right: 4px; }

/* ---------------------------------------------------------------- PaaSbox */
.box-card .box-name { font-size: 1.2rem; font-weight: 700; color: var(--text-strong); }
.box-domain { font-family: var(--mono); font-size: .85rem; color: var(--muted); word-break: break-all; }
.box-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 16px 0; font-size: .88rem; }
.box-meta dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }
.box-meta dd { margin: 0; color: var(--text-strong); font-weight: 600; }
.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 16px; align-items: flex-start; }
.notice i { margin-top: 3px; }
.notice-warning { background: var(--warning-soft); color: #ffd08a; }
.notice-info { background: var(--info-soft); color: #9fd0fb; }
.notice-danger { background: var(--danger-soft); color: #ffaba4; }
.notice-success { background: var(--accent-soft); color: #8ce0bd; }

.instance-card { display: flex; flex-direction: column; gap: 14px; }
.instance-head { display: flex; gap: 12px; align-items: center; }
.instance-head .grow { flex: 1; min-width: 0; }
.instance-name { font-weight: 700; color: var(--text-strong); font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instance-url { font-size: .85rem; word-break: break-all; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.metric-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: flex; justify-content: space-between; }
.metric-value { font-weight: 700; color: var(--text-strong); font-size: 1.05rem; margin: 2px 0 6px; }
.metric .bar { height: 5px; }
.ports { font-size: .85rem; }
.ports table { width: 100%; border-collapse: collapse; }
.ports td { padding: 4px 0; border-bottom: 1px dashed var(--border); vertical-align: top; }
.ports tr:last-child td { border-bottom: 0; }
.ports td:last-child { text-align: right; font-family: var(--mono); color: var(--text-strong); font-size: .82rem; }
.instance-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.instance-actions .spacer { flex: 1; }
.instance-error { font-size: .85rem; color: #ffaba4; background: var(--danger-soft); border-radius: var(--radius-sm); padding: 8px 10px; word-break: break-word; }

/* ------------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: .88rem; font-weight: 600; color: var(--text-strong); }
.field .hint, .hint { font-size: .82rem; color: var(--muted); }
.field .error-text { font-size: .82rem; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text-strong);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: .95rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, input[readonly], select:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
input.invalid { border-color: var(--danger); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 38px; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix .suffix { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted); font-family: var(--mono); font-size: .88rem; white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }

/* Sliders */
.slider { display: flex; flex-direction: column; gap: 8px; }
.slider-top { display: flex; justify-content: space-between; align-items: center; }
.slider-value { font-family: var(--mono); color: var(--text-strong); font-weight: 500; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.slider input[type=range]:disabled { opacity: .7; cursor: not-allowed; }
.lock-note { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* Plan picker */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; cursor: pointer;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .12s;
}
.plan:hover { border-color: #5b6b78; }
.plan.selected { border-color: var(--accent); background: linear-gradient(180deg, rgba(4,170,109,.10), transparent 60%), var(--surface); }
.plan.disabled { opacity: .5; cursor: not-allowed; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan-name { font-size: 1.15rem; font-weight: 700; color: var(--text-strong); letter-spacing: 1px; }
.plan-price { font-size: 1.7rem; font-weight: 700; color: var(--text-strong); }
.plan-price small { font-size: .85rem; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.plan li { padding: 3px 0; }
.plan li i { color: var(--accent); width: 20px; }
.plan-check { position: absolute; top: 14px; right: 14px; color: var(--accent); font-size: 1.2rem; display: none; }
.plan.selected .plan-check { display: block; }
.steps { display: flex; flex-direction: column; gap: 24px; max-width: 1100px; }
.step-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.name-status { font-size: .88rem; display: flex; align-items: center; gap: 6px; min-height: 22px; }
.name-status.ok { color: var(--accent); }
.name-status.bad { color: var(--danger); }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95rem; }
.summary-line.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; font-weight: 700; color: var(--text-strong); font-size: 1.1rem; }

/* ------------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 15, 20, .72); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
  animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: max-width .25s ease; animation: rise .18s ease;
}
.modal.wide { max-width: 980px; }
.modal.xl { max-width: 1180px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.2rem; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Deploy wizard */
.wizard-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; overflow-x: auto; }
.wizard-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.wizard-tab:hover { color: var(--text-strong); }
.wizard-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-tab .tab-count { background: var(--surface-3); border-radius: 10px; padding: 0 7px; font-size: .75rem; margin-left: 4px; color: var(--text); }
.wizard-tab .tab-warn { color: var(--danger); margin-left: 4px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.kv-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.kv-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); font-weight: 600; }
.kv-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.kv-table tr:last-child td { border-bottom: 0; }
.kv-table input, .kv-table select { padding: 7px 10px; font-size: .9rem; }
.kv-key { font-family: var(--mono); font-size: .85rem; color: var(--text-strong); word-break: break-all; }
.kv-key .req { color: var(--danger); }
.kv-label { font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; font-size: .68rem; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; vertical-align: middle; margin-left: 4px; font-family: var(--font); }
.tag-nas { background: var(--info-soft); color: var(--info); }
.tag-local { background: var(--warning-soft); color: var(--warning); }
.tag-auto { background: var(--accent-soft); color: var(--accent); }
.secret-wrap { display: flex; gap: 6px; }
.secret-wrap input { flex: 1; }
.host-path { font-family: var(--mono); font-size: .78rem; color: var(--muted); word-break: break-all; margin-top: 3px; }
.box-select-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.notes { white-space: pre-line; }

/* Log viewer */
.log-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.log-toolbar .grow { flex: 1; }
.log-toolbar label { display: flex; gap: 6px; align-items: center; font-size: .88rem; color: var(--muted); }
.log-toolbar select, .log-toolbar input[type=search] { width: auto; padding: 6px 10px; font-size: .88rem; }
.log-output {
  background: #10161c; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 12.5px/1.55 var(--mono); color: #cfd8dc; padding: 12px 14px; height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0;
}
.log-output .ts { color: #607d8b; }
.log-output .err { color: #ff8a80; }
.log-output .warn { color: #ffd180; }
.log-output mark { background: var(--yellow); color: #282a35; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info); box-shadow: var(--shadow); animation: rise .18s ease; font-size: .93rem; }
.toast.success { border-left-color: var(--accent); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast i { margin-top: 3px; }
.toast.success i { color: var(--accent); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 0; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: .93rem; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: #ffaba4; }

/* -------------------------------------------------------------------- auth */
.auth-page { display: flex; min-height: 100vh; background: radial-gradient(circle at 20% 10%, rgba(4,170,109,.12), transparent 40%), var(--bg); }
.auth-wrap { margin: auto; width: 100%; max-width: 420px; padding: 24px 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand-name { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); line-height: 1; }
.auth-brand-sub { color: var(--muted); font-size: .85rem; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: .9rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 18px; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .layout.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .layout.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .menu-toggle { display: inline-grid; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 20px 16px 40px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .account-name { display: none; }
  .box-select-row, .spec-grid { grid-template-columns: 1fr; }
  .kv-table thead { display: none; }
  .kv-table tr { display: grid; grid-template-columns: 1fr; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .kv-table td { border: 0; padding: 3px 0; }
}
