:root {
  --primary: #1a6b3c;
  --primary-light: #219653;
  --primary-dark: #0f4d2a;
  --accent: #f2994a;
  --accent-light: #f5b771;
  --bg: #f8faf9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f4d2a;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-inverse: #ffffff;
  --border: #e2e8f0;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --sidebar-width: 240px;
  --nav-height: 64px;
  --header-height: 60px;
  --danger: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
}

body.dark {
  --primary: #34a853;
  --primary-light: #43c465;
  --primary-dark: #1a5c32;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0f172a;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --text-inverse: #0f172a;
  --border: #334155;
}

/* ─── FOOD ITEMS & CARGO TRACKING ───────────────────────────── */
.food-item-card {
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
}
.food-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.tax-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e3f2fd;
  color: #1565c0;
  margin: 1px;
}
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
  .info-grid, .inv-grid { grid-template-columns: 1fr; }
}
/* ─── RESET ──────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── PUBLIC LAYOUT ─────────────────────────── */

.pub-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 24px;
  padding: 0 32px; height: var(--nav-height); flex-shrink: 0;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}

.pub-logo { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; text-decoration: none; }
.pub-logo span { color: var(--accent); }
.pub-links { display: flex; gap: 4px; flex: 1; }
.pub-link {
  padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--text-light);
  text-decoration: none; border-radius: var(--radius); transition: all 0.2s;
}
.pub-link:hover, .pub-link.active { color: var(--primary); background: rgba(26,107,60,0.08); }
.pub-auth { display: flex; gap: 8px; align-items: center; }
.pub-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); padding: 4px; margin-left: auto; line-height: 1; }

/* ─── LANGUAGE SWITCHER ─────────────────────── */
.lang-switch {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-light); font-size: 12px; font-weight: 600; padding: 5px 10px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.lang-switch:hover { color: var(--primary); border-color: var(--primary); background: rgba(26,107,60,0.08); }
select.lang-switch { padding: 4px 6px; max-width: 150px; cursor: pointer; }
.topbar-lang { flex-shrink: 0; }

/* ─── CURRENCY SWITCHER ─────────────────────── */
.currency-switch {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-light); font-size: 12px; font-weight: 600; padding: 4px 6px;
  cursor: pointer; transition: all 0.2s; max-width: 168px;
}
.currency-switch:hover, .currency-switch:focus {
  color: var(--primary); border-color: var(--primary);
  background: rgba(26,107,60,0.08); outline: none;
}

/* RTL — Arabic */
[dir="rtl"] .pub-links { flex-direction: row; }
[dir="rtl"] .footer-inner { flex-direction: row-reverse; }
[dir="rtl"] .sidebar-nav { padding-left: 0; padding-right: 8px; }
[dir="rtl"] .pub-toggle { margin-left: 0; margin-right: auto; }
[dir="rtl"] .footer-col { align-items: flex-end; }
[dir="rtl"] .topbar h2 { text-align: right; }
[dir="rtl"] .hero { direction: rtl; }
[dir="rtl"] .hero-actions { justify-content: center; }
[dir="rtl"] .card-header, [dir="rtl"] .modal-actions { flex-direction: row-reverse; }
[dir="rtl"] .form-group label { text-align: right; }
[dir="rtl"] .pub-link { text-align: right; }

.pub-content { flex: 1; }

.pub-footer {
  border-top: 1px solid var(--border); background: var(--bg-card);
  padding: 32px 32px 24px; margin-top: auto;
}
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; font-size: 13px; color: var(--text-light); }
.footer-brand { flex: 1 1 220px; max-width: 360px; }
.footer-logo { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; margin-bottom: 8px; }
.footer-logo span { color: var(--accent); }
.footer-credits { margin-top: 6px; line-height: 1.8; }
.footer-credits a { color: var(--text-light); text-decoration: none; border-bottom: 1px dotted var(--text-light); }
.footer-credits a:hover { color: var(--primary); border-color: var(--primary); }
.footer-sitemap { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.footer-col h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text); margin-bottom: 4px; }
.footer-col a { color: var(--text-light); text-decoration: none; }
.footer-col a:hover { color: var(--primary); }

/* ─── LANDING PAGE ──────────────────────────── */

