/* =============================================================================
   TABLE OF CONTENTS
   (Ctrl+F the section name in CAPS below to jump to it in your editor)

   1.  ROOT VARIABLES & GLOBAL RESET
   2.  TOPBAR, LOGIN PAGE, FOOTERS, ANIMATIONS
   3.  SHARED PRIMITIVES (card, data-table base, buttons, pagination,
       spinner / empty-state / legend, tabs, kpi-strip legacy base)
   4.  MANUAL ENTRY (relocated verbatim -- UNTOUCHED, do not edit)
   5.  EDIT HISTORY (relocated verbatim -- UNTOUCHED, do not edit)
   6.  INTEGRATION DEBUG (relocated verbatim -- UNTOUCHED, do not edit)
   7.  OVERVIEW TAB (#view-overview, self-contained, font sizes fixed:
       16px titles / 14px body / 13px secondary, nothing smaller)
   8.  BREAKDOWN TAB (#view-breakdown, self-contained, font sizes fixed)
   9.  ALL TRIPS TAB (#view-all, self-contained, font sizes fixed)
   ============================================================================= */


/* ============================================================
   1. ROOT VARIABLES & GLOBAL RESET
   ============================================================ */

:root {
  --color-primary: #1b4965;
  --color-secondary: #5fa8d3;
  --color-accent: #62b6cb;
  --color-bg: #f4f7f9;
  --color-surface: #ffffff;
  --color-text: #1c2733;
  --color-muted: #1c2733;
  --color-success: #2e7d4f;
  --color-danger: #b3261e;
  --color-warning: #b8860b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Lato", -apple-system, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
}


/* ============================================================
   2. TOPBAR, LOGIN PAGE, FOOTERS, ANIMATIONS
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-primary);
  color: white;
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar .brand {
  font-weight: 700;
  font-size: 19.8px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
}

.topbar-logo {
  height: 28px;
  margin-right: 10px;
}

.topbar .user-info {
  font-size: 15.4px;
  opacity: 0.9;
}

.topbar button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}

.topbar button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-back-dashboard {
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-right: 12px;
}

.btn-back-dashboard:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* --- Billing doc search (topbar) --- */

.billing-search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin: 0 20px;
}

.billing-search-input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 14.3px;
}

.billing-search-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.billing-search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.18);
}

.billing-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}

.billing-search-empty {
  padding: 14px;
  font-size: 14.3px;
  color: var(--color-muted);
  text-align: center;
}

.billing-search-result-row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1.4fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid #eef1f4;
  font-size: 13.2px;
}

.billing-search-result-row:last-child {
  border-bottom: none;
}

.billing-search-result-row:hover {
  background: #eef5f9;
}

.billing-search-doc {
  font-weight: 700;
  color: var(--color-primary);
}

.billing-search-meta {
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billing-search-status {
  font-size: 12.1px;
  color: var(--color-muted);
  white-space: nowrap;
}

.billing-search-variance {
  font-weight: 700;
  text-align: right;
}

.billing-search-truncated {
  padding: 8px 14px;
  font-size: 12.1px;
  font-style: italic;
  color: var(--color-muted);
  text-align: center;
  border-top: 1px solid #eef1f4;
}

/* --- Login page --- */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 360px;
  text-align: center;
}

.login-logo {
  height: 48px;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 24.2px;
  margin: 0 0 6px;
  color: var(--color-primary);
  text-align: center;
  letter-spacing: -0.2px;
}

.login-card p.subtitle {
  color: var(--color-muted);
  opacity: 0.75;
  font-size: 14.3px;
  margin: 0 0 24px;
  text-align: center;
}

.field {
  margin-bottom: 16px;
  text-align: left;
}

.field label {
  display: block;
  font-size: 14.3px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 15.4px;
}

.field input:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 56px;
}

.btn-toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #8a97a3;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.btn-toggle-password:hover {
  color: var(--color-secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-secondary);
  font-size: 14.3px;
  cursor: pointer;
  padding: 0;
}

.error-msg {
  color: var(--color-danger);
  font-size: 14.3px;
  margin-top: 8px;
  min-height: 16px;
}

.success-msg {
  color: var(--color-success);
  font-size: 14.3px;
  margin-top: 8px;
}

.dev-otp-hint {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14.3px;
  margin-bottom: 16px;
  color: #7a5c00;
}

/* --- Footers --- */

.login-footer {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13.2px;
  color: var(--color-muted);
  opacity: 0.55;
}

.dashboard-footer {
  text-align: center;
  font-size: 13.2px;
  color: #8a8f98;
  padding: 24px 0 16px;
}

/* --- Animations --- */

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

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

