:root{
  --bg:#0b1220;
  --card:#0f1b2e;
  --stroke:rgba(255,255,255,.10);
  --text:#e9eef7;
  --muted:rgba(233,238,247,.70);
  --accent:#ffd230;

  /* Brand */
  --brand:#132a4b;
  --brand-deep:#0f213d;

  /* Semantic */
  --success: rgba(60, 255, 160, .18);
  --success-stroke: rgba(60, 255, 160, .28);
  --warn: rgba(255, 205, 70, .16);
  --warn-stroke: rgba(255, 205, 70, .28);
  --danger: rgba(255, 80, 80, .15);
  --danger-stroke: rgba(255, 80, 80, .25);

  /* Depth + surfaces */
  --shadow: 0 18px 55px rgba(0,0,0,.38);
  --shadow-soft: 0 10px 28px rgba(0,0,0,.25);
  --surface: rgba(255,255,255,.06);
  --surface-2: rgba(255,255,255,.09);
  --stroke-2: rgba(255,255,255,.14);

  /* Focus ring */
  --ring: 0 0 0 3px rgba(255,210,48,.18);
}

*{ box-sizing:border-box; }
html, body{ height: 100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:
    radial-gradient(1200px 900px at 15% 10%, rgba(19,42,75,.95) 0%, var(--bg) 55%),
    radial-gradient(900px 650px at 90% 5%, rgba(255,210,48,.08) 0%, rgba(11,18,32,0) 60%);
  color:var(--text);
}

/* Layout */
.wrap{ max-width: 1100px; margin: 0 auto; padding: 24px; }
.center{ min-height:100vh; display:flex; align-items:center; justify-content:center; }

/* ===== HEADER (hard locked single-row layout) ===== */
.topbar{
  position:sticky;
  top:0;
  z-index: 50;
  border-bottom:1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.topbar::after{
  content:"";
  display:block;
  height:1px;
  background: linear-gradient(90deg, transparent, rgba(255,210,48,.35), transparent);
}

.topbar-inner{
  width:100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;

  display:grid;
  grid-template-columns: auto 1fr auto;
  align-items:center;
  column-gap: 18px;

  min-height: 58px;
}

/* Left: Logo */
.brand-link{
  display:flex;
  align-items:center;
  text-decoration:none;
  color:inherit;
}
.brand-link:hover{ opacity:.96; }

.brand-logo{
  height: 34px;
  width: auto;
  display:block;
  background:none !important;
  border:none !important;
  box-shadow:none !important;
  padding:0 !important;
  border-radius:0 !important;
  object-fit:contain;
}

/* Middle: Nav */
.topnav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  white-space: nowrap;
}

.navlink{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  color: var(--text);
  text-decoration:none;
  opacity:.88;
  font-weight: 850;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
}

.navlink:hover{ opacity:1; background: rgba(255,255,255,.08); }

.navlink.active{
  opacity:1;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 0 0 1px rgba(255,210,48,.12);
}

/* Right: User + logout */
.topright{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 14px;
  white-space: nowrap;
}

.who{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  line-height:1.05;
  max-width: 340px;
}

