/* frontend/css/style.css - AgriConnect Styling */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@500;600;700&display=swap');

/* ==========================================================================
   Single Source of Truth Theme Tokens (WCAG AA Compliant)
   ========================================================================== */
:root {
  /* 13 Core Theme Tokens */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #4A3728;
  --text-muted: #7A6A5A;
  --border: #D8CFC0;
  --accent: #E8B94A;
  --accent-text: #4A3728;
  --header-band: #02BD01;
  --header-text: #FFFFFF;
  --success: #02BD01;
  --danger: #B6512C;
  --icon: #4A3728;
  --icon-muted: #7A6A5A;

  /* Semantic UI Tokens derived from single source */
  --bg-warm: var(--bg);
  --bg-card: var(--surface);
  --bg-card-alt: #F0EAE1;
  --card: var(--surface);
  --paper: var(--bg);
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --border-color: var(--border);
  --border-focus: var(--header-band);
  --line: var(--border);

  --primary-green: var(--header-band);
  --primary-dark: #1E3621;
  --primary-light: #02BD01;
  --primary-subtle: #E8F0E9;
  --gold: var(--accent);

  --bull-green: var(--success);
  --bull-bg: #E8F5E9;
  --bear-red: var(--danger);
  --bear-bg: #FBEAE5;
  --neutral-gray: var(--text-muted);

  --text-main: var(--text);
  --text-light: #746456;

  /* Button State & Hover Tokens */
  --accent-hover: #DDA836;
  --accent-active: #CE9B2E;
  --btn-secondary-hover-bg: #FFFFFF;
  --btn-secondary-hover-border: var(--header-band);

  /* Form Control States */
  --focus-ring: rgba(2, 189, 1, 0.25);

  /* Theme Toggle Tokens */
  --toggle-bg: rgba(247, 243, 233, 0.15);
  --toggle-border: rgba(247, 243, 233, 0.35);
  --toggle-hover-bg: rgba(247, 243, 233, 0.25);
  --toggle-hover-border: var(--accent);
  --toggle-hover-text: var(--accent);

  --shadow-sm: 0 1px 3px rgba(74, 55, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(74, 55, 40, 0.12);
  --shadow-lg: 0 10px 30px rgba(74, 55, 40, 0.16);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Roboto Mono', 'SFMono-Regular', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Status Badges & Chips */
  --badge-booked-bg: #E3F2FD;
  --badge-booked-text: #0D47A1;
  --badge-booked-border: #90CAF9;

  --badge-queue-bg: #FFF3E0;
  --badge-queue-text: #9C4100;
  --badge-queue-border: #FFCC80;

  --badge-complete-bg: #E8F5E9;
  --badge-complete-text: #1B5E20;
  --badge-complete-border: #A5D6A7;

  --badge-cancel-bg: #FFEBEE;
  --badge-cancel-text: #B71C1C;
  --badge-cancel-border: #EF9A9A;

  --badge-pending-bg: #EEEEEE;
  --badge-pending-text: #616161;
  --badge-pending-border: #BDBDBD;

  --badge-weighed-bg: #F3E5F5;
  --badge-weighed-text: #6A1B9A;
  --badge-weighed-border: #CE93D8;

  --badge-graded-bg: #E0F2F1;
  --badge-graded-text: #004D40;
  --badge-graded-border: #80CBC4;

  --badge-channel-online-bg: #E3F2FD;
  --badge-channel-online-text: #0D47A1;
  --badge-channel-online-border: #90CAF9;

  --badge-channel-offline-bg: #FFF3E0;
  --badge-channel-offline-text: #9C4100;
  --badge-channel-offline-border: #FFCC80;

  --badge-role-admin-bg: #FFF8E1;
  --badge-role-admin-text: #7E5700;
  --badge-role-admin-border: #FFE082;

  --badge-role-member-bg: #E8F5E9;
  --badge-role-member-text: #1B5E20;
  --badge-role-member-border: #A5D6A7;

  --alert-warn-bg: #FFF3E0;
  --alert-warn-border: #FFE0B2;
  --alert-warn-text: #9C4100;

  --alert-error-bg: #FDEDED;
  --alert-error-border: #F5C2C7;
  --alert-error-text: #842029;

  --alert-success-bg: #E8F5E9;
  --alert-success-border: #C8E6C9;
  --alert-success-text: #1B5E20;

  --pill-open-bg: #E8F5E9;
  --pill-open-text: #1B5E20;

  --pill-full-bg: #FFEBEE;
  --pill-full-text: #B71C1C;

  --pill-closed-bg: #EEEEEE;
  --pill-closed-text: #616161;

  /* Mandi Operations Palette & Status Tokens */
  --mandi-leaf: #02BD01;
  --mandi-wheat: #C47D16;
  --mandi-soil: #4A3728;
  --mandi-paper: #FFFFFF;
  --mandi-clay: #8C5032;
  --mandi-sky: #2B6CB0;

  --slot-empty: var(--mandi-sky);
  --slot-partial: var(--mandi-wheat);
  --slot-full: var(--mandi-leaf);
  --slot-closed: var(--text-muted);

  --status-pending: var(--mandi-wheat);
  --status-processing: var(--mandi-sky);
  --status-complete: var(--mandi-leaf);

  color-scheme: light dark;
}

[data-theme="dark"] {
  /* 13 Core Theme Tokens - Dark overrides */
  --bg: #1E1812;
  --surface: #2A231C;
  --text: #F2ECE0;
  --text-muted: #B8AC9A;
  --border: #453A2E;
  --accent: #E8B94A;
  --accent-text: #1E1812;
  --header-band: #1B3020;
  --header-text: #F2ECE0;
  --success: #6FA37C;
  --danger: #E07850;
  --icon: #F2ECE0;
  --icon-muted: #B8AC9A;

  /* Semantic UI Tokens derived from single source */
  --bg-warm: var(--bg);
  --bg-card: var(--surface);
  --bg-card-alt: #342B23;
  --card: var(--surface);
  --paper: var(--bg);
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --border-color: var(--border);
  --border-focus: var(--accent);
  --line: var(--border);

  --primary-green: #6FA37C;
  --primary-dark: #A3D9B1;
  --primary-light: #6FA37C;
  --primary-subtle: #242E25;
  --gold: var(--accent);

  --bull-green: var(--success);
  --bull-bg: rgba(111, 163, 124, 0.18);
  --bear-red: var(--danger);
  --bear-bg: rgba(224, 120, 80, 0.18);
  --neutral-gray: var(--text-muted);

  --text-main: var(--text);
  --text-light: #A89C8C;

  /* Button State & Hover Tokens - Dark overrides */
  --accent-hover: #F5C75A;
  --accent-active: #E8B94A;
  --btn-secondary-hover-bg: #342B23;
  --btn-secondary-hover-border: var(--accent);

  /* Form Control States - Dark overrides */
  --focus-ring: rgba(232, 185, 74, 0.3);

  /* Theme Toggle Tokens - Dark overrides */
  --toggle-bg: rgba(242, 236, 224, 0.12);
  --toggle-border: rgba(242, 236, 224, 0.3);
  --toggle-hover-bg: rgba(242, 236, 224, 0.22);
  --toggle-hover-border: var(--accent);
  --toggle-hover-text: var(--accent);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);

  /* Badges & Status Chips - Dark overrides */
  --badge-booked-bg: rgba(33, 150, 243, 0.2);
  --badge-booked-text: #90CAF9;
  --badge-booked-border: rgba(144, 202, 249, 0.5);

  --badge-queue-bg: rgba(255, 152, 0, 0.2);
  --badge-queue-text: #FFB74D;
  --badge-queue-border: rgba(255, 183, 77, 0.6);

  --badge-complete-bg: rgba(76, 175, 80, 0.2);
  --badge-complete-text: #81C784;
  --badge-complete-border: rgba(129, 199, 132, 0.6);

  --badge-cancel-bg: rgba(244, 67, 54, 0.2);
  --badge-cancel-text: #E57373;
  --badge-cancel-border: rgba(229, 115, 115, 0.6);

  --badge-pending-bg: rgba(189, 189, 189, 0.2);
  --badge-pending-text: #EEEEEE;
  --badge-pending-border: rgba(189, 189, 189, 0.5);

  --badge-weighed-bg: rgba(156, 39, 176, 0.25);
  --badge-weighed-text: #CE93D8;
  --badge-weighed-border: rgba(206, 147, 216, 0.6);

  --badge-graded-bg: rgba(0, 150, 136, 0.25);
  --badge-graded-text: #80CBC4;
  --badge-graded-border: rgba(128, 203, 196, 0.6);

  --badge-channel-online-bg: rgba(13, 71, 161, 0.35);
  --badge-channel-online-text: #90CAF9;
  --badge-channel-online-border: rgba(144, 202, 249, 0.55);

  --badge-channel-offline-bg: rgba(230, 81, 0, 0.35);
  --badge-channel-offline-text: #FFB74D;
  --badge-channel-offline-border: rgba(255, 183, 77, 0.55);

  --badge-role-admin-bg: rgba(212, 175, 55, 0.25);
  --badge-role-admin-text: #F9E076;
  --badge-role-admin-border: #D4AF37;

  --badge-role-member-bg: rgba(76, 175, 80, 0.25);
  --badge-role-member-text: #81C784;
  --badge-role-member-border: #81C784;

  --alert-warn-bg: #38281A;
  --alert-warn-border: #5C3D24;
  --alert-warn-text: #FFB74D;

  --alert-error-bg: #351C1C;
  --alert-error-border: #6E2D2D;
  --alert-error-text: #FF8B8B;

  --alert-success-bg: #1F2E23;
  --alert-success-border: #2C5A3E;
  --alert-success-text: #81C784;

  --pill-open-bg: rgba(46, 125, 50, 0.25);
  --pill-open-text: #81C784;

  --pill-full-bg: rgba(211, 47, 47, 0.25);
  --pill-full-text: #E57373;

  --pill-closed-bg: #33372B;
  --pill-closed-text: #A9A692;

  /* Mandi Operations Palette & Status Tokens - Dark overrides */
  --mandi-leaf: #6FA37C;
  --mandi-wheat: #E8B94A;
  --mandi-soil: #F2ECE0;
  --mandi-paper: #1E1812;
  --mandi-clay: #E07850;
  --mandi-sky: #63B3ED;

  --slot-empty: var(--mandi-sky);
  --slot-partial: var(--mandi-wheat);
  --slot-full: var(--mandi-leaf);
  --slot-closed: var(--text-muted);

  --status-pending: var(--mandi-wheat);
  --status-processing: var(--mandi-sky);
  --status-complete: var(--mandi-leaf);

  color-scheme: dark;
}

