:root {
  --bg: #1e1e2e;
  --panel: #2a2a3e;
  --panel2: #242438;
  --accent: #7c3aed;
  --accent2: #06b6d4;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --gold: #f59e0b;
  --blue: #3b82f6;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Tahoma", sans-serif;
  margin: 0;
  min-height: 100vh;
}

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

header.topbar {
  background: #16162a;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header.topbar .brand { font-weight: bold; color: var(--accent2); font-size: 15px; }

nav.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: #16162a;
  padding: 0 16px 8px;
}

nav.tabs a {
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  background: #2a2a3e;
  color: var(--muted);
  font-weight: bold;
  font-size: 13px;
}

nav.tabs a.active { background: #312e4f; color: var(--accent2); }
nav.tabs a:hover { text-decoration: none; background: #312e4f; }

.userbar { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.userbar .role-badge { background: var(--accent); color: white; padding: 2px 8px; border-radius: 10px; font-size: 11px; }

main { padding: 16px 20px 40px; max-width: 1200px; margin: 0 auto; }

.panel { background: var(--panel); border-radius: 8px; padding: 16px; margin-bottom: 16px; }

h1, h2, h3 { margin-top: 0; }
h1 { font-size: 18px; color: var(--accent2); }
h2 { font-size: 15px; color: var(--accent2); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid var(--green); }
.flash-error { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid var(--red); }
.flash-info { background: rgba(59,130,246,0.15); color: var(--blue); border: 1px solid var(--blue); }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=date],
input[type=search], input[type=file], select, textarea {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 13px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.field { margin-bottom: 10px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  color: white;
  background: var(--accent);
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary { background: var(--accent2); }
.btn-muted { background: #475569; }
.btn-danger { background: var(--red); }
.btn-green { background: var(--green); color: #062; }
.btn-gold { background: var(--gold); color: #000; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
table.data th { color: var(--muted); font-size: 11px; text-transform: uppercase; background: #312e4f; }
table.data tr:hover td { background: rgba(124,58,237,0.08); }
table.data td.num { text-align: right; }

.badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; }
.badge-pending { background: rgba(245,158,11,0.2); color: var(--gold); }
.badge-approved { background: rgba(34,197,94,0.2); color: var(--green); }
.badge-void { background: rgba(239,68,68,0.2); color: var(--red); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.totals-box { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 13px; }
.totals-box .row { display: flex; gap: 10px; }
.totals-box .label { color: var(--muted); }
.totals-box .grand { font-size: 16px; font-weight: bold; color: var(--green); }

.line-items-table input { text-align: right; }
.line-items-table input.desc { text-align: left; }

.login-wrap { max-width: 360px; margin: 60px auto; }

footer.pagefoot { text-align: center; color: var(--muted); font-size: 11px; padding: 20px; }

@media print {
  header.topbar, nav.tabs, footer.pagefoot, .no-print { display: none !important; }
}
