:root {
  --aus-burgundy: #983222;
  --aus-burgundy-dark: #7a2819;
  --aus-burgundy-light: #b84534;
  --aus-black: #000000;
  --aus-grey: #4D4F53;
  --aus-grey-light: #6b6d71;
  --aus-white: #FFFFFF;
  --aus-eng: #DF7A00;
  --aus-arts: #988642;
  --aus-biz: #8BA69C;
  --aus-arch: #9DABE2;

  --primary: var(--aus-burgundy);
  --primary-dark: var(--aus-burgundy-dark);
  --primary-light: var(--aus-burgundy-light);
  --bg: #f4f3f1;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: var(--aus-grey);
  --border: #d9d6d0;
  --border-light: #e8e6e2;
  --success: #2e7d32;
  --warning: var(--aus-eng);
  --danger: #c62828;
  --sidebar-w: 240px;
  --header-h: 56px;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 14px rgba(0,0,0,.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14.5px; }
body {
  font-family: Verdana, 'Segoe UI', Geneva, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

h1, h2, h3, .panel-header, .card-value, .sidebar-brand {
  font-family: Georgia, 'Charter ITC', 'Times New Roman', serif;
}

/* ── Layout ── */
html, body { overflow-x: hidden; }
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--aus-burgundy);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}
a.sidebar-brand, .sidebar-brand {
  display: block;
  padding: 20px 20px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.15);
  line-height: 1.35;
  color: #fff;
  text-decoration: none;
}
a.sidebar-brand:hover { opacity: .9; }
.sidebar-brand small {
  display: block;
  font-family: Verdana, sans-serif;
  font-size: .68rem;
  font-weight: 400;
  opacity: .75;
  margin-top: 3px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { border-bottom: 1px solid rgba(255,255,255,.06); }
.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  font-family: Verdana, sans-serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: rgba(255,255,255,.85);
  padding: 10px 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-heading:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-heading span { flex: 1; }
.nav-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .5;
  transition: transform .2s ease;
}
.nav-section.open .nav-chevron { transform: rotate(180deg); }
.nav-links {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.nav-section.open .nav-links { max-height: 600px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 18px 6px 30px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .74rem;
  font-weight: 400;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-left-color: #fff;
  font-weight: 700;
}
.sidebar-nav a svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.sidebar-footer {
  padding: 14px 20px;
  font-size: .72rem;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-footer #logout-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 400;
  transition: color .15s;
}
.sidebar-footer #logout-link:hover { color: #fff; }
.sidebar-footer #logout-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: .85;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-w));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  max-width: 100%;
  overflow: hidden;
}
.header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--aus-burgundy);
}
.header .meta {
  margin-left: auto;
  font-size: .75rem;
  color: var(--text-muted);
  font-family: Verdana, sans-serif;
}

