/* style.css — Smart Forage & Pasture Design Tokens + Component Styles */

/* =============================================
   FONTS
   ============================================= */
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap');

/* =============================================
   TYPE SCALE
   ============================================= */
:root {
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;

  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* =============================================
     SPACING (4px base)
     ============================================= */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* =============================================
     RADIUS
     ============================================= */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* =============================================
     TRANSITIONS
     ============================================= */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* =============================================
     CONTENT WIDTHS
     ============================================= */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* =============================================
     SIDEBAR
     ============================================= */
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
}

/* =============================================
   LIGHT MODE — Smart Forage Palette
   ============================================= */
:root, [data-theme="light"] {
  /* Surfaces */
  --color-bg:               #f4f4f2;
  --color-surface:          #fafaf8;
  --color-surface-2:        #ffffff;
  --color-surface-offset:   #eeeee9;
  --color-surface-offset-2: #e6e6e0;
  --color-surface-dynamic:  #ddddd6;
  --color-divider:          #d4d4cb;
  --color-border:           #c8c8be;

  /* Text */
  --color-text:             #2a2a28;
  --color-text-muted:       #6b6b66;
  --color-text-faint:       #a3a39e;
  --color-text-inverse:     #ffffff;

  /* Primary Accent — Smart Forage Green #86bc25 */
  --color-primary:          #86bc25;
  --color-primary-hover:    #6fa01e;
  --color-primary-active:   #5a8518;
  --color-primary-highlight: #e8f2d3;
  --color-primary-text:     #1a2e05;

  /* Semantic Colors */
  --color-error:            #c5362a;
  --color-error-hover:      #a82c22;
  --color-error-active:     #8b2319;
  --color-error-highlight:  #f5dbd8;

  --color-success:          #2d8540;
  --color-success-hover:    #236b33;
  --color-success-active:   #1a5226;
  --color-success-highlight: #d4edda;

  --color-warning:          #cc7a00;
  --color-warning-hover:    #a86300;
  --color-warning-active:   #854e00;
  --color-warning-highlight: #fce8c4;

  --color-info:             #2874a6;
  --color-info-highlight:   #d6eaf8;

  /* Shadows (warm-toned) */
  --shadow-sm: 0 1px 2px oklch(0.25 0.01 100 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.25 0.01 100 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.25 0.01 100 / 0.12);
  --shadow-card: 0 1px 3px oklch(0.25 0.01 100 / 0.04), 0 8px 24px oklch(0.25 0.01 100 / 0.06);
}

/* =============================================
   DARK MODE — Smart Forage Palette
   ============================================= */
[data-theme="dark"] {
  --color-bg:               #141614;
  --color-surface:          #1a1c1a;
  --color-surface-2:        #1f211f;
  --color-surface-offset:   #1c1e1c;
  --color-surface-offset-2: #232523;
  --color-surface-dynamic:  #2c2e2c;
  --color-divider:          #272927;
  --color-border:           #383a38;

  --color-text:             #cdd0cb;
  --color-text-muted:       #7f827d;
  --color-text-faint:       #585a56;
  --color-text-inverse:     #1a1c1a;

  --color-primary:          #9acc3c;
  --color-primary-hover:    #86bc25;
  --color-primary-active:   #6fa01e;
  --color-primary-highlight: #2a3320;
  --color-primary-text:     #141614;

  --color-error:            #e06058;
  --color-error-hover:      #d04a42;
  --color-error-active:     #b83830;
  --color-error-highlight:  #3d2220;

  --color-success:          #5cb870;
  --color-success-hover:    #42a057;
  --color-success-active:   #2d8540;
  --color-success-highlight: #1f3225;

  --color-warning:          #e8a030;
  --color-warning-hover:    #d08d20;
  --color-warning-active:   #b57a10;
  --color-warning-highlight: #3a2e18;

  --color-info:             #5dade2;
  --color-info-highlight:   #1c2a33;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  --shadow-card: 0 1px 3px oklch(0 0 0 / 0.15), 0 8px 24px oklch(0 0 0 / 0.2);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #141614;
    --color-surface:          #1a1c1a;
    --color-surface-2:        #1f211f;
    --color-surface-offset:   #1c1e1c;
    --color-surface-offset-2: #232523;
    --color-surface-dynamic:  #2c2e2c;
    --color-divider:          #272927;
    --color-border:           #383a38;
    --color-text:             #cdd0cb;
    --color-text-muted:       #7f827d;
    --color-text-faint:       #585a56;
    --color-text-inverse:     #1a1c1a;
    --color-primary:          #9acc3c;
    --color-primary-hover:    #86bc25;
    --color-primary-active:   #6fa01e;
    --color-primary-highlight: #2a3320;
    --color-primary-text:     #141614;
    --color-error:            #e06058;
    --color-error-hover:      #d04a42;
    --color-error-active:     #b83830;
    --color-error-highlight:  #3d2220;
    --color-success:          #5cb870;
    --color-success-hover:    #42a057;
    --color-success-active:   #2d8540;
    --color-success-highlight: #1f3225;
    --color-warning:          #e8a030;
    --color-warning-hover:    #d08d20;
    --color-warning-active:   #b57a10;
    --color-warning-highlight: #3a2e18;
    --color-info:             #5dade2;
    --color-info-highlight:   #1c2a33;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
    --shadow-card: 0 1px 3px oklch(0 0 0 / 0.15), 0 8px 24px oklch(0 0 0 / 0.2);
  }
}

