:root {
  --bg: #0d0d10;
  --surface: #17171c;
  --surface-2: #1f1f26;
  --border: rgba(255, 255, 255, 0.08);
  --fg: #f6f3ec;
  --muted: #9aa0a6;
  --accent: #e63946;
  --accent-dim: rgba(230, 57, 70, 0.2);
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ───────────── auth ───────────── */
.auth-wrap {
  display: grid; place-items: center; min-height: 100vh;
  padding: 24px; gap: 20px;
}
.auth-card {
  background: var(--surface); padding: 36px 32px; border-radius: 16px;
  width: 100%; max-width: 420px; border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.auth-brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.logo-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.2);
}
.auth-card form { display: grid; gap: 14px; margin-top: 22px; }
.auth-card label { font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-card input {
  padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-size: 15px; font-family: inherit;
}
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-card button {
  padding: 12px 16px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: white; font-weight: 600; font-size: 15px;
  font-family: inherit; transition: transform 0.1s, opacity 0.2s;
}
.auth-card button:hover:not(:disabled) { transform: translateY(-1px); }
.auth-card button:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-footer { font-size: 13px; color: var(--muted); }
.check-inbox { text-align: center; padding: 12px 0 4px; }
.check-inbox-icon {
  font-size: 40px; margin: 0 auto 14px; width: 70px; height: 70px;
  background: var(--accent-dim); color: var(--accent); border-radius: 50%;
  display: grid; place-items: center;
}
.check-inbox h3 { margin: 4px 0 6px; }

.flash {
  padding: 10px 14px; border-radius: 8px; font-size: 14px;
  background: var(--accent-dim); color: var(--fg); margin-top: 16px;
}
.flash.error { background: rgba(230, 57, 70, 0.25); }

/* ───────────── shell ───────────── */
.shell {
  display: grid; grid-template-columns: 260px 1fr; min-height: 100vh;
}
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 20px; display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 17px; margin-bottom: 28px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 10px 12px; border-radius: 8px; color: var(--fg);
  font-weight: 500; font-size: 14px;
}
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-user {
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px;
  font-size: 13px; color: var(--muted);
}
.user-email { color: var(--fg); font-weight: 600; margin-bottom: 2px; }
.user-role { margin-bottom: 10px; }
button.link, a.link {
  background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; font: inherit; text-decoration: underline;
}

.content { padding: 32px 40px; max-width: 1200px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.page-header h2 { margin: 0; font-size: 24px; font-weight: 700; }
.page-header button {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); font: inherit; cursor: pointer;
}
.page-header button:not(:disabled):hover { background: var(--surface-2); }
.page-header button:disabled { opacity: 0.5; cursor: not-allowed; }
.muted { color: var(--muted); font-size: 14px; }
.empty {
  margin-top: 24px; padding: 36px; border-radius: var(--radius);
  background: var(--surface); border: 1px dashed var(--border);
  color: var(--muted); text-align: center;
}
.kv {
  display: grid; grid-template-columns: 160px 1fr; gap: 10px 24px;
  margin-top: 20px; padding: 20px; background: var(--surface);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.kv dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; font-size: 14px; }
.swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  vertical-align: middle; margin-right: 6px;
  border: 1px solid var(--border);
}

