/* ──────────────────────────────────────────────────────────
   DOLIER Studio — premium dark theme (Linear/Vercel-inspired)
   ────────────────────────────────────────────────────────── */

:root {
  --bg: #07080a;
  --bg-2: #0c0d10;
  --panel: #101216;
  --panel-2: #14161b;
  --border: #1d2027;
  --border-strong: #262a32;
  --text: #ededee;
  --text-2: #c9ccd1;
  --muted: #7a818d;
  --muted-2: #5a606a;
  --accent: #5e6ad2;
  --accent-hover: #6d78db;
  --accent-soft: rgba(94, 106, 210, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.13);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --amber: #fbbf24;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --radius: 10px;
  --radius-sm: 6px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--text); }

::selection { background: var(--accent-soft); color: #fff; }

/* ── Brand ─────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #5e6ad2 0%, #8a93ff 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 6px 16px -4px rgba(94, 106, 210, 0.55);
}
.brand-name { color: var(--text); font-size: 14px; letter-spacing: 0.04em; }
.brand-sub  { color: var(--muted); font-size: 14px; font-weight: 500; margin-left: 2px; }
.brand-center { justify-content: center; margin-bottom: 28px; }

/* ── Auth pages ────────────────────────────────────────── */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(94, 106, 210, 0.08), transparent 70%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: var(--shadow-card), 0 20px 60px -30px rgba(0, 0, 0, 0.7);
}
.auth-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.auth-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}
.auth-foot {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.auth-foot a { color: var(--text); }
.auth-foot a:hover { color: var(--accent-hover); }

.auth-card .form > button[type="submit"] { margin-top: 10px; }

/* ── App layout ────────────────────────────────────────── */
body.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-top { display: flex; flex-direction: column; gap: 22px; }
.sidebar-top .brand { padding: 4px 8px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text-2); }
.nav-item.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border) inset;
}
.nav-icon { display: inline-flex; opacity: .85; }

.sidebar-foot { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(94,106,210,0.14), rgba(94,106,210,0.06));
  border: 1px solid rgba(94,106,210,0.28);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  text-decoration: none;
  font-family: inherit;
}
.admin-btn:hover { background: linear-gradient(180deg, rgba(94,106,210,0.22), rgba(94,106,210,0.10)); border-color: rgba(94,106,210,0.45); }
.admin-btn:active { transform: translateY(1px); }
.admin-btn .ico {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
}
.admin-btn .lbl { flex: 1; }
.admin-btn .badge { font-size: 10px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5e6ad2, #8a93ff);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-email {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  color: var(--muted-2);
  font-size: 11px;
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* ── Main ──────────────────────────────────────────────── */
.main {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}
.topbar-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.content {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1100px;
  width: 100%;
}

/* ── KPIs ──────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-card);
}
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.kpi-value { color: var(--text); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.card-sub   { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body  { padding: 16px 18px; }

/* ── Status badge ──────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
}
.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.status-on  { color: var(--green); background: var(--green-soft); border-color: rgba(74,222,128,0.25); }
.status-on .dot { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.status-off { color: var(--muted); background: var(--bg-2); }
.status-off .dot { background: var(--muted); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 6px 14px -6px rgba(94, 106, 210, 0.7);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost {
  background: var(--panel-2);
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--text); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger:hover:not(:disabled) { background: var(--red-soft); }
.btn-block { width: 100%; justify-content: center; padding: 9px 14px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.action-feedback {
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}
.action-feedback.ok  { color: var(--green); }
.action-feedback.err { color: var(--red); }

/* ── Forms ─────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.field input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: var(--muted-2); }

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.alert-err { background: var(--red-soft); border-color: rgba(248,113,113,0.3); color: #fca5a5; }
.alert-ok  { background: var(--green-soft); border-color: rgba(74,222,128,0.3); color: #86efac; }

/* ── Logs ──────────────────────────────────────────────── */
.logs {
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-2);
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Tables ────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.table tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--panel-2); }
.row-actions { text-align: right; width: 0; white-space: nowrap; }