/* =============================================
   SHARED COMPONENTS
   ============================================= */

/* View system */
.view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Logo */
.logo-smart {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: 1;
  letter-spacing: -0.01em;
}

.logo-forage {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
  display: block;
  line-height: 1;
  margin-top: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-height: 40px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

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

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

.btn-secondary {
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}
.btn-secondary:hover {
  background: var(--color-primary-highlight);
}

.btn-ghost {
  color: var(--color-text-muted);
  background: transparent;
  padding: var(--space-2) var(--space-3);
}
.btn-ghost:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}
.btn-danger:hover { background: var(--color-error-hover); }

.btn-sm {
  min-height: 34px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-full {
  width: 100%;
}

.btn-loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-icon {
  min-height: 34px;
  min-width: 34px;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-interactive);
}
.btn-icon:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-coming {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.badge-active {
  background: var(--color-success-highlight);
  color: var(--color-success);
}

.badge-inactive {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
}

.badge-herbicide { background: #e8f2d3; color: #3d6b00; }
.badge-fungicide { background: #d6eaf8; color: #1a5276; }
.badge-insecticide { background: #fce8c4; color: #7d5a00; }
.badge-admin { background: var(--color-primary); color: var(--color-primary-text); }

[data-theme="dark"] .badge-herbicide { background: #2a3320; color: #9acc3c; }
[data-theme="dark"] .badge-fungicide { background: #1c2a33; color: #5dade2; }
[data-theme="dark"] .badge-insecticide { background: #3a2e18; color: #e8a030; }

/* Section label */
.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* Theme toggle */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

/* =============================================
   LOGIN VIEW
   ============================================= */
.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-6);
}

/* Subtle agricultural CSS pattern background */
.login-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 80%, oklch(from var(--color-primary) l c h / 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, oklch(from var(--color-primary) l c h / 0.04) 0%, transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      oklch(from var(--color-primary) l c h / 0.03) 39px,
      oklch(from var(--color-primary) l c h / 0.03) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      oklch(from var(--color-primary) l c h / 0.03) 39px,
      oklch(from var(--color-primary) l c h / 0.03) 40px
    );
}

[data-theme="dark"] .login-bg-pattern {
  opacity: 0.2;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-card);
}

@media (max-width: 480px) {
  .login-card {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
  }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.login-logo svg {
  flex-shrink: 0;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
}

.login-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.login-tagline {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-field label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
  min-height: 44px;
}

@media (max-width: 480px) {
  .form-field input,
  .form-field select {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--color-text-faint);
}

.form-field input.input-error,
.form-field select.input-error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px oklch(from var(--color-error) l c h / 0.1);
}

.field-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.login-footer-text {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-6);
}

.login-footer-text a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}
.login-footer-text a:hover {
  text-decoration: underline;
}

/* Demo accounts box */
.demo-accounts {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}

.demo-accounts-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.demo-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-interactive);
}

.demo-account-item:hover {
  color: var(--color-primary);
}

