:root {
  --ledger-green: #16213D;        /* deep navy - sidebar, headings, links, primary buttons */
  --ledger-green-dark: #0E1830;   /* darker navy for hover */
  --ledger-gold: #2F6FEB;         /* accent blue - active states, badges, CTA buttons */
  --ledger-gold-soft: #AFC9F5;    /* light blue tint for subtext */
  --bg: #F2F4F8;
  --panel: #FFFFFF;
  --ink: #16213D;
  --ink-soft: #64708A;
  --line: #E4E8F0;
  --danger: #C0362C;
  --success: #2E7D46;
  --an-teal: #0FA3A3;
  --an-purple: #7C5CE0;
  --an-amber: #DB9A22;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

h1, h2, h3, .brand-title {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

/* ---- App shell ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 14px;
  gap: 14px;
}

.sidebar {
  width: 230px;
  background: linear-gradient(180deg, #1A2748 0%, var(--ledger-green) 55%, #10182E 100%);
  color: #E9EDF6;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(16, 24, 48, 0.28);
  overflow: hidden;
}

.sidebar .brand {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar .brand-title {
  color: #fff;
  font-size: 18px;
  margin: 0;
}

.sidebar .brand-sub {
  color: var(--ledger-gold-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar nav {
  flex: 1;
  padding: 14px 10px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: 12px;
  color: #C7D2E8;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar nav a.active {
  background: var(--ledger-gold);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(47, 111, 235, 0.35);
}

.sidebar .stage-count {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
}

.sidebar nav a.active .stage-count {
  background: rgba(0,0,0,0.2);
  color: #fff;
}

.sidebar .footer-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  color: #93A3C2;
}

.sidebar .footer-user a { color: var(--ledger-gold-soft); }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--ledger-gold-soft);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

/* ---- Main content ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 2px 10px rgba(16, 24, 48, 0.05);
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
}

.content {
  padding: 22px 26px 40px;
  flex: 1;
}

/* ---- Cards / panels ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.card h2, .card h3 {
  margin-top: 0;
  font-size: 15px;
  color: var(--ledger-green);
}

.stat-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ledger-gold);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 160px;
}

.stat-card .stat-number {
  font-family: 'Roboto Slab', serif;
  font-size: 26px;
  color: var(--ledger-green);
  font-weight: 700;
}

.cart-amt {
  font-size: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--ledger-green);
  background: var(--ledger-green);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: var(--ledger-green-dark); }

.btn-outline {
  background: transparent;
  color: var(--ledger-green);
}
.btn-outline:hover { background: rgba(22,33,61,0.06); }

.btn-gold {
  background: var(--ledger-gold);
  border-color: var(--ledger-gold);
  color: #fff;
}
.btn-gold:hover { background: #1E56C7; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- Forms ---- */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
  margin-top: 12px;
}

input[type=text], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=password], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ledger-gold);
  outline-offset: 0;
  border-color: var(--ledger-gold);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.form-grid p {
  margin: 0 0 12px;
}

.form-grid p label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.ledger-payment-form p:last-of-type {
  grid-column: span 2;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ledger-gold-soft);
  border-top-color: var(--ledger-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.info-note {
  background: #EEF1F7;
  border-left: 3px solid var(--ledger-gold);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 4px;
}

/* ---- Tables ---- */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  background: #EEF1F7;
  color: var(--ledger-green);
  padding: 9px 10px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--ledger-gold);
}

table.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

