/* ============================================================
   Import Manager - Dashboard
   Pedagogiskt gränssnitt för EMCS-importflöde
   ============================================================ */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-alt: #f8f9fc;
  --border: #e2e6ef;
  --text: #1e2a3a;
  --text-muted: #6b7a8d;
  --text-light: #9aa5b4;
  --primary: #3b6df5;
  --primary-light: #eef2ff;
  --accent: #10b981;
  --accent-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  --muted: #6b7a8d;
  --card-bg: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1, .app-header-logo {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  transition: opacity var(--transition);
}
.app-header-logo:hover { opacity: 0.8; }

.app-header h1 span.logo {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

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

.header-nav .nav-btn {
  display: inline-flex; align-items: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  line-height: 1.3;
}
.header-nav .nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.header-nav .nav-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }

.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem 2rem; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--text-muted);
  margin-bottom: 1rem;
}
.breadcrumbs a {
  color: var(--primary); text-decoration: none;
  transition: var(--transition);
}
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .bc-sep { color: var(--text-light); }
.breadcrumbs .bc-current { color: var(--text); font-weight: 500; }

/* ============================================================
   OVERVIEW HEADER
   ============================================================ */

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

.overview-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.overview-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.overview-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============================================================
   FLOW PIPELINE
   ============================================================ */

.flow-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

.flow-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flow-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
  position: relative;
}

.flow-step .step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: 2px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 2;
  transition: var(--transition);
}

.flow-step.active .step-icon {
  border-color: var(--primary);
  background: var(--primary-light);
}

.flow-step.completed .step-icon {
  border-color: var(--accent);
  background: var(--accent-light);
}

.flow-step .step-label {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}
.flow-step.active .step-label { color: var(--primary); }
.flow-step.completed .step-label { color: var(--accent); }

.flow-step .step-count {
  font-size: 0.7rem;
  color: var(--text-light);
}

.flow-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 40px;
  position: relative;
  top: -12px;
}
.flow-connector.completed { background: var(--accent); }

/* ============================================================
   SHIPMENT CARDS
   ============================================================ */

.shipment-list { display: flex; flex-direction: column; gap: 0.5rem; }

.shipment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}
.shipment-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }

.shipment-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.shipment-info h3 { font-size: 0.95rem; font-weight: 600; }

.shipment-vessel {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.shipment-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.draft { background: var(--warning-light); color: #b45309; }
.status-badge.validated { background: var(--primary-light); color: var(--primary); }
.status-badge.submitted { background: var(--purple-light); color: var(--purple); }
.status-badge.accepted { background: var(--accent-light); color: #059669; }
.status-badge.delivered { background: #f0fdf4; color: #166534; }

/* ============================================================
   DETAIL VIEW
   ============================================================ */

.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-title { flex: 1; }

.detail-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.detail-vessel {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 1rem;
}

.detail-subtitle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.detail-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.back-btn:hover { background: var(--surface-alt); }

.detail-header h2 { font-size: 1.25rem; font-weight: 700; flex: 1; }

/* Tabs */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

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

/* Info Cards within detail */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-card-header {
  background: var(--surface-alt);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card-body { padding: 1.25rem; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--bg);
  font-size: 0.85rem;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); }
.info-row .value { font-weight: 600; text-align: right; }
.info-row .value.mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 0.8rem; }

/* Validation */
.validation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.validation-badge.ok { background: var(--accent-light); color: #059669; }
.validation-badge.fail { background: var(--danger-light); color: var(--danger); }

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

.data-table thead {
  background: var(--surface-alt);
  position: sticky;
  top: 0;
}

.data-table th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bg);
}

.data-table tr:hover td { background: var(--surface-alt); }

.data-table .number { text-align: right; font-family: "SF Mono", "Fira Code", monospace; font-size: 0.8rem; }

.data-table .total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: var(--surface-alt);
}

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

/* EMCS box */
.emcs-line {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
}

.emcs-line h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.emcs-line .emcs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.emcs-line .emcs-field .ef-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
}

.emcs-line .emcs-field .ef-value {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 2rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 1rem;
}

/* User info in header */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================
   EMCS COMPONENTS
   ============================================================ */

.status-badge.cancelled { background: var(--danger-light); color: var(--danger); }
.status-badge.redirected { background: var(--purple-light); color: var(--purple); }
.status-badge.received { background: var(--accent-light); color: #059669; }
.status-badge.sent { background: var(--primary-light); color: var(--primary); }
.status-badge.error { background: var(--danger-light); color: var(--danger); }
.status-badge.unknown { background: var(--bg); color: var(--text-muted); }

/* Cert indicator */
.cert-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.cert-status .cert-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.cert-status .cert-dot.ok { background: var(--accent); }
.cert-status .cert-dot.warn { background: var(--warning); }
.cert-status .cert-dot.err { background: var(--danger); }
.cert-status .cert-dot.off { background: var(--text-light); }

/* Sync action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.btn-primary:hover { background: #2d5be0; }
.btn.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn.btn-danger:hover { background: #dc2626; }
.btn.btn-small { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

/* Movement cards */
.movement-list { display: flex; flex-direction: column; gap: 0.75rem; }

.movement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  transition: var(--transition);
}
.movement-card:hover { box-shadow: var(--shadow); }
.movement-card.error-card { border-left: 4px solid var(--danger); }

.movement-card .arc-number {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.95rem;
  font-weight: 700;
}

.movement-card .movement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.movement-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Modal / Dialog */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
}

.modal-body { padding: 1.5rem; }

.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  transition: var(--transition);
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Log messages table */
.log-direction { font-size: 0.9rem; }
.log-direction.inbound { color: var(--accent); }
.log-direction.outbound { color: var(--primary); }

/* Sync result alert */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.alert.alert-success { background: var(--accent-light); border: 1px solid #86efac; }
.alert.alert-error { background: var(--danger-light); border: 1px solid #fca5a5; }
.alert.alert-info { background: var(--primary-light); border: 1px solid #93c5fd; }

/* ============================================================
   DOCUMENTS
   ============================================================ */

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.doc-card:hover {
  border-color: var(--primary);
}

.doc-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius);
}

.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.15rem;
}

.doc-meta span:not(:last-child)::after {
  content: "\00B7";
  margin-left: 0.5rem;
}