.demo-account-item + .demo-account-item {
  border-top: 1px solid var(--color-divider);
}

.demo-account-item .demo-role {
  font-weight: 600;
  color: var(--color-text);
  min-width: 60px;
}

.demo-account-item .demo-email {
  flex: 1;
  text-align: left;
  margin-left: var(--space-2);
}

.demo-account-item .demo-use {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   APP HEADER (Farmer views)
   ============================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-divider);
  backdrop-filter: blur(12px);
}

.app-header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  gap: var(--space-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  cursor: pointer;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.header-nav-link {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.header-nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.header-nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.user-email {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .user-email {
    display: none;
  }
  .app-header-inner {
    padding: var(--space-2) var(--space-4);
  }
  .header-right {
    gap: var(--space-2);
  }
  .header-logo .logo-forage {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
  }
  .header-nav {
    display: none;
  }
}

/* =============================================
   WELCOME / FARMER DASHBOARD
   ============================================= */

/* Welcome Hero */
.welcome-hero {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  padding: clamp(var(--space-8), 4vw, var(--space-12)) var(--space-6);
}

.welcome-hero-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
}

.welcome-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.welcome-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Dashboard content */
.dashboard-content {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  flex: 1;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.dash-card {
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: box-shadow var(--transition-interactive), border-color var(--transition-interactive), transform var(--transition-interactive);
  position: relative;
}

.dash-card.card-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.dash-card.card-active {
  border-color: var(--color-primary);
  cursor: pointer;
}

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

.dash-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
}

.dash-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
}

.dash-card-footer {
  padding-top: var(--space-2);
}

/* =============================================
   BREADCRUMB
   ============================================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-text-faint);
}

/* =============================================
   LOCATION CARDS (My Chemicals)
   ============================================= */
.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.location-card {
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-interactive);
}

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

.location-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.location-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.location-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
}

.location-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.location-stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.location-stat svg {
  flex-shrink: 0;
  color: var(--color-text-faint);
}

.location-card-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.add-location-card {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-interactive);
  color: var(--color-text-muted);
  min-height: 180px;
}

.add-location-card:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.add-location-card .add-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-interactive);
}

.add-location-card:hover .add-icon {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.add-location-card span {
  font-weight: 600;
  font-size: var(--text-sm);
}

/* =============================================
   DATA TABLE
   ============================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.data-table thead {
  background: var(--color-surface-offset);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  font-size: 0.7rem;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--transition-interactive);
}

.data-table tbody tr:hover {
  background: var(--color-surface-offset);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* =============================================
   TOOLBAR (above tables)
   ============================================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-input {
  padding: var(--space-2) var(--space-4);
  padding-left: var(--space-10);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-xs);
  color: var(--color-text);
  min-height: 38px;
  min-width: 200px;
  max-width: 320px;
  width: 100%;
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-wrapper svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

.filter-select {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-xs);
  color: var(--color-text);
  min-height: 38px;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

/* =============================================
   LOCATION DETAIL HEADER
   ============================================= */
.location-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.location-detail-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.location-detail-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
}

.location-detail-address {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.location-detail-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* =============================================
   MODAL / OVERLAY
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 200ms ease-out;
}

[data-theme="dark"] .modal-overlay {
  background: oklch(0 0 0 / 0.7);
}

.modal {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Search results in modal */
.search-results-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.search-result-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  transition: background var(--transition-interactive);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.search-result-item:hover {
  background: var(--color-primary-highlight);
}

.search-result-item.selected {
  background: var(--color-primary-highlight);
  border-left: 3px solid var(--color-primary);
}

.search-result-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.search-result-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* =============================================
   STOCKTAKE VIEW
   ============================================= */
.stocktake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.stocktake-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stocktake-item {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.stocktake-item-name {
  flex: 1;
  min-width: 160px;
}

.stocktake-item-name strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.stocktake-item-name span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.stocktake-qty {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stocktake-qty input {
  width: 80px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--color-text);
  min-height: 38px;
}

.stocktake-qty input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.stocktake-unit {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-width: 24px;
}

.stocktake-footer {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

/* =============================================
   ADMIN LAYOUT
   ============================================= */
.admin-layout {
  display: flex;
  min-height: 100dvh;
}

/* Admin Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface-2);
  border-right: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-link:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.sidebar-link.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-divider);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.hamburger-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  transition: all var(--transition-interactive);
}

.hamburger-btn:hover {
  background: var(--color-surface-offset);
}

.admin-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
}

/* Admin KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.kpi-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  line-height: 1.1;
}

.kpi-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* Admin page header */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.admin-page-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.4);
  z-index: 199;
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .hamburger-btn {
    display: flex;
  }

  .admin-content {
    padding: var(--space-4);
  }

  .admin-header {
    padding: var(--space-3) var(--space-4);
  }
}

/* =============================================
   COMING SOON PLACEHOLDER
   ============================================= */
.coming-soon-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-16) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
}