table.data-table tr:hover td { background: #F7F9FC; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #DCEFE1; color: var(--success); }
.badge-red { background: #FBE1DE; color: var(--danger); }
.badge-gold { background: #DCE8FC; color: #1E4FA8; }
.badge-gray { background: #E7EAF2; color: var(--ink-soft); }

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-bar input[type=text] { max-width: 280px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tabs a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}

.tabs a.active {
  color: var(--ledger-green);
  border-bottom-color: var(--ledger-gold);
}

.empty-state {
  padding: 30px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li {
  padding: 10px 14px;
  border-radius: 6px;
  background: #DCEFE1;
  color: var(--success);
  font-size: 13px;
  margin-bottom: 6px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ledger-green);
}

.login-card {
  background: var(--panel);
  padding: 34px 32px;
  border-radius: 10px;
  width: 320px;
  border-top: 4px solid var(--ledger-gold);
}

.login-card h1 {
  color: var(--ledger-green);
  font-size: 20px;
  margin: 0 0 4px;
}

.login-card p.sub {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin: 0 0 20px;
}

/* ---- Order Management: inline row actions ---- */
.row-action summary {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid var(--ledger-gold);
  color: var(--ledger-gold);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.row-action summary::-webkit-details-marker { display: none; }
.row-action[open] summary {
  background: var(--ledger-gold);
  color: #fff;
}
.row-action-body {
  margin-top: 10px;
  padding: 12px;
  background: #F7F9FC;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0 12px;
  align-items: end;
}
.row-action-body .full-row { grid-column: 1 / -1; }
.inline-date-form {
  display: flex;
  gap: 6px;
  align-items: center;
}
.inline-date-form input[type=date] { width: auto; }

.confirm-inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-right: 6px;
}
.confirm-inline-form input[type=number] { width: 90px; }
.confirm-inline-form input[type=date] { width: auto; }

#pm-f10-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #1f2937;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 9999;
}
#pm-f10-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Analytics module ===== */
.analytics-hero {
  background: linear-gradient(135deg, #16213D 0%, #1E3A78 55%, #2F6FEB 130%);
  border-radius: 18px;
  padding: 26px 28px;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: 0 14px 30px rgba(16, 24, 48, 0.22);
}
.analytics-hero p.sub {
  color: #C7D6F5;
  font-size: 13px;
  margin: 4px 0 0;
  max-width: 640px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.kpi-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(2px);
}
.kpi-card .kpi-label {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #C7D6F5;
}
.kpi-card .kpi-value {
  font-family: 'Roboto Slab', serif;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

/* Analytics module cards (hub) */
.module-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.module-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(16, 24, 48, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(16, 24, 48, 0.14);
}
.module-card .module-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ledger-gold), #1E4FA8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}
.module-card h3 { margin: 0; font-size: 16.5px; }
.module-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  flex: 1;
}

/* KPI stat strip used inside sub-pages (light theme) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-strip .stat-card { min-width: 0; }

/* Filter bar */
.analytics-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.analytics-filter-bar input[type=text],
.analytics-filter-bar input[type=date],
.analytics-filter-bar select {
  width: auto;
  min-width: 160px;
}

/* State-wise bar chart (SVG) */
.bar-chart-card { overflow-x: auto; }
.bar-chart-svg text { font-family: 'Inter', sans-serif; }
.bar-track { fill: #EEF1F7; }
.bar-fill {
  fill: url(#barGradient);
  transition: opacity 0.15s ease;
}
.bar-row:hover .bar-fill { opacity: 0.85; }
.bar-row.is-selected .bar-fill { fill: url(#barGradientSelected); }
.bar-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.bar-value { fill: var(--ink-soft); font-size: 11.5px; }

/* Timeline (party purchase history) */
.pm-timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.pm-timeline-item {
  position: relative;
  padding: 12px 16px 12px 20px;
  border-left: 2px solid var(--line);
  margin-left: 6px;
}
.pm-timeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ledger-gold);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--ledger-gold);
}
.pm-timeline-item.kind-ledger::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.pm-timeline-date {
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pm-timeline-title { font-size: 13.5px; font-weight: 600; color: var(--ink); margin: 2px 0; }
.pm-timeline-meta { font-size: 12px; color: var(--ink-soft); }

.design-chip {
  display: inline-block;
  background: #EEF1F7;
  border: 1px solid var(--line);
  color: var(--ledger-green);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  margin: 2px 4px 2px 0;
}

/* ================================================================
   ---- App-wide motion / micro-interactions ----
   Subtle animations layered on top of the existing UI. Nothing here
   changes layout or color — only timing, easing and small transforms.
   ================================================================ */

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

@keyframes pmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pmPopIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pmSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Whole app-shell settles in on load */
.app-shell {
  animation: pmFadeIn 0.35s ease both;
}

.sidebar {
  transition: box-shadow 0.25s ease;
}

.sidebar .brand-title,
.sidebar .brand-sub {
  animation: pmFadeUp 0.5s ease both;
}
.sidebar .brand-sub { animation-delay: 0.05s; }

/* Sidebar nav links: staggered entrance + smoother hover/active motion */
.sidebar nav a {
  animation: pmFadeUp 0.4s ease both;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.25s ease;
}
.sidebar nav a:nth-child(1) { animation-delay: 0.03s; }
.sidebar nav a:nth-child(2) { animation-delay: 0.06s; }
.sidebar nav a:nth-child(3) { animation-delay: 0.09s; }
.sidebar nav a:nth-child(4) { animation-delay: 0.12s; }
.sidebar nav a:nth-child(5) { animation-delay: 0.15s; }
.sidebar nav a:nth-child(6) { animation-delay: 0.18s; }
.sidebar nav a:nth-child(7) { animation-delay: 0.21s; }
.sidebar nav a:nth-child(8) { animation-delay: 0.24s; }
.sidebar nav a:nth-child(9) { animation-delay: 0.27s; }
.sidebar nav a:nth-child(10) { animation-delay: 0.3s; }

.sidebar nav a:hover {
  transform: translateX(3px);
}

.sidebar nav a.active {
  transform: translateX(2px);
}

.sidebar .stage-count {
  transition: transform 0.18s ease;
}
.sidebar nav a:hover .stage-count {
  transform: scale(1.08);
}

/* Topbar + page content glide in */
.topbar {
  animation: pmSlideDown 0.4s cubic-bezier(.2,.8,.25,1) both;
}

.content {
  animation: pmFadeUp 0.45s cubic-bezier(.2,.8,.25,1) both;
  animation-delay: 0.05s;
}

/* Cards lift gently on hover, and settle in on load */
.card {
  animation: pmFadeUp 0.4s ease both;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: 0 10px 24px -14px rgba(16, 24, 48, 0.25);
  transform: translateY(-1px);
}

.stat-row {
  animation: pmFadeUp 0.45s ease both;
  animation-delay: 0.08s;
}

.stat-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-left-color 0.2s ease;
}
.stat-card:hover {
  box-shadow: 0 12px 26px -14px rgba(16, 24, 48, 0.3);
  transform: translateY(-2px);
}
.stat-card .stat-number {
  transition: color 0.2s ease;
}

/* Buttons: soft lift + press feedback everywhere */
.btn, .btn-outline, .btn-gold, .lp-btn-login {
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.18s ease, opacity 0.18s ease;
}
.btn:hover, .btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -8px rgba(22, 33, 61, 0.4);
}
.btn:active, .btn-gold:active, .btn-outline:active {
  transform: translateY(0) scale(0.98);
}
.btn-outline:hover {
  transform: translateY(-1px);
}

/* Form fields: gentle focus glow instead of a hard snap */
input[type=text], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=password], select, textarea {
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.15);
}

/* Table rows: quick fade-in on load, smooth hover */
table.data-table tbody tr {
  animation: pmFadeIn 0.3s ease both;
}
table.data-table td {
  transition: background 0.15s ease;
}

/* Messages / toasts slide down and hover-lift on cards inside them */
.messages li {
  animation: pmSlideDown 0.3s cubic-bezier(.2,.8,.25,1) both;
}

.badge {
  transition: transform 0.15s ease;
}

.design-chip {
  transition: transform 0.15s ease, background 0.15s ease;
}
.design-chip:hover {
  transform: translateY(-1px);
  background: #E4E9F4;
}

/* Row-action expand/collapse gets a touch of motion */
.row-action-body {
  animation: pmFadeUp 0.25s ease both;
}
.row-action summary {
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Timeline items ease in */
.pm-timeline-item {
  animation: pmFadeUp 0.35s ease both;
}

/* Spinner stays as-is; toast gets a nicer pop */
#pm-f10-toast.show {
  animation: pmPopIn 0.18s cubic-bezier(.2,.8,.25,1) both;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


/* =========================================================
   Analytics Dashboard — Sales & Revenue Trends
   (colour-coded KPI strip, gradient trend chart with hover
   guide, revenue-mix donut, and refined data tables)
   ========================================================= */

.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 980px) {
  .an-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

.an-kpi-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px 14px;
  overflow: hidden;
  animation: pmFadeUp 0.4s ease both;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.an-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ledger-gold);
  opacity: 0.9;
}