.doc-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-small {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ============================================================
   COMPLETENESS
   ============================================================ */

.completeness-bar-mini {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.completeness-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.completeness-pct {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.completeness-panel {
  margin-bottom: 1.5rem;
}

.completeness-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.completeness-label {
  position: absolute;
  right: 0;
  top: -1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.completeness-missing {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.missing-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: var(--warning-light);
  color: #b45309;
  border-radius: 10px;
}

/* ============================================================
   LRN / MRN / ARC FLOW
   ============================================================ */

.lrn-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 0.5rem 0;
}

.lrn-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  position: relative;
}

.lrn-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
}

.lrn-step.done .lrn-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.lrn-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-align: center;
}

.lrn-step.done .lrn-label { color: var(--accent); }

.lrn-value {
  font-size: 0.65rem;
  color: var(--text-light);
  font-family: monospace;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lrn-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
  margin-top: 5px;
}

.lrn-connector.done { background: var(--accent); }

/* ============================================================
   FORM GRID & FIELD STATUS
   ============================================================ */

.form-section {
  margin-bottom: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.form-group.field-missing input,
.form-group.field-missing select {
  border-left: 3px solid var(--warning);
}

.form-group.field-filled input,
.form-group.field-filled select {
  border-left: 3px solid var(--accent);
}

/* ============================================================
   COST INVOICES
   ============================================================ */

.cost-summary {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.cost-total-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
}

.cost-total-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  display: block;
}

.cost-vat {
  font-size: 0.8rem;
  color: var(--text-light);
}

.cost-summary-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cost-type-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* ============================================================
   DESTINATIONS
   ============================================================ */

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

.dest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dest-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.dest-card.inactive {
  opacity: 0.6;
}

.dest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.dest-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.dest-field {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

.dest-label {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.dest-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dest-rule-chip {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg);
  border-radius: 10px;
  white-space: nowrap;
}

.card-missing {
  border-left: 3px solid var(--warning);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .container { padding: 1rem; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
  .shipment-card { grid-template-columns: 1fr; gap: 0.75rem; }
  .shipment-icon { display: none; }
  .shipment-status { text-align: left; }
}

/* ============================================================
   TRACKING UI
   ============================================================ */

.tracking-panel { display:flex; flex-direction:column; gap:1.5rem; }

.tracking-header {
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:0.75rem;
}
.tracking-header-left { display:flex; align-items:center; gap:0.75rem; }
.tracking-header-left h3 { margin:0; font-size:1.15rem; }
.tracking-header-right { display:flex; gap:0.5rem; flex-wrap:wrap; }

.tracking-badge {
  display:inline-flex; align-items:center; gap:0.25rem;
  padding:0.25rem 0.75rem; border-radius:999px; color:#fff;
  font-size:0.8rem; font-weight:600;
}

.tracking-badge-mini {
  display:inline-flex; align-items:center; gap:0.15rem;
  padding:0.1rem 0.5rem; border-radius:999px; color:#fff;
  font-size:0.7rem; font-weight:600;
}

.tracking-delay-badge {
  color: var(--danger); font-weight:600; font-size:0.8rem;
}

.tracking-info-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:0.75rem;
}
.tracking-info-item {
  background:var(--surface); padding:0.75rem; border-radius:8px; border:1px solid var(--border);
}
.tracking-info-item.tracking-delay-severe {
  border-color:var(--danger); background:rgba(244,67,54,0.05);
}
.tracking-info-item.tracking-delay-minor {
  border-color:var(--warning); background:rgba(255,152,0,0.05);
}
.tracking-label { display:block; font-size:0.75rem; color:var(--muted); margin-bottom:0.25rem; }
.tracking-value { display:block; font-size:1rem; font-weight:600; }

.tracking-position-card {
  background:var(--surface); padding:1rem; border-radius:8px;
  border:1px solid var(--border);
}
.tracking-position-card h4 { margin:0 0 0.5rem 0; }
.tracking-position-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:0.5rem;
}

.tracking-providers { }
.tracking-providers h4 { margin:0 0 0.75rem 0; }
.tracking-note { color:var(--muted); font-style:italic; font-size:0.9rem; }