.coming-soon-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}

.coming-soon-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
}

.coming-soon-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 360px;
}

/* =============================================
   TOAST / NOTIFICATIONS
   ============================================= */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.toast.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast.toast-out {
  animation: toastOut 200ms ease-in forwards;
}

.toast svg {
  flex-shrink: 0;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

@media (max-width: 480px) {
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    top: var(--space-4);
  }
  .toast {
    min-width: unset;
    max-width: unset;
  }
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  gap: var(--space-4);
  color: var(--color-text-faint);
}

.empty-state svg {
  opacity: 0.4;
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* =============================================
   DOC LINK BUTTONS
   ============================================= */
.doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all var(--transition-interactive);
  min-height: 26px;
  line-height: 1;
}

.doc-btn-label {
  background: var(--color-info-highlight);
  color: var(--color-info);
}
.doc-btn-label:hover {
  background: var(--color-info);
  color: #fff;
}

/* HazNote styles removed — only Label + MSDS going forward */

.doc-btn-msds {
  background: var(--color-error-highlight);
  color: var(--color-error);
}
.doc-btn-msds:hover {
  background: var(--color-error);
  color: #fff;
}

/* =============================================
   FOOTER
   ============================================= */
.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-6);
}

.app-footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.app-footer-inner a {
  color: var(--color-text-faint);
  text-decoration: none;
  transition: color var(--transition-interactive);
}

.app-footer-inner a:hover {
  color: var(--color-text-muted);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-card {
  animation: fadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-card {
  animation: fadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: backwards;
}

.dash-card:nth-child(1) { animation-delay: 80ms; }
.dash-card:nth-child(2) { animation-delay: 140ms; }
.dash-card:nth-child(3) { animation-delay: 200ms; }

@media (prefers-reduced-motion: reduce) {
  .login-card,
  .dash-card,
  .modal-overlay,
  .modal,
  .toast {
    animation: none;
  }
}

/* =============================================
   MOBILE TABLE → CARDS CONVERSION
   ============================================= */
@media (max-width: 640px) {
  .data-table thead {
    display: none;
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }
  .data-table tr {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-divider);
    position: relative;
  }
  .data-table td {
    padding: var(--space-1) 0;
    border-bottom: none;
  }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 2px;
  }
  .table-actions {
    margin-top: var(--space-2);
  }
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* Maps link */
.maps-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
}
.maps-link:hover {
  text-decoration: underline;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-faint);
}

/* =============================================
   V3: PDF Upload, AI Scanner, Formulation, File Mgmt
   ============================================= */

/* Wide modal for Add/Edit Chemical */
.modal-wide {
  max-width: 640px;
}

/* Modal divider */
.modal-divider {
  height: 1px;
  background: var(--color-surface-dynamic);
  margin: var(--space-4) 0;
}

/* Formulation badge */
.badge-formulation {
  background: var(--color-surface-offset);
  color: var(--color-text);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-surface-dynamic);
}

/* Adjuvant / Growth Regulator badges */
.badge-adjuvant {
  background: rgba(158, 118, 219, 0.12);
  color: #7c3aed;
}
[data-theme="dark"] .badge-adjuvant {
  background: rgba(158, 118, 219, 0.18);
  color: #a78bfa;
}
.badge-regulator {
  background: rgba(234, 179, 8, 0.12);
  color: #a16207;
}
[data-theme="dark"] .badge-regulator {
  background: rgba(234, 179, 8, 0.18);
  color: #fbbf24;
}