.content { padding: 28px 32px 40px; flex: 1; max-width: 100%; min-width: 0; }

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--aus-burgundy);
}
.card-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: Verdana, sans-serif;
}
.card-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--aus-burgundy);
  line-height: 1.2;
}
.card-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Section panels ── */
.panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 28px;
  overflow: hidden;
  max-width: 100%;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
  font-weight: 700;
  color: var(--aus-burgundy);
  background: #faf8f6;
}
.panel-body { padding: 20px 24px; }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.data-table th {
  background: var(--aus-burgundy);
  color: #fff;
  font-weight: 700;
  font-family: Verdana, sans-serif;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
  padding: 9px 10px;
  position: sticky;
  top: 0;
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  word-break: break-word;
}
.data-table tbody tr:hover { background: #f7f4f0; }
.data-table tbody tr:nth-child(even) { background: #faf9f7; }
.data-table tbody tr:nth-child(even):hover { background: #f7f4f0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-success { background: #e8f5e9; color: #1b5e20; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger  { background: #fce4ec; color: #b71c1c; }
.badge-info    { background: #e3f2fd; color: #0d47a1; }
.badge-muted   { background: #f0efed; color: var(--aus-grey); }

/* ── Charts ── */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 280px;
  max-height: 400px;
}
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

/* ── Login page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--aus-burgundy);
  position: relative;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(0,0,0,.25) 0%, transparent 60%),
    linear-gradient(315deg, rgba(0,0,0,.15) 0%, transparent 50%);
}
.login-card {
  background: #fff;
  border-radius: 6px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
}
.login-card .aus-bar {
  height: 4px;
  background: var(--aus-burgundy);
  border-radius: 6px 6px 0 0;
  position: absolute;
  top: 0; left: 0; right: 0;
}
.login-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--aus-burgundy);
  margin-bottom: 4px;
}
.login-card p.subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-family: Verdana, sans-serif;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--aus-grey);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  font-family: Verdana, sans-serif;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus {
  border-color: var(--aus-burgundy);
  box-shadow: 0 0 0 2px rgba(152,50,34,.12);
}
.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--aus-burgundy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .88rem;
  font-family: Verdana, sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.btn-primary:hover { background: var(--aus-burgundy-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.login-error {
  background: #fce4ec;
  color: #b71c1c;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .8rem;
  margin-bottom: 16px;
  display: none;
  border-left: 3px solid #c62828;
}
.login-error.visible { display: block; }

/* ── Responsive ── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--aus-burgundy);
  cursor: pointer;
}
.menu-toggle svg { width: 24px; height: 24px; }

@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
  .link-cards { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; max-width: 100vw; }
  .menu-toggle { display: block; }
  .content { padding: 20px 16px 32px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .panel-body { padding: 16px; }
}

/* ── Misc ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .8em;
  background: #f0efed;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--aus-burgundy-dark);
}
.scroll-x { overflow-x: auto; }

/* ── Guide / prose pages ── */
.prose { line-height: 1.75; }
.prose.narrow { max-width: 860px; }

/* ── Table of Contents ── */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  border-left: 4px solid var(--aus-burgundy);
}
.toc-title {
  font-family: Georgia, serif;
  font-size: .92rem;
  font-weight: 700;
  color: var(--aus-burgundy);
  margin-bottom: 10px;
}
.toc ol {
  margin: 0;
  padding-left: 1.4em;
  list-style: decimal;
}
.toc li {
  margin-bottom: 4px;
  font-size: .84rem;
  line-height: 1.5;
}
.toc a {
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}
.toc a:hover { color: var(--aus-burgundy); text-decoration: underline; }
.prose h2 {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  color: var(--aus-burgundy);
  margin: 2rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border-light);
}
.prose h3 {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--aus-grey);
  margin: 1.5rem 0 .5rem;
}
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: .5rem 0 1rem 1.5rem; }
.prose li { margin-bottom: .35rem; }
.prose pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.6;
  margin: 1rem 0;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose .tip {
  background: #fff8e1;
  border-left: 4px solid var(--aus-eng);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-size: .88rem;
}
.prose .note {
  background: #e3f2fd;
  border-left: 4px solid var(--aus-arch);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-size: .88rem;
}
.prose a { color: var(--aus-burgundy); text-decoration: underline; }
.prose a:hover { color: var(--aus-burgundy-dark); }

/* ── Placeholder / coming-soon pages ── */
.placeholder-hero {
  text-align: center;
  padding: 80px 32px;
}
.placeholder-hero .icon-large {
  width: 64px;
  height: 64px;
  color: var(--aus-burgundy);
  opacity: .3;
  margin-bottom: 20px;
}
.placeholder-hero h2 {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  color: var(--aus-burgundy);
  margin-bottom: 8px;
}
.placeholder-hero p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Link cards grid ── */
.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
  border-top: 3px solid var(--aus-burgundy);
}
.link-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}
.link-card h3 {
  font-family: Georgia, serif;
  font-size: 1rem;
  color: var(--aus-burgundy);
  margin-bottom: 6px;
}
.link-card p {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Figure cards (sequential) ── */
.fig-seq { margin: 20px 0; }
.fig-seq .fig-card,
.fig-seq .fig-item,
.fig-seq .fig-panel {
  margin-bottom: 24px;
}
.fig-seq .fig-card:last-child,
.fig-seq .fig-item:last-child,
.fig-seq .fig-panel:last-child {
  margin-bottom: 0;
}

/* ── Iframe embed ── */
.embed-frame {
  width: 100%;
  min-height: 80vh;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #fff;
}
