@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@400;500&display=swap');

:root {
  --ink:       #1a1410;
  --paper:     #f5f0e8;
  --cream:     #ede7d6;
  --copper:    #b5652a;
  --copper-lt: #d4844a;
  --copper-dk: #7a3d14;
  --teal:      #2a6e6b;
  --teal-lt:   #e0efee;
  --amber:     #c9921a;
  --muted:     #6b5e4e;
  --border:    #d4c9b5;
  --shadow:    rgba(26,20,16,.12);
  --card:      #faf7f2;
  --danger:    #963030;
  --success:   #2a6e40;
  --warn:      #7a5c14;
  --nav-h:     64px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--ink);
  border-bottom: 3px solid var(--copper);
  display: flex; align-items: center;
  padding: 0 2rem; gap: 2rem;
}
.nav-brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; }
.nav-brand span:first-child {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem; font-weight: 700;
  color: var(--copper-lt); letter-spacing: .02em;
}
.nav-brand span:last-child {
  font-family: 'DM Mono', monospace;
  font-size: .68rem; color: #9a8878; letter-spacing: .1em;
}
.nav-links { display: flex; gap: .25rem; align-items: center; flex: 1; }
.nav-links a {
  padding: .4rem .85rem; border-radius: 4px;
  text-decoration: none; font-size: .875rem; font-weight: 500;
  color: #c8b9a8; transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(181,101,42,.18); color: var(--copper-lt);
}
.nav-right { margin-left: auto; }
.btn-portal {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem 1rem; border: 1.5px solid var(--copper);
  border-radius: 5px; color: var(--copper-lt); text-decoration: none;
  font-size: .83rem; font-weight: 500; letter-spacing: .02em;
  transition: background .15s, color .15s; white-space: nowrap;
}
.btn-portal:hover { background: var(--copper); color: #fff; }

/* ── LAYOUT ── */
.page { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--ink) 0%, #2e1f0e 60%, #1a3333 100%);
  padding: 3rem 2.5rem 2.5rem; border-radius: 12px;
  margin-bottom: 2.5rem; position: relative; overflow: hidden;
}
.hero::before {
  content: '⚡'; position: absolute; right: 2rem; top: 50%;
  transform: translateY(-50%); font-size: 8rem; opacity: .05;
  line-height: 1; pointer-events: none;
}
.hero-eyebrow {
  font-family: 'DM Mono', monospace; font-size: .7rem;
  letter-spacing: .15em; color: var(--copper); text-transform: uppercase; margin-bottom: .6rem;
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700;
  color: #f0e8dc; line-height: 1.2; margin-bottom: .8rem;
}
.hero-sub { color: #9a8878; font-size: .9rem; max-width: 600px; }
.hero-stats { display: flex; gap: 2rem; margin-top: 1.8rem; flex-wrap: wrap; }
.hstat { display: flex; flex-direction: column; }
.hstat-n { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--copper-lt); line-height: 1; }
.hstat-l { font-size: .75rem; color: #8a7868; letter-spacing: .05em; margin-top: .2rem; }

/* ── CARDS ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.card-title {
  font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600;
  color: var(--copper-dk); margin-bottom: 1rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--cream); display: flex; align-items: center; gap: .5rem;
}

/* ── GRIDS ── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.5rem; }
@media(max-width:900px){ .grid-3,.grid-4{ grid-template-columns:1fr 1fr; } }
@media(max-width:600px){ .grid-2,.grid-3,.grid-4{ grid-template-columns:1fr; } }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem; border-radius: 6px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none; transition: all .15s;
  font-family: inherit;
}
.btn-primary  { background: var(--copper); color: #fff; }
.btn-primary:hover  { background: var(--copper-dk); }
.btn-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn-secondary:hover { border-color: var(--copper); color: var(--copper); }
.btn-teal  { background: var(--teal); color: #fff; }
.btn-teal:hover { background: #1e4f4d; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* ── TAGS ── */
.tag {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 500; white-space: nowrap;
}
.tag-copper { background: #f3e4d6; color: var(--copper-dk); }
.tag-teal   { background: var(--teal-lt); color: var(--teal); }
.tag-warn   { background: #f3ecd4; color: var(--warn); }
.tag-danger { background: #f3dada; color: var(--danger); }
.tag-ok     { background: #d4ead9; color: var(--success); }
.tag-muted  { background: #ede8e0; color: var(--muted); }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: var(--ink); }
thead th {
  padding: .75rem 1rem; text-align: left;
  font-family: 'DM Mono', monospace; font-size: .72rem;
  letter-spacing: .08em; color: var(--copper-lt); font-weight: 500; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--teal-lt); }
tbody td { padding: .65rem 1rem; vertical-align: top; }
td a { color: var(--copper); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--copper-dk); text-decoration: underline; }
.mono { font-family: 'DM Mono', monospace; font-size: .82rem; }

/* ── FORMS ── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
label { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
input, select {
  padding: .55rem .85rem; border: 1.5px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--ink);
  font-size: .9rem; font-family: inherit; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(181,101,42,.12);
}

/* ── BAR ROWS ── */
.bar-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.bar-label {
  font-size: .78rem; color: var(--ink); min-width: 140px; max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-track { flex: 1; background: var(--cream); border-radius: 3px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; }
.bar-fill-copper { background: linear-gradient(90deg, var(--copper-dk), var(--copper-lt)); }
.bar-fill-teal   { background: linear-gradient(90deg, var(--teal), #4aaba8); }
.bar-fill-amber  { background: linear-gradient(90deg, var(--copper-dk), var(--amber)); }
.bar-count { font-family: 'DM Mono', monospace; font-size: .78rem; color: var(--muted); min-width: 36px; text-align: right; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.page-btn {
  padding: .4rem .7rem; border-radius: 5px; border: 1.5px solid var(--border);
  background: #fff; color: var(--muted); font-size: .82rem;
  cursor: pointer; transition: all .12s; font-family: inherit;
}
.page-btn:hover { border-color: var(--copper); color: var(--copper); }
.page-btn.active { background: var(--copper); border-color: var(--copper); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── MISC ── */
.section-title {
  font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 600;
  color: var(--ink); margin-bottom: 1.2rem; display: flex; align-items: center; gap: .6rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state .big { font-size: 3rem; margin-bottom: .5rem; }
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2.5px solid var(--border); border-top-color: var(--copper);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DETAIL TABLE ── */
.detail-table { width: 100%; font-size: .875rem; }
.detail-table td:first-child {
  color: var(--muted); width: 42%; padding: .45rem 0;
  font-size: .8rem; font-weight: 500; vertical-align: top;
}
.detail-table td:last-child { padding: .45rem 0; }

/* ── FOOTER ── */
footer {
  margin-top: 4rem; padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center; font-size: .78rem; color: var(--muted);
}
footer a { color: var(--copper); text-decoration: none; }

/* ── LOADING OVERLAY ── */
#page-loading {
  position: fixed; inset: 0; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; gap: 1rem;
}
#page-loading p { color: var(--muted); font-size: .9rem; }
