:root {
  --primary: #BD202E;
  --primary-dark: #9a1a25;
  --secondary: #000000;
  --accent: #FFFFFF;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: var(--bg); line-height: 1.5;
}
a { color: var(--primary); }

/* Top nav */
.nav {
  background: var(--secondary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
}
.nav .brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; }
.nav .brand .logo {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px;
}
.nav .links { display: flex; gap: 22px; align-items: center; }
.nav .links a { color: #fff; text-decoration: none; font-weight: 500; opacity: .92; }
.nav .links a:hover, .nav .links a.active { color: var(--primary); opacity: 1; }

/* Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 28px; }
.page-title { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 700; margin: 8px 0 22px; }
.page-title .gear { color: var(--amber); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px;
}
.card h2 { margin: 0 0 16px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.card h2 i { color: var(--primary); }

/* Tab bar */
.tabs {
  display: flex; flex-wrap: wrap; gap: 4px; background: #eef0f3;
  border-radius: var(--radius); padding: 6px; margin-bottom: 22px;
}
.tabs button {
  border: none; background: transparent; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer; font-weight: 500;
}
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tabs button:disabled { opacity: .45; cursor: not-allowed; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
label .req { color: var(--primary); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(189,32,46,.25); border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  padding: 11px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-blue { background: #2563eb; color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-gray { background: #e5e7eb; color: #374151; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* Item list rows */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px;
  background: #fff;
}
.row h3 { margin: 0 0 4px; font-size: 16px; }
.row .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 14px; }
.row .actions { display: flex; gap: 8px; flex-shrink: 0; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: #eef0f3; color: #374151;
}
.badge.green { background: #dcfce7; color: #15803d; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.purple { background: #ede9fe; color: #6d28d9; }
.badge.amber { background: #fef3c7; color: #b45309; }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin-bottom: 18px; }
.filters > div { min-width: 220px; }

.empty { text-align: center; color: var(--muted); padding: 28px; font-style: italic; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #111827; color: #fff;
  padding: 12px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(8px); transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--primary); }
.mt0 { margin-top: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

@media print {
  .nav, .filters, .btn, .no-print, #logout { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
  .row { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