/* ==========================================================================
   Global Intentional Theme Transition
   ========================================================================== */
body, .modal-box, .modal-content, .card, .dashboard-card, .auth-card, .rate-card, .metric-card, input, select, textarea, button {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-warm);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

/* ========================================================
   Icon Layout & Normalization Utilities
   ======================================================== */
.icon,
.app-icon,
.inline-icon,
.btn-icon,
.tab-icon,
.crop-icon,
.feature-icon,
.title-icon,
.demo-icon,
.badge-icon,
.user-badge-icon,
.notif-bell-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.15s ease, filter 0.2s ease;
}

.btn-icon, .tab-icon, .badge-icon {
  font-size: 1.05em;
}

.title-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--icon);
  font-size: 1.15rem;
  border: 1px solid var(--border);
}

.feature-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--icon);
  font-size: 1.35rem;
  border: 1px solid var(--border);
}

.notif-bell-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.user-badge-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.demo-icon {
  font-size: 1.1rem;
}

.crop-icon {
  font-size: 1.15rem;
}

/* ========================================================
   Header & Navigation
   ======================================================== */
.site-header .logo-icon,
.site-header .brand-icon {
  background: rgba(247, 243, 233, 0.15);
  border: 1.5px solid rgba(247, 243, 233, 0.35);
  color: var(--header-text);
}