/* ── Misc ──────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px 12px;
}
.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.kv:last-child { border-bottom: none; }
.kv-key { color: var(--muted); font-size: 12.5px; }
.kv-val { color: var(--text); font-size: 13px; font-weight: 500; }

/* ── User block + dropdown ─────────────────────────────── */
.user-block {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font: inherit;
  color: inherit;
  text-align: left;
}
.user-block:hover { background: var(--panel-2); border-color: var(--border-strong); }
.user-block .chev {
  margin-left: auto;
  color: var(--muted);
  display: inline-flex;
}
.user-name {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu {
  position: absolute;
  bottom: 64px;
  left: 14px;
  right: 14px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 10px 32px -8px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255,255,255,0.04) inset;
  display: none;
  z-index: 50;
}
.user-menu.open { display: block; animation: pop .12s ease-out; }
.user-menu-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-menu-head .name { color: var(--text); font-size: 13px; font-weight: 600; }
.user-menu-head .email { color: var(--muted); font-size: 12px; margin-top: 2px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font: inherit;
}
.menu-item:hover { background: var(--bg-2); color: var(--text); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: var(--red-soft); color: var(--red); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal (native <dialog>) ───────────────────────────── */
dialog.modal {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: hidden;
}
dialog.modal::backdrop {
  background: rgba(5, 6, 8, 0.65);
  backdrop-filter: blur(4px);
}
dialog.modal[open] { animation: modal-in .15s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.modal-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Action grid (Quick actions) ───────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.action-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: background .15s, border-color .15s, transform .1s;
}
.action-tile:hover { background: var(--panel-2); border-color: var(--border-strong); }
.action-tile:active { transform: translateY(1px); }
.action-tile .icn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.action-tile .lbl { font-size: 13.5px; font-weight: 500; }
.action-tile .sub { font-size: 12px; color: var(--muted); }
.action-tile .col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* ── Detail rows (used in cards) ───────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.detail-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.detail-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
}

/* ── Status variants ───────────────────────────────────── */
.status-warn  { color: var(--amber); background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.3); }
.status-warn .dot { background: var(--amber); }
.status-info  { color: var(--accent); background: var(--accent-soft); border-color: rgba(94,106,210,0.3); }
.status-info .dot { background: var(--accent); }
.status-err   { color: var(--red); background: var(--red-soft); border-color: rgba(248,113,113,0.3); }
.status-err   .dot { background: var(--red); box-shadow: 0 0 8px rgba(248,113,113,0.45); }