/* Document status chips (admin table) */
.doc-status-group {
  display: flex;
  gap: 4px;
}
.doc-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  border: 1px solid var(--color-surface-dynamic);
  cursor: default;
}
.doc-status-chip.uploaded {
  background: rgba(134, 188, 37, 0.15);
  color: var(--color-primary);
  border-color: rgba(134, 188, 37, 0.3);
}

/* Doc buttons — disabled state */
.doc-btn-none {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ---- PDF Upload Zones ---- */
.pdf-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.pdf-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.pdf-upload-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 540px) {
  .pdf-upload-grid,
  .pdf-upload-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* MSDS Auto-Search Status */
.msds-search-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(134, 188, 37, 0.06);
  border: 1px solid rgba(134, 188, 37, 0.15);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.msds-search-status a {
  color: var(--color-primary);
}
.msds-search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(134, 188, 37, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.pdf-upload-zone {
  border: 2px dashed var(--color-surface-dynamic);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--color-surface);
}
.pdf-upload-zone:hover,
.pdf-upload-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}
.pdf-upload-zone.has-file {
  border-style: solid;
  border-color: rgba(134, 188, 37, 0.4);
  background: rgba(134, 188, 37, 0.06);
  cursor: default;
}
.pdf-zone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
}
.pdf-zone-label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.pdf-zone-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.pdf-zone-filled {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
}
.pdf-zone-filename {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-zone-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdf-zone-remove:hover {
  color: var(--color-error);
  background: rgba(220, 38, 38, 0.08);
}

/* ---- AI Label Scanner ---- */
.scanner-section {
  margin-bottom: var(--space-2);
}
.scanner-header {
  margin-bottom: var(--space-3);
}
.scanner-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}
.scanner-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.scanner-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.scanner-dropzone {
  border: 2px dashed var(--color-surface-dynamic);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.scanner-dropzone:hover,
.scanner-dropzone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}
.scanner-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary-highlight);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
}
.scanner-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(134, 188, 37, 0.25);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.scanner-result {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-success);
  font-weight: 500;
}

/* ---- File Management Page ---- */
.file-stats-bar {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-surface-dynamic);
  border-radius: var(--radius-lg);
}
.file-stats-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.file-stats-count {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.file-stats-pct {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
}
.file-stats-progress {
  height: 6px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.file-stats-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-chip.file-uploaded {
  background: rgba(134, 188, 37, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(134, 188, 37, 0.25);
}
.file-chip.file-missing {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  border: 1px solid var(--color-surface-dynamic);
}

/* Toast info type */
.toast-info {
  border-left-color: var(--color-primary);
}

/* =============================================
   SHOP — Product Card Grid
   ============================================= */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.shop-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: box-shadow var(--transition-interactive), border-color var(--transition-interactive);
}

.shop-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(134, 188, 37, 0.1);
}

.shop-card-header {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.shop-card-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.2;
  color: var(--color-text);
  margin: 0;
}

.shop-card-ingredient {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  flex: 1;
}

.shop-card-registrant {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}

.shop-order-btn {
  margin-top: auto;
}

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

/* =============================================
   STOCKTAKE — Enhanced (Add, Delete, Order)
   ============================================= */
.stocktake-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.stocktake-header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding-top: var(--space-1);
}

.stocktake-item-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-left: auto;
}

.btn-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-interactive);
}

.btn-icon-danger:hover {
  background: rgba(197, 54, 42, 0.08);
  border-color: var(--color-error);
  color: var(--color-error);
}

/* =============================================
   ORDER STATUS BADGES
   ============================================= */
.badge-pending {
  background: rgba(234, 179, 8, 0.12);
  color: #b47d09;
  border: 1px solid rgba(234, 179, 8, 0.25);
}
[data-theme="dark"] .badge-pending {
  color: #facc15;
}

.badge-processing {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
[data-theme="dark"] .badge-processing {
  color: #60a5fa;
}

.order-status-select {
  font-size: var(--text-xs) !important;
  padding: var(--space-1) var(--space-3) !important;
  min-width: 110px;
}

/* =============================================
   LEAFLET MAP IN MODAL — z-index fixes
   ============================================= */
.modal .leaflet-container {
  z-index: 1;
}
.modal .leaflet-pane {
  z-index: 1;
}
.modal .leaflet-top,
.modal .leaflet-bottom {
  z-index: 2;
}

/* Map marker customization */
#location-map {
  cursor: crosshair;
}

