/* =============================================
   OrderBridge Kundenportal – Styles
   ============================================= */

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

:root {
  --navy:        #1A2B4A;
  --navy-dark:   #152238;
  --bg:          #F4F6F9;
  --surface:     #FFFFFF;
  --border:      #E8EAED;
  --text-1:      #111827;
  --text-2:      #6B7280;
  --text-3:      #9CA3AF;

  --green:       #10B981;
  --green-bg:    #ECFDF5;
  --green-text:  #065F46;

  --orange:      #F59E0B;
  --orange-bg:   #FFFBEB;
  --orange-text: #92400E;

  --red:         #EF4444;
  --red-bg:      #FEF2F2;
  --red-text:    #991B1B;

  --blue:        #3B82F6;
  --blue-bg:     #EFF6FF;
  --blue-text:   #1D4ED8;

  --gray-bg:     #F3F4F6;
  --gray-text:   #374151;

  --radius:      12px;
  --radius-sm:   8px;
  --sidebar-w:   240px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.16);
}

html, body { height: 100%; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a    { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }


/* ─── Screens ──────────────────────────────── */

.screen { display: none; }

#screen-login.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

#screen-app.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}


/* ─── Login ────────────────────────────────── */

.login-wrap {
  background: var(--surface);
  border-radius: 18px;
  padding: 52px 48px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.3s ease;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--navy);
  color: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.brand-logo.sm { width: 30px; height: 30px; font-size: 11px; border-radius: 7px; }

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.2px;
}

.login-title {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-1);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 28px;
}

.login-wrap .form-group { margin-bottom: 16px; }

.login-wrap label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.forgot {
  text-align: right;
  margin-top: -6px;
  margin-bottom: 24px;
}

.forgot a { font-size: 13px; color: var(--navy); font-weight: 500; }
.forgot a:hover { text-decoration: underline; }


/* ─── Error banner ─────────────────────────── */

.error-banner {
  background: var(--red-bg);
  border-bottom: 2px solid var(--red);
  color: var(--red-text);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
}


/* ─── Sidebar ──────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .brand-logo { background: rgba(255,255,255,0.14); }
.sidebar-header .brand-name { color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover  { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.14);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.user-details   { flex: 1; min-width: 0; }
.user-name  { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 11px; color: rgba(255,255,255,0.45); }

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: rgba(255,255,255,0.45);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.08); }


/* ─── Main Content ─────────────────────────── */

.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
}


/* ─── Views ────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }


/* ─── Page Header ──────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-1);
}

.page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}


/* ─── KPI Grid ─────────────────────────────── */

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

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 22px 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 22px; height: 22px; }

.kpi-blue   { background: var(--blue-bg);   color: var(--blue);   }
.kpi-green  { background: var(--green-bg);  color: var(--green);  }
.kpi-orange { background: var(--orange-bg); color: var(--orange); }

.kpi-body  { display: flex; flex-direction: column; }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text-1);
}

.kpi-value-sm { font-size: 20px; }

.kpi-delta          { font-size: 12px; margin-top: 5px; font-weight: 500; color: var(--text-2); }
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red);   }


/* ─── Card ─────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}


/* ─── Table ────────────────────────────────── */

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #FAFAFA;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #FAFAFA; }

.data-table tbody td {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text-1);
  vertical-align: middle;
}

.data-table tbody td.dim { color: var(--text-2); }

.sap-nr {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.empty-row td {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 14px;
  cursor: default;
}


/* ─── Badge ────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green-text);  }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text);   }
.badge-orange { background: var(--orange-bg); color: var(--orange-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text);    }
.badge-gray   { background: var(--gray-bg);   color: var(--gray-text);   }


/* ─── Buttons ──────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  cursor: pointer;
  border: none;
}

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }

.btn-outline {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-sm   { padding: 6px 12px; font-size: 13px; }


/* ─── Form Inputs ──────────────────────────── */

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}

.form-input::placeholder { color: var(--text-3); }
.form-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,43,74,0.08);
}

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


/* ─── Settings ─────────────────────────────── */

.settings-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}


/* ─── Filter chips ─────────────────────────── */

.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all 0.15s;
  cursor: pointer;
}

.chip:hover  { border-color: var(--navy); color: var(--navy); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }


/* ─── Activity Timeline ────────────────────── */

.timeline-wrap {
  padding: 20px 24px;
}

.timeline-empty {
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid var(--border);
  background: var(--surface);
}

.timeline-dot.done  { background: var(--green); border-color: var(--green); }
.timeline-dot.active { background: var(--blue); border-color: var(--blue); }

.timeline-content { flex: 1; }

.timeline-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}

.timeline-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}


/* ─── Detail Modal ─────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  margin: 16px;
}

.modal-lg { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg); color: var(--text-1); }

.modal-body {
  padding: 20px 24px;
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 32px;
}

.detail-info { display: flex; flex-direction: column; gap: 16px; }

.detail-row { display: flex; flex-direction: column; gap: 3px; }

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value { font-size: 15px; font-weight: 500; color: var(--text-1); }

.detail-delivery {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}


/* ─── Status timeline (modal) ──────────────── */

.detail-timeline {
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.status-timeline { list-style: none; }

.status-step {
  display: flex;
  gap: 12px;
  padding-bottom: 24px;
  position: relative;
}

.status-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.status-step.done::before   { background: var(--green); }

.step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

.status-step.done .step-dot {
  background: var(--green);
  border-color: var(--green);
}

.status-step.done .step-dot::after {
  content: '';
  width: 6px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.status-step.current .step-dot {
  border-color: var(--blue);
  background: var(--blue-bg);
}

.step-info { padding-top: 1px; }

.step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.status-step:not(.done):not(.current) .step-label { color: var(--text-3); }

.step-date {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.status-step.done .step-date { color: var(--green); }


/* ─── Toast notifications ──────────────────── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.2s ease;
}


/* ─── Animations ───────────────────────────── */

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

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


/* ─── Language switcher (sidebar) ──────────── */

.sidebar-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.lang-sep { color: rgba(255,255,255,0.25); font-size: 12px; }

.lang-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.lang-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.lang-btn--active { color: #fff !important; }


/* ─── Sortable table headers ────────────────── */

.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { background: #f0f2f5; }

.sort-ind {
  opacity: 0.35;
  font-size: 9px;
  margin-left: 3px;
  display: inline-block;
}

.data-table th.sort-asc  .sort-ind,
.data-table th.sort-desc .sort-ind { opacity: 1; }


/* ─── CSV download button (per row) ─────────── */

.th-action, .td-action {
  width: 36px;
  padding: 0 8px !important;
  text-align: center;
}

.btn-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-dl:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}


/* ─── Modal header with export button ──────── */

.modal-header {
  gap: 12px;
  flex-wrap: wrap;
}