.who-email{
  font-weight: 900;
  font-size: 12px;
  opacity: .95;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.who-role{
  font-size: 11px;
  color: rgba(233,238,247,.68);
}

.small-btn{ padding: 6px 10px; font-size: 12px; }

/* Mobile: nav scrolls, right drops under (ONLY on small screens) */
@media (max-width: 760px){
  .topbar-inner{
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    row-gap: 10px;
  }

  .topnav{
    justify-content:flex-start;
    overflow-x:auto;
    padding-bottom: 2px;
  }

  .topright{
    grid-column: 1 / -1;
    justify-content:flex-start;
  }
}

/* Links + helpers */
.link{ color: var(--text); text-decoration:none; opacity:.85; }
.link:hover{ opacity:1; text-decoration: underline; }

.muted{ color:var(--muted); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.small{ font-size: 12px; }
.green{ color: rgba(60,255,160,.95); }

/* Cards */
.card{
  background: rgba(15,27,46,.9);
  border:1px solid var(--stroke);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card{ margin-top: 14px; }

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 8px;
}

/* Headings */
h1,h2{ margin: 0 0 10px 0; }
h1{ font-size: 26px; letter-spacing: .2px; }
h2{ font-size: 16px; letter-spacing: .2px; }

.pagehead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin: 8px 0 18px;
}

/* Forms */
.form{ display:grid; gap:10px; margin-top: 14px; }
label{ font-size: 13px; color: var(--muted); font-weight: 750; }
.help{ margin-top: 6px; font-size: 12px; color: var(--muted); }

input, select, textarea{
  width: 360px;
  max-width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
textarea{ min-height: 110px; resize: vertical; }

input:focus, select:focus, textarea:focus{
  box-shadow: var(--ring);
  border-color: rgba(255,210,48,.35);
  background: rgba(255,255,255,.075);
}

button{
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 0;
  font-weight: 900;
  cursor: pointer;
  background: var(--accent);
  color: #111827;
  transition: filter .15s ease, transform .05s ease;
}
button:hover{ filter: brightness(1.03); }
button:active{ transform: translateY(1px); }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  text-decoration:none;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover{ background: var(--surface-2); }
.btn:active{ transform: translateY(1px); }
.btn.ghost{ background: transparent; }
.btn.danger{ border-color: rgba(255,80,80,.35); background: rgba(255,80,80,.12); }

/* Alerts */
.alert{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger);
  border: 1px solid var(--danger-stroke);
}

/* Notice banners */
.notice{
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--surface);
}
.notice.success{ background: var(--success); border-color: var(--success-stroke); }
.notice.warn{ background: var(--warn); border-color: var(--warn-stroke); }

/* Tables */
.table-wrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.08);
}

table{
  width:100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th, td{
  border-bottom: 1px solid var(--stroke);
  text-align:left;
  padding: 10px 8px;
  font-size: 13px;
  vertical-align: top;
}

th{ color: var(--muted); font-weight: 850; }

tbody tr:hover td{
  background: rgba(255,255,255,.03);
}

/* Grids */
.grid-4{ display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px; margin: 14px 0 16px; }
.grid-3{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px; margin: 14px 0 16px; }

@media (max-width: 900px){
  .grid-4{ grid-template-columns: 1fr 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
}

/* Stats */
.stat{
  background: rgba(15,27,46,.75);
  border:1px solid var(--stroke);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.stat.highlight{
  background: linear-gradient(180deg, rgba(255,210,48,.14), rgba(15,27,46,.75));
  border-color: rgba(255,210,48,.20);
}

.stat-k{ color: var(--muted); font-size: 12px; font-weight: 850; }
.stat-v{ font-size: 22px; font-weight: 950; margin-top: 6px; }
.stat-sub{ margin-top: 6px; font-size: 12px; }

/* Row links + pills */
.rowlink{ color: var(--text); text-decoration:none; font-weight: 900; }
.rowlink:hover{ text-decoration: underline; }

.pill{
  display:inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  margin-left: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface);
}

.pill-red{ background: var(--danger); border-color: var(--danger-stroke); }
.pill-green{ background: var(--success); border-color: var(--success-stroke); }
.pill-blue{ background: rgba(110, 180, 255, .14); border-color: rgba(110, 180, 255, .22); }
.pill-outline{ background: rgba(255,255,255,.04); border-color: var(--stroke); }

/* Key-value rows */
.kv{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding: 10px 0;
  border-top: 1px solid var(--stroke);
}
.kv:first-of-type{ border-top: 0; padding-top: 0; }

/* Form helpers */
.form.wide input, .form.wide select, .form.wide textarea{ width: 100%; }

.row2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px){
  .row2{ grid-template-columns: 1fr; }
}