.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1a8a4a 100%);
  color: #fff; padding: 100px 32px 80px; text-align: center;
}
.hero-content { max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 48px; font-weight: 800; line-height: 1.15; letter-spacing: -1px; }
.hero-sub { font-size: 18px; opacity: 0.9; margin: 20px 0 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn { font-size: 16px; padding: 14px 32px; }
.hero-actions .btn-outline { border-color: rgba(255,255,255,0.5); color: #fff; }
.hero-actions .btn-outline:hover { border-color: #fff; background: rgba(255,255,255,0.1); }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 60px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat .hs-num { display: block; font-size: 32px; font-weight: 800; }
.hero-stat .hs-label { font-size: 14px; opacity: 0.75; }

/* Compact landing hero */
.hero.hero-compact { padding: 46px 32px 38px; }
.hero-compact .hero-content { max-width: 860px; }
.hero-compact h1 { font-size: 34px; letter-spacing: -0.6px; }
.hero-compact .hero-sub { font-size: 15px; margin: 12px auto 22px; max-width: 680px; }
.hero-compact .hero-actions .btn { font-size: 13.5px; padding: 9px 20px; }

/* Live marketplace board */
.home-live {
  padding: 34px 32px 10px;
  background: var(--bg-secondary, var(--bg-muted));
  border-bottom: 1px solid var(--border);
}
.live-board-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; text-align: left;
}
.live-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.16); animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.16); opacity: 1; }
  50% { box-shadow: 0 0 0 7px rgba(34,197,94,0.04); opacity: 0.7; }
}
.live-updated { font-size: 11.5px; color: var(--text-light); white-space: nowrap; }
.live-metrics, .live-trade {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.live-trade { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.live-scope { margin: -6px 0 12px; font-size: 11px; color: var(--text-light); text-align: left; }
.live-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; text-align: left; min-width: 0;
}
.live-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 10px;
}
.live-card-head h3 { margin: 0; font-size: 13.5px; }
.live-value { display: block; font-size: 27px; font-weight: 800; line-height: 1.05; }
.live-label {
  display: block; margin-top: 2px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-light);
}
.live-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary); background: rgba(26,107,60,0.1);
  border: 1px solid rgba(26,107,60,0.25); border-radius: 999px; padding: 2px 7px;
}
.live-badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; animation: badgeBlink 1.8s infinite;
}
@keyframes badgeBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.live-count { font-size: 12px; font-weight: 800; color: var(--primary); }
.live-list {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  gap: 7px; max-height: 196px; overflow-y: auto;
}
.live-row {
  display: flex; align-items: flex-start; gap: 7px; font-size: 12px;
  border-top: 1px solid var(--border); padding-top: 7px; min-width: 0;
}
.live-row:first-child { border-top: 0; padding-top: 0; }
.live-row-main {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1;
  color: var(--text); text-decoration: none;
}
.live-row-main strong {
  font-size: 12.5px; font-weight: 650; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.live-row-main span {
  font-size: 10.5px; color: var(--text-light); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.live-time { font-size: 9.5px; color: var(--text-light); white-space: nowrap; flex-shrink: 0; }
.live-status {
  font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-light); background: var(--bg-muted); border-radius: 4px;
  padding: 2px 5px; white-space: nowrap; flex-shrink: 0;
}
.live-amount { font-size: 11.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.live-meta { font-size: 9px; color: var(--text-light); white-space: nowrap; flex-shrink: 0; }
.live-note { margin: -2px 0 8px; font-size: 10.5px; color: var(--text-light); line-height: 1.4; }
.live-locate { margin-top: 9px; font-size: 11px; padding: 4px 10px; }
.live-row { flex-wrap: wrap; }
.live-row-main { flex: 1 1 65%; }
.live-empty { font-size: 11.5px; color: var(--text-light); padding: 6px 0; }

.cert-list { display: flex; flex-direction: column; gap: 6px; }
.cert-list-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); background: var(--bg-card);
}
.cert-list-item:hover { border-color: var(--primary); background: rgba(26,107,60,0.04); }
.cert-list-id { font-weight: 700; font-size: 12.5px; }
.cert-list-meta { flex: 1; font-size: 11.5px; color: var(--text-light); }

/* Business planning */
.bp-progress {
  height: 8px; margin: 0 16px 12px; border-radius: 999px;
  background: var(--bg-muted); overflow: hidden;
}
.bp-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #22c55e); }
.bp-steps { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 16px; }
.bp-step {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
}
.bp-step.done { background: rgba(34,197,94,0.05); border-color: rgba(34,197,94,0.25); }
.bp-step-dot {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-muted); font-size: 12px; font-weight: 700;
}
.bp-step.done .bp-step-dot { background: #22c55e; color: #fff; }
.bp-step-body { flex: 1; min-width: 0; }
.bp-step-body strong { font-size: 13px; }
.bp-step-body p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-light); }
.bp-plan-form { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.bp-automations { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 8px; }
.bp-automation {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
}
.bp-automation > div { flex: 1; min-width: 0; }
.bp-automation strong { font-size: 13px; }
.bp-automation p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-light); }
.bp-plan-card:hover { border-color: var(--primary); }
@media (max-width: 767px) {
  .bp-step { flex-wrap: wrap; }
  .bp-step-body { flex: 1 1 100%; }
  .bp-automation { flex-wrap: wrap; }
  .bp-automation > div { flex: 1 1 100%; }
}

