:root {
  --bg: #0f1114;
  --panel: #191c21;
  --panel-2: #22262d;
  --line: #2a2e36;
  --text: #e8ecf1;
  --muted: #8b94a3;
  --accent: #4da3ff;
  --accent-hover: #69b3ff;
  --good: #2bb673;
  --warn: #d98a00;
  --bad: #d94848;
  --info: #4da3ff;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif; font-size: 15px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

header.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
header.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: 0.2px; }
header.topbar .brand { display: flex; align-items: center; gap: 10px; }
header.topbar .brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #4da3ff, #7358ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
header.topbar .spacer { flex: 1; }
header.topbar .user { color: var(--muted); font-size: 13px; }
header.topbar .user strong { color: var(--text); }
header.topbar nav a { margin-right: 14px; color: var(--muted); font-size: 14px; }
header.topbar nav a.active, header.topbar nav a:hover { color: var(--text); }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.card .hint { color: var(--muted); font-size: 13px; margin-top: -6px; margin-bottom: 14px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; min-width: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.ghost, .btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.ghost:hover, .btn.ghost:hover { background: var(--panel-2); }
button.danger { background: var(--bad); }
button.danger:hover { background: #e85b5b; }
button.good { background: var(--good); }
button.good:hover { background: #36c683; }
button.warn { background: var(--warn); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.status.draft { background: #3a3f48; color: #c6ccd6; }
.status.submitted { background: #2a4d7a; color: #a9cbff; }
.status.approved { background: #1e5237; color: #8fe0b4; }
.status.rejected { background: #5a2222; color: #ffb3b3; }
.status.paid { background: #4a3477; color: #d8c4ff; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.selected { background: #24344d; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: #1e5237; color: #b8ecd1; }
.flash.err { background: #5a2222; color: #ffc5c5; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.kpi {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.kpi .tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; min-width: 150px; flex: 1;
}
.kpi .tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .tile .value { font-size: 22px; font-weight: 600; margin-top: 4px; }

.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px; width: 100%; max-width: 400px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-card .brand-mark-big {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, #4da3ff, #7358ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 20px; margin-bottom: 18px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pill { display: inline-block; background: var(--panel-2); padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--muted); }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px; min-width: 320px; max-width: 90vw;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog h3 { margin: 0 0 14px; }

@media (max-width: 720px) {
  main { padding: 16px 12px 60px; }
  .card { padding: 16px; }
  header.topbar { padding: 10px 14px; gap: 10px; }
  header.topbar nav a { margin-right: 10px; }
  table { font-size: 13px; }
  tbody td, thead th { padding: 8px 6px; }
}