.provider-chips { display:flex; gap:0.5rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.provider-chip {
  display:inline-flex; align-items:center; gap:0.25rem;
  padding:0.3rem 0.75rem; border-radius:999px; font-size:0.8rem;
  background:var(--surface); border:1px solid var(--border);
}
.provider-chip.provider-active { background:var(--accent); color:#fff; border-color:var(--accent); }

.provider-details { margin-top:0.5rem; }
.provider-details summary {
  cursor:pointer; color:var(--accent); font-size:0.85rem; font-weight:500;
}
.provider-list { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:0.75rem; margin-top:0.75rem; }
.provider-card {
  background:var(--surface); padding:1rem; border-radius:8px;
  border:1px solid var(--border); display:flex; flex-direction:column; gap:0.5rem;
}
.provider-name { font-weight:600; font-size:0.95rem; }
.provider-type { font-size:0.8rem; color:var(--muted); }
.provider-notes { font-size:0.8rem; color:var(--text); line-height:1.4; }
.provider-rate { font-size:0.75rem; color:var(--muted); }
.free-badge {
  display:inline-block; padding:0.1rem 0.5rem; border-radius:999px;
  background:var(--accent); color:#fff; font-size:0.7rem; font-weight:600;
}

.tracking-history h4 { margin:0 0 0.75rem 0; }

.tracking-timeline {
  position:relative; padding-left:2rem;
}
.tracking-timeline::before {
  content:""; position:absolute; left:0.55rem; top:0; bottom:0; width:2px;
  background:var(--border);
}

.timeline-event {
  position:relative; margin-bottom:1rem; padding:0.75rem; background:var(--surface);
  border-radius:8px; border:1px solid var(--border);
}
.timeline-event.timeline-latest { border-color:var(--accent); }

.timeline-dot {
  position:absolute; left:-1.65rem; top:1rem; width:12px; height:12px;
  border-radius:50%; border:2px solid var(--bg);
}

.timeline-header {
  display:flex; align-items:center; gap:0.75rem; flex-wrap:wrap; font-size:0.85rem;
}
.timeline-type { font-weight:600; }
.timeline-date { color:var(--muted); }
.timeline-source {
  background:var(--border); padding:0.1rem 0.4rem; border-radius:4px;
  font-size:0.7rem; color:var(--muted);
}

.timeline-detail { margin-top:0.5rem; font-size:0.9rem; }
.timeline-delay { color:var(--danger); font-weight:500; font-size:0.85rem; margin-top:0.25rem; }
.timeline-eta { color:var(--accent); font-size:0.85rem; margin-top:0.25rem; }
.timeline-position { color:var(--muted); font-size:0.8rem; margin-top:0.25rem; }

/* ============================================================
   DOCUMENT PARSE WIZARD
   ============================================================ */

.parse-wizard { min-height:300px; }

.parse-intro { text-align:center; padding:1rem 0; }
.parse-intro-icon { font-size:3rem; margin-bottom:0.5rem; }
.parse-intro h4 { margin:0 0 0.5rem 0; font-size:1.1rem; }
.parse-intro p { color:var(--muted); font-size:0.9rem; line-height:1.5; max-width:500px; margin:0 auto; }

.parse-dropzone {
  border:2px dashed var(--border); border-radius:12px; padding:2rem;
  text-align:center; cursor:pointer; transition:all 0.2s;
  margin:1rem 0;
}
.parse-dropzone:hover, .parse-dropzone.dropzone-active {
  border-color:var(--accent); background:rgba(76,175,80,0.05);
}
.dropzone-icon { font-size:2rem; margin-bottom:0.5rem; }
.dropzone-text { font-size:0.95rem; color:var(--text); }
.dropzone-link { color:var(--accent); font-weight:600; cursor:pointer; text-decoration:underline; }
.dropzone-hint { font-size:0.75rem; color:var(--muted); margin-top:0.5rem; }

.parse-file-list { margin-top:0.75rem; }
.parse-files-header { font-size:0.85rem; font-weight:600; margin-bottom:0.5rem; color:var(--text); }

.parse-file-item {
  display:flex; align-items:center; gap:0.5rem; padding:0.5rem 0.75rem;
  background:var(--surface); border-radius:8px; margin-bottom:0.5rem;
  border:1px solid var(--border);
}
.parse-file-icon { font-size:1.2rem; }
.parse-file-name { flex:1; font-size:0.9rem; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.parse-file-size { font-size:0.75rem; color:var(--muted); }
.btn-icon {
  border:none; background:none; font-size:1.2rem; cursor:pointer;
  color:var(--muted); padding:0.2rem 0.4rem; border-radius:4px;
}
.btn-icon:hover { background:var(--border); color:var(--danger); }

.parse-progress { text-align:center; padding:3rem 1rem; }
.parse-progress p { margin-top:1rem; color:var(--text); font-size:1rem; }

.parse-results { max-height:60vh; overflow-y:auto; padding-right:0.5rem; }

.parse-results-header {
  display:flex; justify-content:space-between; align-items:flex-start;
  gap:1rem; margin-bottom:1rem; flex-wrap:wrap;
}
.parse-results-header h4 { margin:0; font-size:1.1rem; }
.parse-results-summary { color:var(--muted); font-size:0.85rem; margin:0.25rem 0 0 0; }

.parse-confidence { text-align:right; }
.parse-conf-bar {
  width:120px; height:6px; border-radius:3px; background:var(--border); overflow:hidden;
  margin-bottom:0.25rem;
}
.parse-conf-fill { height:100%; border-radius:3px; transition:width 0.3s; }
.parse-confidence span { font-size:0.75rem; color:var(--muted); }

.parse-documents-detected { margin-bottom:1rem; }
.parse-documents-detected h5 { margin:0 0 0.5rem 0; font-size:0.9rem; }
.parse-doc-chips { display:flex; gap:0.5rem; flex-wrap:wrap; }
.parse-doc-chip {
  display:inline-flex; align-items:center; gap:0.25rem;
  padding:0.3rem 0.75rem; border-radius:999px; font-size:0.8rem;
  background:var(--accent); color:#fff;
}
.parse-doc-chip small { opacity:0.8; }

.parse-fields-review { margin-top:1rem; }
.parse-fields-review h5 { margin:0 0 0.5rem 0; font-size:0.9rem; }
.parse-hint { color:var(--muted); font-size:0.8rem; margin:0 0 1rem 0; }

.form-group.field-parsed { border-left:3px solid var(--accent); padding-left:0.5rem; }
.form-group.field-parsed input { background:rgba(76,175,80,0.06); }

.parse-auto-badge {
  display:inline-block; padding:0.05rem 0.4rem; border-radius:4px;
  background:var(--accent); color:#fff; font-size:0.65rem; font-weight:700;
  text-transform:uppercase; letter-spacing:0.5px; vertical-align:middle;
  margin-left:0.25rem;
}

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

/* ============================================================
   SETTINGS VIEW
   ============================================================ */

.settings-section {
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:1.5rem; margin-bottom:1.5rem;
}
.settings-section-header { margin-bottom:1.25rem; }
.settings-section-header h3 { margin:0 0 0.25rem 0; font-size:1.1rem; }
.settings-desc { color:var(--muted); font-size:0.85rem; margin:0; line-height:1.5; }

.settings-providers-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(340px, 1fr)); gap:1rem;
}

.settings-provider-card {
  border:1px solid var(--border); border-radius:10px; padding:1rem;
  background:var(--bg); display:flex; flex-direction:column; gap:0.75rem;
  transition: border-color 0.2s;
}
.settings-provider-card.provider-configured { border-color:var(--accent); }
.settings-provider-card:hover { border-color:var(--accent); }

.settings-provider-header {
  display:flex; justify-content:space-between; align-items:center; gap:0.5rem; flex-wrap:wrap;
}
.settings-provider-name { font-weight:600; font-size:0.95rem; }

.settings-provider-status {
  font-size:0.75rem; font-weight:600; padding:0.2rem 0.6rem;
  border-radius:999px;
}
.settings-provider-status.status-active { background:var(--accent); color:#fff; }
.settings-provider-status.status-inactive { background:var(--border); color:var(--muted); }

.settings-provider-body { flex:1; }
.settings-provider-notes { font-size:0.85rem; color:var(--text); line-height:1.4; margin:0; }
.settings-provider-meta { font-size:0.75rem; color:var(--muted); margin-top:0.25rem; }

.settings-provider-actions { display:flex; gap:0.5rem; }

.link-accent { color:var(--accent); font-weight:500; text-decoration:underline; }
.link-accent:hover { opacity:0.8; }

.tracking-providers-summary { display:flex; flex-direction:column; gap:0.5rem; }

/* ============================================================
   PRODUCTS TABLE
   ============================================================ */

.products-summary {
  display:flex; gap:1rem; margin-bottom:1rem; font-size:0.85rem; color:var(--muted);
}

.products-table-wrap { overflow-x:auto; }

.products-table {
  width:100%; border-collapse:collapse; font-size:0.85rem;
}
.products-table th {
  text-align:left; padding:0.6rem 0.75rem; background:var(--surface);
  border-bottom:2px solid var(--border); font-weight:600; font-size:0.8rem;
  color:var(--muted); text-transform:uppercase; letter-spacing:0.3px;
  white-space:nowrap;
}
.products-table td {
  padding:0.6rem 0.75rem; border-bottom:1px solid var(--border);
  vertical-align:top;
}
.products-table tbody tr:hover { background:rgba(76,175,80,0.04); }
.products-table tbody tr.product-inactive { opacity:0.5; }
.products-table td.num { text-align:right; font-variant-numeric:tabular-nums; }
.products-table code {
  background:var(--surface); padding:0.1rem 0.3rem; border-radius:4px;
  font-size:0.8rem;
}

.product-detail-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:1rem;
}
.product-detail-card {
  background:var(--surface); padding:1rem; border-radius:8px;
  border:1px solid var(--border);
}
.product-detail-card h4 { margin:0 0 0.5rem 0; font-size:1rem; }
.product-detail-name { font-size:0.95rem; font-weight:500; }
.product-detail-ja { font-size:0.85rem; color:var(--muted); margin-top:0.25rem; }
.product-detail-meta { font-size:0.8rem; color:var(--muted); margin-top:0.25rem; }

.product-emcs-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:0.4rem; font-size:0.85rem;
}

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

