:root {
  --gold: #eab308;
  --gold-soft: #facc15;
  --black: #0a0a0a;
  --panel: #111111;
  --panel-2: #171717;
  --line: #262626;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --red: #ef4444;
  --green: #22c55e;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(234, 179, 8, 0.16), transparent 60%),
    var(--black);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; color: var(--gold-soft); }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.red { color: var(--red); }
.green { color: var(--green); }
.small { font-size: 13px; }
.right { text-align: right; }
.hidden { display: none !important; }

/* Layout */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(10,10,10,0.9); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.brand { font-weight: 800; letter-spacing: 0.5px; font-size: 18px; }
.brand span { color: var(--gold); }
.topbar .spacer { flex: 1; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--gold); vertical-align: middle; object-fit: cover; object-position: top; }
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.sidebar { padding: 18px 12px; border-right: 1px solid var(--line); }
.sidebar a.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--text);
  margin-bottom: 4px; font-size: 14px;
}
.sidebar a.nav:hover { background: var(--panel-2); text-decoration: none; }
.sidebar a.nav.active { background: rgba(234,179,8,0.14); color: var(--gold); }
main { padding: 22px; max-width: 1280px; width: 100%; }
.main-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.main-head .spacer { flex: 1; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { text-align: center; padding: 18px 10px; }
.stat .value { font-size: 30px; font-weight: 800; color: var(--gold); }
.stat .label { color: var(--muted); font-size: 13px; }

/* Buttons + forms */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--gold); color: #111; border: 0; border-radius: 10px;
  padding: 9px 15px; font-weight: 700; font-size: 14px; cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--gold-soft); text-decoration: none; }
button.secondary, .btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.secondary:hover { border-color: var(--gold); color: var(--gold); }
button.danger { background: var(--red); color: #fff; }
button.small { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; background: #0d0d0d; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-family: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
label.check input { width: auto; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 150px; }
.form-row button { flex: 0 0 auto; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.open, .badge.paid, .badge.ready { color: var(--gold); border-color: rgba(234,179,8,0.5); }
.badge.green, .badge.done, .badge.accepted { color: var(--green); border-color: rgba(34,197,94,0.4); }
.badge.red, .badge.cancelled, .badge.denied { color: var(--red); border-color: rgba(239,68,68,0.4); }
.badge.building { color: #60a5fa; border-color: rgba(96,165,250,0.4); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: 0; }

/* Ticket cards */
.ticket { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.ticket .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ticket .head .title { font-weight: 700; color: var(--gold); }
.ticket details { margin-top: 8px; }
.ticket summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.answer { margin: 4px 0; }
.answer b { color: var(--gold-soft); }

/* Orders board */
.board { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; }
.column { background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 120px; }
.column h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; margin: 4px 6px 10px; }
.order-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 13px; }
.order-card .pkg { font-weight: 700; color: var(--gold); }
.proof { max-width: 100%; border-radius: 8px; margin-top: 6px; display: block; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50;
}
.modal { width: min(680px, 100%); max-height: 88vh; overflow: auto; }

/* Auth cards */
.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { width: min(430px, 100%); text-align: center; padding: 34px 28px; border-top: 3px solid var(--gold); box-shadow: 0 18px 50px rgba(0,0,0,0.55); }
/* The logo is portrait (618x828): keep its shape instead of squashing it into a square. */
.auth-logo { height: 160px; width: auto; max-width: 75%; object-fit: contain; margin: 0 auto 16px; display: block; filter: drop-shadow(0 6px 18px rgba(234,179,8,0.35)); }
.auth-card h1 { font-size: 30px; }
.auth-card .btn { padding: 12px 22px; font-size: 15px; }
.auth-card .small { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(234,179,8,0.12); color: var(--gold); font-size: 12px; font-weight: 700; margin-bottom: 14px; }

.toast {
  position: fixed; bottom: 18px; right: 18px; z-index: 60;
  background: var(--panel-2); border: 1px solid var(--gold); color: var(--text);
  padding: 12px 16px; border-radius: 10px; max-width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.toast.error { border-color: var(--red); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .sidebar a.nav { white-space: nowrap; margin: 0 4px 0 0; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: 1fr; }
  main { padding: 14px; }
}
@media (max-width: 560px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .brand { font-size: 16px; }
}

/* Text overrides (Texts page) */
.text-line { border-bottom: 1px solid var(--line); padding: 10px 0; }
.text-line:last-child { border-bottom: 0; }
.text-line textarea { min-height: 52px; margin-top: 6px; }
.text-line .mono { color: var(--gold-soft); }

/* Live panel */
.live-player { cursor: pointer; }
.live-player:hover td { background: rgba(234,179,8,0.06); }
.map-wrap { position: relative; width: 100%; max-width: 620px; margin: 0 auto; }
.map-wrap canvas { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); background: #070707; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 55; padding: 18px; overflow-y: auto;
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}
.drawer h2 { color: var(--gold); }
.frame { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.chat-box { height: 340px; overflow-y: auto; background: #070707; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 13px; }
.chat-line { margin-bottom: 4px; }
.chat-line b { color: var(--gold-soft); }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
