/* ─── SigServer · Black & Gold Theme ─────────────────────────────── */
:root {
  --bg:        #0a0a0a;
  --bg2:       #111111;
  --bg3:       #1a1a1a;
  --bg4:       #222222;
  --border:    #2a2a2a;
  --gold:      #c9a227;
  --gold-lt:   #e0b840;
  --gold-dk:   #a07d10;
  --text:      #e6dfc8;
  --text-muted:#888888;
  --danger:    #c0392b;
  --success:   #1e8449;
  --info:      #1a5276;
  --radius:    6px;
  --nav-h:     58px;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Top Nav ─────────────────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: #0d0d0d;
  border-bottom: 2px solid var(--gold-dk);
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,.6);
}

.topnav-brand {
  display: flex; align-items: center; gap: 8px;
  min-width: 220px;
}
.brand-icon { font-size: 22px; color: var(--gold); }
.brand-name {
  font-family: 'Cinzel', serif;
  font-size: 17px; font-weight: 700;
  color: var(--gold); letter-spacing: .05em;
}
.brand-sub { font-size: 10px; color: var(--text-muted); letter-spacing: .04em; }

.topnav-links { display: flex; gap: 2px; flex: 1; }
.topnav-links a {
  color: var(--text-muted); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.topnav-links a:hover, .topnav-links a.active {
  color: var(--gold); background: rgba(201,162,39,.1);
}

.topnav-user { display: flex; align-items: center; gap: 8px; }
.user-pill {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none;
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 13px; transition: border-color .15s;
}
.user-pill:hover { border-color: var(--gold); }
.btn-logout {
  color: var(--text-muted); text-decoration: none;
  font-size: 12px; padding: 4px 8px;
  border-radius: var(--radius); transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

/* ─── Layout ──────────────────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  padding: 24px 28px;
  max-width: 1400px;
}
.main-content.centered {
  margin-top: 0; max-width: 100%;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}

/* ─── Page Header ─────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 20px; color: var(--gold); letter-spacing: .04em;
}
.page-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ─── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 12px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--gold);
  letter-spacing: .03em;
}
.card-body { padding: 16px; }
.card-body.p-0 { padding: 0; }
.card-body.flex-row { display: flex; align-items: center; flex-wrap: wrap; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

/* ─── Stat Grid ───────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: border-color .15s;
}
.stat-card:hover { border-color: var(--gold-dk); }
.stat-icon { font-size: 26px; margin-bottom: 6px; }
.stat-val {
  font-family: 'Cinzel', serif;
  font-size: 32px; font-weight: 700; color: var(--gold);
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-link {
  display: inline-block; margin-top: 10px;
  font-size: 12px; color: var(--gold); text-decoration: none;
}
.stat-link:hover { text-decoration: underline; }

/* ─── Tables ──────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 14px;
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(201,162,39,.04); }
.action-cell { white-space: nowrap; }

/* ─── Forms ───────────────────────────────────────────────────────── */
.form-layout {
  display: flex; gap: 18px; align-items: flex-start;
}
.form-main { flex: 1; min-width: 0; }
.form-side { width: 320px; flex-shrink: 0; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .04em; }
.flex-1 { flex: 1; min-width: 120px; }
.flex-2 { flex: 2; min-width: 180px; }
.flex-3 { flex: 3; min-width: 200px; }

.form-control {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold-dk);
  box-shadow: 0 0 0 3px rgba(201,162,39,.12);
}
.form-control[readonly] { opacity: .6; cursor: default; }
.form-control[disabled] { opacity: .5; cursor: not-allowed; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
textarea.form-control { resize: vertical; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.code-editor {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #080808;
  min-height: 200px;
}

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; color: var(--text); font-size: 13px !important;
  font-weight: 400 !important; letter-spacing: 0 !important;
  padding-top: 4px;
}
.checkbox-label input[type=checkbox] { accent-color: var(--gold); width: 15px; height: 15px; }

.form-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: all .15s; white-space: nowrap;
}
.btn-primary {
  background: var(--gold); color: #0a0a0a; font-weight: 600;
}
.btn-primary:hover { background: var(--gold-lt); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger {
  background: transparent; color: var(--danger);
  border: 1px solid rgba(192,57,43,.3);
}
.btn-danger:hover { background: rgba(192,57,43,.15); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.gap-2 { gap: 10px; }

/* ─── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.badge-gold { background: rgba(201,162,39,.2); color: var(--gold); border: 1px solid rgba(201,162,39,.3); }
.badge-muted { background: var(--bg4); color: var(--text-muted); border: 1px solid var(--border); }
.badge-danger { background: rgba(192,57,43,.2); color: #e74c3c; border: 1px solid rgba(192,57,43,.3); }

/* ─── Alerts ──────────────────────────────────────────────────────── */
.flash-container { margin-bottom: 16px; }
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  border-left: 3px solid;
}
.alert-success { background: rgba(30,132,73,.15); border-color: #1e8449; color: #2ecc71; }
.alert-danger  { background: rgba(192,57,43,.15); border-color: #c0392b; color: #e74c3c; }
.alert-warning { background: rgba(243,156,18,.12); border-color: #f39c12; color: #f1c40f; }
.alert-info    { background: rgba(26,82,118,.2); border-color: #1a5276; color: #85c1e9; }

/* ─── Login ───────────────────────────────────────────────────────── */
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 40px; color: var(--gold); display: block; margin-bottom: 8px; }
.login-title {
  font-family: 'Cinzel', serif;
  font-size: 24px; color: var(--gold); font-weight: 700;
}
.login-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }

/* ─── User Avatar ─────────────────────────────────────────────────── */
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-dk); color: #0a0a0a;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-avatar.lg { width: 48px; height: 48px; font-size: 20px; }
.user-avatar.sm { width: 24px; height: 24px; font-size: 11px; }

.user-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 18px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.user-banner > div { display: flex; flex-direction: column; gap: 2px; }
.user-banner strong { font-size: 16px; }

/* ─── Signature Preview ───────────────────────────────────────────── */
.sig-preview-frame {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 16px;
  min-height: 80px;
  color: #333;
}

/* ─── Template Variables ──────────────────────────────────────────── */
.template-vars {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.template-vars code {
  background: var(--bg4); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; font-size: 11px;
  color: var(--gold); cursor: pointer;
  transition: background .1s;
}
.template-vars code:hover { background: rgba(201,162,39,.15); }

/* ─── Push Center ─────────────────────────────────────────────────── */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-row .form-control { flex: 1; min-width: 140px; }

.user-checklist {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 380px; overflow-y: auto;
  background: var(--bg3);
  margin-bottom: 14px;
}
.user-check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.user-check-item:last-child { border-bottom: none; }
.user-check-item:hover { background: rgba(201,162,39,.06); }
.user-check-item input[type=checkbox] { accent-color: var(--gold); flex-shrink: 0; }
.ucb-info { display: flex; flex-direction: column; gap: 1px; }
.ucb-info strong { font-size: 13px; }
.ucb-info .muted { font-size: 11px; }

/* ─── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 85vh; display: flex; flex-direction: column;
}
.modal-box.modal-lg { max-width: 740px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; color: var(--gold);
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 16px; overflow-y: auto; }

/* ─── Code Block ──────────────────────────────────────────────────── */
.code-block {
  background: #080808;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #a8d8a8;
  margin: 8px 0;
  line-height: 1.7;
}
.guide-list { margin-left: 16px; color: var(--text-muted); font-size: 13px; }
.guide-list li { margin-bottom: 6px; }

/* ─── Ref Table ───────────────────────────────────────────────────── */
.ref-table { width: 100%; border-collapse: collapse; }
.ref-table td { padding: 4px 0; font-size: 12px; vertical-align: top; }
.ref-table td:first-child { padding-right: 10px; color: var(--gold); }

/* ─── Profile ─────────────────────────────────────────────────────── */
.profile-detail {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.profile-detail:last-child { border-bottom: none; }
.profile-detail label { color: var(--text-muted); font-size: 12px; font-weight: 500; }

/* ─── Misc ────────────────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.p-3 { padding: 12px 16px; }
code {
  background: var(--bg4); padding: 1px 5px;
  border-radius: 3px; font-size: 12px; color: var(--gold);
}
.mt-2 { margin-top: 8px; }

/* ─── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dk); }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .form-layout { flex-direction: column; }
  .form-side { width: 100%; }
  .topnav-links a { padding: 6px 8px; font-size: 12px; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  .main-content { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
}
