@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Inter:wght@400;500;600;700&family=Rye&display=swap");

:root {
  --leather: #2b1d14;
  --leather-2: #3a281b;
  --leather-3: #4a3424;
  --parchment: #f5ead3;
  --parchment-2: #efe1c4;
  --card: #fbf4e4;
  --ink: #2a1d12;
  --ink-soft: #6b5740;
  --brass: #c08a2e;
  --brass-2: #e0aa44;
  --gold: #f2c768;
  --rust: #a8521f;
  --oxblood: #8a2e20;
  --sage: #5c6b4f;
  --line: rgba(43, 29, 20, 0.14);
  --line-strong: rgba(43, 29, 20, 0.28);
  --shadow-sm: 0 2px 8px rgba(43, 29, 20, 0.1);
  --shadow-md: 0 12px 30px rgba(43, 29, 20, 0.16);
  --shadow-lg: 0 28px 60px rgba(43, 29, 20, 0.28);
  --radius: 14px;
  --radius-lg: 22px;
  --maxw: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.55;
  background-color: #e8d5b1;
  background-image:
    radial-gradient(900px circle at 12% -5%, rgba(240, 199, 104, 0.35), transparent 45%),
    radial-gradient(1000px circle at 100% 0%, rgba(168, 82, 31, 0.22), transparent 50%),
    radial-gradient(800px circle at 50% 120%, rgba(92, 107, 79, 0.18), transparent 55%),
    linear-gradient(160deg, #f2e2c2 0%, #e3cca3 50%, #d7bd92 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

a {
  color: var(--rust);
}

h1, h2, h3 {
  font-family: "Cinzel", serif;
  letter-spacing: 0.01em;
  color: var(--leather);
  line-height: 1.2;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--leather);
  color: var(--parchment);
  padding: 0.6rem 1rem;
  border-radius: 0 0 10px 0;
  z-index: 200;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(33, 22, 15, 0.97), rgba(43, 29, 20, 0.94));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(240, 199, 104, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.header-inner {
  width: min(var(--maxw), 94vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--parchment);
  flex-shrink: 0;
}

.brand-star {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, rgba(240, 199, 104, 0.25), rgba(43, 29, 20, 0.6));
  border: 1px solid rgba(240, 199, 104, 0.4);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--parchment);
}
.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav a {
  position: relative;
  color: rgba(245, 234, 211, 0.82);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover {
  color: var(--parchment);
  background: rgba(240, 199, 104, 0.12);
}
.nav a.active {
  color: var(--leather);
  background: linear-gradient(180deg, var(--gold), var(--brass));
  font-weight: 600;
}

.header-account {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.3rem 0.25rem 0.3rem;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.user-name {
  color: var(--parchment);
  font-weight: 600;
  font-size: 0.85rem;
}
.user-role {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: uppercase;
}

/* Burger */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
  cursor: pointer;
  padding: 8px;
}
.nav-burger span {
  width: 24px;
  height: 2px;
  background: var(--parchment);
  border-radius: 2px;
  transition: 0.2s;
}

/* ---------- Layout ---------- */
.page {
  width: min(var(--maxw), 94vw);
  margin: 1.8rem auto 3rem;
}

.section-head {
  text-align: center;
  margin: 2.4rem auto 1.2rem;
  max-width: 60ch;
}
.section-head h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  margin: 0 0 0.3rem;
}
.section-head p {
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 199, 104, 0.22), transparent 60%),
    linear-gradient(160deg, rgba(251, 244, 228, 0.96), rgba(239, 225, 196, 0.92));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 2.6rem 1.5rem 2.2rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: rise 0.6s ease;
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  height: 3px;
  left: 8%;
  right: 8%;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  opacity: 0.5;
}
.hero::before { top: 16px; }
.hero::after { bottom: 16px; }

.hero-emblem {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  color: var(--brass);
  background: radial-gradient(circle at 38% 30%, rgba(240, 199, 104, 0.35), rgba(43, 29, 20, 0.08));
  border: 2px solid var(--brass);
  box-shadow: inset 0 0 18px rgba(192, 138, 46, 0.3), var(--shadow-sm);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--rust);
  margin: 0 0 0.5rem;
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}

.motto {
  margin: 0.8rem auto 1.4rem;
  max-width: 52ch;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--leather-3);
}