@keyframes blinkBorder {
  0%, 100% { border-color: #d5dbe1; box-shadow: none; }
  50% { border-color: var(--color-secondary); box-shadow: 0 0 6px rgba(95, 168, 211, 0.6); }
}


/* ============================================================
   3. SHARED PRIMITIVES
   (card, data-table base, buttons, pagination, spinner /
   empty-state / legend, tabs, dashboard chrome)
   ============================================================ */

.dashboard-container {
  max-width: 1300px;
  margin: 24px auto;
  padding: 0 20px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-header h1 {
  font-size: 24.2px;
  color: var(--color-primary);
  margin: 0;
}

.data-as-of {
  font-size: 13.2px;
  color: var(--color-muted);
  margin-bottom: 14px;
}

.tabs {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: var(--color-bg);
  padding-top: 8px;
  padding-bottom: 4px;
  display: flex;
  gap: 4px;
  margin: 20px 0;
  border-bottom: 2px solid #dde3e8;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 15.4px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-rohit {
  color: var(--color-warning);
}

.view-panel {
  animation: fadeIn 0.25s ease-in;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card h3 {
  margin-top: 0;
  font-size: 16.5px;
  color: var(--color-text);
}

.chart-caption {
  font-size: 13.2px;
  color: var(--color-muted);
  margin-top: 8px;
}

.reference-card {
  background: #fbfcfd;
  box-shadow: none;
  border: 1px solid #e2e7eb;
}

.reference-card h3 {
  color: #3a4a5a;
}

.table-scroll-wrap {
  max-height: 560px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #e9edf0;
  border-radius: 4px;
  margin-top: 8px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.3px;
}

table.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: #eef1f4;
  color: var(--color-muted);
  font-weight: 600;
}

table.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f4;
}

.reference-table th {
  position: sticky;
  top: 0;
  background: #eef1f4;
  z-index: 1;
}

.reference-table td, .reference-table th {
  font-size: 13.2px;
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  font-size: 15.4px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #163a52;
}

.btn-primary:disabled {
  background: #a9b6c0;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.btn-export {
  background: var(--color-accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 4px;
}

.btn-text-link:hover {
  color: var(--color-primary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 4px;
}

.pagination-status {
  font-size: 13.2px;
  color: var(--color-muted);
  font-weight: 600;
}

.pagination-controls .btn-secondary {
  padding: 6px 14px;
  font-size: 13.2px;
}

.pagination-controls .btn-secondary:disabled {
  opacity: 0.4;
  cursor: default;
}

.spinner {
  border: 3px solid #dde3e8;
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  margin: 20px auto;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 40px;
  font-size: 15.4px;
}

.data-legend {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid #dde3e8;
  padding: 6px 16px;
  font-size: 14.3px;
  font-weight: 600;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.legend-real {
  background: var(--color-success);
}

.legend-unverified {
  background: var(--color-warning);
  margin-left: 12px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-real { background: #e2f3e8; color: var(--color-success); }
.badge-unverified { background: #fff3d6; color: var(--color-warning); }
.badge-neutral { background: #eceff1; color: #37474f; }
.badge-warning { background: #fff3d6; color: var(--color-warning); }
.badge-success { background: #e2f3e8; color: var(--color-success); }
.badge-overridden { background: #fce4ec; color: #ad1457; }

.gain { color: var(--color-success); font-weight: 700; }
.loss { color: var(--color-danger); font-weight: 700; }

/* Generic status/filter primitives reused by All Trips (kept here
   since .status-badge styling originates pre-tab-split) */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0.2px;
}

.status-completed { background: #e2f3e8; color: var(--color-success); }
.status-pending { background: #fff3d6; color: var(--color-warning); font-weight: 700; }
.status-transit { background: #eceff1; color: #607d8b; }
.status-attention { background: #fde2e1; color: var(--color-danger, #c62828); font-weight: 700; }
.status-depot { background: #ede7f6; color: #5e35b1; font-weight: 700; }
.status-gate { background: #fde2e1; color: var(--color-danger, #c62828); font-weight: 700; }

.late-entry-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  background: #fff3d6;
  color: var(--color-warning);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: help;
  white-space: nowrap;
}

.integration-card {
  border-left: 4px solid var(--color-primary);
}

.integration-confirmed { border-left-color: var(--color-secondary); }
.integration-unconfirmed { border-left-color: var(--color-warning); }

.integration-card pre {
  background: #f4f7f9;
  padding: 10px;
  border-radius: var(--radius);
  font-size: 13.2px;
  overflow-x: auto;
}


/* ============================================================
   4. MANUAL ENTRY
   (relocated verbatim from original Sections 4, 9-17 -- UNTOUCHED,
   do not edit sizes/layout here without an explicit separate request)
   ============================================================ */

.entry-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.entry-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.entry-card h2 {
  margin-top: 0;
  color: var(--color-primary);
  font-size: 20px;
}

.entry-field {
  margin-bottom: 22px;
}

.entry-field label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.entry-field input {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border: 2px solid #d5dbe1;
  border-radius: var(--radius);
}

.entry-field input:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.entry-field input[readonly],
.entry-field input.locked {
  background: #eef1f4;
  color: var(--color-muted);
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 10px;
}

.fields-grid .entry-field {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .fields-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .fields-grid { grid-template-columns: 1fr; }
}

.result-panel {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: #f0f5f8;
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.result-panel.show { display: block; }

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #dde3e8;
}

.result-row:last-child { border-bottom: none; }
.result-row .label { color: var(--color-muted); }

.calc-panel {
  background: white;
  border: 1px solid #dde3e8;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 10px;
  font-size: 13px;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-calc {
  width: 100%;
  background: var(--color-secondary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  margin-bottom: 8px;
}

.btn-calc:hover { background: #4a8fb8; }

.demo-filter-bar {
  margin: 12px 0;
  padding: 10px 14px;
  background: #eef7f0;
  border: 1px solid #cde8d3;
  border-radius: var(--radius);
}

.demo-toggle {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-toggle input { cursor: pointer; }

.no-scroll-page {
  overflow: auto;
  height: 100vh;
}

.entry-container-compact {
  max-width: 1750px;
  margin: 8px auto;
  padding: 0 16px;
  height: auto;
  overflow-x: hidden;
}

.entry-card-compact {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 20px;
}

.entry-field-compact {
  margin-bottom: 6px;
}

.entry-field-compact label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.entry-field-compact input {
  width: 100%;
  padding: 8px 10px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #d5dbe1;
  border-radius: var(--radius);
}

.entry-field-compact select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #ccc);
  border-radius: var(--radius);
  font-size: 19.8px;
  font-weight: 600;
  background: white;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px 16px;
  margin-bottom: 8px;
}

@media (max-width: 1300px) {
  .compact-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .compact-grid { grid-template-columns: repeat(2, 1fr); }
}

.ro-item {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 600;
}

.ro-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.gate-pending-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 10px 16px;
  color: #7a5c00;
  font-weight: 600;
  margin-bottom: 8px;
}

.result-panel-compact {
  background: #f0f5f8;
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px 24px;
}

@media (max-width: 1300px) {
  .result-panel-compact { grid-template-columns: repeat(4, 1fr); }
}

.time-picker-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-part {
  width: 44px;
  text-align: center;
  padding: 8px 4px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #d5dbe1;
  border-radius: var(--radius);
}

.ampm-select {
  padding: 8px 6px;
  border: 2px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
}

.qq-time-freegroup {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qq-time-freegroup select {
  padding: 8px 6px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #d5dbe1;
  border-radius: var(--radius);
  box-sizing: border-box;
  background: white;
}

#qq_time_hour, #qq_time_minute { width: 62px; }
#qq_time_ampm { width: 78px; font-weight: 700; }

.qq-time-colon {
  font-size: 20px;
  font-weight: 700;
  padding: 0 2px;
}

.window-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: none;
  letter-spacing: normal;
}

.journey-timeline { margin-top: 10px; }
.journey-step { padding: 6px 0; border-left: 2px solid #ddd; padding-left: 12px; margin-left: 4px; }
.journey-extra { margin-top: 2px; padding-left: 18px; }

.cadence-list {
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  padding-left: 18px;
}

.cadence-list li { margin-bottom: 4px; }

.field-active {
  animation: blinkBorder 1.4s ease-in-out infinite;
}

.code-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--color-muted);
  margin-left: 6px;
  font-weight: 400;
}

.btn-retry {
  margin-left: 10px;
  background: white;
  border: 1px solid #7a5c00;
  color: #7a5c00;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 13.2px;
  font-weight: 600;
  cursor: pointer;
}

.btn-retry:hover { background: #fff3cd; }

.save-reason {
  font-size: 13.2px;
  color: var(--color-muted);
  margin-top: 6px;
  min-height: 14px;
  text-align: center;
}

.btn-primary.btn-saved { background: #2e7d32; cursor: default; }
.btn-primary.btn-saved:hover { background: #2e7d32; }

.already-saved-banner {
  background: #e8f5e9;
  border: 2px solid #66bb6a;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.already-saved-heading {
  font-size: 17px;
  font-weight: 700;
  color: #1b5e20;
  margin-bottom: 4px;
}

.already-saved-detail {
  font-size: 15px;
  font-weight: 600;
  color: #1b5e20;
}

.save-snapshot {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #1b5e20;
}

.override-reason-panel {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.override-reason-panel label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #7a5c00;
}

.override-reason-panel textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 500;
  border: 2px solid #ffe082;
  border-radius: var(--radius);
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  min-height: 36px;
  height: 36px;
}

.override-confirm-panel {
  background: #f0f5f8;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}

.override-confirm-panel h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 700;
}

.diff-row {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  flex-wrap: nowrap;
  margin-right: 16px;
  margin-bottom: 8px;
  background: #eef3f6;
  border: 1px solid #d5dbe1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
}

.diff-label {
  min-width: 0;
  font-weight: 700;
  color: #33475b;
  margin-right: 8px;
}

.diff-old { color: #b3261e; text-decoration: line-through; }
.diff-new { color: #2e7d4f; font-weight: 700; }

.diff-attribution {
  margin-top: 6px;
  font-style: italic;
  color: var(--color-muted);
}

.provenance-strip { display: none; }

.ro-map-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.ro-map-link-active:hover {
  text-decoration: underline;
  cursor: pointer;
}

.history-section {
  margin-top: 16px;
  text-align: center;
}

.history-list {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e0e4e8;
  border-radius: var(--radius);
  padding: 8px 12px;
  text-align: left;
}

.history-row {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 1fr;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid #eef1f3;
}

.history-row:last-child { border-bottom: none; }
.history-field { font-weight: 600; color: var(--color-muted); }
.history-change { color: var(--color-text, #222); }
.history-when { color: var(--color-muted); text-align: right; }

.history-loading, .history-empty {
  font-size: 13px;
  color: var(--color-muted);
  padding: 10px 0;
  text-align: center;
}

@media (max-width: 900px) {
  .history-row { grid-template-columns: 1fr; gap: 2px; }
  .history-when { text-align: left; }
}

.billing-doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.billing-doc-row label {
  white-space: nowrap;
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 700;
}

.billing-doc-row input { flex: 1; }

.sap-data-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  row-gap: 6px;
  border-top: 3px solid #90a4ae;
  padding-top: 6px;
}

.sap-data-grid .ro-item { margin-bottom: 0; }

#editable-fields {
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  border-top: 3px solid #5c8aa8;
  padding-top: 6px;
  margin-top: 2px;
}

#editable-fields .entry-field-compact {
  display: flex;
  flex-direction: column;
  min-height: 78px;
  justify-content: flex-end;
}

#editable-fields label, #qq_time_label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 20px;
}

#editable-fields .window-hint {
  display: inline;
  font-size: 11px;
  white-space: nowrap;
}

#editable-fields input, #editable-fields select {
  width: 100%;
  box-sizing: border-box;
}

#result-panel .ro-item:has(#r-weather-status) { display: none; }

#result-panel {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 16px;
  border-top: 3px solid #66bb6a;
  padding-top: 6px;
  margin-top: 2px;
}

#result-panel .ro-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 600;
}

#result-panel .ro-label { font-size: 15px; font-weight: 700; }

#warnings-container, .gate-pending-banner { margin-bottom: 4px; }

@media print {
  .no-print, .topbar, #lookup-spinner, #submit-spinner { display: none !important; }
  .no-scroll-page { overflow: visible; height: auto; }
  .entry-container-compact {
    height: auto; overflow: visible; max-width: 100%; margin: 0; padding: 0;
  }
  .entry-card-compact { box-shadow: none; padding: 4px 8px; }
  body { font-size: 12.1px; transform: scale(0.92); transform-origin: top left; }
  .compact-grid, .result-panel-compact { gap: 4px 12px; margin-bottom: 4px; }
  .ro-item { font-size: 13.2px; }
  .ro-label { font-size: 11px; }
  .entry-field-compact label { font-size: 12.1px; }
  .entry-field-compact input, .entry-field-compact select {
    font-size: 13.2px; padding: 3px 6px; border-width: 1px;
  }
  .gate-pending-banner, .already-saved-banner, .save-snapshot {
    padding: 4px 8px; margin-bottom: 4px;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

/* ---- Success toast (manual_entry.js auth/UX pass) ---- */
.success-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f8a4c;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  box-shadow: var(--shadow);
}

.success-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media print {
  .success-toast { display: none !important; }
}

/* ============================================================
   5. EDIT HISTORY
   (relocated verbatim from original Sections 20, 27-28 --
   UNTOUCHED, do not edit sizes/layout here without an explicit
   separate request)
   ============================================================ */

.history-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  margin-bottom: 16px;
}

.history-title-row h3 { margin: 0; flex-shrink: 0; }

.history-title-row .history-filters {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.history-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0;
}

.history-filter-label {
  font-size: 13px;
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
}

.history-filters input[type="text"] {
  padding: 6px 10px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 13px;
  width: 200px;
  max-width: 200px;
}

.history-filters .btn-primary { padding: 6px 16px; width: auto; }
.history-filters .btn-text-link { padding: 6px 4px; }

.history-source-filters { display: flex; flex-wrap: wrap; gap: 8px; }

.history-source-select-wrap { position: relative; align-self: flex-start; }

.history-source-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d5dbe1;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  min-width: 200px;
  justify-content: space-between;
}

.history-source-select-btn:hover { border-color: var(--color-primary); }

.history-source-caret { font-size: 10px; color: var(--color-muted); }

.history-source-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  background: white;
  border: 1px solid #d5dbe1;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.source-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

.source-chip input { cursor: pointer; }

.source-chip-field-team { background: #e2f3e8; color: var(--color-success); }
.source-chip-manual-override, .source-chip-correction { background: #fce4ec; color: #ad1457; }
.source-chip-sap-sync, .source-chip-vts-sync, .source-chip-ro-master-resync { background: #eceff1; color: #607d8b; }

.history-filter-actions { display: flex; gap: 8px; }

.history-result-count {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 10px;
}

.history-event-card {
  background: white;
  border: 1px solid #e6eaee;
  border-left: 4px solid #b0bec5;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.event-correction { border-left-color: #ad1457; }
.event-first-entry { border-left-color: var(--color-success); }
.event-system { border-left-color: #90a4ae; opacity: 0.85; }

.history-event-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.history-event-title { display: flex; align-items: center; gap: 10px; }

.history-billing-link {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
  text-decoration: none;
}

.history-billing-link:hover { text-decoration: underline; }

.history-event-meta { font-size: 12px; color: var(--color-muted); }

.history-event-reason {
  font-size: 13px;
  font-style: italic;
  color: #7a5c00;
  background: #fff8e1;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.history-event-fields { display: flex; flex-direction: column; gap: 4px; }

.history-field-line { font-size: 13px; color: var(--color-text); }
.history-field-line.history-field-tva strong { color: var(--color-primary); }

.history-old { color: var(--color-danger); text-decoration: line-through; }
.history-new { color: var(--color-success); font-weight: 700; }

.history-journey-panel {
  background: #f7fafc;
  border: 1px solid #dde3e8;
  border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

@media print {
  body * { visibility: hidden; }
  #history-journey-panel, #history-journey-panel * { visibility: visible; }
  #history-journey-panel { position: absolute; top: 0; left: 0; width: 100%; }
  .no-print { display: none !important; }
}

.override-reason-counter {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  text-align: right;
}

.counter-insufficient { color: var(--color-danger); }
.counter-sufficient { color: var(--color-success); }

.journey-override-flag {
  background: #fff3e0;
  border: 1px solid #f5c26b;
  border-left: 4px solid #d97706;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: #7a4a00;
}

.jt-wrap { font-family: inherit; color: #1a2530; }

.jt-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  margin-bottom: 10px;
}

.jt-header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.jt-header-left h4 {
  white-space: nowrap;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #0f1f2e;
  display: flex;
  align-items: center;
  gap: 10px;
}

.jt-header-left h4 strong { color: #000; font-weight: 700; font-size: 15px; margin-left: 0; }

.jt-facts {
  font-size: 13px;
  font-weight: 400;
  color: #33424f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1.5px solid #b8c8d4;
  padding-left: 14px;
}

.jt-facts b { color: #0f1f2e; font-weight: 600; font-size: 13px; }
.jt-facts-sep { color: #9aa8b3; font-weight: 400; }

.jt-print-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 500;
  background: var(--color-secondary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.jt-print-btn:hover { background: #143a52; }

.jt-timeline-strip {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #eef3f7;
  border-radius: var(--radius);
  border: 1.5px solid #b8c8d4;
}

.jt-tl-step { flex: 1; text-align: center; position: relative; }

.jt-tl-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 7px;
  right: -50%;
  width: 100%;
  height: 3px;
  background: #7d95a6;
  z-index: 0;
}

.jt-tl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-secondary);
  border: 2px solid #0f1f2e;
  margin: 0 auto 6px;
  position: relative;
  z-index: 1;
}

.jt-tl-dot-pending { background: white; border-color: #b8c8d4; }

.jt-tl-label { font-size: 12.5px; font-weight: 600; color: #0f1f2e; }
.jt-tl-time { font-size: 11.5px; color: #33424f; font-weight: 400; margin-top: 1px; }
.jt-tl-extra { font-size: 10.5px; color: #55606b; margin-top: 1px; }

.jt-main-row { display: grid; grid-template-columns: 190px 1fr; gap: 16px; }

@media (max-width: 900px) {
  .jt-main-row { grid-template-columns: 1fr; }
}

.jt-hero {
  background: #eef3f7;
  border: 1.5px solid #b8c8d4;
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.jt-hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #33424f;
}

.jt-hero-value { font-size: 28px; font-weight: 700; line-height: 1.15; margin: 6px 0; }
.jt-hero-value.gain { color: #157347; }
.jt-hero-value.loss { color: #c0392b; }
.jt-hero-pending { font-size: 16px; font-weight: 500; color: #55606b; }
.jt-hero-outcome { font-size: 12px; font-weight: 400; color: #33424f; }

.jt-cards-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 700px) {
  .jt-cards-row { grid-template-columns: 1fr; }
}

.jt-card {
  background: #eef3f7;
  border: 1.5px solid #b8c8d4;
  border-radius: var(--radius);
  padding: 10px 14px;
}

.jt-card-calc { background: #e3ecf3; border-color: #9fb8c9; }
.jt-card-stack { display: flex; flex-direction: column; gap: 12px; }
.jt-corrected-badge { color: #c0392b; font-weight: 600; margin-left: 8px; }

.jt-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #0f1f2e;
  margin-bottom: 6px;
  border-bottom: 1.5px solid #b8c8d4;
  padding-bottom: 4px;
}

.jt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 2px 0;
  line-height: 1.4;
}

.jt-row span:first-child { color: #33424f; font-weight: 400; }
.jt-row span:last-child { font-weight: 500; color: #0f1f2e; text-align: right; }


/* ============================================================
   6. INTEGRATION DEBUG
   (relocated verbatim from original Sections 7, 18 (history
   toggle/source badges) -- UNTOUCHED)
   ============================================================ */

.product-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 700px) {
  .product-compare-grid { grid-template-columns: 1fr; }
}

.product-compare-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--color-secondary);
  text-align: left;
}

.product-compare-card.product-hsd { border-left-color: var(--color-primary); }
.product-compare-card.product-ebms { border-left-color: var(--color-accent); }

.product-compare-label {
  font-size: 13.2px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 700;
}

.product-compare-value {
  font-size: 28.6px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.product-compare-sub { font-size: 14.3px; color: var(--color-muted); }

.product-compare-bar-track {
  width: 100%;
  height: 8px;
  background: #e5ecf1;
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.product-compare-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.product-hsd .product-compare-bar-fill { background: var(--color-primary); }
.product-ebms .product-compare-bar-fill { background: var(--color-accent); }

.chart-tall-container { position: relative; width: 100%; }
.chart-tall-container canvas { max-height: 480px; }

.chart-topn-note {
  font-size: 13.2px;
  color: var(--color-muted);
  margin-top: 6px;
  font-style: italic;
}

.chart-empty-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--color-muted);
  text-align: center;
}

.chart-empty-overlay .chart-empty-icon { font-size: 30.8px; margin-bottom: 8px; opacity: 0.5; }
.chart-empty-overlay .chart-empty-text { font-size: 14.3px; max-width: 320px; }

.history-toggle-bar {
  margin: 12px 0;
  padding: 10px 14px;
  background: #eef7f0;
  border: 1px solid #cde8d3;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.history-toggle-label {
  font-size: 14.3px;
  font-weight: 600;
  color: var(--color-success);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-toggle-label input { cursor: pointer; }

.history-toggle-count { font-size: 13.2px; color: var(--color-muted); }

.history-row-system { opacity: 0.55; }
.history-row-system:hover { opacity: 0.85; }
.history-row-human { opacity: 1; }

.history-source-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.history-source-badge.source-field-team { background: #e2f3e8; color: var(--color-success); }
.history-source-badge.source-manual-override { background: #fce4ec; color: #ad1457; }
.history-source-badge.source-sap-sync,
.history-source-badge.source-vts-sync,
.history-source-badge.source-ro-master-resync { background: #eceff1; color: #607d8b; }

.history-tva-field {
  font-weight: 700;
  color: var(--color-primary);
  position: relative;
  padding-left: 10px;
}

.history-tva-field::before {
  content: "";
  position: absolute;
  left: 0; top: 2px; bottom: 2px;
  width: 3px;
  background: var(--color-warning);
  border-radius: 2px;
}

.history-delta {
  font-size: 13.2px;
  font-weight: 700;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
}

.history-delta-up { color: var(--color-success); background: #e2f3e8; }
.history-delta-down { color: var(--color-danger); background: #fbe9e7; }

.history-reason { font-size: 13.2px; font-style: italic; color: var(--color-muted); }
.history-reason.history-reason-empty { opacity: 0.5; }

.history-link-cell { text-align: center; }

.history-row-link {
  font-size: 13.2px;
  font-weight: 700;
  color: var(--color-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.history-row-link:hover { text-decoration: underline; color: var(--color-primary); }

.log-filter-bar { display: flex; gap: 8px; margin: 10px 0; }

.log-filter-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 14.3px;
}


/* ============================================================
   7. OVERVIEW TAB (#view-overview)
   Self-contained. Font sizes fixed per locked hierarchy:
   16px titles / 14px body / 13px secondary -- nothing smaller.
   Section 23 (old unscoped responsibility-chip fallback) folded
   in here and removed as a separate section -- was dead code,
   fully superseded by this scoped version.
   ============================================================ */

#view-overview {
  font-size: 14px;
}

#view-overview .tva-ov-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

#view-overview .tva-ov-topline .data-as-of { margin-bottom: 0; }

#view-overview .tva-ov-daterow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#view-overview .tva-ov-daterow label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
}

#view-overview .tva-ov-daterow input,
#view-overview .tva-ov-daterow select {
  font-size: 14px;
  font-family: inherit;
  padding: 3px 7px;
  border: 1px solid #d5dbe1;
  border-radius: 6px;
  background: #fff;
}

#view-overview .tva-ov-daterow button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
}

#view-overview .tva-ov-sd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 2px 7px 2px;
}

#view-overview .tva-ov-sd .tva-ov-badge {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--color-primary);
  color: #fff;
}

#view-overview .tva-ov-sd.tva-ov-ops .tva-ov-badge { background: #2B3A4A; }

#view-overview .tva-ov-sd .tva-ov-sd-desc {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
}

#view-overview .tva-ov-sd .tva-ov-sd-line {
  flex: 1;
  height: 1px;
  background: #e6eaee;
}

#view-overview .tva-ov-hero {
  background: linear-gradient(135deg, #081A30 0%, #0F2A4A 60%, #1a3a5c 100%);
  border-radius: 12px;
  padding: 10px 18px;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

#view-overview .tva-ov-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(201,162,39,.12) 0%, transparent 70%);
}

#view-overview .tva-ov-eyebrow {
  color: #C9A227;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

#view-overview .tva-ov-hnums {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  position: relative;
  z-index: 1;
}

#view-overview .tva-ov-hstat .tva-ov-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17.6px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

#view-overview .tva-ov-hstat .tva-ov-num.gold { color: #C9A227; }
#view-overview .tva-ov-hstat .tva-ov-num.r { color: #FF6B6B; }
#view-overview .tva-ov-hstat .tva-ov-num.g { color: #4ADE80; }

#view-overview .tva-ov-hstat .tva-ov-label {
  color: rgba(255,255,255,.55);
  font-size: 13px;
  font-weight: 600;
  margin-top: 3px;
  text-transform: uppercase;
}

#view-overview .tva-ov-g12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

#view-overview .tva-ov-c2 { grid-column: span 2; }
#view-overview .tva-ov-c3 { grid-column: span 3; }
#view-overview .tva-ov-c4 { grid-column: span 4; }
#view-overview .tva-ov-c5 { grid-column: span 5; }
#view-overview .tva-ov-c6 { grid-column: span 6; }
#view-overview .tva-ov-c7 { grid-column: span 7; }
#view-overview .tva-ov-c8 { grid-column: span 8; }
#view-overview .tva-ov-c12 { grid-column: span 12; }

#view-overview .tva-ov-card {
  background: var(--color-surface);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 9px 12px;
}

#view-overview .tva-ov-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 1px 0;
  color: var(--color-text);
}

#view-overview .tva-ov-card .tva-ov-sub {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 5px;
}

#view-overview .tva-ov-card .tva-ov-chart-wrap { position: relative; height: 165px; }
#view-overview .tva-ov-card .tva-ov-chart-wrap.short { height: 135px; }
#view-overview .tva-ov-card .tva-ov-chart-wrap.tall { height: 190px; }

#view-overview table.tva-ov-dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#view-overview table.tva-ov-dt th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 3px 5px;
  border-bottom: 1.5px solid #e6eaee;
}

#view-overview table.tva-ov-dt td {
  padding: 3px 5px;
  border-bottom: 1px solid #e6eaee;
}

#view-overview .tva-ov-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

#view-overview .tva-ov-pill.g { background: #e2f3e8; color: var(--color-success); }
#view-overview .tva-ov-pill.r { background: #fbe9e7; color: var(--color-danger); }
#view-overview .tva-ov-pill.a { background: #fff3d6; color: var(--color-warning); }

#view-overview .tva-ov-mk {
  text-align: center;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 112px;
}

#view-overview .tva-ov-mk .tva-ov-v {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

#view-overview .tva-ov-mk:not(.tva-ov-mk-ring) .tva-ov-v {
  font-size: 37.4px;
  line-height: 1;
  margin-bottom: 8px;
}

#view-overview .tva-ov-mk-ring .tva-ov-v { font-size: 16.5px; }

#view-overview .tva-ov-mk .tva-ov-l {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

#view-overview .tva-ov-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex-direction: column;
  gap: 5px;
  color: #9BA5B0;
  font-size: 13px;
  text-align: center;
  padding: 8px;
}

#view-overview .tva-ov-chart-empty .tva-ov-chart-empty-icon { font-size: 19.8px; }

/* Responsibility summary chips -- scoped to Overview only.
   This replaces the old standalone Section 23 entirely; there is
   no other usage of .responsibility-summary / .responsibility-chip
   anywhere else in the app, so no fallback/base version is needed. */

#view-overview .responsibility-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

#view-overview .responsibility-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: white;
  border: 1px solid #e6eaee;
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#view-overview .responsibility-chip:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(27, 73, 101, 0.08);
}

#view-overview .responsibility-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

#view-overview .responsibility-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
}

#view-overview .tva-ov-mk-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#view-overview .tva-ov-ring-wrap { position: relative; width: 76px; height: 76px; }

#view-overview .tva-ov-ring-wrap canvas {
  position: absolute; top: 0; left: 0;
  width: 76px; height: 76px;
}

#view-overview .tva-ov-ring-num {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 19.8px;
  font-weight: 700;
}

#view-overview .tva-ov-gainloss-bar-wrap {
  position: relative;
  z-index: 1;
  margin-top: 8px;
}

#view-overview .tva-ov-gainloss-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,.1);
}

#view-overview .tva-ov-gainloss-seg { height: 100%; transition: width .6s ease; }
#view-overview .tva-ov-gainloss-gain { background: #4ADE80; }
#view-overview .tva-ov-gainloss-loss { background: #FF6B6B; }

#view-overview .tva-ov-variance-note {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  line-height: 1.4;
}

#view-overview .tva-ov-variance-note strong {
  color: rgba(255,255,255,.85);
  font-weight: 700;
}

#view-overview .tva-ov-callout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

#view-overview .tva-ov-callout-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
}

#view-overview .tva-ov-callout-bad {
  background: rgba(194, 59, 59, 0.08);
  border: 1px solid rgba(194, 59, 59, 0.25);
}

#view-overview .tva-ov-callout-good {
  background: rgba(27, 138, 90, 0.08);
  border: 1px solid rgba(27, 138, 90, 0.25);
}

#view-overview .tva-ov-callout-icon {
  font-size: 16px;
  line-height: 1.3;
  flex-shrink: 0;
}

#view-overview .tva-ov-callout-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(20, 30, 40, 0.9);
}

#view-overview .tva-ov-callout-detail {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(20, 30, 40, 0.65);
  margin-top: 2px;
}

@media (max-width: 1100px) {
  #view-overview .tva-ov-hnums { grid-template-columns: repeat(3, 1fr); }
  #view-overview .tva-ov-c2,
  #view-overview .tva-ov-c3,
  #view-overview .tva-ov-c4,
  #view-overview .tva-ov-c5,
  #view-overview .tva-ov-c6,
  #view-overview .tva-ov-c7,
  #view-overview .tva-ov-c8 {
    grid-column: span 12;
  }
}

/* NOTE: .tva-ov-trigger / .tva-ov-itag rules intentionally NOT
   carried forward into this reorganized file. The "Trips Above
   ₹500 Review Threshold" panel markup and its JS were removed
   from dashboard.html/dashboard.js in an earlier session (dead,
   disconnected mechanism). Since this reorg already requires
   rewriting the file from scratch, this is the natural point to
   drop the dead CSS too, rather than carry it forward again.
   If you ever restore that panel's HTML, say so and I'll restore
   this CSS from the original file's Section 29. */


/* ============================================================
   8. BREAKDOWN TAB (#view-breakdown)
   Self-contained. Uses shared .card / .data-table / .btn-primary
   / .btn-secondary / .pagination-controls from Section 3.
   Font sizes fixed per locked hierarchy: 14px body / 13px
   secondary -- nothing smaller.
   ============================================================ */

#view-breakdown .breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

#view-breakdown .breakdown-header h3 { margin: 0; }

#view-breakdown .chart-caption {
  font-size: 14px;
}

#view-breakdown .groupby-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
}

