:root {
  --ink: #0b1224;
  --ink-2: #5b6478;
  --ink-3: #8a93a6;
  --line: #e7eaf1;
  --soft: #f5f7fc;
  --brand: #1d3fb8;
  --brand-2: #4f6df3;
  --pill: #eef2ff;
  --danger: #b91c1c;
  --good: #0a8f6f;
  --shadow: 0 6px 24px rgba(15,23,42,.08);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif; color: var(--ink); background: #f4f6fb; }

button { font-family: inherit; cursor: pointer; }
.btn-primary, .btn-ghost, .btn-danger {
  border: 0; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .2px;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 10px rgba(29,63,184,.3); }
.btn-ghost   { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-danger  { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-primary[disabled], .btn-ghost[disabled] { opacity: .5; cursor: not-allowed; }

.muted { color: var(--ink-3); font-size: 12px; }

/* ---- Login ---- */
.login {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at -10% -20%, rgba(29,63,184,.15) 0%, transparent 60%),
    radial-gradient(700px 400px at 110% -10%, rgba(0,194,168,.12) 0%, transparent 60%),
    linear-gradient(180deg, #f6f8ff 0%, #eef2fa 100%);
  padding: 40px 16px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 32px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow-lg);
}
.login-card .logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; box-shadow: 0 8px 20px rgba(29,63,184,.4);
  margin-bottom: 16px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.login-card label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-top: 6px; }
.login-card input {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,63,184,.15); }
.login-card .err { color: var(--danger); font-size: 12px; min-height: 16px; }
.login-card .btn-primary { margin-top: 10px; padding: 12px; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: #0b1224; color: #fff; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 16px;
}
.side .brand { display: flex; gap: 10px; align-items: center; }
.side .brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.side .brand .title { font-size: 14px; font-weight: 800; }
.side .brand .muted { color: #8a93a6; }
.side .nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  text-align: left; background: transparent; color: #c9d2f3;
  border: 0; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.nav-btn:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,.12); color: #fff; }
.side-foot { font-size: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-foot .muted { color: #8a93a6; }
.side-foot .btn-ghost { background: rgba(255,255,255,.05); color: #fff; border-color: rgba(255,255,255,.1); }

.main { padding: 22px 28px; overflow: auto; }
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.row h2 { margin: 0; font-size: 22px; }
.row input[type="search"] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; min-width: 260px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }
.tbl th { background: var(--soft); color: var(--ink-2); font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .swatch { display: inline-flex; align-items: center; gap: 6px; }
.tbl .swatch span { width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--line); }
.tbl .logo-thumb { width: 28px; height: 28px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); object-fit: cover; }
.tbl .pill { padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tbl .pill.on { background: #ecfdf5; color: var(--good); }
.tbl .pill.off { background: #fef2f2; color: var(--danger); }
.tbl a.slug { color: var(--brand); font-weight: 700; text-decoration: none; }
.tbl a.slug:hover { text-decoration: underline; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions button { background: transparent; border: 0; color: var(--brand); font-weight: 700; font-size: 12px; padding: 4px 8px; }
.tbl .actions button:hover { text-decoration: underline; }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(11,18,36,.5);
  z-index: 50; display: grid; place-items: center; padding: 16px;
}
[hidden] { display: none !important; }
.modal-card {
  background: #fff; border-radius: 16px; max-width: 720px; width: 100%;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal-card header {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-card header h3 { margin: 0; font-size: 16px; }
.modal-card .x { background: transparent; border: 0; font-size: 22px; color: var(--ink-3); padding: 4px 10px; }
.modal-card .form { padding: 22px; overflow: auto; }
.modal-card footer {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}
.field .hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.field .hint code { background: var(--pill); color: var(--brand); padding: 2px 6px; border-radius: 4px; }
.field .check { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; padding: 9px 0; }

.slug-row { display: flex; align-items: center; gap: 6px; }
.slug-row span { color: var(--ink-3); font-size: 14px; }
.slug-row input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }

.color-row { display: flex; gap: 8px; }
.color-row input[type="color"] { width: 56px; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: #fff; }
.color-row input[type="text"] { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.logo-row { display: flex; gap: 12px; align-items: center; }
.logo-preview {
  width: 80px; height: 80px; border-radius: 16px; border: 1px dashed var(--line);
  background: var(--soft); display: grid; place-items: center;
  font-size: 11px; color: var(--ink-3); overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; }

.brand-preview {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: #f9faff;
}
.bp-logo {
  width: 64px; height: 64px; border-radius: 18px; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
  box-shadow: 0 10px 24px rgba(29,63,184,.3);
}
.bp-bar { width: 70%; height: 6px; border-radius: 999px; }
.bp-btn { padding: 10px 22px; border-radius: 10px; color: #fff; font-weight: 800; font-size: 13px; }

/* Quote modal */
#qmBody dl { margin: 0; display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; font-size: 13px; }
#qmBody dt { color: var(--ink-3); font-weight: 700; }
#qmBody dd { margin: 0; color: var(--ink); }
#qmBody h4 { margin: 16px 0 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
#qmBody .totals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 6px; }
#qmBody .totals .t { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
#qmBody .totals .t .v { font-size: 18px; font-weight: 800; }
#qmBody .totals .t .l { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