.cascade-list {
  margin: 8px 0 0;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cascade-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.cascade-list li::before {
  content: "·";
  color: var(--muted);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}

/* ── Section heading inside content ────────────────────── */
.section-title {
  margin: 4px 0 -6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Monitoring : live mini metrics ────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.metric-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.metric-value .v { color: var(--text); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.metric-value .u { color: var(--muted); font-size: 12px; font-weight: 500; }
.metric-extra { color: var(--muted); font-size: 11.5px; }
.metric-bar {
  position: relative;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
}
.metric-bar > span {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px;
  transition: width .4s ease-out;
}
.metric-bar > span.warn { background: linear-gradient(90deg, var(--amber), #f59e0b); }
.metric-bar > span.crit { background: linear-gradient(90deg, var(--red), #dc2626); }

/* ── Period tabs ───────────────────────────────────────── */
.period-tabs {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.period-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.period-tab:hover { color: var(--text-2); }
.period-tab.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.4); }

/* ── Charts (SVG) ─────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.chart-title { color: var(--text); font-size: 13px; font-weight: 600; }
.chart-current { color: var(--muted); font-size: 12px; }
.chart-current .v { color: var(--text); font-weight: 500; }
.chart-svg {
  width: 100%;
  height: 140px;
  display: block;
}
.chart-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 40px 0;
}

/* ── Status: dual pair (production / DEV) ──────────────── */
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.status-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-pair-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── Env grid : DEV / Prod side-by-side ────────────────── */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.env-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.env-card .env-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.env-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.env-tag.dev  { background: var(--accent-soft); color: var(--accent); }
.env-tag.prod { background: rgba(74, 222, 128, 0.12); color: var(--green); }

.env-meta {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}
.env-meta .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.env-meta .row .k { color: var(--muted); }
.env-meta .row .v { color: var(--text); font-weight: 500; }
.env-meta .mono  { font-family: var(--mono); font-size: 12px; }

.env-actions {
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.env-logs {
  padding: 0 18px 18px;
}

/* ── Console Claude ────────────────────────────────────── */
.claude-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.claude-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.claude-head .title { font-size: 14px; font-weight: 600; }
.claude-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 900px) {
  .chat { grid-template-columns: 1fr 1fr; }
}

.chat-list {
  border-right: 1px solid var(--border);
  max-height: 420px;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 50px 12px;
}
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user {
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid rgba(94,106,210,0.3);
  align-self: flex-end;
  max-width: 88%;
}
.chat-msg.system {
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  align-self: flex-start;
  max-width: 88%;
}
.chat-msg .meta {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-pane {
  background: #050608;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  padding: 14px 16px;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.chat-pane-empty {
  color: var(--muted-2);
  font-style: italic;
}

.chat-input {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-2);
}
.chat-input textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 160px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Terminal section */
.term-output {
  background: #050608;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 14px 16px;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 0;
  margin: 0;
}
.term-output .prompt { color: var(--accent); }
.term-output .err { color: var(--red); }
.term-empty { color: var(--muted-2); font-style: italic; }
.term-input {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.term-input .prefix {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  user-select: none;
}
.term-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-family: var(--mono);
  font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s;
}
.term-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Project list : clickable name */
.card-title-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s, color .15s;
}
.card-title-link:hover { color: var(--text); border-bottom-color: var(--accent); }

/* ── Clickable VPS list card ───────────────────────────── */
.card.vps-card {
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.card.vps-card:hover {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
}
.card.vps-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
/* Buttons inside the card stay normal (not inheriting pointer cursor twice) */
.card.vps-card button,
.card.vps-card a,
.card.vps-card input,
.card.vps-card select,
.card.vps-card .card-actions { cursor: auto; }
.card.vps-card button:not(:disabled),
.card.vps-card a { cursor: pointer; }

/* ── VPS detail modal (large) + integrated console ─────── */
dialog.modal.modal-large {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}
/* Only apply flex layout when the dialog is actually open — otherwise we
   override the browser's default `display:none` and the modal stays visible. */
dialog.modal.modal-large[open] {
  display: flex;
  flex-direction: column;
}
dialog.modal.modal-large[open] .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
}
.modal-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.card-title-link.as-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.vps-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
}

.console-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #050608;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.console-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.console-title { font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.console-sub { flex: 1; color: var(--muted-2); font-size: 11px; }
.console-output {
  height: 240px;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  background: #050608;
}
.console-line {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.console-line + .console-line { margin-top: 2px; }
.console-line.cmd { color: #d6dcea; }
.console-line.stdout { color: #d8e2f0; }
.console-line.stderr { color: #f1c0c0; }
.console-line.err { color: #f87171; }
.console-line.blocked { color: #fbbf24; }
.console-line.exitcode { color: var(--muted); font-size: 11px; }
.console-line.muted { color: var(--muted); }
.console-line.loading { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.console-prompt { color: #6ee7b7; user-select: none; margin-right: 4px; }
.console-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid rgba(110, 231, 183, 0.25);
  border-top-color: #6ee7b7;
  border-radius: 50%;
  animation: scan-spin .7s linear infinite;
}
.console-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.console-input {
  flex: 1;
  background: #050608;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  outline: none;
}
.console-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.console-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── VPS scan (Ajouter un projet) ──────────────────────── */
.scan-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.scan-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 16px;
}
.scan-status.ok { color: #6ee7b7; }
.scan-status.err { color: #f87171; }
.scan-status.muted { color: var(--muted); }
.scan-status.loading {
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-status.loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: scan-spin .7s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }
.scan-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.scan-card {
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-2);
  transition: border-color .15s, background .15s;
  display: block;
  font: inherit;
  width: 100%;
}
.scan-card:hover { border-color: var(--border-strong); background: var(--bg); }
.scan-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.scan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.scan-card-name { font-weight: 600; color: var(--text); font-size: 13px; }
.scan-card-path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.scan-card-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.scan-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scan-badge.ok { color: #6ee7b7; border-color: rgba(110, 231, 183, 0.3); }
.scan-badge.docker { color: #93c5fd; border-color: rgba(147, 197, 253, 0.3); }
.scan-badge.git { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.scan-badge.muted { color: var(--muted-2); }
.scan-card-types { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 760px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar-top { flex-direction: row; align-items: center; gap: 14px; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { padding: 6px 10px; font-size: 13px; }
  .sidebar-foot { margin-left: auto; }
  .user-meta { display: none; }
  .topbar { padding: 14px 18px; }
  .content { padding: 18px; }
}