#view-breakdown .groupby-control select,
#view-breakdown .groupby-control input {
  padding: 6px 10px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-primary);
  background: white;
  cursor: pointer;
}

#view-breakdown .breakdown-footer-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#view-breakdown .breakdown-footer-row .btn-secondary {
  font-size: 14px;
  font-family: inherit;
  flex: 0 0 auto;
  width: auto;
}

#view-breakdown .breakdown-table { margin-top: 10px; }

#view-breakdown .drill-toggle-col { width: 28px; }

#view-breakdown .drill-arrow {
  color: var(--color-secondary);
  font-size: 13px;
  display: inline-block;
  width: 16px;
}

#view-breakdown .breakdown-row-l1,
#view-breakdown .breakdown-row-l2 {
  cursor: pointer;
  transition: background 0.12s ease;
}

#view-breakdown .breakdown-row-l1:hover,
#view-breakdown .breakdown-row-l2:hover {
  background: #eef5f9;
}

#view-breakdown .breakdown-row-expanded {
  background: #e2eef5;
  font-weight: 600;
}

#view-breakdown .breakdown-row-expanded:hover { background: #e2eef5; }

#view-breakdown .breakdown-subrow-wrap td {
  padding: 0;
  border-bottom: none;
}

#view-breakdown .drill-nested {
  background: #f7fafc;
  border-left: 3px solid var(--color-secondary);
  padding: 10px 10px 10px 24px;
  margin: 4px 0;
}