/* Taxonomy detail: constrained shell + holders first */
.taxonomy-detail-shell { max-width: 1200px; margin: 0 auto; }
.taxonomy-detail-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-top: 16px; align-items: start;
}
.taxonomy-detail-grid > .card { margin-top: 0 !important; }
.holder-card { border-color: rgba(26,107,60,0.35); }
.holder-filters {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px;
}
.holder-filters select { flex: 0 1 auto; }
.holder-table td { vertical-align: top; }
.holder-qty { color: var(--primary); white-space: nowrap; }
@media (max-width: 900px) {
  .taxonomy-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .holder-filters { padding: 0 12px 10px; }
  .holder-filters select { flex: 1 1 140px; }
}

/* Guided opportunity workflow */
.workflow-shell { max-width: 1000px; margin: 0 auto; }
.workflow-shell-inner { display: flex; flex-direction: column; gap: 16px; }
.workflow-hero { border-color: rgba(26,107,60,0.35); }
.workflow-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.workflow-grid .form-group label { font-size: 12px; color: var(--text-light); }
@media (max-width: 640px) {
  .workflow-grid { grid-template-columns: 1fr; }
}

/* Service-provider directory */
.provider-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.provider-card .provider-meta { font-size: 12px; color: var(--text-light); line-height: 1.6; }

.section { padding: 72px 32px; }
.section-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.section h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.section-sub { color: var(--text-light); font-size: 16px; margin-bottom: 48px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; text-align: left; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px; transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.feature-icon { font-size: 36px; margin-bottom: 12px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-light); line-height: 1.7; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; text-align: left; margin-top: 24px; }
.step { padding: 24px; }
.step-num {
  width: 48px; height: 48px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; margin-bottom: 16px;
}
.step h3 { font-size: 18px; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-light); line-height: 1.7; }

.cta { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; text-align: center; }
.cta h2 { font-size: 32px; }
.cta p { opacity: 0.9; margin: 12px 0 24px; font-size: 16px; }
.cta .btn { font-size: 16px; padding: 14px 32px; }

/* ─── PAGE HEADER (about/contact) ──────────── */

.page-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff; padding: 64px 32px; text-align: center;
}
.page-header h1 { font-size: 36px; font-weight: 700; }
.page-header p { opacity: 0.85; font-size: 16px; margin-top: 8px; }

/* ─── RESPONSIVE ────────────────────────────── */

@media (max-width: 1199px) {
  .pub-nav .autocomplete-wrap { max-width: 220px !important; }
}

