:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: #263244;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12.5px; }
code { background: rgba(148,163,184,.14); padding: 2px 6px; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Auth Gate */
.auth-gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at top, #1e293b, #0b1120); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 24px 50px rgba(0,0,0,.45); }
.brand-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 4px 10px; border-radius: 99px; background: rgba(249,115,22,.16); color: #fb923c; margin-bottom: 12px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-foot { margin-top: 16px; text-align: center; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 10px; border: 1px solid var(--border); margin: 12px 0 4px; }
.role-tab { border: none; border-radius: 7px; padding: 8px 10px; font-weight: 700; font-size: 12px; cursor: pointer; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.role-tab.active { background: var(--accent); color: #fff; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.6); }
.link { color: var(--blue); text-decoration: none; font-weight: 600; font-size: 12.5px; }
.link:hover { text-decoration: underline; }

/* Form & Buttons */
.field-lbl { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
.input { width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; outline: none; }
.input:focus { border-color: var(--accent); }
.sm-select { width: auto; min-width: 240px; padding: 6px 10px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font-weight: 700; font-size: 12.5px; cursor: pointer; text-decoration: none; background: var(--surface-2); color: var(--text); transition: .15s; }
.btn:hover { border-color: #475569; }
.btn.primary { background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.outline { background: transparent; border-color: var(--border); }
.btn.outline:hover { border-color: var(--accent); color: #fdba74; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.35); color: #fca5a5; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.full { width: 100%; justify-content: center; margin-top: 14px; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 9px; cursor: pointer; }
.err-box { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.4); color: #fca5a5; font-size: 12.5px; }
.success-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.4); color: #86efac; }

/* Shell */
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 14px; position: sticky; top: 0; z-index: 30; }
.topbar-left { display: flex; align-items: center; gap: 11px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #f97316, #c2410c); display: flex; align-items: center; justify-content: center; font-size: 16px; color: #fff; }
.topbar-title { font-weight: 800; font-size: 15px; line-height: 1.15; }
.topbar-sub { font-size: 11px; color: var(--muted); }
.topbar-vitals { display: flex; gap: 8px; flex-wrap: wrap; }
.vital-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: #cbd5e1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.admin-chip, .client-chip { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: rgba(56,189,248,.12); color: var(--blue); }

.workspace { display: flex; min-height: calc(100vh - 58px); }
.sidebar { width: 246px; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; flex-shrink: 0; }
.nav-lbl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0 8px 8px; }
.nav-item { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; background: transparent; border: none; color: #cbd5e1; padding: 10px 11px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; margin-bottom: 3px; }
.nav-item:hover { background: var(--surface-2); color: #fff; }
.nav-item.active { background: rgba(249,115,22,.16); color: #fb923c; font-weight: 700; }
.nav-item .fa-grid-2 { display: none; }
.sidebar-projects { display: flex; flex-direction: column; gap: 3px; }
.side-proj-btn { width: 100%; text-align: left; background: transparent; border: 1px solid transparent; color: var(--muted); padding: 7px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-proj-btn:hover { background: var(--surface-2); color: var(--text); }

.main { flex: 1; padding: 20px 24px; min-width: 0; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h2 { margin: 0 0 3px; font-size: 19px; }

/* Cards & Grids */
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.vital-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.vital-card .lbl { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.vital-card .val { font-size: 20px; font-weight: 800; margin-top: 4px; }
.bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: linear-gradient(90deg, #38bdf8, #f97316); border-radius: 99px; }

.projects-grid, .docker-grid, .domains-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card:hover { border-color: #3b4b63; }
.card-title { font-weight: 800; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: #cbd5e1; }
.pill.ok { background: rgba(34,197,94,.16); color: #4ade80; }
.pill.bad { background: rgba(239,68,68,.16); color: #f87171; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }

/* File Manager */
.fm-select-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fm-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; font-size: 12.5px; }
.crumb { background: transparent; border: none; color: var(--blue); font-weight: 700; cursor: pointer; padding: 2px 5px; border-radius: 5px; }
.crumb:hover { background: var(--surface-2); }
.dropzone { border: 1.5px dashed #334155; border-radius: 11px; padding: 12px 16px; text-align: center; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; transition: .15s; }
.dropzone.dragover { border-color: var(--accent); background: rgba(249,115,22,.1); color: #fdba74; }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.fm-table { width: 100%; border-collapse: collapse; }
.fm-table th, .fm-table td { padding: 10px 13px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.fm-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: rgba(15,23,42,.5); }
.fm-table tr:hover td { background: rgba(30,41,59,.45); }
.fm-name-btn { background: transparent; border: none; color: var(--text); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 0; }
.fm-name-btn:hover { color: #fb923c; }

/* Deploy Card */
.deploy-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; max-width: 780px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.hint { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(2,6,23,.78); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 18px; }
.modal-card { width: 100%; max-width: 960px; height: 84vh; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,.6); }
.modal-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.code-editor { flex: 1; width: 100%; border: none; resize: none; background: #070b14; color: #e2e8f0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; padding: 16px; outline: none; }
.logs-terminal { flex: 1; margin: 0; background: #050811; color: #a7f3d0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; padding: 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #1e293b; border: 1px solid var(--accent); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; z-index: 80; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.mobile-only { display: none; }

@media (max-width: 860px) {
  .topbar-vitals { display: none; }
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; top: 58px; bottom: 0; left: 0; z-index: 40; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .form-row { grid-template-columns: 1fr; }
}
