/* QuickKitchen Admin — single-page cockpit */
:root {
  --bg: #0b0c0e;
  --bg-2: #15171b;
  --bg-3: #1e2127;
  --line: #2b2f38;
  --line-2: #1f2229;
  --text: #f0f2f4;
  --text-2: #99a0ab;
  --text-3: #5e6470;
  --accent: #f5a623;
  --accent-d: #e0951a;
  --green: #10b981;
  --red: #e53e3e;
  --blue: #3b82f6;
  --purple: #a855f7;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* ---------- login ---------- */
.login-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(245,166,35,.08), transparent 50%), var(--bg);
  padding: 24px;
}
.login-box {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 36px 32px; width: 380px; max-width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.login-logo { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.login-logo .admin-tag {
  background: var(--accent); color: #000; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 5px; margin-left: 8px; vertical-align: middle;
}
.login-sub { color: var(--text-2); font-size: 14px; margin: 8px 0 24px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 600; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.login-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 10px; }

.btn {
  padding: 10px 18px; border-radius: 9px; font-weight: 700; font-size: 13px;
  transition: background .12s, color .12s, border-color .12s;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-d); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }
.btn-block { width: 100%; padding: 13px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c53b3b; }

/* ---------- app shell ---------- */
.app-view { min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  background: var(--accent); color: #000;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.brand-title { font-weight: 800; letter-spacing: 1px; font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--text-2); font-size: 12px; }

.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.metric {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.metric-label { color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.metric-value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.metric-sub { color: var(--text-3); font-size: 11px; margin-top: 4px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h1 { font-size: 22px; font-weight: 800; }
.panel-head-actions input {
  width: 280px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--text); font-size: 13px; outline: none;
}
.panel-head-actions input:focus { border-color: var(--accent); }

.loading { text-align: center; padding: 60px 20px; color: var(--text-3); }

/* tenants table */
.t-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.t-table th {
  text-align: left; font-size: 11px; color: var(--text-3); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--bg-3);
}
.t-table td {
  padding: 14px; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.t-row { cursor: pointer; transition: background .12s; }
.t-row:hover { background: var(--bg-3); }
.t-row:last-child td { border-bottom: none; }
.t-name { font-weight: 700; }
.t-slug { color: var(--text-3); font-size: 11px; font-family: monospace; margin-top: 2px; }
.t-num { font-weight: 600; }
.status-badge {
  display: inline-block; padding: 3px 9px; border-radius: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
}
.status-trial   { background: rgba(168,85,247,.15); color: var(--purple); }
.status-active  { background: rgba(16,185,129,.15);  color: var(--green); }
.status-suspended { background: rgba(229,62,62,.15); color: var(--red); }
.status-cancelled { background: var(--bg-3); color: var(--text-3); }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 90; padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }
.modal-box {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  width: 720px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.d-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.d-head h2 { font-size: 18px; font-weight: 800; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--text-2);
}
.icon-btn:hover { color: var(--text); }
.d-body { padding: 20px 22px; }
.d-section { margin-bottom: 20px; }
.d-section h3 { font-size: 12px; color: var(--text-3); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.d-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.d-row span:first-child { color: var(--text-2); }
.d-row span:last-child { font-weight: 600; }
.d-actions { display: flex; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--line); justify-content: flex-end; }
.member-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.member-row:last-child { border-bottom: none; }
.role-tag {
  background: var(--bg-3); color: var(--text-2); padding: 2px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a1a1d; color: #fff; padding: 12px 20px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  font-size: 13px; font-weight: 600; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