.site-header {
  background-color: var(--header-band);
  color: var(--header-text);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container,
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-group,
.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon,
.brand-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--icon);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--header-text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-tagline,
.brand-subtitle {
  font-size: 0.8rem;
  color: rgba(247, 243, 233, 0.85);
  display: block;
}

.header-nav,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(247, 243, 233, 0.15);
  border: 1px solid rgba(247, 243, 233, 0.35);
  color: var(--header-text);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Notification Bell & Drawer */
.notification-btn {
  position: relative;
  background: rgba(247, 243, 233, 0.15);
  border: 1.5px solid rgba(247, 243, 233, 0.35);
  color: var(--header-text);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notification-btn:hover {
  background-color: var(--bg-card-alt);
  border-color: var(--primary-green);
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--danger);
  color: var(--header-text);
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid var(--header-band);
}

.notification-drawer {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 360px;
  max-width: 90vw;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}

.notification-drawer.open {
  display: block;
}

.drawer-header {
  padding: 1rem;
  background-color: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.btn-mark-all-read {
  font-size: 0.75rem;
  background: none;
  border: none;
  color: var(--primary-green);
  cursor: pointer;
  font-weight: 600;
}

.btn-mark-all-read:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.notification-list {
  max-height: 380px;
  overflow-y: auto;
  list-style: none;
  color: var(--text);
}

.notification-list li {
  color: var(--text);
}

.notification-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text);
  background-color: var(--surface);
  transition: background-color 0.2s ease;
}

.notification-item.unread {
  background-color: var(--primary-subtle);
  border-left: 4px solid var(--primary-green);
  color: var(--text);
}

.notification-item:hover {
  background-color: var(--bg-card-alt);
}

.notif-time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================================
   Stock-Market Style Ticker (Live Mandi Rates)
   ======================================================== */
.ticker-strip-wrapper {
  background-color: var(--header-band);
  color: var(--header-text);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  contain: paint;
  border-bottom: 2px solid var(--accent);
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
}

.ticker-badge,
.ticker-strip-wrapper::before {
  content: attr(data-ticker-label);
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--bg);
  color: var(--text);
  padding: 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  z-index: 10;
  letter-spacing: 0.5px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.ticker-strip-wrapper:has(.ticker-badge)::before {
  display: none !important;
  content: none !important;
}

.ticker-strip-wrapper:not([data-ticker-label])::before {
  content: '🔴 LIVE MANDI';
}
html[lang="te"] .ticker-strip-wrapper:not([data-ticker-label])::before {
  content: '🔴 లైవ్ మండి';
}
html[lang="hi"] .ticker-strip-wrapper:not([data-ticker-label])::before {
  content: '🔴 लाइव मंडी';
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: scrollTicker 75s linear infinite;
  padding-left: 140px;
}

.ticker-strip-wrapper:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes scrollTicker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  font-size: 0.85rem;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.ticker-crop-name {
  font-weight: 500;
  color: var(--text-muted);
}

.ticker-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--header-text);
}

.ticker-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ticker-change.up {
  color: var(--success);
  background-color: rgba(76, 175, 80, 0.15);
}

.ticker-change.down {
  color: var(--danger);
  background-color: rgba(239, 83, 80, 0.15);
}

.ticker-change.neutral {
  color: var(--text-muted);
}

.ticker-item.my-crop {
  background: rgba(46, 125, 50, 0.35);
  border-bottom: 2px solid var(--accent);
}

/* ========================================================
   Light Mode Market Ticker High-Contrast Overrides
   ======================================================== */
:root:not([data-theme="dark"]) .ticker-strip-wrapper,
[data-theme="light"] .ticker-strip-wrapper,
:root:not([data-theme="dark"]) .ticker-badge,
[data-theme="light"] .ticker-badge {
  opacity: 1;
  filter: none;
}

:root:not([data-theme="dark"]) .ticker-track,
[data-theme="light"] .ticker-track {
  opacity: 1;
  filter: none;
}