/* =============================================
   V10: Address Dropdown
   ============================================= */
.address-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
}
.address-item {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-subtle, var(--color-border));
  transition: background 0.15s;
}
.address-item:last-child { border-bottom: none; }
.address-item:hover { background: var(--color-surface-offset); }
.address-item strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.address-detail {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.address-loading, .address-none {
  cursor: default;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  padding: var(--space-3) var(--space-3);
}
.address-loading:hover, .address-none:hover {
  background: transparent;
}

/* =============================================
   V10: Page Visibility Toggles
   ============================================= */
.page-toggles {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.toggle-row:hover {
  background: var(--color-border);
}
.toggle-label {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.toggle-label strong {
  font-size: var(--text-sm);
  color: var(--color-text);
}
.toggle-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
/* Hide the default checkbox */
.toggle-row input[type="checkbox"] {
  display: none;
}
/* Toggle switch track */
.toggle-switch {
  width: 40px;
  min-width: 40px;
  height: 22px;
  background: var(--color-text-faint);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-row input:checked + .toggle-switch {
  background: var(--color-primary);
}
.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

/* =============================================
   V10: Admin Greyed Out Nav / Cards
   ============================================= */
.nav-greyed {
  opacity: 0.4;
  text-decoration: line-through;
}
.card-admin-greyed {
  opacity: 0.45;
  border: 2px dashed var(--color-border);
  cursor: pointer;
}
.card-admin-greyed:hover {
  opacity: 0.65;
}

/* =============================================
   V10: Modal Divider
   ============================================= */
.modal-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-4) 0;
}

/* =============================================
   V11: Shed Detail Toggle (compact / detailed)
   ============================================= */

/* Toggle control in toolbar */
.detail-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.detail-toggle-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}
.detail-toggle input[type="checkbox"] {
  display: none;
}

/* Hide detail columns and ingredient line by default */
#location-chem-table .detail-col,
#location-chem-table .detail-inline {
  display: none;
}

/* Show when toggled on */
#location-chem-table.show-chem-details .detail-col {
  display: table-cell;
}
#location-chem-table.show-chem-details .detail-inline {
  display: block;
}

/* Mobile: clean compact cards for shed chemicals */
@media (max-width: 640px) {
  /* Remove the generic data-label headings for this table */
  #location-chem-table td::before {
    display: none !important;
  }

  /* Each row = a compact card */
  #location-chem-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  /* Product name — full width */
  #location-chem-table td[data-label="Product"] {
    flex: 1 1 100%;
    padding: 0;
  }
  #location-chem-table td[data-label="Product"] strong {
    font-size: var(--text-base);
  }

  /* Stock — inline pill */
  #location-chem-table td[data-label="Stock"] {
    padding: 0;
    font-size: var(--text-sm);
  }
  #location-chem-table td[data-label="Stock"] strong {
    background: var(--color-surface-offset);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
  }

  /* Docs — inline */
  #location-chem-table td[data-label="Docs"] {
    padding: 0;
  }
  #location-chem-table td[data-label="Docs"] .table-actions {
    margin-top: 0;
  }

  /* Actions — push to right */
  #location-chem-table td[data-label="Actions"] {
    margin-left: auto;
    padding: 0;
  }
  #location-chem-table td[data-label="Actions"] .table-actions {
    margin-top: 0;
  }

  /* Detail columns — hidden by default */
  #location-chem-table .detail-col {
    display: none !important;
  }

  /* When details toggled on — show as full-width rows below */
  #location-chem-table.show-chem-details .detail-col {
    display: block !important;
    flex: 1 1 100%;
    padding: 0;
    font-size: var(--text-sm);
  }
  #location-chem-table.show-chem-details .detail-col::before {
    content: attr(data-label) ": ";
    display: inline !important;
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
}

/* =============================================
   V12: Settings Tabs
   ============================================= */