#view-breakdown .breakdown-table-nested { background: transparent; }

#view-breakdown .breakdown-table-nested th {
  background: #eef3f6;
  font-size: 13px;
}

#view-breakdown .breakdown-trips-table th {
  background: #eaf1ea;
  font-size: 13px;
}

#view-breakdown .breakdown-trips-table td,
#view-breakdown .breakdown-trips-table th {
  font-size: 13px;
  padding: 6px 8px;
}

#view-breakdown .breakdown-download-col { width: 1px; }

#view-breakdown .breakdown-download-cell {
  text-align: right;
  white-space: nowrap;
}

#view-breakdown .breakdown-row-download-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d5dbe1;
  border-radius: 6px;
  background: #fff;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

#view-breakdown .breakdown-row-download-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

#view-breakdown .breakdown-row-download-btn:active { transform: scale(0.96); }

/* Pivot Builder + Outlier Trips panels reuse the shared .card,
   .groupby-control, .chart-caption -- already sized above. */

#view-breakdown .tva-ov-chart-wrap.tall {
  position: relative;
  height: 190px;
}

#view-overview .tva-badge-lowsample {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  background: #f3f4f6;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ============================================================
   9. ALL TRIPS TAB (#view-all)
   Self-contained. Uses shared .card / .reference-card /
   .data-table / .reference-table / .pagination-controls /
   .status-badge / .late-entry-flag from Section 3.
   Font sizes fixed per locked hierarchy: 14px body / 13px
   secondary -- nothing smaller.
   ============================================================ */

#view-all .all-trips-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
  row-gap: 10px;
}

#view-all .filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

#view-all .filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

#view-all .filter-group input[type="date"],
#view-all .filter-group input[type="text"],
#view-all .filter-group input[type="number"] {
  padding: 6px 10px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 140px;
}

#view-all .filter-group select {
  padding: 6px 10px;
  border: 1px solid #d5dbe1;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  background: white;
  cursor: pointer;
  max-width: 160px;
}

#view-all .filter-group select:hover { border-color: var(--color-primary); }

#view-all .btn-text-link {
  font-size: 14px;
}

#view-all .status-help-icon {
  font-size: 13px;
  opacity: 0.6;
  cursor: help;
}

#view-all .status-badge:hover .status-help-icon { opacity: 1; }


/* ============================================================
   END OF FILE
   ============================================================ */