:root:not([data-theme="dark"]) .ticker-item,
[data-theme="light"] .ticker-item {
  opacity: 1;
  filter: none;
  color: #FFFFFF;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

:root:not([data-theme="dark"]) .ticker-item .crop-icon,
[data-theme="light"] .ticker-item .crop-icon {
  opacity: 1;
  filter: none;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

:root:not([data-theme="dark"]) .ticker-crop-name,
[data-theme="light"] .ticker-crop-name {
  color: #FFFFFF;
  font-weight: 600;
  opacity: 1;
  filter: none;
  letter-spacing: 0.2px;
}

:root:not([data-theme="dark"]) .ticker-price,
[data-theme="light"] .ticker-price {
  color: #FFFFFF;
  font-weight: 700;
  opacity: 1;
  filter: none;
  letter-spacing: 0.3px;
}

:root:not([data-theme="dark"]) .ticker-change,
[data-theme="light"] .ticker-change {
  opacity: 1;
  filter: none;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

:root:not([data-theme="dark"]) .ticker-change.up,
[data-theme="light"] .ticker-change.up {
  color: #52F08B;
  background-color: rgba(34, 197, 94, 0.22);
  border: 1px solid rgba(82, 240, 139, 0.4);
  opacity: 1;
}

:root:not([data-theme="dark"]) .ticker-change.down,
[data-theme="light"] .ticker-change.down {
  color: #FFA39E;
  background-color: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(255, 163, 158, 0.4);
  opacity: 1;
}

:root:not([data-theme="dark"]) .ticker-change.neutral,
[data-theme="light"] .ticker-change.neutral {
  color: #E2E8F0;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(226, 232, 240, 0.3);
  opacity: 1;
}

:root:not([data-theme="dark"]) .ticker-item.my-crop,
[data-theme="light"] .ticker-item.my-crop {
  background: rgba(232, 185, 74, 0.22);
  border-bottom: 2px solid var(--accent);
  opacity: 1;
}

/* ========================================================
   Container & Layout
   ======================================================== */
.container,
.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  flex: 1 0 auto;
  box-sizing: border-box;
}

.dashboard-container {
  width: 100%;
  margin: 0 auto;
  flex: 1 0 auto;
  box-sizing: border-box;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* ========================================================
   Landing Page / Auth Card
   ======================================================== */
.landing-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

@media (max-width: 860px) {
  .landing-hero {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.hero-text {
  align-self: start;
}

.hero-text h1 {
  margin-top: 0;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.18;
  color: var(--primary-dark);
  margin-bottom: 1rem;
}

.hero-text h1 span {
  color: var(--primary-light);
}

.hero-text p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.feature-pill {
  background: var(--surface);
  border: 1.5px solid var(--border-color);
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  min-height: 100%;
}

.feature-pill:hover {
  border-color: var(--primary-green);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .hero-features {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 600px) {
  .hero-features {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* Auth Card & Tabs */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.tab-nav {
  display: flex;
  background: var(--bg-card-alt);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  gap: 4px;
  flex-wrap: wrap;
  border: 1px solid transparent;
}

.tab-btn {
  flex: 1 1 calc(25% - 4px);
  min-width: 105px;
  padding: 0.65rem 0.35rem;
  border: 1px solid transparent;
  background: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--primary-green);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.tab-btn.staff-tab.active {
  color: var(--accent-text);
  font-weight: 700;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: var(--border-focus);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-input:disabled, .form-select:disabled, .form-textarea:disabled {
  background-color: var(--bg-card-alt);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.75;
}

.form-input::placeholder {
  color: var(--text-light);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Password Input Wrapper with Show/Hide Eye Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .form-input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
  line-height: 1;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.password-toggle-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card-alt);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.password-toggle-btn svg {
  width: 19px;
  height: 19px;
  pointer-events: none;
  display: block;
}


/* Crop Selection Multi-Select Chips */
.crop-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
}

.crop-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.crop-chip-label:hover {
  border-color: var(--primary-green);
}

.crop-chip-label input[type="checkbox"] {
  accent-color: var(--primary-green);
  cursor: pointer;
}

.crop-chip-label:has(input:checked) {
  background-color: var(--primary-subtle);
  border-color: var(--primary-green);
  color: var(--primary-dark);
  font-weight: 600;
}

.custom-crop-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.custom-crop-wrapper input {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  gap: 0.35rem;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--accent-text) !important;
  border-color: rgba(74, 55, 40, 0.25);
}

.btn-primary .btn-icon {
  color: var(--accent-text) !important;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text) !important;
  box-shadow: 0 4px 14px rgba(232, 185, 74, 0.35);
}

.btn-primary:active {
  background-color: var(--accent-active);
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover-bg);
  border-color: var(--btn-secondary-hover-border);
}

.btn-secondary:active {
  background: var(--border);
  transform: translateY(1px);
}

.btn-danger {
  background: var(--danger);
  color: var(--header-text);
}

.btn-danger:hover {
  background: var(--danger);
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(182, 81, 44, 0.3);
}

.btn-danger:active {
  transform: translateY(1px);
}

.btn-block {
  width: 100%;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(25%);
  pointer-events: none;
}

/* ========================================================
   Market Rates Cards Grid
   ======================================================== */
.mandi-section {
  margin-top: 1rem;
}

.rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.rate-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.4s;
  position: relative;
  overflow: hidden;
}

.rate-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rate-card.my-registered-crop {
  border: 2px solid var(--primary-green);
  background: var(--surface);
}

.rate-card.my-registered-crop::after {
  content: '★ MY CROP';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary-subtle);
  color: var(--primary-dark);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.rate-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.rate-crop-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.rate-crop-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.rate-crop-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rate-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.rate-price-current {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.rate-trend-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.rate-trend-badge.up {
  color: var(--bull-green);
  background-color: var(--bull-bg);
}

.rate-trend-badge.down {
  color: var(--bear-red);
  background-color: var(--bear-bg);
}

.rate-trend-badge.neutral {
  color: var(--neutral-gray);
  background-color: var(--bg-card-alt);
}

.rate-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

/* Flash animation for real-time price updates */
@keyframes flashGreen {
  0% { background-color: var(--bull-bg); }
  100% { background-color: var(--surface); }
}

@keyframes flashRed {
  0% { background-color: var(--bear-bg); }
  100% { background-color: var(--surface); }
}

.rate-card.flash-up {
  animation: flashGreen 1.5s ease-out;
}

.rate-card.flash-down {
  animation: flashRed 1.5s ease-out;
}

/* ========================================================
   Farmer Dashboard Styles
   ======================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.25;
}

.card-title > span.title-icon,
.section-title > span.title-icon,
.workflow-section-title > span.title-icon,
.title-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
  border: 1px solid rgba(46, 125, 50, 0.15);
}

/* Live Queue Status Tracker Widget */
.queue-widget-active {
  background: var(--header-band);
  color: var(--header-text);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 8px 24px rgba(46, 125, 50, 0.25);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.queue-widget-active::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

.queue-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.queue-stat-box {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.queue-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  margin-bottom: 0.3rem;
}

.queue-stat-val {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.queue-progress-wrapper {
  background: rgba(0, 0, 0, 0.2);
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.queue-status-text {
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0.95;
}

.pulse-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(129, 199, 132, 0.7);
  animation: pulseGreen 1.8s infinite;
  margin-right: 6px;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(129, 199, 132, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(129, 199, 132, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(129, 199, 132, 0); }
}

/* Time Slot Selection Grid */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-top: 0.5rem;
  margin-bottom: 1.2rem;
}

.slot-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.2s ease;
}

.slot-item:hover:not(.disabled) {
  border-color: var(--primary-green);
  background-color: var(--primary-subtle);
}

.slot-item.selected {
  background: var(--primary-green);
  color: var(--header-text);
  border-color: var(--header-band);
}

.slot-item.disabled {
  background-color: var(--bg-card-alt);
  color: var(--icon-muted);
  cursor: not-allowed;
  border-color: var(--border);
}

.slot-time-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  display: block;
}

.slot-cap-text {
  font-size: 0.7rem;
  opacity: 0.85;
}

/* Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background-color: var(--bg-card-alt);
  color: var(--text-main);
  padding: 0.85rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: var(--bg-card-alt);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  line-height: 1.2;
  border: 1px solid transparent;
}

.badge-booked { background-color: var(--badge-booked-bg); color: var(--badge-booked-text); border-color: var(--badge-booked-border); }
.badge-in_queue { background-color: var(--badge-queue-bg); color: var(--badge-queue-text); border-color: var(--badge-queue-border); animation: pulseBadge 2s infinite; }
.badge-completed { background-color: var(--badge-complete-bg); color: var(--badge-complete-text); border-color: var(--badge-complete-border); }
.badge-cancelled { background-color: var(--badge-cancel-bg); color: var(--badge-cancel-text); border-color: var(--badge-cancel-border); }
.badge-pending { background-color: var(--badge-pending-bg); color: var(--badge-pending-text); border-color: var(--badge-pending-border); }
.badge-weighed { background-color: var(--badge-weighed-bg); color: var(--badge-weighed-text); border-color: var(--badge-weighed-border); }
.badge-graded { background-color: var(--badge-graded-bg); color: var(--badge-graded-text); border-color: var(--badge-graded-border); }
.badge-accepted { background-color: var(--badge-complete-bg); color: var(--badge-complete-text); border-color: var(--badge-complete-border); }
.badge-rejected { background-color: var(--badge-cancel-bg); color: var(--badge-cancel-text); border-color: var(--badge-cancel-border); }
.badge-processing { background-color: var(--badge-queue-bg); color: var(--badge-queue-text); border-color: var(--badge-queue-border); }
.badge-paid { background-color: var(--badge-complete-bg); color: var(--badge-complete-text); border-color: var(--badge-complete-border); font-weight: 700; }

/* Dark Mode Badges — Luminous & High Contrast */

@keyframes pulseBadge {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* ========================================================
   Admin Dashboard Styles
   ======================================================== */
.admin-control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.admin-centre-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 280px;
}

.call-next-action-card {
  background: var(--header-band);
  color: var(--header-text);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .call-next-action-card {
    flex-direction: column;
    text-align: center;
  }
}

.call-next-info h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.btn-call-next {
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-call-next:hover {
  background: var(--accent);
  filter: brightness(0.95);
  transform: scale(1.03);
}

/* Analytics Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-dark);
}

/* ==========================================================================
   Global Modal System: Full-Viewport Centering, Scrollable Body, Sticky Header/Footer
   ========================================================================== */

/* Prevent background page from scrolling while any modal is open */
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Overlay: covers full viewport, centers the modal box horizontally and vertically */
.modal-overlay,
.modal-backdrop {
  position: fixed !important;
  inset: 0 !important; /* top, right, bottom, left: 0 */
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px; /* breathing room on small screens */
  z-index: 9999;
  overflow-y: auto; /* allow overlay to scroll if box is taller than viewport */
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-sizing: border-box;
}

.modal-overlay.active,
.modal-backdrop.active {
  display: flex !important;
}

/* Modal box itself */
.modal-box,
.modal-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 560px; /* default max width - overridden per modal */
  max-height: 90vh; /* never exceed viewport height */
  max-height: 90dvh;
  overflow: hidden; /* Header and footer stay pinned; body handles internal scrolling */
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 0; /* Header, body, and footer provide padding edge-to-edge */
  margin: auto; /* fallback centering */
  position: relative;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* If a modal-content doesn't have a .modal-header, provide default padding */
.modal-box:not(:has(.modal-header)),
.modal-content:not(:has(.modal-header)) {
  padding: 24px;
  overflow-y: auto;
}

/* Modal Form: flex column so it passes full height and scroll behavior down to body */
.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Sticky Modal Header (pinned at top) */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 11px;
  border-top-right-radius: 11px;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-alt);
}

.modal-close-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Modal Body (scrollable middle content) */
.modal-body {
  padding: 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

/* Sticky Modal Footer (pinned at bottom) */
.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom-left-radius: 11px;
  border-bottom-right-radius: 11px;
  flex-shrink: 0;
}

.modal-footer-actions,
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

/* Dedicated Error Banner */
.modal-error-banner {
  box-sizing: border-box;
  width: 100%;
  background-color: var(--alert-error-bg);
  border: 1px solid var(--alert-error-border);
  color: var(--alert-error-text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.modal-error-banner::before {
  content: "⚠️ ";
  font-size: 1rem;
  margin-right: 0.4rem;
  display: inline-block;
  vertical-align: middle;
}

/* Native dialog element styling */
dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: 560px;
  width: min(560px, calc(100% - 32px));
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

/* Mobile Responsiveness for Modal contents (< 540px) */
@media (max-width: 540px) {
  .modal-overlay,
  .modal-backdrop {
    padding: 8px;
  }

  .modal-box,
  .modal-content {
    max-height: 95vh;
    border-radius: 8px;
  }

  .modal-header {
    padding: 0.9rem 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
  }

  .modal-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .modal-footer-actions,
  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-footer-actions button,
  .modal-actions button {
    width: 100%;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-left: 4px solid var(--primary-green);
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  max-width: 380px;
}

.toast.toast-success {
  border-left-color: var(--primary-light);
}

.toast.toast-alert {
  border-left-color: var(--accent);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ========================================================
   Dark Theme Toggle Button
   ======================================================== */
.theme-toggle-btn {
  background-color: var(--toggle-bg);
  border: 1.5px solid var(--toggle-border);
  color: var(--header-text);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.theme-toggle-btn:hover {
  background-color: var(--toggle-hover-bg);
  border-color: var(--toggle-hover-border);
  color: var(--toggle-hover-text);
}

.theme-toggle-btn:active {
  transform: scale(0.97);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Role Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.badge-role-admin { background: var(--badge-role-admin-bg); color: var(--badge-role-admin-text); border: 1.5px solid var(--badge-role-admin-border); }
.badge-role-member { background: var(--badge-role-member-bg); color: var(--badge-role-member-text); border: 1.5px solid var(--badge-role-member-border); }

/* ========================================================
   Mandi Operations Control Desk & Timeline Grid
   ======================================================== */
.op-icon {
  width: 1.1em;
  height: 1.1em;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.op-icon-lg {
  width: 1.35em;
  height: 1.35em;
}

.op-icon-sm {
  width: 0.9em;
  height: 0.9em;
}

.mandi-timeline-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}

.timeline-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
}

.timeline-board-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-swatch.swatch-empty {
  border: 2px solid var(--slot-empty);
  background: transparent;
}

.legend-swatch.swatch-partial {
  background: var(--slot-partial);
}

.legend-swatch.swatch-full {
  background: var(--slot-full);
}

.legend-swatch.swatch-closed {
  border: 1.5px solid var(--slot-closed);
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    var(--slot-closed) 2px,
    var(--slot-closed) 4px
  );
  opacity: 0.6;
}

/* Continuous hairline border timeline grid */
.mandi-slot-grid,
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  padding: 0;
  margin: 0;
}

.slot-card,
.timeline-cell {
  background: var(--surface);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 112px;
  cursor: pointer;
  position: relative;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.2s ease;
  user-select: none;
}

.slot-card:hover,
.timeline-cell:hover {
  background: var(--bg-card-alt);
}

.slot-card.active,
.timeline-cell.active {
  background: var(--surface);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 3;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

/* 4 Operational status classes */
.slot-card.slot-empty,
.slot-card.slot-open,
.timeline-cell.slot-empty,
.timeline-cell.slot-open {
  border-top: 3px solid var(--slot-empty);
}

.slot-card.slot-partial,
.timeline-cell.slot-partial {
  border-top: 3px solid var(--slot-partial);
  background: color-mix(in srgb, var(--slot-partial) 5%, var(--surface));
}

.slot-card.slot-full,
.timeline-cell.slot-full {
  border-top: 3px solid var(--slot-full);
  background: color-mix(in srgb, var(--slot-full) 8%, var(--surface));
}

.slot-card.slot-closed,
.timeline-cell.slot-closed {
  border-top: 3px solid var(--slot-closed);
  opacity: 0.6;
  background: var(--bg-card-alt);
  cursor: default;
}

.timeline-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.timeline-range {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.timeline-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 0.25rem;
}

.walkin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s ease;
}

.walkin-dot.empty {
  border: 1.5px solid var(--text-muted);
  background: transparent;
}

.walkin-dot.filled {
  background: var(--slot-partial);
  border: 1.5px solid var(--slot-partial);
}

.walkin-dot-symbol {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slot-closed);
  line-height: 1;
}

.timeline-metrics {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.8rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.4rem;
  margin-top: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.timeline-count {
  font-weight: 600;
  color: var(--text);
}

.timeline-walkin-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-walkin-label.walkin-maxed {
  color: var(--danger);
  font-weight: 700;
}

.slot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.slot-time-range {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.slot-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill-open {
  background: color-mix(in srgb, var(--slot-empty) 15%, transparent);
  color: var(--slot-empty);
  border: 1px solid color-mix(in srgb, var(--slot-empty) 30%, transparent);
}

.pill-partial {
  background: color-mix(in srgb, var(--slot-partial) 18%, transparent);
  color: var(--slot-partial);
  border: 1px solid color-mix(in srgb, var(--slot-partial) 35%, transparent);
}

.pill-full {
  background: color-mix(in srgb, var(--slot-full) 18%, transparent);
  color: var(--slot-full);
  border: 1px solid color-mix(in srgb, var(--slot-full) 35%, transparent);
}

.pill-closed {
  background: color-mix(in srgb, var(--slot-closed) 15%, transparent);
  color: var(--slot-closed);
  border: 1px solid color-mix(in srgb, var(--slot-closed) 30%, transparent);
}

.slot-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  font-variant-numeric: tabular-nums;
}

.slot-offline-quota {
  font-size: 0.75rem;
  color: var(--accent-text);
  margin-top: 0.35rem;
  font-weight: 600;
}

/* Operational Status Badges in Bookings Table */
.badge-status-pending,
.badge-pending {
  background: color-mix(in srgb, var(--status-pending) 15%, transparent);
  color: var(--status-pending);
  border: 1px solid color-mix(in srgb, var(--status-pending) 35%, transparent);
}

.badge-status-processing,
.badge-processing,
.badge-weighed,
.badge-graded {
  background: color-mix(in srgb, var(--status-processing) 15%, transparent);
  color: var(--status-processing);
  border: 1px solid color-mix(in srgb, var(--status-processing) 35%, transparent);
}

.badge-status-complete,
.badge-completed,
.badge-paid,
.badge-accepted {
  background: color-mix(in srgb, var(--status-complete) 15%, transparent);
  color: var(--status-complete);
  border: 1px solid color-mix(in srgb, var(--status-complete) 35%, transparent);
}

/* Channel Badges */
.badge-channel {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-channel-online { background: var(--badge-channel-online-bg); color: var(--badge-channel-online-text); border: 1.5px solid var(--badge-channel-online-border); }
.badge-channel-offline { background: var(--badge-channel-offline-bg); color: var(--badge-channel-offline-text); border: 1.5px solid var(--badge-channel-offline-border); }

/* Workflow Panel inside Modal */
.workflow-section {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.workflow-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.auto-calc-box {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-light);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.auto-calc-amount {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Farmer Slot Button Closed State */
.slot-select-btn.slot-closed-btn {
  background-color: var(--bg-card-alt) !important;
  color: var(--icon-muted) !important;
  border-color: var(--border) !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

/* Receipt container */
.receipt-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.receipt-preview-canvas {
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   Live IST Clock Component (Top Header)
   ========================================================================== */
.header-live-clock {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  user-select: none;
  white-space: nowrap;
}

.header-live-clock .live-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(46, 125, 50, 0.12);
  color: #2E7D32;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .header-live-clock .live-clock-badge {
  background: rgba(76, 175, 80, 0.2);
  color: #81C784;
}

.header-live-clock .live-clock-pulse {
  width: 6px;
  height: 6px;
  background-color: #2E7D32;
  border-radius: 50%;
  display: inline-block;
  animation: live-clock-blink 1.5s infinite;
}

[data-theme="dark"] .header-live-clock .live-clock-pulse {
  background-color: #81C784;
}

@keyframes live-clock-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.header-live-clock .live-clock-time {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.header-live-clock .live-clock-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  border-left: 1px solid var(--border-color);
  padding-left: 0.5rem;
}

@media (max-width: 640px) {
  .header-live-clock .live-clock-date {
    display: none;
  }
}

/* Past & Closed Slot Styling in Slot Grid */
.slot-item.slot-closed-item,
.slot-item.disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  background: var(--bg-card-alt, #ECEFF1) !important;
  border-color: var(--border-color, #CFD8DC) !important;
}

.slot-item.slot-closed-item .slot-cap-text {
  color: var(--text-muted, #78909C) !important;
  font-weight: 700 !important;
}

/* ========================================================
   Mandi Directory Component Styles
   ======================================================== */
.mandi-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.mandi-directory-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.mandi-directory-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-green);
  box-shadow: var(--shadow-md);
}

.mandi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}

.mandi-state-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(2, 189, 1, 0.12);
  color: var(--primary-dark);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(2, 189, 1, 0.3);
}

.mandi-city-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mandi-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.2rem 0 0.5rem;
  line-height: 1.35;
}

.mandi-card-location {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  line-height: 1.4;
}

.mandi-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
}

.mandi-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ========================================================
   Landing Page: Clean Navigation & Role Selection Entry Flow
   ======================================================== */
.header-nav .btn {
  font-size: 0.88rem;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.hero-auth-card {
  background: var(--surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-auth-header {
  text-align: center;
}

.hero-auth-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero-auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.hero-auth-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.hero-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hero-auth-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hero-auth-meta-item strong {
  display: block;
  color: var(--text-main);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* Role Selection Modal */
.auth-modal-box {
  max-width: 580px;
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.auth-modal-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.auth-modal-close-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.auth-modal-close-btn:hover {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}

.auth-modal-back-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-modal-back-btn:hover {
  background: var(--surface);
  border-color: var(--primary-green);
  color: var(--primary-green);
}

.auth-modal-body {
  padding: 1.5rem;
  max-height: calc(88vh - 70px);
  max-height: calc(88dvh - 70px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.role-select-intro {
  text-align: center;
  margin-bottom: 1.4rem;
}

.role-select-intro h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
}

.role-select-intro p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.role-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  margin-bottom: 1.4rem;
}

.role-card {
  background: var(--surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.15rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.role-card:hover {
  border-color: var(--primary-green);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  background: var(--primary-subtle);
}

.role-card.staff-role:hover {
  border-color: var(--accent);
  background: var(--badge-queue-bg);
}

.role-card-icon {
  font-size: 2.6rem;
  margin-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease;
}

.role-card:hover .role-card-icon {
  transform: scale(1.08);
}

.role-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.role-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.role-card-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  width: 100%;
  pointer-events: none;
}

.role-card-footer-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.role-card-footer-switch a {
  font-weight: 600;
  color: var(--primary-green);
  cursor: pointer;
}

.auth-form-subswitch {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-form-subswitch a {
  font-weight: 600;
  color: var(--primary-green);
  cursor: pointer;
}

@media (max-width: 600px) {
  .role-card-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hero-auth-meta {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Compact 3-Position Sliding Language Switch [E] [త] [ह]
   ========================================================================== */

.lang-switch-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-alt, rgba(0, 0, 0, 0.06));
  border: 1.5px solid var(--border-color, rgba(0, 0, 0, 0.14));
  border-radius: 9999px;
  padding: 3px;
  height: 36px;
  box-sizing: border-box;
  user-select: none;
  z-index: 2;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .lang-switch-wrapper {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.lang-switch-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary-green, #2e7d32), var(--primary-dark, #1b5e20));
  border-radius: 9999px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
}

.lang-switch-wrapper[data-active-lang="en"] .lang-switch-slider {
  transform: translateX(0);
}

.lang-switch-wrapper[data-active-lang="te"] .lang-switch-slider {
  transform: translateX(32px);
}

.lang-switch-wrapper[data-active-lang="hi"] .lang-switch-slider {
  transform: translateX(64px);
}

.lang-btn {
  position: relative;
  z-index: 2;
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 9999px;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: color 0.2s ease;
  outline: none;
}

.lang-btn:hover {
  color: var(--text-main, #1e293b);
}

[data-theme="dark"] .lang-btn:hover {
  color: #f1f5f9;
}

.lang-switch-wrapper[data-active-lang="en"] .lang-btn[data-lang="en"],
.lang-switch-wrapper[data-active-lang="te"] .lang-btn[data-lang="te"],
.lang-switch-wrapper[data-active-lang="hi"] .lang-btn[data-lang="hi"] {
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.header-nav,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Mandi Registration 114 Centres Selection Component
   ========================================================================== */
.mandi-selector-group {
  margin-bottom: 1rem;
}

.mandi-search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.mandi-search-box {
  width: 100%;
  padding-right: 2.2rem;
}

.mandi-search-clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}

.mandi-search-clear-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-alt);
}

.mandi-selected-card {
  border: 2px solid var(--primary-green);
  background: var(--primary-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  animation: fadeInMandi 0.2s ease;
}

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

.mandi-selected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mandi-selected-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.mandi-selected-details {
  flex: 1;
  min-width: 0;
}

.mandi-selected-name {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mandi-selected-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mandi-picker-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
}

.mandi-picker-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mandi-picker-legend {
  display: inline-flex;
  align-items: center;
}

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

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

.legend-dot.claimed {
  background-color: var(--danger);
}

.mandi-picker-list {
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mandi-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.mandi-picker-item:last-child {
  border-bottom: none;
}

.mandi-picker-item.available {
  cursor: pointer;
}

.mandi-picker-item.available:hover {
  background: var(--primary-subtle);
}

.mandi-picker-item.selected {
  background: var(--bull-bg);
  border-left: 4px solid var(--primary-green);
}

.mandi-picker-item.claimed {
  opacity: 0.65;
  background: var(--bg-card-alt);
  cursor: not-allowed;
}

.mandi-item-main {
  flex: 1;
  min-width: 0;
  padding-right: 0.75rem;
}

.mandi-item-name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mandi-picker-item.claimed .mandi-item-name {
  color: var(--text-muted);
}

.mandi-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mandi-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.mandi-badge.badge-available {
  background: var(--badge-complete-bg);
  color: var(--badge-complete-text);
  border: 1px solid var(--badge-complete-border);
}

.mandi-badge.badge-claimed {
  background: var(--badge-cancel-bg);
  color: var(--badge-cancel-text);
  border: 1px solid var(--badge-cancel-border);
}

.mandi-picker-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Password Hint & Account Recovery Styles
   ========================================================================== */
.forgot-password-link-wrapper a {
  color: var(--primary-green);
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.forgot-password-link-wrapper a:hover {
  text-decoration: underline !important;
  color: var(--primary-dark);
}

.hint-display-card {
  transition: all 0.2s ease;
}