.settings-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 2px solid var(--color-divider);
  margin-bottom: var(--space-6);
}
.settings-tab {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.settings-tab:hover {
  color: var(--color-text);
}
.settings-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.settings-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

/* =============================================
   V12: Role Badges
   ============================================= */
.badge-role-admin {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-role-manager {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-role-farmer {
  background: rgba(134, 188, 37, 0.1);
  color: #5d8a0f;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Admin header badge for managers */
.badge-manager {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}

[data-theme="dark"] .badge-role-admin {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}
[data-theme="dark"] .badge-role-manager,
[data-theme="dark"] .badge-manager {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
[data-theme="dark"] .badge-role-farmer {
  background: rgba(134, 188, 37, 0.2);
  color: #a3d44e;
}

/* =============================================
   V12: Manager Customer View Cards
   ============================================= */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================
   V12: "Viewing as Customer" Banner
   ============================================= */
.viewing-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.viewing-as-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: #2563eb;
}
.viewing-as-info svg {
  flex-shrink: 0;
}
.viewing-as-exit {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
  font-size: var(--text-xs);
}
.viewing-as-exit:hover {
  background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .viewing-as-banner {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}
[data-theme="dark"] .viewing-as-info {
  color: #93c5fd;
}
[data-theme="dark"] .viewing-as-exit {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

@media (max-width: 600px) {
  .viewing-as-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .viewing-as-exit {
    align-self: flex-end;
  }
}

/* =============================================
   MODULE GRID — Admin Dashboard Cards
   ============================================= */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}
.module-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.module-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.module-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.module-icon-green  { background: rgba(134,188,37,0.12); color: #5d8a0f; }
.module-icon-blue   { background: rgba(59,130,246,0.12);  color: #2563eb; }
.module-icon-purple { background: rgba(139,92,246,0.12);  color: #7c3aed; }
.module-icon-amber  { background: rgba(234,179,8,0.12);   color: #b45309; }
.module-icon-teal   { background: rgba(20,184,166,0.12);  color: #0d9488; }
.module-icon-emerald{ background: rgba(16,185,129,0.12);  color: #059669; }
.module-icon-slate  { background: rgba(100,116,139,0.12); color: #475569; }
.module-icon-orange { background: rgba(249,115,22,0.12);  color: #c2410c; }
.module-info {
  flex: 1;
  min-width: 0;
}
.module-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--color-text);
}
.module-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}
.module-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(134,188,37,0.1);
  color: #5d8a0f;
  letter-spacing: 0.02em;
}
.module-badge-warning {
  background: rgba(234,179,8,0.12);
  color: #b45309;
}
.module-arrow {
  flex-shrink: 0;
  color: var(--color-text-faint);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.module-card:hover .module-arrow {
  opacity: 1;
  transform: translateX(2px);
}
.admin-page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

[data-theme="dark"] .module-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}
[data-theme="dark"] .module-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
  .module-grid {
    grid-template-columns: 1fr;
  }
  .module-card {
    padding: var(--space-4);
  }
  .module-desc {
    display: none;
  }
  .module-arrow {
    display: none;
  }
}

/* =============================================
   BULK UPLOAD
   ============================================= */
.bulk-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--color-surface);
}
.bulk-upload-zone:hover,
.bulk-upload-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(134,188,37,0.04);
}
.bulk-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.bulk-zone-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}
.bulk-zone-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

.bulk-progress-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.bulk-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}
.bulk-progress-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
}
.bulk-progress-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}
.bulk-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-4);
}
.bulk-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.bulk-progress-log {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.bulk-log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.bulk-log-name {
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-log-status {
  flex-shrink: 0;
  font-weight: 600;
  margin-left: var(--space-3);
}
.bulk-log-scanning { color: var(--color-primary); }
.bulk-log-done     { color: var(--color-success); }
.bulk-log-error    { color: var(--color-error); }

/* =============================================
   OFFLINE INDICATOR
   ============================================= */
.offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #f59e0b;
  color: #000;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 4px 12px;
  animation: slideDown 0.3s ease;
}
body.app-offline .offline-banner { display: block; }
body.app-offline .app-header { margin-top: 26px; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  background: rgba(134, 188, 37, 0.1);
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.15s;
}
.sync-btn:active { transform: scale(0.96); }
.sync-btn.syncing { opacity: 0.6; pointer-events: none; }
.sync-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 99px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 4px;
}

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