:root {
  --psmu-burgundy: #8B1538;
  --psmu-burgundy-dark: #6E1129;
  --psmu-burgundy-light: #B83E5F;
  --psmu-burgundy-50: #FBF0F3;
  --psmu-burgundy-100: #F4D9E1;
  --psmu-gold: #C9A961;
  --ink: #1A1D24;
  --ink-2: #3D424E;
  --ink-3: #6B7280;
  --ink-4: #9CA3AF;
  --line: #E4E2DC;
  --line-2: #EFEDE6;
  --paper: #FAF8F3;
  --paper-2: #F5F2EA;
  --white: #FFFFFF;
  --green: #1F7A4E;
  --green-bg: #E6F4EC;
  --red: #B42318;
  --red-bg: #FDECEA;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar { background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { padding: 22px 22px 20px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: flex-start; }
.brand-mark { width: 38px; height: 38px; background: var(--psmu-burgundy); color: var(--white); font-family: 'PT Sans', serif; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; border-radius: 2px; letter-spacing: -0.5px; flex-shrink: 0; position: relative; }
.brand-mark::after { content: ''; position: absolute; bottom: -3px; left: 0; right: 0; height: 2px; background: var(--psmu-gold); }
.brand-name { font-family: 'PT Sans', serif; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: -0.2px; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: 3px; letter-spacing: 0.2px; }

.nav-section { padding: 16px 14px 4px; font-size: 10px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.nav-item { display: block; padding: 8px 14px; margin: 1px 8px; border-radius: 4px; font-size: 13px; color: var(--ink-2); cursor: pointer; text-decoration: none; position: relative; }
.nav-item:hover { background: var(--paper-2); }
.nav-item.active { background: var(--psmu-burgundy-50); color: var(--psmu-burgundy-dark); font-weight: 500; }
.nav-item.active::before { content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; background: var(--psmu-burgundy); border-radius: 0 2px 2px 0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; align-items: center; gap: 20px; }
.crumb { font-size: 12px; color: var(--ink-3); }
.crumb b { color: var(--ink); font-weight: 500; }

.page { padding: 22px 28px 40px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.page-title { font-family: 'PT Sans', serif; font-size: 26px; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: -0.4px; }
.page-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.page-sub b { color: var(--psmu-burgundy); font-weight: 600; }

.btn { border: 1px solid var(--line); background: white; height: 36px; padding: 0 14px; border-radius: 4px; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all .12s; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--psmu-burgundy); color: white; border-color: var(--psmu-burgundy); }
.btn.primary:hover { background: var(--psmu-burgundy-dark); border-color: var(--psmu-burgundy-dark); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.actions { display: flex; gap: 8px; }

.filters { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 16px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 500; }
.filter select, .filter input { height: 32px; border: 1px solid var(--line); background: var(--paper); border-radius: 4px; padding: 0 10px; font-family: inherit; font-size: 12px; color: var(--ink); min-width: 160px; }
.filter select:focus, .filter input:focus { outline: none; border-color: var(--psmu-burgundy); background: white; }
.range-input { display: flex; align-items: center; gap: 6px; }
.range-input input { width: 90px; min-width: auto; text-align: center; }
.range-input span { color: var(--ink-4); font-size: 11px; }
.filter-meta { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-3); }
.filter-meta b { color: var(--ink); font-weight: 600; }

.table-wrap { background: white; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tools { padding: 10px 14px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line-2); background: var(--paper); }
.tools .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.table-scroll { overflow-x: auto; max-height: 70vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { position: sticky; top: 0; background: var(--paper); color: var(--ink-3); font-weight: 500; text-align: left; padding: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; z-index: 1; }
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--psmu-burgundy); }
thead th .sort-arrow { margin-left: 4px; color: var(--psmu-burgundy); font-weight: 700; }
tbody td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr:hover { background: var(--paper-2); }
tbody td a { color: var(--psmu-burgundy); text-decoration: none; }
tbody td a:hover { text-decoration: underline; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--psmu-burgundy); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: white; padding: 10px 16px; border-radius: 4px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.error { background: var(--red); }

.num { font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 12px; color: var(--ink); }
.muted { color: var(--ink-3); }
