/* ══════════════════════════════════════════
   SHARED — Base, Layout, Components, Modals
   ══════════════════════════════════════════ */

/* ── Reset & Body ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f5f5f5; color: #000; }

/* ── Top Bar ─────────────────────────────── */
.topbar {
  background: #fff; color: #034381; padding: 0 28px; display: flex; align-items: center;
  height: 56px; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 50;
}
.topbar .topbar-left {
  display: flex; align-items: center; gap: 8px; min-width: 180px;
}
.topbar .topbar-left img { height: 36px; width: 36px; }
.topbar .topbar-left .company-name { font-size: 18px; font-weight: 700; color: #034381; }
.topbar .topbar-center { flex: 1; text-align: center; }
.topbar .logo { font-size: 20px; font-weight: 700; letter-spacing: .5px; color: #034381; }
.topbar .logo span { color: #11afbf; }
.topbar .subtitle { font-size: 10px; color: #999; margin-top: 1px; }
.topbar .topbar-right { min-width: 180px; text-align: right; }
.topbar .demo-badge {
  display: inline-block; background: #034381; color: #fff; font-size: 11px; font-weight: 700;
  padding: 5px 16px; border-radius: 6px; letter-spacing: .5px;
}

/* ── Tab Nav ──────────────────────────────── */
.tab-nav { display: flex; background: #fff; border-bottom: 2px solid #e0e0e0; padding: 0 28px; }
.tab-btn {
  padding: 13px 28px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; background: none; color: #666; position: relative; transition: color .2s;
}
.tab-btn:hover { color: #034381; }
.tab-btn.active { color: #034381; }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 3px; background: #11afbf; border-radius: 3px 3px 0 0;
}
.tab-btn .badge {
  background: #e74c3c; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px; margin-left: 5px; vertical-align: top;
}
.tab-btn .badge.green { background: #27ae60; }

/* ── Tab Content ─────────────────────────── */
.tab-content { display: none; min-height: calc(100vh - 110px); }
.tab-content.active { display: block; }
.tab-content.has-padding { padding: 20px 28px; }

/* ── Card ─────────────────────────────────── */
.card {
  background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 5px rgba(0,0,0,.07); border: 1px solid #eee;
}
.card h3 { font-size: 15px; margin-bottom: 12px; color: #034381; display: flex; align-items: center; gap: 7px; }

/* ── Forms ────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .5px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 11px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; font-family: inherit; transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #034381; box-shadow: 0 0 0 3px rgba(0,0,0,.1); }
.form-group textarea { resize: vertical; min-height: 50px; }

/* ── Buttons ──────────────────────────────── */
.btn {
  padding: 9px 20px; border: none; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 5px;
}
.btn-primary { background: #034381; color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-blue { background: #034381; color: #fff; }
.btn-blue:hover { background: #000; }
.btn-outline { background: #fff; color: #034381; border: 2px solid #034381; }
.btn-outline:hover { background: #034381; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Tables ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 9px 12px; text-align: left; font-size: 11px; text-transform: uppercase; color: #777; letter-spacing: .5px; border-bottom: 2px solid #eee; }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
tr:hover td { background: #fafbfc; }

/* ── Status ───────────────────────────────── */
.status { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.status-new { background: #eaf2ff; color: #034381; }
.status-assigned { background: #fff4e5; color: #e67e22; }
.status-confirmed { background: #e3f0fa; color: #034381; }
.status-loading { background: #e0f7fa; color: #00838f; }
.status-transit { background: #e8f8f5; color: #1abc9c; }
.status-unloading { background: #fff3e0; color: #ef6c00; }
.status-delivered { background: #e8f5e9; color: #27ae60; }
.status-invoiced { background: #fce4ec; color: #c0392b; }
.status-available { background: #e8f5e9; color: #27ae60; }
.status-busy { background: #fff4e5; color: #e67e22; }
.status-delay { background: #fce4ec; color: #e74c3c; }
.status-cancelled { background: #f5f5f5; color: #999; }

/* ── Stats ────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 16px; text-align: center; border: 1px solid #eee; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.stat-card .num { font-size: 30px; font-weight: 800; }
.stat-card .label { font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.stat-card.blue .num { color: #034381; }
.stat-card.orange .num { color: #e67e22; }
.stat-card.green .num { color: #27ae60; }
.stat-card.purple .num { color: #034381; }
.stat-card.red .num { color: #e74c3c; }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 24px; width: 92%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 14px; color: #034381; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* ── Toast ────────────────────────────────── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: #034381; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 12px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: slideIn .3s ease; cursor: pointer; max-width: 340px;
}
.toast.success { background: #27ae60; }
.toast.info { background: #034381; }
.toast.warn { background: #f39c12; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Workflow Banner ──────────────────────── */
.workflow-banner {
  background: #034381; color: #fff;
  border-radius: 12px; padding: 14px 20px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
}
.wf-step { text-align: center; font-size: 11px; font-weight: 600; opacity: .6; }
.wf-step.active-step { opacity: 1; }
.wf-step .wf-icon { font-size: 20px; display: block; margin-bottom: 2px; }
.wf-arrow { font-size: 16px; opacity: .4; }

/* ── Lieferschein (shared between dispatcher & driver) ── */
.ls-doc {
  border: 2px solid #034381; border-radius: 10px; padding: 0; background: #fff;
  font-size: 12px; overflow: hidden;
}
.ls-header {
  background: #034381; color: #fff;
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
}
.ls-header h4 { font-size: 16px; font-weight: 700; margin: 0; }
.ls-header .ls-num { font-size: 12px; opacity: .7; }
.ls-body { padding: 16px 18px; }
.ls-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #f0f0f0; }
.ls-row:last-child { border-bottom: none; }
.ls-row .ls-label { color: #888; font-weight: 600; font-size: 11px; text-transform: uppercase; min-width: 120px; }
.ls-row .ls-val { color: #034381; font-weight: 500; text-align: right; flex: 1; }
.ls-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e0e0e0; }
.ls-section-title { font-size: 11px; font-weight: 700; color: #034381; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.ls-sig-row { display: flex; gap: 14px; margin-top: 10px; }
.ls-sig-box {
  flex: 1; border: 2px dashed #ccc; border-radius: 10px; padding: 10px;
  text-align: center; min-height: 70px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #fafafa;
  transition: all .2s;
}
.ls-sig-box.signed { border-color: #27ae60; border-style: solid; background: #e8f5e9; }
.ls-sig-box .sig-label { font-size: 10px; font-weight: 700; color: #888; text-transform: uppercase; margin-bottom: 4px; }
.ls-sig-box .sig-status { font-size: 11px; font-weight: 600; }
.ls-sig-box .sig-status.done { color: #27ae60; }
.ls-sig-box .sig-status.pending { color: #999; }
.ls-sign-options { display: flex; gap: 8px; margin-top: 12px; }
.ls-sign-options .btn { flex: 1; justify-content: center; }
.ls-footer {
  background: #f8f9fa; border-top: 1px solid #e0e0e0;
  padding: 10px 18px; font-size: 10px; color: #999; text-align: center;
}

/* ── Utility ─────────────────────────────── */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-12 { margin-top: 12px; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: #999; font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lang-switch { font-size: 11px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .two-col, .form-grid { grid-template-columns: 1fr; }
}