.hero-cta {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}
.hero-welcome {
  margin: 0.4rem 0 0;
  font-size: 1.05rem;
  color: var(--leather-3);
}

/* ---------- Cards ---------- */
.option-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.option-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: linear-gradient(160deg, var(--card), var(--parchment-2));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.option-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}
.option-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  color: var(--leather);
  background: linear-gradient(160deg, var(--gold), var(--brass));
  box-shadow: var(--shadow-sm);
}
.option-card h3 {
  margin: 0.3rem 0 0;
  font-size: 1.2rem;
}
.option-card p {
  margin: 0;
  color: var(--ink-soft);
  flex: 1;
}
.option-go {
  font-weight: 600;
  color: var(--rust);
  font-size: 0.9rem;
}

/* ---------- Panels & lists ---------- */
.panel {
  background: linear-gradient(160deg, rgba(251, 244, 228, 0.97), rgba(245, 234, 211, 0.95));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-md);
}
.panel + .panel {
  margin-top: 1.2rem;
}
.panel h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}
.panel h2 {
  margin: 1.4rem 0 0.4rem;
  font-size: 1.25rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.narrow {
  width: min(560px, 94vw);
  margin: 3rem auto;
  text-align: center;
}

.list {
  margin-top: 1.2rem;
  display: grid;
  gap: 1rem;
}
.list-item {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--brass);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.list-item h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  border: 0;
  padding: 0;
}

/* ---------- Forms ---------- */
.stack {
  display: grid;
  gap: 0.9rem;
}
label span {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--leather-3);
}
input,
select,
textarea,
button {
  font: inherit;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: #fffdf8;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(192, 138, 46, 0.22);
}
textarea {
  min-height: 140px;
  resize: vertical;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  background: linear-gradient(160deg, var(--brass-2), var(--rust));
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}
.btn:active {
  transform: translateY(0);
}
.btn.big {
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
}
.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}
.btn.danger,
.btn-danger {
  background: linear-gradient(160deg, #b9402e, var(--oxblood));
}
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(240, 199, 104, 0.5);
  color: var(--parchment);
  box-shadow: none;
}
.btn-ghost:hover {
  background: rgba(240, 199, 104, 0.14);
}
.btn-discord {
  background: linear-gradient(160deg, #5865f2, #4752c4);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
}
.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 180px;
  width: auto;
}