/* ───────────── displays ───────────── */
.display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.display-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 10px;
}
.display-card.disabled { opacity: 0.55; }
.display-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.display-card-head h3 { margin: 0 0 3px; font-size: 16px; }
.display-domain { font-size: 13px; }
.badge {
  padding: 2px 8px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.display-card-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.display-card-meta .sep { color: var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: #30c770; box-shadow: 0 0 0 3px rgba(48, 199, 112, 0.2); }
.dot.amber { background: #ffc107; box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2); }
.dot.red { background: #e63946; box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.2); }
.dot.grey { background: var(--muted); }

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.status-active { background: rgba(48, 199, 112, 0.15); color: #30c770; }
.status-pill.status-provisioning { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.status-pill.status-pending { background: rgba(154, 160, 166, 0.15); color: var(--muted); }
.status-pill.status-error { background: rgba(230, 57, 70, 0.2); color: var(--accent); }
.display-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.display-card-actions button {
  padding: 6px 12px; font-size: 13px; border-radius: 6px; border: 0; cursor: pointer;
  background: var(--accent); color: white; font-family: inherit;
}
.display-card-actions button.btn-secondary,
.page-header .btn-secondary {
  background: transparent; color: var(--fg); border: 1px solid var(--border);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}
.editor-form { display: grid; gap: 14px; }
.editor-form label {
  display: grid; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.editor-form input[type="text"],
.editor-form input[type="email"],
.editor-form select,
.editor-form textarea {
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 14px;
}
.editor-form input:disabled { opacity: 0.6; cursor: not-allowed; }
.editor-form label:has(input[type="checkbox"]) {
  grid-template-columns: auto 1fr; align-items: center;
}
.editor-preview { display: grid; gap: 10px; align-content: start; }
.preview-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.hint {
  padding: 10px 12px; background: var(--surface-2);
  border-radius: 6px; font-size: 12px; color: var(--muted);
  line-height: 1.6;
}
.hint code { color: var(--fg); background: var(--bg); padding: 1px 5px; border-radius: 3px; }

@media (max-width: 1000px) { .editor-grid { grid-template-columns: 1fr; } }

/* ───────────── assets / images ───────────── */
.btn-upload {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--accent); color: white; font-weight: 600; cursor: pointer;
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
}
.asset-dropzone {
  border: 2px dashed transparent;
  border-radius: var(--radius);
  padding: 8px;
  min-height: 200px;
  transition: border-color 150ms;
}
.asset-dropzone.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.asset-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-rows: 160px auto;
}
.asset-thumb {
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
}
.asset-card figcaption { padding: 10px 12px; }
.asset-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-meta {
  font-size: 12px; color: var(--muted);
  display: flex; gap: 6px; align-items: center; margin-top: 4px;
}

/* ───────────── tenants ───────────── */
.tenant-select {
  background: var(--surface); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; font-family: inherit; font-size: 14px;
}
.tenant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.tenant-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.tenant-card .tenant-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.tenant-card h3 { margin: 0; font-size: 17px; }
.kv.small { gap: 4px 18px; font-size: 12px; padding: 12px; }
.kv.small dt, .kv.small dd { font-size: 12px; }
.kv code { background: var(--bg); padding: 1px 5px; border-radius: 3px; }

/* ───────────── users ───────────── */
.user-list {
  display: grid; gap: 8px;
  margin-top: 10px;
  max-width: 560px;
}
.user-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.user-row .user-email { font-weight: 600; font-size: 14px; }
.user-row .user-meta { font-size: 12px; margin-top: 2px; }
.user-row .user-meta span + span { margin-left: 4px; }
.user-row .user-actions { display: flex; gap: 10px; }

/* ───────────── brand form ───────────── */
.brand-form {
  display: grid; gap: 14px;
  max-width: 520px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.brand-form label {
  display: grid;
  grid-template-columns: 140px auto 1fr;
  gap: 10px;
  align-items: center;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.brand-form input[type="color"] {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 6px;
  padding: 0; background: transparent; cursor: pointer;
}
.brand-form input[type="text"],
.brand-form input[type="number"] {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 14px;
}
.brand-preview {
  display: flex; gap: 14px; margin-top: 6px; padding: 12px;
  background: var(--surface-2); border-radius: 8px;
}
.brand-swatch {
  width: 80px; height: 80px; border-radius: 8px;
  border: 1px solid var(--border);
}
.brand-form button {
  padding: 10px 18px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: white; font-weight: 600; font-size: 14px;
}

/* ───────────── modal ───────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  padding: 22px;
}
.modal header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal header h3 { margin: 0; }
.modal header .link { font-size: 24px; line-height: 1; }
.modal form { display: grid; gap: 12px; }
.modal form label {
  display: grid; gap: 5px;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.modal form input[type="text"],
.modal form input[type="email"],
.modal form input[type="password"],
.modal form input[type="number"],
.modal form select,
.modal form textarea {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 14px;
}
.modal form button {
  padding: 10px 16px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--accent); color: white; font-weight: 600; font-size: 14px;
}
.modal form button.btn-secondary {
  background: transparent; color: var(--fg); border: 1px solid var(--border);
}
.modal form label[for]:has(input[type="checkbox"]),
.modal form label:has(input[type="checkbox"]) {
  grid-template-columns: auto 1fr; align-items: center;
}

/* ───────────── category picker ───────────── */
.category-picker {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.cat-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
}
.cat-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.cat-check:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.cat-check input { margin: 0; }

/* ───────────── menu table ───────────── */
.menu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.menu-table th, .menu-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.menu-table th {
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
}
.menu-table tr.disabled td { opacity: 0.5; }

/* ───────────── splash ───────────── */
.splash { display: grid; place-items: center; min-height: 100vh; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