.an-kpi-card.is-purple::before { background: var(--an-purple); }
.an-kpi-card.is-amber::before { background: var(--an-amber); }
.an-kpi-card.is-success::before { background: var(--success); }
.an-kpi-card.is-danger::before { background: var(--danger); }

.an-kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--ledger-gold-soft);
  box-shadow: 0 14px 28px -18px rgba(16, 24, 48, 0.35);
}

.an-kpi-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EAF1FE;
  color: var(--ledger-gold);
}

.an-kpi-icon svg { width: 18px; height: 18px; }

.an-kpi-card.is-danger .an-kpi-icon { background: #FBE1DE; color: var(--danger); }
.an-kpi-card.is-success .an-kpi-icon { background: #DCEFE1; color: var(--success); }
.an-kpi-card.is-purple .an-kpi-icon { background: #EEE9FD; color: var(--an-purple); }
.an-kpi-card.is-amber .an-kpi-icon { background: #FBEDD3; color: var(--an-amber); }

.an-kpi-body { min-width: 0; }

.an-kpi-label {
  font-size: 10.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
}

.an-kpi-value {
  font-family: 'Roboto Slab', serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--ledger-green);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.an-kpi-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--ink-soft);
}

.an-growth {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

.an-growth.up { background: #DCEFE1; color: var(--success); }
.an-growth.down { background: #FBE1DE; color: var(--danger); }
.an-growth.flat { background: #E7EAF2; color: var(--ink-soft); }

/* ---- Main grid: trend chart + revenue-mix donut ---- */
.an-main-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

@media (max-width: 1100px) {
  .an-main-grid { grid-template-columns: 1fr; }
}

.an-chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px 10px;
  box-shadow: 0 14px 30px -24px rgba(16, 24, 48, 0.3);
  animation: pmFadeUp 0.45s ease both;
  animation-delay: 0.04s;
  min-width: 0;
}

.an-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.an-chart-head h2 {
  margin: 0;
  font-size: 16px;
}

.an-chart-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.an-year-form { display: inline-flex; align-items: center; }

.an-year-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364708A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 9px center;
  background-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 28px 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ledger-green);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.an-year-select:hover { border-color: var(--ledger-gold-soft); }
.an-year-select:focus { outline: none; box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.15); }

.an-chart-wrap {
  position: relative;
  width: 100%;
}

.an-chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.an-area-path {
  animation: anFadeArea 0.9s ease both;
  animation-delay: 0.12s;
}

.an-line-path {
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: anDrawLine 1.1s cubic-bezier(.2,.8,.25,1) forwards;
  animation-delay: 0.08s;
}

.an-point {
  opacity: 0;
  animation: pmFadeIn 0.3s ease forwards;
  cursor: pointer;
}

.an-point circle:first-child {
  transition: r 0.15s ease;
}

.an-point:hover circle:first-child { r: 6.5; }

.an-grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.an-axis-label { fill: var(--ink-soft); font-size: 12px; font-family: 'Inter', sans-serif; }

.an-avg-line { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.55; }
.an-avg-label { fill: var(--ink-soft); font-size: 11.5px; font-weight: 600; font-family: 'Inter', sans-serif; }

.an-peak-tag rect { fill: var(--ledger-green); }
.an-peak-tag text { fill: #fff; font-size: 10.5px; font-weight: 700; font-family: 'Inter', sans-serif; }

.an-hover-guide {
  stroke: var(--ledger-gold);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.an-hover-guide.show { opacity: 0.55; }

.an-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ledger-green);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 12px 24px -8px rgba(16, 24, 48, 0.45);
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 5;
}

.an-tooltip.show { opacity: 1; transform: translate(-50%, -14px); }
.an-tooltip .an-tooltip-sub { color: var(--ledger-gold-soft); font-weight: 500; font-size: 10.5px; margin-top: 1px; }

/* ---- Revenue-mix donut card ---- */
.an-donut-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 14px 30px -24px rgba(16, 24, 48, 0.3);
  animation: pmFadeUp 0.45s ease both;
  animation-delay: 0.07s;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.an-donut-card h3 {
  margin: 0;
  font-size: 15px;
  color: var(--ledger-green);
}

.an-donut-sub {
  margin: 3px 0 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.an-donut-wrap {
  position: relative;
  width: 100%;
  max-width: 240px;
  margin: 6px auto 8px;
}

.an-donut-wrap svg { display: block; width: 100%; height: auto; }

.an-donut-slice {
  opacity: 0;
  animation: pmFadeIn 0.4s ease forwards;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.an-donut-wrap:hover .an-donut-slice { opacity: 0.45; }
.an-donut-wrap .an-donut-slice:hover { opacity: 1 !important; }

.an-donut-center-val {
  font-family: 'Roboto Slab', serif;
  font-weight: 700;
  fill: var(--ledger-green);
}

.an-donut-center-label {
  fill: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.an-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.an-donut-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.an-donut-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}

.an-donut-legend-name {
  color: var(--ink);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.an-donut-legend-pct {
  color: var(--ink-soft);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.an-donut-empty {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12.5px;
  padding: 30px 6px;
}

.an-two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

@media (max-width: 980px) {
  .an-two-col { grid-template-columns: 1fr; }
}

/* ---- Period breakdown table (under the chart) ---- */
.an-trend-table-wrap {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.an-trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.an-trend-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: right;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.an-trend-table thead th:first-child { text-align: left; }

.an-trend-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.an-trend-table tr:last-child td { border-bottom: none; }
.an-trend-table tr:hover td { background: #F7F9FC; }

.an-trend-period {
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  padding-right: 12px;
  white-space: nowrap;
}

.an-trend-amt { font-weight: 700; color: var(--ledger-green); font-variant-numeric: tabular-nums; }
.an-trend-muted { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.an-trend-bar-track {
  margin-top: 4px;
  max-width: none;
  margin-left: auto;
}

/* ---- Top parties table ---- */
.an-party-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.an-party-table th {
  text-align: left;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.an-party-table th.an-num { text-align: right; }

.an-party-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.an-party-table tr:last-child td { border-bottom: none; }
.an-party-table tr:hover td { background: #F7F9FC; }

.an-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #EEF2FB;
  color: var(--ledger-green);
  font-weight: 700;
  font-size: 11px;
}

.an-party-name { font-weight: 600; font-size: 13px; color: var(--ink); }
.an-party-company { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }

.an-party-bar-track {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: #EEF1F7;
  overflow: hidden;
  max-width: 220px;
}

.an-party-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ledger-gold), var(--an-teal));
  animation: anBarGrow 0.6s ease both;
  animation-delay: 0.1s;
}

.an-party-bills {
  text-align: right;
  color: var(--ink-soft);
  white-space: nowrap;
  padding-right: 10px;
  font-variant-numeric: tabular-nums;
}

.an-party-amt {
  text-align: right;
  font-weight: 700;
  color: var(--ledger-green);
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.an-snapshot-note {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 10px;
  line-height: 1.5;
}

@keyframes anDrawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes anFadeArea {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes anBarGrow {
  from { width: 0 !important; }
}

/* ---- Tighter on small phones ---- */
@media (max-width: 560px) {
  .an-kpi-card { padding: 11px 11px; gap: 9px; }
  .an-kpi-icon { width: 30px; height: 30px; border-radius: 8px; }
  .an-kpi-icon svg { width: 15px; height: 15px; }
  .an-kpi-value { font-size: 17px; }
  .an-kpi-label { font-size: 9.5px; }
  .an-kpi-sub { font-size: 10px; }
  .an-chart-card { padding: 13px 12px 6px; border-radius: 13px; }
  .an-chart-head h2 { font-size: 14px; }
  .an-donut-card { padding: 14px; }
  .card { padding: 13px; }
  .an-party-bar-track { max-width: 120px; }
}


/* ===== Analytics: tabs, design bar graph (scrollable), filters ===== */
.an-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.an-tabs a {
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); background: var(--panel); border: 1px solid var(--line); text-decoration: none;
}
.an-tabs a.active { background: var(--ledger-green); border-color: var(--ledger-green); color: #fff; }
.an-series-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.an-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft); }
.an-chip b { color: var(--ink); margin-left: 4px; }
.an-filter-form { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.an-design-card { margin-bottom: 14px; }
.an-bar-scroll { max-height: 440px; overflow-y: auto; padding-right: 6px; scrollbar-gutter: stable; }
.an-bar-scroll:focus-visible { outline: 2px solid var(--ledger-gold); outline-offset: 2px; }
.an-bar-row { display: grid; grid-template-columns: 28px minmax(130px, 220px) 1fr 120px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.an-bar-row:last-child { border-bottom: none; }
.an-bar-track { height: 14px; background: #E7EAF2; border-radius: 7px; overflow: hidden; }
.an-bar-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--an-teal), var(--ledger-gold)); }
.an-bar-val { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.an-bar-val small { display: block; color: var(--ink-soft); font-size: 10.5px; }
.an-donut-legend-amt { display: block; color: var(--ink-soft); font-size: 10.5px; font-weight: 500; }
.an-total-row td { border-top: 2px solid var(--line); font-weight: 700; }
.an-state-card { margin-top: 14px; }
.an-state-card a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
@media (max-width: 720px) {
  .an-bar-row { grid-template-columns: 24px 1fr 90px; }
  .an-bar-track { grid-column: 2 / 4; grid-row: 2; }
}

.an-design-filter { position: relative; display: inline-flex; align-items: center; }
.an-design-input { min-width: 210px; padding-right: 26px; }
.an-clear { position: absolute; right: 8px; font-size: 12px; color: var(--ink-soft); text-decoration: none; }
.an-bar-head { display: grid; grid-template-columns: 28px minmax(130px, 220px) 1fr 120px; gap: 12px; font-size: 11px; font-weight: 700; color: var(--ink-soft); padding: 0 0 6px; border-bottom: 2px solid var(--line); margin-top: 6px; }
.an-bar-head-r { text-align: right; }
@media (max-width: 720px) { .an-bar-head { display: none; } .an-design-input { min-width: 150px; } }

/* ---- Chart clarity: value labels, legend, disc line ---- */
.an-val-label { fill: var(--ink); font-size: 11.5px; font-weight: 700; font-family: 'Inter', sans-serif; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.an-val-label.is-peak { fill: var(--ledger-green); }
.an-disc-line { stroke: var(--an-purple); stroke-width: 2.2; stroke-dasharray: 6 4; stroke-linecap: round; }
.an-disc-dot { fill: var(--panel); stroke: var(--an-purple); stroke-width: 2; }
.an-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-lg-line { width: 18px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--an-teal), var(--ledger-gold)); }
.an-lg-line.is-disc { background: var(--an-purple); }
.an-lg-dash { width: 18px; border-top: 2px dashed var(--ink-soft); opacity: .7; }
.an-lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ledger-gold); }
.an-tooltip b { display: block; margin-bottom: 2px; }
.an-tooltip { white-space: nowrap; }

/* ---- Session 17: Employee Dashboard ---- */
.ed-section { margin-top: 14px; }
.ed-section h3 { margin: 0 0 10px; }
.ed-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ed-tile { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ledger-gold); border-radius: 12px; padding: 12px 14px; }
.ed-tile .n { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--ledger-green); }
.ed-tile .l { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.ed-tile.good { border-left-color: var(--success); }
.ed-tile.warn { border-left-color: var(--an-amber); }
.ed-tile.bad  { border-left-color: var(--danger); }
.ed-tile.bad .n { color: var(--danger); }
.ed-tile.hot  { border-left-color: var(--danger); }
.ed-tile.cold { border-left-color: var(--an-teal); }
.ed-note { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-soft); }
@media (max-width: 720px) { .ed-grid { grid-template-columns: repeat(2, 1fr); } .ed-tile .n { font-size: 24px; } }

/* ---- City combobox (static/js/city_dropdown.js): <input name=city> with a searchable list of the chosen State's cities ---- */
.pm-cb{position:relative;display:block;width:100%}
.pm-cb>input{width:100%;box-sizing:border-box;padding-right:38px!important}
.pm-cb-caret{position:absolute;right:1px;top:1px;bottom:1px;width:36px;border:0;background:transparent;border-radius:0 8px 8px 0;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0}
.pm-cb-caret i{width:7px;height:7px;border-right:2px solid var(--ink-soft);border-bottom:2px solid var(--ink-soft);transform:rotate(45deg) translateY(-2px);transition:transform .15s}
.pm-cb.open .pm-cb-caret i{transform:rotate(-135deg) translateY(-2px)}
.pm-cb.open>input{border-color:#3B6CF5;box-shadow:0 0 0 3px rgba(59,108,245,.14)}
.pm-cb-panel{position:absolute;z-index:80;left:0;right:0;top:calc(100% + 4px);margin:0;padding:4px;list-style:none;max-height:240px;overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 14px 34px rgba(20,30,70,.18)}
.pm-cb-panel[hidden]{display:none}
.pm-cb-panel li{padding:9px 10px;border-radius:7px;font-size:14px;color:var(--ink);cursor:pointer;line-height:1.25}
.pm-cb-panel li[data-v]:hover,.pm-cb-panel li.hl{background:#F3F6FF}
.pm-cb-panel li.on{font-weight:600;color:#1E4FA8;background:#EEF2FF}
.pm-cb-panel li.pm-cb-note{cursor:default;color:var(--ink-soft);font-size:12.5px;font-style:italic}
@media (max-width:640px){.pm-cb-panel{max-height:46vh}.pm-cb-panel li{padding:12px 12px;font-size:15px}}