/* ---------- Timeline ---------- */
.timeline {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.timeline-item {
  background: linear-gradient(160deg, rgba(239, 225, 196, 0.7), rgba(245, 234, 211, 0.5));
  border: 1px solid var(--line);
  border-left: 3px solid var(--sage);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}
.timeline-item p {
  margin: 0.1rem 0;
}
.timeline-item small {
  color: var(--ink-soft);
}

.wiki-content {
  background: #fffdf8;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.wiki-content h1,
.wiki-content h2,
.wiki-content h3 {
  margin-top: 1rem;
}

.notice {
  background: rgba(92, 107, 79, 0.14);
  border: 1px solid rgba(92, 107, 79, 0.4);
  border-left: 4px solid var(--sage);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
}
.hint {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------- Rank / status chips ---------- */
.rank-chip,
.user-role {
  display: inline-block;
}
.rank-chip {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--leather-3);
  color: var(--parchment);
  vertical-align: middle;
}
.rank-admin { background: linear-gradient(160deg, #7a1f1f, #4a1010); color: #ffe; }
.rank-commissioner { background: linear-gradient(160deg, #8a5a12, #5a3a08); color: #ffe; }
.rank-sheriff { background: linear-gradient(160deg, var(--brass), #7a5410); color: #fff; }
.rank-undersheriff { background: linear-gradient(160deg, #9a7320, #6a4e12); color: #fff; }
.rank-captain { background: linear-gradient(160deg, #5c6b4f, #3c4733); color: #fff; }
.rank-sargent { background: linear-gradient(160deg, #4f5b6b, #333d47); color: #fff; }
.rank-corporal { background: linear-gradient(160deg, #6b5740, #463829); color: #fff; }
.rank-deputy { background: linear-gradient(160deg, #7a6a52, #534736); color: #fff; }
.rank-cadet { background: linear-gradient(160deg, #8a8071, #5f574b); color: #fff; }
.rank-visitor { background: #6b5740; color: var(--parchment); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 3rem;
  background: linear-gradient(180deg, rgba(43, 29, 20, 0.96), rgba(33, 22, 15, 0.98));
  color: rgba(245, 234, 211, 0.7);
  border-top: 1px solid rgba(240, 199, 104, 0.2);
}
.footer-inner {
  width: min(var(--maxw), 94vw);
  margin: 0 auto;
  padding: 1.6rem 0;
  text-align: center;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-weight: 600;
}
.footer-note {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  font-style: italic;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Records dashboard layout ---------- */
.records-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.4rem;
  align-items: start;
}

.records-sidebar {
  position: sticky;
  top: 84px;
  background: linear-gradient(180deg, var(--leather-2), var(--leather));
  border: 1px solid rgba(240, 199, 104, 0.18);
  border-radius: var(--radius);
  padding: 1rem 0.8rem;
  box-shadow: var(--shadow-md);
}
.sidebar-label {
  margin: 0.2rem 0.5rem 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.sidebar-nav {
  display: grid;
  gap: 0.2rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 9px;
  text-decoration: none;
  color: rgba(245, 234, 211, 0.82);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover {
  background: rgba(240, 199, 104, 0.12);
  color: var(--parchment);
}
.sidebar-nav a.active {
  background: linear-gradient(160deg, var(--gold), var(--brass));
  color: var(--leather);
  font-weight: 600;
}
.sidebar-foot-link {
  display: block;
  margin-top: 0.9rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  color: var(--gold);
  text-decoration: none;
  border-top: 1px solid rgba(240, 199, 104, 0.14);
}
.sidebar-foot-link:hover {
  color: var(--parchment);
}

.records-main {
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.page-head h1 {
  margin: 0;
}
.page-sub {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.stat-card {
  display: grid;
  gap: 0.25rem;
  padding: 1.3rem;
  text-decoration: none;
  background: linear-gradient(160deg, var(--card), var(--parchment-2));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  color: var(--leather);
  background: linear-gradient(160deg, var(--gold), var(--brass));
  margin-bottom: 0.3rem;
}
.stat-num {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--leather);
  line-height: 1;
}
.stat-label {
  color: var(--ink-soft);
  font-weight: 500;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Form card (collapsible) */
.form-card {
  background: linear-gradient(160deg, rgba(251, 244, 228, 0.97), rgba(245, 234, 211, 0.95));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem 1.2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.4rem;
}
.form-card > summary {
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-weight: 600;
  color: var(--leather);
  padding: 0.8rem 0.2rem;
  list-style: none;
}
.form-card > summary::-webkit-details-marker { display: none; }
.form-card > summary::before {
  content: "+ ";
  color: var(--rust);
  font-weight: 700;
}
.form-card[open] > summary::before {
  content: "− ";
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

/* Record cards */
.record-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-sm);
  display: block;
}
.record-card + .record-card {
  margin-top: 0;
}
a.record-link {
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.record-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}
.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.record-head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.2rem;
  border: 0;
  padding: 0;
}
.record-id {
  font-family: "Inter", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--rust);
  background: rgba(168, 82, 31, 0.1);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.record-meta {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.record-body {
  margin: 0.9rem 0 0;
  white-space: pre-wrap;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.detail-key {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.qa-block {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.4rem;
}
.badge-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
}
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* Tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.tag {
  font-size: 0.8rem;
  background: rgba(92, 107, 79, 0.14);
  border: 1px solid rgba(92, 107, 79, 0.3);
  color: var(--leather-3);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.tag-muted {
  background: rgba(43, 29, 20, 0.06);
  border-color: var(--line);
  color: var(--ink-soft);
}
.link-chip {
  display: inline-block;
  margin-top: 0.7rem;
  font-weight: 600;
  font-size: 0.88rem;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-open,
.status-submitted,
.status-pending-approval { background: #fdf0d2; color: #8a5a12; border-color: #e7c878; }
.status-under-review,
.status-on-hold { background: #e6ecf5; color: #3a4d6b; border-color: #b6c6df; }
.status-approved,
.status-accepted,
.status-solved,
.status-resolved { background: #dff0df; color: #2f6b35; border-color: #a7d3aa; }
.status-rejected,
.status-closed { background: #f6dcd7; color: #8a2e20; border-color: #e0a69b; }

/* Priority badges */
.priority-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.priority-low { background: #e7ece3; color: #4a5a3e; }
.priority-normal { background: #e6ecf5; color: #3a4d6b; }
.priority-high { background: #fce8cf; color: #9a5a12; }
.priority-critical { background: #f6dcd7; color: #8a2e20; }

/* Chat thread (IA tickets) */
.chat-thread {
  display: grid;
  gap: 0.7rem;
  margin: 1.2rem 0;
}
.chat-bubble {
  background: linear-gradient(160deg, rgba(239, 225, 196, 0.7), rgba(245, 234, 211, 0.55));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  max-width: 85%;
}
.chat-bubble.chat-mine {
  margin-left: auto;
  background: linear-gradient(160deg, rgba(240, 199, 104, 0.28), rgba(192, 138, 46, 0.18));
  border-color: rgba(192, 138, 46, 0.35);
}
.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}
.chat-meta small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}
.chat-bubble p {
  margin: 0;
}

/* ---------- IA ticket meta card ---------- */
.ia-meta-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.ia-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.ia-meta-row .detail-key {
  min-width: 200px;
  flex-shrink: 0;
}
.ia-officer-name {
  font-weight: 600;
  color: var(--leather);
}
.ia-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.empty-state {
  text-align: center;
  padding: 2.4rem 1rem;
  color: var(--ink-soft);
  background: rgba(43, 29, 20, 0.03);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- Penal Code ---------- */
.pc-page {
  background: linear-gradient(160deg, rgba(251, 244, 228, 0.97), rgba(245, 234, 211, 0.95));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-md);
}

.pc-search-wrap {
  flex-shrink: 0;
}
.pc-search-wrap input {
  width: 280px;
  max-width: 100%;
}
.records-head-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.pc-section {
  margin-top: 1.6rem;
}
.pc-section-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}
.pc-cat-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.pc-cat-minor-felony {
  background: linear-gradient(160deg, #fce8cf, #f5d9b0);
  color: #7a4a10;
  border: 1px solid #e8c07a;
}
.pc-cat-serious-felony {
  background: linear-gradient(160deg, #f6dcd7, #f0c7be);
  color: #7a2218;
  border: 1px solid #e09a8e;
}
.pc-count {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.pc-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.pc-table thead {
  background: linear-gradient(180deg, var(--leather-2), var(--leather));
  color: var(--parchment);
}
.pc-table thead th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pc-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.pc-table tbody tr:last-child {
  border-bottom: 0;
}
.pc-table tbody tr:nth-child(even) {
  background: rgba(43, 29, 20, 0.025);
}
.pc-table tbody tr:hover {
  background: rgba(192, 138, 46, 0.1);
}
.pc-table td {
  padding: 0.75rem 1rem;
  vertical-align: top;
}
.pc-num {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.82rem;
  width: 36px;
  white-space: nowrap;
}
.pc-charge {
  font-weight: 600;
  color: var(--leather);
  width: 220px;
}
.pc-notes {
  color: var(--ink-soft);
  line-height: 1.45;
}
.pc-fine {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--sage);
  white-space: nowrap;
}
.pc-updated {
  margin-top: 1.2rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: right;
}

/* ---------- Roster ---------- */
.roster-group {
  margin-top: 1.4rem;
}
.roster-group-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.roster-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.roster-table thead {
  background: linear-gradient(180deg, var(--leather-2), var(--leather));
  color: var(--parchment);
}
.roster-table thead th {
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.roster-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.roster-table tbody tr:last-child { border-bottom: 0; }
.roster-table tbody tr:nth-child(even) { background: rgba(43, 29, 20, 0.025); }
.roster-table tbody tr:hover { background: rgba(192, 138, 46, 0.1); }
.roster-table td {
  padding: 0.6rem 0.9rem;
  vertical-align: middle;
}
.roster-avatar-cell { width: 48px; }
.roster-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: block;
}
.roster-name {
  font-weight: 600;
  color: var(--leather);
}
.roster-discrim {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.roster-days {
  font-weight: 700;
  color: var(--leather);
  font-size: 0.95rem;
}
.roster-days-label {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.roster-joined {
  font-size: 0.84rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.roster-select {
  width: auto;
  min-width: 130px;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

/* ---------- SOP Page ---------- */
.sop-chapter {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 2px solid var(--line-strong);
}
.sop-chapter:first-of-type { border-top: none; margin-top: 0.5rem; }
.sop-chapter-title {
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leather);
  margin-bottom: 0.7rem;
}
.sop-chapter-intro {
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 1rem;
  max-width: 76ch;
}
.sop-section {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.2rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.sop-section-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--leather);
  color: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.15rem;
}
.sop-section-body h3 {
  margin: 0 0 0.4rem;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  color: var(--leather);
}
.sop-section-body p { margin: 0 0 0.5rem; }
.sop-list {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
  color: var(--ink);
}
.sop-list li {
  margin-bottom: 0.35rem;
  line-height: 1.55;
}
.sop-list-def li { list-style: none; margin-left: -1.1rem; padding-left: 0; }
.sop-notice {
  margin-top: 0.7rem;
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--rust);
  background: rgba(139, 44, 44, 0.07);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  color: var(--ink);
}
.sop-notice-guiding {
  border-left-color: var(--brass);
  background: rgba(192, 138, 46, 0.09);
  margin-top: 1rem;
}

/* Chain of Command grid */
.coc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}
.coc-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
}
.coc-card .rank-chip { margin-bottom: 0.55rem; display: inline-block; }
.coc-card p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.5; }

/* Chain of Command vertical chain */
.coc-chain { display: flex; flex-direction: column; gap: 0; max-width: 680px; }
.coc-chain-item {
  display: grid;
  grid-template-columns: 2.2rem 2px 1fr;
  gap: 0 1rem;
  align-items: stretch;
}
.coc-chain-badge {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--parchment);
  flex-shrink: 0;
  z-index: 1;
  background: var(--leather);
}
.coc-badge-1 { background: linear-gradient(160deg, #b8860b, #8b6914); }
.coc-badge-2 { background: linear-gradient(160deg, #7a5c1e, #5c4010); }
.coc-badge-3 { background: linear-gradient(160deg, #6b4c2a, #4a3018); }
.coc-badge-4 { background: linear-gradient(160deg, #5c3d1e, #3d2810); }
.coc-badge-5 { background: linear-gradient(160deg, #4a3018, #2e1d0e); }
.coc-badge-6 { background: linear-gradient(160deg, #3d2810, #2a1a08); }
.coc-badge-7 { background: linear-gradient(160deg, #2e1d0e, #1e1208); }
.coc-badge-8 { background: linear-gradient(160deg, #1e1208, #120c04); }
.coc-chain-line {
  width: 2px;
  background: var(--line-strong);
  margin: 0 auto;
}
.coc-chain-last .coc-chain-line { visibility: hidden; }
.coc-chain-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow-sm);
}
.coc-chain-card .rank-chip { margin-bottom: 0.45rem; display: inline-block; }
.coc-chain-card p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.5; }

/* Operational procedures grid */
.sop-ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.sop-op-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.sop-op-title {
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--leather);
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

/* Sentencing table */
.sop-sentence-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.sop-sentence-table thead {
  background: linear-gradient(180deg, var(--leather-2), var(--leather));
  color: var(--parchment);
}
.sop-sentence-table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sop-sentence-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
}
.sop-sentence-table tbody tr:last-child td { border-bottom: 0; }
.sop-sentence-table tbody tr:nth-child(even) { background: rgba(43,29,20,0.03); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-burger {
    display: flex;
  }
  .nav {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    background: rgba(33, 22, 15, 0.99);
    border-bottom: 1px solid rgba(240, 199, 104, 0.2);
    padding: 0.5rem 6vw 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    padding-top: 0;
    padding-bottom: 0;
  }
  .nav-toggle:checked ~ .nav {
    max-height: 70vh;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
  }
  .nav a {
    padding: 0.8rem 0.6rem;
    border-radius: 8px;
    border-bottom: 1px solid rgba(240, 199, 104, 0.08);
  }
  .header-account .user-meta {
    display: none;
  }
  .records-layout {
    grid-template-columns: 1fr;
  }
  .records-sidebar {
    position: static;
  }
  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 1fr);
    overflow-x: auto;
  }
  .sidebar-foot-link {
    display: none;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .chat-bubble {
    max-width: 100%;
  }
}