.excise-line-chips { display:flex; flex-wrap:wrap; gap:0.5rem; margin-top:0.5rem; }
.excise-chip {
  display:inline-flex; align-items:center; gap:0.25rem;
  padding:0.35rem 0.75rem; border-radius:8px; font-size:0.82rem;
  background:var(--surface); border:1px solid var(--border);
}
.excise-chip small { color:var(--muted); }

.excise-preview { margin-top:0.5rem; }
.excise-preview strong { font-size:0.9rem; }

.alert { padding:0.75rem 1rem; border-radius:8px; font-size:0.9rem; margin-bottom:0.5rem; }
.alert-success { background:rgba(76,175,80,0.1); color:#2e7d32; border:1px solid rgba(76,175,80,0.3); }
.alert-warning { background:rgba(255,152,0,0.1); color:#e65100; border:1px solid rgba(255,152,0,0.3); }
.alert-error { background:rgba(244,67,54,0.1); color:#c62828; border:1px solid rgba(244,67,54,0.3); }

/* ============================================================
   PRODUCT EDIT — FULLSCREEN VIEW
   ============================================================ */
.product-edit-page {
  max-width:1200px; margin:0 auto; padding:1.5rem;
}
.product-edit-header {
  display:flex; align-items:center; gap:1rem; margin-bottom:1.25rem;
  flex-wrap:wrap;
}
.product-edit-title { flex:1; min-width:200px; }
.product-edit-title h2 { margin:0; font-size:1.35rem; }
.product-edit-ja { font-size:0.9rem; color:var(--muted); }
.product-edit-actions { display:flex; align-items:center; gap:0.75rem; }
.pe-active-toggle {
  display:flex; align-items:center; gap:0.35rem; cursor:pointer;
  font-size:0.85rem; color:var(--muted);
}

.product-edit-tabs {
  display:flex; gap:0; border-bottom:2px solid var(--border);
  margin-bottom:0; overflow-x:auto;
}
.pe-tab {
  padding:0.65rem 1.25rem; border:none; background:none;
  cursor:pointer; font-size:0.88rem; font-weight:500;
  color:var(--muted); border-bottom:2px solid transparent;
  margin-bottom:-2px; white-space:nowrap;
  transition:color 0.15s, border-color 0.15s;
}
.pe-tab:hover { color:var(--text); }
.pe-tab.active {
  color:var(--primary); border-bottom-color:var(--primary);
}

.product-edit-body { padding-top:1.25rem; }
.pe-panel { display:none; }
.pe-panel.active { display:block; animation:fadeIn 0.15s ease; }

.pe-section {
  background:var(--card-bg, #fff); border:1px solid var(--border);
  border-radius:var(--radius-sm, 10px); padding:1.25rem;
  margin-bottom:1rem;
}
.pe-section h3 {
  margin:0 0 0.75rem 0; font-size:1rem; font-weight:600;
  color:var(--text);
}
.pe-hint {
  font-size:0.82rem; color:var(--muted); margin:-0.5rem 0 0.75rem 0;
}
.form-grid-3 {
  grid-template-columns:repeat(3, 1fr) !important;
}
@media (max-width:900px) {
  .form-grid-3 { grid-template-columns:repeat(2, 1fr) !important; }
}
@media (max-width:600px) {
  .form-grid-3 { grid-template-columns:1fr !important; }
  .product-edit-header { flex-direction:column; align-items:stretch; }
  .product-edit-actions { justify-content:flex-end; }
}
.pe-empty { color:var(--muted); font-size:0.9rem; padding:2rem 0; text-align:center; }
.pe-shipment-link:hover { background:rgba(76,175,80,0.06); }

.pe-validoo-status {
  padding:0.75rem; margin-top:0;
}
.pe-validoo-badge {
  display:inline-block; padding:0.4rem 0.75rem; border-radius:6px;
  font-size:0.82rem; background:var(--surface); border:1px solid var(--border);
}
.pe-validoo-badge.synced {
  background:rgba(76,175,80,0.1); border-color:rgba(76,175,80,0.3); color:#2e7d32;
}

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

/* ============================================================
   PRODUCT FILTERS & BULK
   ============================================================ */
.product-filters {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.75rem; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px;
}
.pf-search-wrap { flex: 1; min-width: 200px; }
.pf-search {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; background: var(--bg);
}
.pf-select {
  padding: 0.5rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.85rem; background: var(--bg);
  min-width: 140px; max-width: 220px;
}
.pf-toggle {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.85rem; color: var(--muted); cursor: pointer;
  white-space: nowrap; user-select: none;
}
.pf-toggle input { cursor: pointer; }
.product-toolbar {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.6rem 0.75rem; margin-bottom: 0.5rem;
  background: #e3f2fd; border: 1px solid #90caf9; border-radius: 8px;
  font-size: 0.85rem; flex-wrap: wrap;
}
.product-toolbar #bulkCount { font-weight: 600; margin-right: 0.5rem; }
.col-check { width: 36px; text-align: center; }
.col-check input { cursor: pointer; }
.btn-warning { background: #ff9800; color: #fff; border-color: #f57c00; }
.btn-warning:hover { background: #f57c00; }
.btn-danger { background: #f44336; color: #fff; border-color: #d32f2f; }
.btn-danger:hover { background: #d32f2f; }

/* ============================================================
   PRODUCT IMAGE GALLERY
   ============================================================ */
.validoo-img-info {
  background: #e3f2fd; border: 1px solid #90caf9; border-radius: 8px;
  padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.82rem;
}
.validoo-img-info ul { margin: 0.4rem 0 0 1.2rem; padding: 0; }
.validoo-img-info li { margin-bottom: 0.25rem; }
.img-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.img-card {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--card-bg); transition: box-shadow 0.15s;
}
.img-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.img-card-primary { border-color: var(--primary); border-width: 2px; }
.img-card-preview {
  position: relative; background: #f5f5f5;
  display: flex; align-items: center; justify-content: center;
  height: 180px; overflow: hidden;
}
.img-card-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-badge-primary {
  position: absolute; top: 6px; right: 6px;
  background: var(--primary); color: #fff; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.img-card-meta { padding: 0.6rem 0.75rem; }
.img-card-name {
  font-size: 0.8rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.img-card-info {
  display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--muted);
  margin: 0.25rem 0;
}
.img-card-validoo { font-size: 0.75rem; margin: 0.2rem 0; }
.img-card-status {
  display: flex; justify-content: space-between; font-size: 0.8rem;
  margin: 0.3rem 0;
}
.img-card-actions {
  display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.4rem;
}

/* ============================================================
   AI RESULT PANELS
   ============================================================ */
.ai-loading {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.5rem; color: var(--muted); font-size: 0.9rem;
}
.ai-error {
  padding: 1rem; background: #fce4ec; border: 1px solid #f48fb1;
  border-radius: 8px; color: #c62828; font-size: 0.9rem;
}
.ai-result { margin-top: 0.5rem; }
.ai-score {
  display: inline-flex; align-items: baseline; gap: 0.25rem;
  font-size: 1rem; font-weight: 500; border: 2px solid;
  border-radius: 10px; padding: 0.3rem 0.8rem; margin-bottom: 0.75rem;
}
.ai-score-num { font-size: 1.6rem; font-weight: 700; }
.ai-summary {
  padding: 0.75rem; background: #f5f5f5; border-radius: 8px;
  font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.5;
}
.ai-section { margin-bottom: 1rem; }
.ai-section h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.ai-item {
  padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 0.35rem;
  font-size: 0.85rem; line-height: 1.4;
}
.ai-item-error { background: #fce4ec; border-left: 3px solid #f44336; }
.ai-item-warning { background: #fff3e0; border-left: 3px solid #ff9800; }
.ai-item-info { background: #e3f2fd; border-left: 3px solid #2196f3; }
.ai-severity {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; margin-right: 0.3rem;
  text-transform: uppercase;
}
.ai-sev-error { background: #f44336; color: #fff; }
.ai-sev-warning { background: #ff9800; color: #fff; }
.ai-sev-info { background: #2196f3; color: #fff; }

/* ============================================================
   VALIDOO COMPARE & SYNC
   ============================================================ */
.validoo-compare-result { margin-top: 0.75rem; }
.validoo-compare-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem; background: #f5f5f5; border-radius: 8px;
  margin-bottom: 0.75rem;
}
.validoo-diff-table td { font-size: 0.85rem; vertical-align: top; }
.validoo-diff-mismatch { background: #fff8e1 !important; }
.validoo-ok { color: #4caf50; font-weight: 700; font-size: 1.1rem; }
.validoo-diff { color: #ff9800; font-weight: 700; font-size: 1.1rem; }
.validoo-status-summary {
  display: flex; gap: 1rem; flex-wrap: wrap; padding: 0.75rem;
  background: #f5f5f5; border-radius: 8px;
}
.validoo-stat { text-align: center; min-width: 80px; }
.validoo-stat-num { display: block; font-size: 1.5rem; font-weight: 700; }

/* ============================================================
   DUPLICATE WARNINGS
   ============================================================ */
.dup-warning {
  background: #fce4ec; border: 1px solid #f48fb1; border-radius: 8px;
  padding: 0.75rem 1rem; margin-bottom: 0.75rem; font-size: 0.85rem;
  color: #c62828;
}
.dup-warning ul { margin: 0.4rem 0 0 1.2rem; padding: 0; }
.dup-warning li { margin-bottom: 0.2rem; }
.product-dup-row { background: #fff8e1 !important; }
.dup-code { color: #d32f2f !important; font-weight: 600; }
.dup-badge {
  display: inline-block; font-size: 0.6rem; font-weight: 700;
  background: #f44336; color: #fff;
  padding: 1px 5px; border-radius: 4px; margin-left: 4px;
  vertical-align: middle;
}

/* ============================================================
   VENDOR GRID
   ============================================================ */
.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.vendor-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}
.vendor-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.vendor-card-header {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.vendor-card-img {
  width: 56px; height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.vendor-card-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  font-size: 1.4rem; font-weight: 700;
}
.vendor-card-info h3 { margin: 0; font-size: 1rem; }
.vendor-card-loc { font-size: 0.8rem; color: var(--muted); }
.vendor-card-type {
  display: inline-block;
  font-size: 0.7rem;
  background: rgba(33,150,243,0.1);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-top: 0.25rem;
}
.vendor-card-body {
  padding: 0.75rem 1rem 1rem;
}
.vendor-card-desc {
  font-size: 0.85rem; color: var(--muted);
  margin: 0 0 0.75rem; line-height: 1.4;
}
.vendor-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem;
}
.vendor-card-link {
  color: var(--primary); text-decoration: none;
}
.vendor-card-link:hover { text-decoration: underline; }
@media (max-width:600px) {
  .vendor-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   VALIDOO READINESS CHECK
   ============================================================ */
.validoo-ready-field {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: transform 0.1s, box-shadow 0.1s;
}
.validoo-ready-field:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.validoo-ready-field.missing {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #ef9a9a;
}
.validoo-ready-field.ok {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}
.validoo-ready-field.recommended {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* ============================================================
   SORTABLE TABLE HEADERS
   ============================================================ */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.sortable-th:hover {
  background: rgba(33,150,243,0.08);
}
.sortable-th.sorted {
  color: var(--primary);
  font-weight: 700;
}
.validoo-sync-badge {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================================
   IMAGE PROCESSING
   ============================================================ */
.img-process-section {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
  border: 1px solid rgba(33,150,243,0.2);
  border-radius: 12px;
  padding: 1.5rem;
}
.img-process-preview-row {
  display: flex; gap: 1rem; align-items: center;
  margin: 1rem 0;
}
.img-process-col {
  flex: 1; text-align: center;
}
.img-process-col h4 {
  margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.img-process-box {
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: 10px;
  min-height: 180px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.img-process-arrow {
  font-size: 2rem; color: var(--primary);
  flex-shrink: 0;
}
.img-process-result {
  background: #fff; border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.img-process-result-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.img-process-result-header h4 { margin: 0; }
.ai-score-inline {
  font-weight: 700; font-size: 1.1rem;
}
.img-process-steps {
  margin-bottom: 0.5rem; font-size: 0.85rem;
}
.img-step-badge {
  display: inline-block;
  background: rgba(33,150,243,0.1);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  margin: 0.15rem 0.2rem;
}
.img-process-dims {
  font-size: 0.85rem; color: var(--muted);
  display: flex; gap: 0.5rem; align-items: center;
  margin-bottom: 0.75rem;
}
.img-process-ai-review {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.img-ai-checks {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.img-ai-check {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem; border-radius: 6px;
  font-size: 0.78rem; font-weight: 500;
}
.img-ai-check.ok {
  background: #e8f5e9; color: #2e7d32;
}
.img-ai-check.fail {
  background: #fce4ec; color: #c62828;
}
.img-ai-issues { margin-top: 0.5rem; }
.img-ai-issue {
  padding: 0.4rem 0.6rem; border-radius: 6px;
  margin-bottom: 0.3rem; font-size: 0.82rem;
}
.img-ai-issue-error { background: #fce4ec; border-left: 3px solid #f44336; }
.img-ai-issue-warning { background: #fff3e0; border-left: 3px solid #ff9800; }
.img-ai-issue-info { background: #e3f2fd; border-left: 3px solid #2196f3; }
.img-ai-issue-sev {
  display: inline-block; font-size: 0.65rem; font-weight: 600;
  padding: 1px 5px; border-radius: 3px; margin-right: 0.3rem;
  text-transform: uppercase; background: var(--muted); color: #fff;
}
.img-ai-suggestions {
  margin-top: 0.5rem; font-size: 0.82rem;
}
.img-ai-suggestions ul {
  margin: 0.25rem 0 0 1.2rem; padding: 0;
}
.img-ai-suggestions li { margin-bottom: 0.2rem; }
@media (max-width: 700px) {
  .img-process-preview-row { flex-direction: column; }
  .img-process-arrow { transform: rotate(90deg); }
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.dash-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow 0.15s, transform 0.15s;
}
.dash-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.dash-card-icon { font-size: 1.8rem; margin-bottom: 0.3rem; }
.dash-card-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.dash-card-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }
.dash-card-sub { font-size: 0.75rem; color: var(--text-light); margin-top: 0.3rem; }

.dash-section { margin-bottom: 2rem; }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.dash-section-header h3 { margin: 0; }
.dash-section-actions { display: flex; gap: 0.5rem; }

/* ============================================================
   SHIPMENTS LIST PAGE
   ============================================================ */
.shipments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.shipments-header-actions { display: flex; gap: 0.5rem; }

.shipments-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.shipments-filters .pf-search { max-width: 400px; }

.shipments-status-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.ship-status-tab {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ship-status-tab:hover { border-color: var(--primary); color: var(--primary); }
.ship-status-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.ship-status-tab .tab-count {
  font-weight: 600;
  opacity: 0.8;
  margin-left: 0.2rem;
}

.shipments-table td { vertical-align: middle; }
.shipments-table .completeness-bar-mini { width: 60px; }
.empty-row { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* ============================================================
   NEW SHIPMENT PAGE (Order Builder)
   ============================================================ */
.shipment-new-page { max-width: 1400px; }

.sn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.sn-header h2 { margin: 0; }
.sn-header-actions { display: flex; gap: 0.5rem; }

.sn-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  align-items: start;
}

.sn-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sn-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Order totals */
.order-totals {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}
.order-total-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}
.order-total-item span { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.order-total-item strong { font-size: 1.1rem; color: var(--primary); }

/* Order table */
.order-table input[type="number"] {
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
}
.order-table input[type="number"]:focus { border-color: var(--primary); outline: none; }
.order-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.order-remove:hover { background: #fce4ec; }

/* Product picker sidebar */
.sn-picker {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 6rem);
  display: flex;
  flex-direction: column;
}
.sn-picker h3 { margin-bottom: 0.75rem; }
.sn-picker .pf-search { margin-bottom: 0.75rem; }

.pp-list {
  overflow-y: auto;
  flex: 1;
  max-height: 60vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pp-vendor-group { padding: 0.5rem 0; }
.pp-vendor-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.pp-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.pp-product:hover { background: #f8f9ff; }
.pp-product.pp-added { opacity: 0.5; background: #f5f5f5; }
.pp-product-info { flex: 1; min-width: 0; }
.pp-product-info strong { display: block; font-size: 0.82rem; }
.pp-product-info small { display: block; font-size: 0.7rem; margin-top: 0.1rem; }
.pp-add-btn { white-space: nowrap; flex-shrink: 0; }

@media (max-width: 900px) {
  .sn-layout { grid-template-columns: 1fr; }
  .sn-picker { position: static; max-height: none; }
}

/* Container tracking links */
.tracking-container-links {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}
.tracking-container-links h4 { margin: 0 0 0.3rem 0; }
.tracking-link-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   PROCUREMENTS
   ============================================================ */

.proc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.proc-header h2 { margin: 0; }
.proc-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.proc-filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.proc-filters .pf-search { max-width: 260px; flex: 1; min-width: 180px; }
.pf-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  min-width: 130px;
}
.pf-select:focus { border-color: var(--primary); outline: none; }
.pf-toggles {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}
.pf-toggle {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.15s;
  white-space: nowrap;
}
.pf-toggle:hover { border-color: var(--primary); color: var(--primary); }
.pf-toggle.active { background: var(--primary); color: white; border-color: var(--primary); }

.proc-type-filter {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.proc-type-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.proc-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.proc-type-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.proc-status-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.proc-status-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.proc-status-tab:hover { color: var(--text); }
.proc-status-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.proc-status-tab .tab-count {
  font-size: 0.75rem;
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  margin-left: 0.3rem;
}

.proc-table td { vertical-align: top; }
.th-star, .td-star { width: 30px; text-align: center; padding: 0.3rem !important; }
.star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--border); transition: color 0.15s;
  padding: 0.1rem 0.2rem; line-height: 1;
}
.star-btn:hover { color: #f5a623; }
.star-btn.starred { color: #f5a623; }
.proc-row-starred { background: #fef9e7 !important; }
.proc-row-expired { opacity: 0.55; }

.proc-type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  background: var(--primary-bg, #e3f2fd);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.proc-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}
.proc-status-badge.active { background: #e8f5e9; color: #2e7d32; }
.proc-status-badge.submitted { background: #e3f2fd; color: #1565c0; }
.proc-status-badge.awarded { background: #fff3e0; color: #e65100; }
.proc-status-badge.expired { background: #fce4ec; color: #c62828; }
.proc-status-badge.lost { background: #f5f5f5; color: #616161; }

.proc-deadline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.proc-deadline small { font-size: 0.72rem; }
.proc-deadline.ok { color: var(--text); }
.proc-deadline.ok small { color: #2e7d32; }
.proc-deadline.soon small { color: #e65100; font-weight: 600; }
.proc-deadline.urgent { color: #c62828; }
.proc-deadline.urgent small { font-weight: 700; animation: pulse 1s infinite; }
.proc-deadline.expired { color: #9e9e9e; text-decoration: line-through; }
.proc-deadline.expired small { text-decoration: none; color: #c62828; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Procurement detail */
.proc-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.proc-detail-header h2 { margin: 0; }

.proc-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.proc-tab {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.proc-tab:hover { color: var(--text); background: var(--bg); }
.proc-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.proc-info-form { margin-bottom: 1.5rem; }
.proc-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.proc-form-dates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.proc-info-form .full-width { grid-column: 1 / -1; }

.proc-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius);
}

/* Changelog */
.changelog-list { display: flex; flex-direction: column; gap: 1rem; }
.changelog-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.changelog-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.changelog-date { font-weight: 600; color: var(--text); }
.changelog-summary { color: var(--text-muted); }
.changelog-fields {
  width: 100%;
  font-size: 0.82rem;
  border-collapse: collapse;
}
.changelog-fields th {
  text-align: left;
  padding: 0.4rem 1rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.changelog-fields td {
  padding: 0.35rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  max-width: 300px;
  word-break: break-word;
}
.changelog-field-name { font-weight: 500; white-space: nowrap; }
.changelog-old { color: var(--danger, #e74c3c); }
.changelog-new { color: var(--accent, #27ae60); }

/* Calculator layout */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.calc-inputs, .calc-results {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.calc-inputs h3, .calc-results h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}
.calc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.calc-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.calc-section-divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* Margin controls */
.calc-margin-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.calc-margin-row { margin-bottom: 0.5rem; }
.calc-margin-row label { font-size: 0.85rem; font-weight: 600; display: block; margin-bottom: 0.3rem; }
.calc-margin-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calc-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.calc-margin-num {
  width: 60px;
  text-align: center;
  font-weight: 600;
}
.calc-margin-unit { font-size: 0.85rem; color: var(--text-muted); }

/* Margin guide */
.calc-margin-guide { margin-top: 0.5rem; }
.margin-guide-bar {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 0.3rem;
}
.margin-guide-range {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 4px;
}
.margin-guide-marker {
  position: absolute;
  top: -3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  transform: translateX(-7px);
  border: 2px solid white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.margin-guide-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  gap: 0.5rem;
}
.margin-guide-range-label { font-style: italic; }

/* Foreign currency display */
.calc-max-foreign { font-size: 1.2rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Negative price warning */
.calc-warning {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff3e0;
  border: 1px solid #ff9800;
  border-radius: var(--radius);
  color: #e65100;
  font-size: 0.85rem;
}

/* Max price highlight box */
.calc-max-price {
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}
.calc-max-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.calc-max-value { font-size: 1.8rem; font-weight: 700; }
.calc-max-jpy { font-size: 1.1rem; color: var(--text-muted); }

.calc-verify {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Cost waterfall */
.calc-waterfall { margin-bottom: 1.25rem; }
.waterfall-row {
  display: grid;
  grid-template-columns: 150px 1fr 80px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}
.waterfall-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waterfall-bar-wrap {
  height: 16px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.waterfall-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.waterfall-val { text-align: right; font-variant-numeric: tabular-nums; }
.waterfall-total {
  border-top: 2px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

/* Summary grid */
.calc-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}
.calc-summary-item {
  background: var(--bg);
  padding: 0.6rem;
  border-radius: var(--radius);
  text-align: center;
}
.calc-sum-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.calc-sum-value { font-size: 1rem; font-weight: 600; }

/* Calculations list */
.calc-list { overflow-x: auto; }

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ── Enriched procurement styles ───────────────────────── */

/* Form sections with headers and hints */
.proc-form-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.proc-form-section:last-child { border-bottom: none; }
.proc-form-section h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  color: var(--text);
}
.section-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 1rem 0;
  line-height: 1.4;
}
.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.3;
}
.form-group-check {
  display: flex;
  flex-direction: column;
}
.form-group-check label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.form-group-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Procurement type description box */
.proc-type-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}

/* Classification badges */
.proc-class-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.proc-class-A { background: #c62828; color: white; }
.proc-class-B { background: #1565c0; color: white; }
.proc-class-C { background: #6a1b9a; color: white; }

/* Sortiment type color coding */
.proc-type-FSN { background: #e8f5e9; color: #2e7d32; }
.proc-type-FS { background: #e8f5e9; color: #1b5e20; }
.proc-type-FSB { background: #f1f8e9; color: #33691e; }
.proc-type-TSV { background: #e3f2fd; color: #1565c0; }
.proc-type-TST { background: #e1f5fe; color: #0277bd; }
.proc-type-TSE { background: #ede7f6; color: #4527a0; }
.proc-type-TSS { background: #fff3e0; color: #e65100; }
.proc-type-TSLS { background: #fce4ec; color: #ad1457; }
.proc-type-BS { background: #f5f5f5; color: #616161; }

/* Extended status badges */
.proc-status-badge.offer_submitted { background: #e3f2fd; color: #1565c0; }
.proc-status-badge.sample_sent { background: #e1f5fe; color: #0277bd; }
.proc-status-badge.contract_confirmed { background: #e8f5e9; color: #2e7d32; }
.proc-status-badge.gs1_pending { background: #fff8e1; color: #f57f17; }
.proc-status-badge.gs1_approved { background: #e8f5e9; color: #1b5e20; }
.proc-status-badge.launch_sample_sent { background: #f3e5f5; color: #6a1b9a; }
.proc-status-badge.orderable { background: #e0f2f1; color: #00695c; }
.proc-status-badge.launched { background: #e8f5e9; color: #1b5e20; font-weight: 700; }
.proc-status-badge.scoring { background: #fff3e0; color: #e65100; }
.proc-status-badge.extended { background: #e8f5e9; color: #2e7d32; }

/* ── Timeline tab ─────────────────────────────────────── */

.proc-timeline-tab { max-width: 700px; }

.proc-info-banner {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  border-left: 4px solid #e65100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.proc-timeline {
  position: relative;
  padding-left: 2rem;
  margin: 1.5rem 0;
}
.proc-timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-step {
  position: relative;
  padding-bottom: 1.5rem;
}
.timeline-step:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -2rem;
  top: 0.15rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-bg);
  z-index: 1;
}
.timeline-step.past .timeline-dot { background: #4caf50; border-color: #4caf50; }
.timeline-step.current .timeline-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(21,101,192,0.2); }
.timeline-step.future .timeline-dot { background: var(--card-bg); border-color: var(--border); }

.timeline-content { padding-left: 0.5rem; }
.timeline-label { font-weight: 600; font-size: 0.9rem; }
.timeline-date { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }
.timeline-days {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  margin-left: 0.3rem;
  background: #e3f2fd;
  color: #1565c0;
}
.timeline-days.past { background: #e8f5e9; color: #2e7d32; }
.timeline-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.3;
}

.proc-contract-info {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 1.5rem;
}
.proc-contract-info h4 { margin: 0 0 0.5rem 0; font-size: 0.9rem; }
.proc-contract-info p { margin: 0.25rem 0; font-size: 0.85rem; }

/* ── GS1 / Validoo tab ───────────────────────────────── */

.gs1-tab { max-width: 700px; }

.gs1-status-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.gs1-status-banner.gs1-approved { background: #e8f5e9; border-color: #a5d6a7; }
.gs1-status-banner.gs1-progress { background: #e3f2fd; border-color: #90caf9; }
.gs1-status-banner.gs1-action { background: #fff3e0; border-color: #ffcc02; }

.gs1-overall-select {
  margin-bottom: 1.5rem;
}
.gs1-overall-select label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}
.gs1-overall-select select {
  max-width: 250px;
}

.gs1-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 600px) {
  .gs1-grid { grid-template-columns: 1fr; }
}

.gs1-pack-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.gs1-pack-section h4 { margin: 0 0 0.25rem 0; font-size: 0.9rem; }
.gs1-pack-section .text-muted { font-size: 0.75rem; margin-bottom: 0.75rem; }

.gs1-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.gs1-check:hover { background: var(--bg); }
.gs1-check input[type="checkbox"] { width: 18px; height: 18px; }
.gs1-check span { font-size: 0.9rem; }

.gs1-info-box {
  background: #f5f5f5;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.gs1-info-box h4 { margin: 0 0 0.5rem 0; font-size: 0.9rem; }
.gs1-info-box ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.6;
}
.gs1-info-box li { margin-bottom: 0.3rem; }

.gs1-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Launch calendar modal ────────────────────────────── */

.calendar-year-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.cal-year.active { background: var(--primary); color: white; }

/* ── CRM / Manufacturers ─────────────────────────────── */

.crm-tab { display: flex; flex-direction: column; gap: 1rem; }
.crm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}
.crm-toolbar h3 { margin: 0; }

.crm-agent-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.crm-agent-result {
  padding: 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.crm-agent-result p { margin: 0.25rem 0; }

.crm-new-suggestions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.crm-suggestion-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.crm-suggestion-info { flex: 1; }

.badge-mfr-type { font-size: 0.75rem; }
.badge-winery { background: #7b2d8e20; color: #7b2d8e; }
.badge-brewery { background: #d4880020; color: #b87700; }
.badge-distillery { background: #2d5f8e20; color: #2d5f8e; }
.badge-cidery { background: #4caf5020; color: #2e7d32; }
.badge-sake_brewery { background: #e91e6320; color: #c2185b; }
.badge-spirits { background: #ff572220; color: #e64a19; }
.badge-mixed { background: #60606020; color: #606060; }

.form-select-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--bg-surface); }

/* Offers tab */
.offers-tab .data-table { margin-bottom: 1rem; }
.offers-tab .data-table td.number { white-space: nowrap; }
.offer-form details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
}
.offer-form details summary { user-select: none; }
.offer-form details[open] summary { margin-bottom: 0.75rem; }
.offer-margin-summary > div { transition: all 0.2s; }
.offer-form .form-group label.required::after { content: " *"; color: var(--danger); }
.offer-form .form-hint { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Email composer */
.email-composer .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}
.email-composer .form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
}
.email-composer input,
.email-composer textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.email-composer textarea { resize: vertical; }
#emailBodyPreview {
  overflow-y: auto;
  max-height: 500px;
}
#emailBodyPreview p { margin: 0.4em 0; }
#emailBodyPreview ul { padding-left: 1.5em; }

/* CRM enrichment */
.crm-enrich-btn {
  font-size: 0.75rem !important;
  padding: 0.15rem 0.5rem !important;
}
.badge-info { background: var(--primary); color: white; }

@media print {
  .proc-header-actions,
  .proc-filters,
  .proc-status-tabs,
  .proc-type-filter,
  .calc-actions,
  .modal-overlay,
  nav { display: none !important; }
}
