/* Tourenplanung-App-spezifisch */

.week-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.week-meta-item {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e5e7);
  border-radius: 10px;
  padding: 12px 16px;
}
.week-meta-item .lbl {
  font-size: 11px;
  color: var(--text-secondary, #86868b);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.week-meta-item .val {
  font-size: 18px;
  font-weight: 600;
}

.test-mode-bar {
  background: #fff8e1;
  border: 1px solid #ffd54f;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 16px 0;
  font-size: 14px;
}
.test-mode-bar code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 12px;
  font-weight: 500;
}
.status-pill.draft     { background: #f1f5f9; color: #475569; }
.status-pill.routing   { background: #ddd6fe; color: #5b21b6; }
.status-pill.review    { background: #fef3c7; color: #92400e; }
.status-pill.mailing   { background: #dbeafe; color: #1e40af; }
.status-pill.confirmed { background: #d1fae5; color: #065f46; }
.status-pill.done      { background: #e5e7eb; color: #374151; }
.status-pill.cancelled { background: #fee2e2; color: #991b1b; }

.match-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 8px;
  font-weight: 500;
}
.match-pill.exact     { background: #d1fae5; color: #065f46; }
.match-pill.fuzzy     { background: #fef3c7; color: #92400e; }
.match-pill.unmatched { background: #fee2e2; color: #991b1b; cursor: pointer; text-decoration: underline; }
.match-pill.manual    { background: #dbeafe; color: #1e40af; }

.row-unmatched { background: #fef9f9 !important; }

.almas-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.almas-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 720px; width: calc(100% - 40px);
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.almas-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e5e7;
}
.almas-modal-header h2 { margin: 0; font-size: 18px; }
.almas-modal-close {
  background: none; border: none; font-size: 28px; cursor: pointer;
  color: #86868b; line-height: 1;
}
.almas-modal-body {
  padding: 20px; overflow-y: auto; flex: 1;
}

.field-row { margin-bottom: 14px; }
.field-row label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #424245; }
.field-row input[type=text], .field-row input[type=email], .field-row input[type=number],
.field-row input[type=time], .field-row select, .field-row textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.field-row textarea { min-height: 80px; resize: vertical; }
.field-row .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid #e5e5e7; }

.search-inline {
  position: relative;
}
.search-inline-results {
  position: absolute; top: 100%; left: 0; right: 0;
  max-height: 240px; overflow-y: auto;
  background: #fff; border: 1px solid #d2d2d7;
  border-radius: 8px;
  z-index: 10;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.search-inline-result {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.search-inline-result:hover { background: #f5f5f7; }
.search-inline-result .name { font-weight: 500; }
.search-inline-result .meta { color: #86868b; font-size: 11px; }

.week-detail-tabs {
  display: flex; gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5e5e7;
}
.tab-btn {
  padding: 8px 16px;
  background: none; border: none;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  color: #6e6e73;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn:hover { color: #1d1d1f; }
.tab-btn.active { color: #1d1d1f; border-bottom-color: #007aff; }

.routes-actions {
  display: flex; gap: 10px; align-items: center;
  margin: 16px 0;
}
.pool-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #1e40af;
  color: white;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.routes-help {
  background: #f0f9ff;
  border-left: 3px solid #0284c7;
  padding: 8px 14px;
  margin: 0 0 16px 0;
  font-size: 13px;
  border-radius: 4px;
}
.tech-route.no-route { opacity: 0.7; }
.tech-route.recommended-next { opacity: 1; border: 2px solid #007aff; box-shadow: 0 4px 12px rgba(0,122,255,0.15); }
.order-badge {
  display: inline-block;
  padding: 2px 10px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.order-badge.primary {
  background: #007aff;
  color: white;
}
.tech-route .plan-btn {
  background: #007aff; color: white;
  border: none; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.tech-route .plan-btn:hover { background: #0056cc; }
.tech-route .plan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tech-route .replan-btn {
  background: #f5f5f7; color: #1d1d1f;
  border: 1px solid #d2d2d7; padding: 6px 12px;
  border-radius: 8px; font-size: 12px;
  cursor: pointer; margin-right: 6px;
}
.tech-route .replan-btn:hover { background: #e5e5e7; }

.tech-route {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.tech-route-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.tech-route-name { font-size: 16px; font-weight: 600; }
.tech-route-stats {
  font-size: 12px; color: #6e6e73;
  display: flex; gap: 16px;
}
.tech-route-stats strong { color: #1d1d1f; }

.day-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.day-col {
  background: #fafafa;
  border-radius: 8px;
  padding: 8px;
  min-height: 120px;
}
.day-col-header {
  font-size: 11px;
  font-weight: 600;
  color: #6e6e73;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.stop-card {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}
.stop-card:hover { border-color: #007aff; }
.stop-card .customer { font-weight: 500; line-height: 1.2; }
.stop-card .meta { color: #86868b; font-size: 10px; margin-top: 2px; }
.stop-card .drive { color: #007aff; font-size: 10px; }
.stop-card.hotel-after::after {
  content: '🏨 Hotel nach diesem Stop';
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #ffd54f;
  color: #b45309;
  font-size: 10px;
}

.day-empty {
  color: #c0c0c0; font-size: 11px; text-align: center; padding: 16px 0;
}

.job-status-mini {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 9px;
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
}
.job-status-mini.asked      { background: #dbeafe; color: #1e40af; }
.job-status-mini.confirmed  { background: #d1fae5; color: #065f46; }
.job-status-mini.declined   { background: #fee2e2; color: #991b1b; }
.job-status-mini.needs_call { background: #fef3c7; color: #92400e; }

.job-drawer-actions {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 12px;
}
.msg-list {
  max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.msg {
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
  font-size: 13px;
}
.msg.msg-in { border-left: 3px solid #007aff; }
.msg.msg-out { border-left: 3px solid #6e6e73; }
.msg-header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.msg-meta { color: #6e6e73; font-size: 11px; margin: 4px 0; }
.msg-subject { font-weight: 500; margin: 4px 0; }
.msg-body {
  background: white; padding: 8px;
  border-radius: 4px;
  font-family: -apple-system, sans-serif;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 4px 0 0 0;
  max-height: 200px; overflow-y: auto;
}

.almas-btn-danger { background: #dc2626; color: white; border: none; }
.almas-btn-danger:hover { background: #b91c1c; }