@media (max-width: 991px) {
  .pub-nav { gap: 12px; }
  .pub-nav .autocomplete-wrap { display: none !important; }
  .pub-auth { margin-left: auto; }
  [dir="rtl"] .pub-auth { margin-left: 0; margin-right: auto; }
  .pub-toggle { display: flex; align-items: center; justify-content: center; }
  .pub-links {
    display: none; flex-direction: column; position: absolute; top: var(--nav-height);
    left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 12px;
  }
  [dir="rtl"] .pub-links { flex-direction: column; }
  .pub-links.open { display: flex; }
  .pub-links a { padding: 10px 12px; border-radius: var(--radius); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .live-metrics, .live-trade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .pub-nav { padding: 0 16px; gap: 10px; }
  .pub-auth {
    display: none; flex-direction: column; position: absolute; top: var(--nav-height);
    left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 12px;
  }
  .pub-auth.open { display: flex; }
  .pub-auth .btn { width: 100%; }

  .hero h1 { font-size: 28px; }
  .hero { padding: 60px 16px 50px; }
  .hero-sub { font-size: 16px; }
  .hero-stats { gap: 24px; margin-top: 40px; }
  .hero-stat .hs-num { font-size: 24px; }
  .hero.hero-compact { padding: 32px 16px 28px; }
  .hero-compact h1 { font-size: 25px; }
  .hero-compact .hero-sub { font-size: 14px; margin-bottom: 16px; }
  .hero-compact .hero-actions .btn { font-size: 13px; padding: 8px 14px; }
  .home-live { padding: 24px 16px 8px; }
  .live-board-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .live-metrics, .live-trade { grid-template-columns: 1fr; }
  .live-trade .live-card:last-child { grid-column: auto; }
  .live-list { max-height: 220px; }
  .features-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .section { padding: 48px 16px; }
  .section h2 { font-size: 24px; }
  .page-header { padding: 44px 16px; }
  .page-header h1 { font-size: 28px; }
  .footer-inner { flex-direction: column; gap: 24px; text-align: center; align-items: center; }
  [dir="rtl"] .footer-inner { flex-direction: column; }
  .footer-brand { max-width: none; }
  .footer-sitemap { justify-content: center; gap: 32px; }
}

@media (max-width: 575px) {
  .pub-nav { padding: 0 8px; gap: 8px; }
  .pub-logo { font-size: 18px; }
  .hero h1 { font-size: 24px; }
  .hero { padding: 44px 16px 40px; }
  .hero-sub { font-size: 15px; }
  .hero-actions .btn { width: 100%; }
  .section { padding: 40px 12px; }
  .section h2 { font-size: 22px; }
  .page-header { padding: 36px 12px; }
  .page-header h1 { font-size: 24px; }
  .footer-inner { flex-direction: column; gap: 24px; text-align: center; align-items: center; }
  [dir="rtl"] .footer-inner { flex-direction: column; }
  .footer-sitemap { gap: 20px; }
  .footer-col { min-width: 110px; }
  .pub-footer { padding: 24px 12px 20px; }
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth */
.auth-container {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 20px;
}
.auth-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 28px; color: var(--primary); margin-bottom: 4px; }
.auth-card p { color: var(--text-light); margin-bottom: 24px; font-size: 14px; }
.auth-card .logo { font-size: 32px; font-weight: 800; color: var(--primary); letter-spacing: -1px; margin-bottom: 8px; }
.auth-card .logo span { color: var(--accent); }
.auth-nav { display: flex; justify-content: space-between; margin-bottom: 20px; gap: 8px; }
.auth-nav-link { font-size: 13px; font-weight: 600; color: var(--text-light); text-decoration: none; }
.auth-nav-link:hover { color: var(--primary); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; transition: border-color 0.2s; font-family: var(--font);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.12);
}
.form-group input.input-error, .form-group select.input-error, .form-group textarea.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,53,69,0.12);
}
.form-group .field-error { font-size: 12px; color: var(--danger); margin-top: 2px; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; font-family: var(--font);
}
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: var(--text-inverse); }
.btn-accent:hover { background: var(--accent-light); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: var(--text-inverse); }
.btn-danger:hover { background: #c82333; }
.btn-success { background: #1da851; color: var(--text-inverse); }
.btn-success:hover { background: #17a04a; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-light); }

.sso-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--text-light); font-size: 12px; }
.sso-divider::before, .sso-divider::after { content: ''; flex: 1; height: 1px; background: var(--border, #e5e7eb); }
.sso-buttons { display: flex; flex-direction: column; gap: 8px; }
.sso-btn { border: 1px solid var(--border, #e5e7eb); background: var(--card-bg, #fff); color: var(--text, inherit); }
.sso-note { font-size: 12px; color: var(--text-light); text-align: center; margin-top: 8px; }

.verification-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.verify-box { border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; font-size: 13px; }
.verify-box .badge { font-size: 11px; }
.verify-hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* Layout */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { flex: 1; display: flex; align-items: stretch; min-height: 0; }

.sidebar {
  width: var(--sidebar-width); background: var(--bg-sidebar); color: var(--text-inverse);
  display: flex; flex-direction: column; position: sticky; top: var(--nav-height);
  height: calc(100vh - var(--nav-height)); flex-shrink: 0; align-self: flex-start; z-index: 90;
  overflow: hidden;
}
.sidebar-brand { padding: 20px; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand span { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.75);
  font-size: 14px; transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav a.active { border-left: 3px solid var(--accent); }
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { font-size: 13px; opacity: 0.8; margin-bottom: 8px; }
.sidebar-footer .btn { width: 100%; }

/* Collapsed (icon rail) — always visible, expands on hover */
.sidebar-collapsed { width: 64px; transition: width 0.25s ease; }
.sidebar-collapsed:hover { width: var(--sidebar-width); }
.sidebar-collapsed .sidebar-brand { padding: 20px 0; font-size: 16px; text-align: center; white-space: nowrap; }
.sidebar-collapsed .sidebar-brand .brand-text { display: none; }
.sidebar-collapsed .sidebar-nav a { padding: 12px 0; justify-content: center; gap: 0; }
.sidebar-collapsed .sidebar-nav a .label { display: none; }
.sidebar-collapsed .sidebar-nav a .icon { font-size: 20px; }
.sidebar-collapsed .sidebar-footer { padding: 12px 0; text-align: center; }
.sidebar-collapsed .sidebar-user, .sidebar-collapsed .sidebar-footer .btn { display: none; }
.sidebar-collapsed:hover .sidebar-brand { padding: 20px; font-size: 22px; text-align: left; }
.sidebar-collapsed:hover .sidebar-brand .brand-text { display: inline; }
.sidebar-collapsed:hover .sidebar-nav a { padding: 12px 20px; justify-content: flex-start; gap: 12px; }
.sidebar-collapsed:hover .sidebar-nav a .label { display: inline; }
.sidebar-collapsed:hover .sidebar-nav a .icon { font-size: 18px; }
.sidebar-collapsed:hover .sidebar-footer { padding: 16px 20px; text-align: left; }
.sidebar-collapsed:hover .sidebar-user, .sidebar-collapsed:hover .sidebar-footer .btn { display: block; }

.main-content { margin-left: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: var(--nav-height); z-index: 50;
}
.topbar h2 { font-size: 20px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 24px 32px; flex: 1; }

/* Cards */
.card {
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.card-header h3 { font-size: 16px; font-weight: 700; }
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.list-header input, .list-header .fi { min-width: 0; }
.card-grid { display: grid; gap: 16px; align-items: start; justify-content: start; }
.card-grid > .card { min-width: 0; }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.stat-card { text-align: center; padding: 24px; }
.stat-card .stat-value { font-size: 36px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* Earning opportunities (public browse) */
.opp-tab { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-light); }
.opp-tab.active { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.opp-card { margin-bottom: 16px; }

/* Table */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); border-bottom: 2px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tr:hover td { background: #f1f5f3; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e8f0; color: #4a5568; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card);
}
.timeline-item .tl-title { font-weight: 600; font-size: 14px; }
.timeline-item .tl-sub { font-size: 12px; color: var(--text-light); }
.timeline-item .tl-desc { font-size: 13px; margin-top: 4px; }

/* QR / Barcode */
.code-display { text-align: center; padding: 16px; }
.code-display img { max-width: 200px; } 

/* Scanner */
.scanner-container { max-width: 420px; margin: 0 auto; text-align: center; }
.scanner-container video { width: 100%; border-radius: var(--radius); background: #000; box-shadow: 0 0 0 2px var(--primary); }
.scanner-container .scanning-indicator {
  width: 60%; height: 2px; background: var(--accent); margin: 0 auto; border-radius: 2px;
  animation: scanPulse 1.5s ease-in-out infinite;
}
@keyframes scanPulse {
  0%, 100% { opacity: 0.3; transform: scaleX(0.8); }
  50% { opacity: 1; transform: scaleX(1); }
}
.scanner-overlay { position: relative; }
.scan-result { margin-top: 16px; padding: 16px; border-radius: var(--radius); background: #f0f9f0; }
.scan-result-error { background: #f8d7da; color: #721c24; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center; z-index: 1000;
}
.modal { background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Toast */
.toast {
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; max-width: 400px; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease; color: #fff; cursor: pointer;
}
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }
.toast-out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* Loading */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; }

/* Bar chart */
.bar-chart { display: flex; gap: 2px; align-items: flex-end; height: 120px; padding: 8px 0; }
.bar-chart .bar {
  flex: 1; background: var(--primary); border-radius: 3px 3px 0 0; min-width: 20px;
  transition: height 0.3s ease; position: relative; cursor: pointer;
}
.bar-chart .bar:hover { background: var(--primary-light); }
.bar-chart .bar-label { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-light); white-space: nowrap; }
.bar-chart .bar-value { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text); }

/* Share buttons */
.share-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; color: #fff; transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.85; }
.share-whatsapp { background: #25D366; }
.share-twitter { background: #1DA1F2; }
.share-facebook { background: #1877F2; }
.share-linkedin { background: #0A66C2; }
.share-telegram { background: #0088CC; }
.share-email { background: #6b7280; }

/* MFA */
.mfa-setup { text-align: center; }
.mfa-setup .qr-display { margin: 16px 0; }
.mfa-setup .secret-key { font-family: monospace; font-size: 13px; background: var(--bg); padding: 8px; border-radius: var(--radius); }

/* Mobile menu */
.mobile-toggle {
  display: none; background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text); padding: 4px; line-height: 1;
}
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

/* Responsive */
@media (max-width: 1024px) {
  .card-grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 991px) {
  .topbar { padding: 0 20px; }
}

@media (max-width: 767px) {
  .mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .pub-nav.has-topbar .pub-links,
  .pub-nav.has-topbar .pub-auth { top: calc(var(--nav-height) + var(--header-height)); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.3s ease; z-index: 102;
    width: var(--sidebar-width); left: 0;
  }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open .sidebar-brand { padding: 20px; text-align: left; font-size: 22px; }
  .sidebar.open .sidebar-brand .brand-text { display: inline; }
  .sidebar.open .sidebar-nav a { padding: 12px 20px; justify-content: flex-start; gap: 12px; }
  .sidebar.open .sidebar-nav a .label { display: inline; }
  .sidebar.open .sidebar-footer { padding: 16px 20px; text-align: left; }
  .sidebar.open .sidebar-user, .sidebar.open .sidebar-footer .btn { display: block; }
  .sidebar-overlay.open { display: block; z-index: 101; }
  .main-content { margin-left: 0; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .topbar #topbar-search { display: none; }
  .topbar h2 { flex: 1; font-size: 17px; }
  #cargo-search-form { grid-template-columns: 1fr !important; }
  .page-content { padding: 16px; }
}

@media (max-width: 575px) {
  .topbar { padding: 0 10px; }
  .topbar h2 { font-size: 15px; }
  .topbar-actions { gap: 8px; }
  .page-content { padding: 12px; }
  .card { padding: 16px; }
  .list-header { flex-direction: column; align-items: stretch; }
  .list-header input, .list-header .fi { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  .modal { padding: 24px 20px; }
  th, td { padding: 10px 12px; }
  .info-label { width: 120px; }
}

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ─── SEARCH ─────────────────────────────────── */
.search-bar { display: flex; gap: 8px; width: 100%; max-width: 600px; }
.search-bar input { flex: 1; padding: 10px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--bg); color: var(--text); }
.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.12); }
.search-result-card { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all 0.2s; background: var(--bg-card); }
.search-result-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.search-result-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); }
.search-result-title { font-size: 16px; font-weight: 600; margin: 2px 0; }
.search-result-sub { font-size: 13px; color: var(--text-light); }
.search-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; background: var(--primary); color: #fff; margin-right: 4px; }
.pagination {
  display: flex; gap: 4px; justify-content: center; align-items: center;
  margin: 24px auto 0; flex-wrap: wrap; width: max-content; max-width: 100%;
  padding: 6px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px;
}
.pagination .page-btn {
  min-width: 32px; height: 32px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  background: transparent; font-size: 12.5px; font-weight: 600;
  color: var(--text); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pagination .page-btn:hover:not(:disabled) { background: var(--bg-muted); border-color: var(--border); color: var(--primary); }
.pagination .page-btn.active {
  background: linear-gradient(135deg, var(--primary), #1a8a4a);
  color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(26,107,60,0.25);
}
.pagination .page-btn:disabled { opacity: 0.35; cursor: default; }
.pagination .page-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.pagination .page-btn.ellipsis { border-color: transparent; background: transparent; cursor: default; color: var(--text-light); min-width: 20px; padding: 0 2px; }
.pagination .page-edge { font-size: 11.5px; color: var(--text-light); }
.pagination-info { font-size: 11.5px; color: var(--text-light); padding: 0 6px; white-space: nowrap; }
.page-jump-wrap {
  display: flex; align-items: center; gap: 4px; margin-left: 2px;
  font-size: 11px; color: var(--text-light); white-space: nowrap;
}
.page-jump {
  width: 52px; height: 30px; padding: 2px 6px; text-align: center;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--text); font-size: 12px;
}
.page-jump:focus { outline: none; border-color: var(--primary); }
.pagination .page-go { height: 30px; min-width: 36px; padding: 0 8px; }
@media (max-width: 767px) {
  .pagination {
    border-radius: 14px; justify-content: flex-start; width: 100%;
    overflow-x: auto; flex-wrap: nowrap;
  }
  .pagination .page-btn { flex: 0 0 auto; }
  .pagination-info { display: none; }
  .page-jump-wrap { display: none; }
}
.search-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.search-filters .filter-btn { padding: 4px 12px; border-radius: 16px; border: 1px solid var(--border); font-size: 12px; cursor: pointer; background: transparent; color: var(--text-light); }
.search-filters .filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── TABS ────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text-light); transition: all 0.2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── TRACKING TIMELINE ────────────────────────── */
.tracking-timeline { position: relative; padding-left: 28px; }
.tracking-timeline::before { content: ''; position: absolute; left: 10px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tracking-item { position: relative; padding-bottom: 20px; }
.tracking-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-card); border: 3px solid var(--primary); }
.tracking-item.delivered::before { background: var(--success); border-color: var(--success); }
.tracking-item.exception::before { background: var(--danger); border-color: var(--danger); }
.tracking-item .tt-status { font-weight: 600; font-size: 14px; }
.tracking-item .tt-loc { font-size: 12px; color: var(--text-light); }
.tracking-item .tt-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ─── INVENTORY TABLE ──────────────────────────── */
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .inv-grid { grid-template-columns: 1fr; } }
.zone-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: #e8f5e9; color: #2e7d32; }

/* ─── INFO ROWS ────────────────────────────────── */
.info-row { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-label { width: 160px; color: var(--text-light); flex-shrink: 0; }
.info-value { flex: 1; font-weight: 500; }

/* ─── AUTOCOMPLETE ───────────────────────────── */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg); max-height: 360px; overflow-y: auto;
  display: none;
}
.autocomplete-dropdown.open { display: block; }
.autocomplete-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: rgba(26,107,60,0.06); }
.autocomplete-item .ac-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.ac-icon-taxonomy { background: #d1ecf1; color: #0c5460; }
.ac-icon-product { background: #d4edda; color: #155724; }
.ac-icon-batch { background: #fff3cd; color: #856404; }
.autocomplete-item .ac-label { font-size: 14px; font-weight: 600; }
.autocomplete-item .ac-sub { font-size: 11px; color: var(--text-light); }

/* ─── TAXONOMY ITEM DETAIL (ENHANCED) ──────── */
.item-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .item-detail-grid { grid-template-columns: 1fr; } }
.taxonomy-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; margin: 2px; }
.taxonomy-badge.phylum { background: #e8eaf6; color: #283593; }
.taxonomy-badge.class { background: #fce4ec; color: #880e4f; }
.taxonomy-badge.order { background: #e0f2f1; color: #00695c; }
.taxonomy-badge.family { background: #fff3e0; color: #e65100; }
.taxonomy-badge.genre { background: #f3e5f5; color: #6a1b9a; }

/* ─── LINKED CARD (items-batches-warehouses) ── */
.linked-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; align-items: center; }
.linked-card:hover { border-color: var(--primary); background: rgba(26,107,60,0.04); }
.linked-card .lc-icon { font-size: 24px; width: 36px; text-align: center; }
.linked-card .lc-body { flex: 1; }
.linked-card .lc-title { font-size: 14px; font-weight: 600; }
.linked-card .lc-sub { font-size: 12px; color: var(--text-light); }
.linked-card .lc-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ─── SHIPMENT MODE ICONS ──────────────────── */
.mode-icon { display: inline-flex; align-items: center; gap: 4px; }
.mode-icon .mi-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mi-ferry { background: #2196F3; }
.mi-courier { background: #FF9800; }
.mi-truck { background: #4CAF50; }
.mi-air { background: #9C27B0; }
.mi-rail { background: #795548; }
.mi-multimodal { background: #607D8B; }

/* ─── COLLECTION CARDS ─────────────────────── */
.collection-card { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.2s; background: var(--bg-card); }
.collection-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.collection-card .cc-img { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.collection-card .cc-body { flex: 1; }
.collection-card .cc-title { font-size: 16px; font-weight: 700; }
.collection-card .cc-desc { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.collection-card .cc-meta { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ─── BULKING PIPELINE ─────────────────────── */
.bulk-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.bulk-step {
  flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card);
}
.bulk-step.done { border-color: var(--primary); background: rgba(26,107,60,0.06); }
.bulk-step-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26,107,60,0.1); font-size: 16px;
}
.bulk-step.done .bulk-step-icon { background: var(--primary); color: #fff; }
.bulk-step-label { font-size: 13px; font-weight: 600; }
.bulk-section { margin-top: 20px; }
.bulk-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.trace-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
@media (max-width: 900px) { .trace-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .trace-grid { grid-template-columns: repeat(2, 1fr); } }
.trace-cell {
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 8px;
  text-align: center; background: var(--bg, #fff);
}
.trace-ico { font-size: 18px; }
.trace-name { font-size: 11px; font-weight: 700; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.trace-state { font-size: 11px; color: var(--text-light); margin-top: 2px; text-transform: capitalize; }
.trace-done { border-color: var(--primary); background: rgba(26,107,60,0.06); }
.trace-done .trace-state { color: var(--primary); font-weight: 600; }
.trace-active { border-color: var(--accent, #d97706); background: rgba(217,119,6,0.06); }
.trace-active .trace-state { color: var(--accent, #d97706); font-weight: 600; }

/* ─── BADGE VARIANTS ───────────────────────────────────── */
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ─── STOREFRONT CARD ──────────────────────────────────── */
.storefront-card { cursor: pointer; transition: all 0.2s; }
.storefront-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.storefront-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.storefront-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.storefront-info h4 { font-size: 15px; font-weight: 700; margin: 0 0 2px; color: var(--text); }
.storefront-info p { font-size: 12px; color: var(--text-light); margin: 0; }
.storefront-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.storefront-body { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.storefront-stats { display: flex; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.storefront-stats .stat { text-align: center; flex: 1; }
.storefront-stats .stat-value { font-size: 17px; font-weight: 800; color: var(--primary-dark); }
.storefront-stats .stat-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ─── MOBILE NAV IMPROVEMENTS (additive, no override) ─── */
@media (max-width: 767px) {
  .pub-links a, .pub-auth .btn { padding: 12px 16px; font-weight: 500; }
  .pub-links a.active { background: rgba(26,107,60,0.08); color: var(--primary); }
}

/* ─── IDENTITY BADGE (topbar + sidebar) ────────────────── */
.identity-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.identity-badge .badge { font-size: 11px; padding: 4px 8px; }

.topbar-identity { margin-left: auto; padding-right: 8px; }
.topbar-identity .identity-badge { font-size: 12px; }

/* Sidebar identity block */
.sidebar-identity { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: auto; }
.sidebar-identity .sidebar-user { font-size: 14px; font-weight: 600; color: var(--text-inverse); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-identity .sidebar-tenant { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.sidebar-identity .sidebar-tenant .badge { font-size: 10px; padding: 3px 8px; }

/* ─── BADGE VARIANTS ───────────────────────────────────── */
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ─── STOREFRONT CARD ──────────────────────────────────── */
.storefront-card { cursor: pointer; transition: all 0.2s; }
.storefront-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.storefront-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.storefront-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.storefront-info h4 { font-size: 15px; font-weight: 700; margin: 0 0 2px; color: var(--text); }
.storefront-info p { font-size: 12px; color: var(--text-light); margin: 0; }
.storefront-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.storefront-body { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.storefront-stats { display: flex; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.storefront-stats .stat { text-align: center; flex: 1; }
.storefront-stats .stat-value { font-size: 17px; font-weight: 800; color: var(--primary-dark); }
.storefront-stats .stat-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ─── MOBILE NAV IMPROVEMENTS (additive, no override) ─── */
@media (max-width: 767px) {
  .pub-links a, .pub-auth .btn { padding: 12px 16px; font-weight: 500; }
  .pub-links a.active { background: rgba(26,107,60,0.08); color: var(--primary); }
}

/* ─── CAPABILITY HUB ──────────────────────────────────── */
.cap-summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 0 16px 12px; }
.cap-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 16px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 16px; }
.cap-card { background: var(--card-bg, #fff); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: all 0.2s; position: relative; }
.cap-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.cap-locked { opacity: 0.72; background: var(--bg-muted, #f9fafb); }
.cap-locked:hover { transform: none; border-color: var(--border); box-shadow: none; }
.cap-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: linear-gradient(135deg, rgba(26,107,60,0.12), rgba(26,107,60,0.04)); }
.cap-title { font-size: 15px; font-weight: 700; color: var(--text); }
.cap-desc { font-size: 12.5px; color: var(--text-light); line-height: 1.5; flex: 1; }
.cap-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.cap-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.cap-lock { font-size: 12px; color: var(--warning, #92400e); font-weight: 600; }

/* ─── AI COPILOT ──────────────────────────────────────── */
.ai-shell { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.ai-side .card { position: sticky; top: 16px; }
.ai-thread-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.ai-thread { text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-thread:hover { background: var(--bg-muted, #f9fafb); border-color: var(--border); }
.ai-main { min-width: 0; }
.ai-messages { display: flex; flex-direction: column; gap: 12px; padding: 16px; max-height: 52vh; overflow-y: auto; }
.ai-msg { display: flex; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.ai-msg.assistant .ai-bubble { background: var(--bg-muted, #f3f4f6); color: var(--text); border-top-left-radius: 4px; }
.ai-msg.user .ai-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.ai-citations { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 10px; }
.ai-citation { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(26,107,60,0.08); color: var(--primary-dark, #14532d); text-decoration: none; border: 1px solid rgba(26,107,60,0.15); }
.ai-suggested { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 10px; }
.ai-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.ai-input textarea { flex: 1; resize: vertical; }
.muted { color: var(--text-light); font-size: 13px; }

/* ─── AUTOMATIONS ─────────────────────────────────────── */
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.wf-card { display: flex; flex-direction: column; }
.wf-inputs { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.wf-inputs .form-group { margin-bottom: 0; }

/* ─── BLOCKCHAIN / LEDGER ─────────────────────────────── */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; word-break: break-all; color: var(--text-light); }
.verify-result { background: var(--bg-muted, #f9fafb); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 12px; font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 320px; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 900px) {
  .ai-shell { grid-template-columns: 1fr; }
  .ai-side .card { position: static; }
  .cap-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
