/* EF-Gate — premium minimal dark theme.
   Accent (amber) is used sparingly: brand dot, active nav, focus. Everything
   else is a cool grayscale. Primary actions are near-white (Linear/Vercel feel). */

:root {
  --bg: #08080a;
  --surface: #0e0e11;
  --surface-2: #141418;
  --surface-3: #1b1b21;
  --border: #1a1a1f;      /* ultra-subtle hairlines */
  --border-2: #26262d;    /* input/control edges */
  --text: #ededf0;
  --text-dim: #c3c3cb;
  --muted: #86868f;
  --faint: #56565f;
  --accent: #ea8a4e;      /* desaturated amber — a whisper, not a shout */
  --accent-quiet: rgba(234, 138, 78, .14);
  --ok: #62cf98;
  --ok-bg: rgba(98, 207, 152, .10);
  --warn: #d7a34a;
  --warn-bg: rgba(215, 163, 74, .10);
  --danger: #e07070;
  --radius: 14px;
  --radius-sm: 9px;
  --ring: 0 0 0 3px var(--accent-quiet);
  --ease: 170ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  display: flex;
  min-height: 100dvh;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "cv01", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; transition: color var(--ease); }
a:hover { color: #fff; }

code {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86em;
  background: var(--surface-2);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

h1 { font-size: 26px; font-weight: 600; letter-spacing: -.025em; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.strong { font-weight: 550; color: var(--text); }

/* ---------- sidebar ---------- */
.sidebar {
  width: 244px; flex: none;
  height: 100dvh; position: sticky; top: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 16px 20px;
}
.brand {
  font-size: 19px; font-weight: 600; letter-spacing: -.02em; color: var(--text);
  padding: 0 10px; margin-bottom: 26px;
}
.brand:hover { color: var(--text); }
.brand span { color: var(--accent); margin: 0 1px; }
.brand.big { font-size: 24px; }

.sidebar nav { display: flex; flex-direction: column; gap: 22px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-cat {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint); font-weight: 600; padding: 0 10px 8px;
}
.navlink, .logout {
  display: flex; align-items: center; gap: 11px;
  color: var(--muted); padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 450;
  position: relative; transition: color var(--ease), background var(--ease);
}
.navlink:hover, .logout:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: var(--text); background: var(--surface-2); }
.navlink.active::before {
  content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.navlink.active .nav-ico { color: var(--accent); }
.nav-ico { width: 17px; height: 17px; flex: none; opacity: .95; }
.logout { margin-top: auto; }

/* ---------- layout ---------- */
.app-main { flex: 1 1 auto; min-width: 0; max-width: 1160px; padding: 40px 44px 72px; }
.center { flex: 1; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.wrap { max-width: 1040px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head .muted { font-size: 13.5px; margin-top: 2px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-head { margin-bottom: 18px; }
.card-head h2 { margin-bottom: 3px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 13px; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.grow { min-width: 0; }
.table-card { padding: 6px 8px; }
.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); margin: 0 0 14px; font-weight: 600;
}

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.table td { padding: 15px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover { background: rgba(255,255,255,.015); }
.table tr:last-child td { border-bottom: none; }
.strong-link { font-weight: 550; color: var(--text); }
.strong-link:hover { color: #fff; }
.rule { margin: 3px 0; font-size: 13px; }
.row-actions { display: flex; gap: 2px; align-items: center; justify-content: flex-end; white-space: nowrap; }

/* ---------- chips / tags / dots / badges ---------- */
.chip {
  display: inline-block; background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border-2); border-radius: 7px;
  padding: 3px 9px; font-size: 12px; font-weight: 450; margin: 2px 5px 2px 0;
}
.chip.mono { font-family: "Geist Mono", ui-monospace, monospace; font-size: 11.5px; }
.tag {
  display: inline-block; background: var(--surface-3); color: var(--muted);
  border-radius: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.off { background: var(--faint); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border-2);
}
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; font-size: 13.5px; color: var(--text-dim); }
.field-label { display: block; font-weight: 500; font-size: 13.5px; color: var(--text-dim); margin-bottom: 9px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), textarea, select {
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):focus, textarea:focus, select:focus {
  outline: none; border-color: #3a3a44; box-shadow: var(--ring);
}
.field-row { margin-top: 14px; }
label.inline { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
label.inline select { width: auto; margin-top: 0; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 400; cursor: pointer; color: var(--text-dim); }
label.check input { width: auto; margin: 0; accent-color: var(--accent); }
label.check span { font-size: 13.5px; }
.form-actions { display: flex; gap: 10px; }
.color-row { display: flex; gap: 16px; flex-wrap: wrap; }
.color-row label { font-size: 12.5px; color: var(--muted); }
.color-row input[type=color] {
  width: 52px; height: 34px; margin-top: 7px; padding: 2px;
  border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface-2); cursor: pointer;
}
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.switch input { width: auto; margin: 0; accent-color: var(--accent); }

/* kill Chrome's light autofill fill that made inputs look "light theme" */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 550; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease), color var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: #0a0a0c; }
.btn-primary:hover { background: #fff; color: #0a0a0c; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px 10px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.link-danger { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; font-family: inherit; transition: color var(--ease); }
.link-danger:hover { color: var(--danger); }
.addlink { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; padding: 2px 0; font-family: inherit; transition: color var(--ease); }
.addlink:hover { color: var(--text); }

/* icon action buttons (Edit / Delete in table rows) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; min-width: 30px; padding: 0; border: none; background: transparent;
  color: var(--muted); border-radius: 8px; cursor: pointer;
  transition: color var(--ease), background var(--ease), padding var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.icon-btn .ico { width: 16px; height: 16px; }
.del-form { display: inline-flex; margin: 0; }

/* two-step delete: grey -> armed red "Sure?" -> submits on 2nd click */
[data-confirm] .del-confirm { display: none; }
[data-confirm].armed { color: var(--danger); }
[data-confirm].armed .del-confirm { display: inline; font-size: 12px; font-weight: 600; }
.icon-btn.del:hover { color: var(--danger); }
.icon-btn.del.armed { min-width: 0; padding: 0 10px; background: rgba(224,112,112,.12); }
.btn.del-text.armed { border-color: var(--danger); background: rgba(224,112,112,.10); }
.btn.del-text.armed .del-label { display: none; }

/* ---------- toasts / flash / banner ---------- */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2);
  box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: toastin .22s ease;
}
.toast-success { border-left: 2px solid var(--ok); }
.toast-error { border-left: 2px solid var(--danger); }
@keyframes toastin { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid var(--border-2); }
.flash-success { color: var(--ok); border-left: 2px solid var(--ok); }
.flash-error { color: var(--danger); border-left: 2px solid var(--danger); }
.banner {
  background: var(--warn-bg); border: 1px solid transparent; color: var(--warn);
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 26px;
}
.banner code { background: rgba(0,0,0,.2); color: var(--warn); border-color: transparent; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty h2 { margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }
.empty-inline { padding: 34px 8px; text-align: center; color: var(--muted); }

/* ---------- auth ---------- */
.auth-card { width: 360px; text-align: center; }
.auth-card .brand { display: inline-block; margin-bottom: 4px; padding: 0; }
.auth-card form { margin-top: 22px; text-align: left; }
.auth-card label { margin-bottom: 14px; }

/* ---------- install page ---------- */
.collapse { padding: 0; }
.collapse > summary { display: flex; align-items: center; gap: 12px; padding: 18px 20px; cursor: pointer; list-style: none; user-select: none; }
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
.collapse[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.collapse-title { font-weight: 550; font-size: 14.5px; flex: 1; }
.chev { color: var(--faint); transition: transform var(--ease); font-size: 16px; }
.collapse[open] .chev { transform: rotate(180deg); }
.collapse-body { padding: 20px; }
.step-num { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.snippet { position: relative; background: #050506; color: var(--text-dim); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-family: "Geist Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.7; }
.snippet code { background: none; border: none; color: inherit; padding: 0; }
.copy-btn { position: absolute; top: 10px; right: 10px; background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--border-2); border-radius: 7px; padding: 5px 10px; font-size: 12px; cursor: pointer; transition: background var(--ease); }
.copy-btn:hover { background: var(--surface-2); color: var(--text); }
.install-split { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.preview-wrap { }
.preview-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; margin-bottom: 9px; }
.preview-frame { border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; background: var(--bg); }
.preview-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.preview-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); }
.preview-bar em { margin-left: 10px; font-style: normal; font-size: 12px; color: var(--faint); font-family: "Geist Mono", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-frame iframe { display: block; width: 100%; height: 440px; border: 0; background: var(--bg); }

/* ---------- protected pages: table + inline editor ---------- */
.view-row td { vertical-align: middle; }
.edit-row td, .edit-row:hover td { background: var(--surface-2); padding: 0; }
.peditor { padding: 24px 22px; }
.pe-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.pe-name {
  flex: 1; margin: 0; padding: 4px 2px;
  background: transparent; border: none; box-shadow: none;
  font-size: 19px; font-weight: 600; letter-spacing: -.02em; color: var(--text);
}
.pe-name:focus { outline: none; box-shadow: none; }
.pe-name::placeholder { color: var(--faint); font-weight: 500; }
.pe-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 30px; }
.pe-col { min-width: 0; }
.pe-redirect { margin-top: 14px; font-size: 13px; }
.pe-actions { display: flex; gap: 8px; margin-top: 22px; }
.mini-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; margin-bottom: 10px; }
.mini-label .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.rules { display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.rule-row { display: flex; align-items: center; gap: 9px; }
.rule-val { flex: 1; margin: 0; padding: 8px 11px; font-size: 13.5px; }
.rule-x { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px; padding: 5px 7px; border-radius: 6px; transition: color var(--ease), background var(--ease); }
.rule-x:hover { background: var(--surface-3); color: var(--danger); }

/* segmented Starts-with / Exact — neutral grays, no accent */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 2px; }
.seg-btn { background: none; border: none; cursor: pointer; font-family: inherit; padding: 5px 11px; border-radius: 6px; font-size: 12px; font-weight: 550; color: var(--faint); white-space: nowrap; transition: color var(--ease), background var(--ease); }
.seg-btn:hover { color: var(--muted); }
.seg-btn.active { background: var(--surface-3); color: var(--text); }

/* ---------- tag picker (neutral pills) ---------- */
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tagpill input { position: absolute; opacity: 0; width: 0; height: 0; }
.tagpill span {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-2); font-size: 12.5px; cursor: pointer;
  color: var(--muted); font-family: "Geist Mono", ui-monospace, monospace;
  transition: all var(--ease);
}
.tagpill span:hover { border-color: #3a3a44; color: var(--text-dim); }
.tagpill input:checked + span { background: var(--surface-3); border-color: #3f3f48; color: var(--text); }

@media (max-width: 860px) { .split, .install-split, .pe-grid { grid-template-columns: 1fr; gap: 18px; } }
@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
  .nav-cat, .navlink span { display: none; }
  .navlink.active::before { display: none; }
  .logout span { display: none; }
  .app-main { padding: 24px 18px 56px; max-width: none; }
}
