:root {
  --brand:      #C2562E;
  --brand-hi:   #d96a41;
  --bg:         #0e0e0e;
  --surface:    #161616;
  --card-bg:    #1a1a1a;
  --border:     #2a2a2a;
  --text:       #f0ece8;
  --muted:      #9a9a9a;
  --danger:     #c0392b;
  --ok:         #2e7d5b;
  --radius:     12px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

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

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 3px solid var(--brand);
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 800; letter-spacing: -1px;
}
.brand-mark-lg { width: 68px; height: 68px; font-size: 1.6rem; border-radius: 16px; margin: 0 auto 0.5rem; }
.brand-text { font-weight: 600; }
.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { color: var(--text); }
.nav-user { color: var(--muted); font-size: 0.9rem; }
.inline { display: inline; }

/* ── Layout ── */
.container { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Hero / auth cards ── */
.hero { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem 1.5rem; }
.hero-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem; max-width: 460px; width: 100%;
  text-align: center;
}
.hero-card h1 { margin-bottom: 0.5rem; }
.lead { color: var(--text); margin-bottom: 1.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hero-card .btn { margin-bottom: 1rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.1rem; border-radius: 9px; border: 1px solid transparent;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hi); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-danger { background: transparent; border-color: var(--danger); color: #e6796d; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Flash messages ── */
.flash { padding: 0.8rem 1rem; border-radius: 9px; margin-bottom: 1rem; border: 1px solid var(--border); }
.flash-info    { background: #14232e; border-color: #1d3a4d; }
.flash-success { background: #13291f; border-color: #1e4633; }
.flash-error   { background: #2a1513; border-color: #4d1f1a; }

/* ── Cards / grid ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; transition: border-color var(--transition), transform var(--transition);
}
a.card:hover { border-color: var(--brand); transform: translateY(-3px); }
.card h3 { margin-bottom: 0.3rem; }
.card .meta { color: var(--muted); font-size: 0.85rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }

/* ── Forms ── */
.form-row { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
input[type=text], input[type=email], input[type=search], textarea, select {
  width: 100%; padding: 0.6rem 0.8rem; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; font: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; border: 1px solid var(--border); }
.badge-admin { background: #2a1a12; border-color: var(--brand); color: var(--brand-hi); }
.badge-viewonly { background: #2a1513; border-color: #4d1f1a; color: #e6796d; }
.badge-ok { background: #13291f; border-color: #1e4633; color: #6bbf95; }

/* ── Footer ── */
.site-footer { text-align: center; padding: 1.2rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ── Utilities ── */
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none; }
.copybox { display: flex; gap: 0.5rem; }
.copybox input { font-family: ui-monospace, monospace; font-size: 0.85rem; }

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; }
  th, td { white-space: normal; }
}
