/* ============================================
   MANDATE BOARD STYLES
   iPhone-Style Cards with Drag & Drop
   ============================================ */

/* Dashboard Tab Bar */
.dash-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}

.dash-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.dash-tab:hover {
  color: #1e293b;
  background: rgba(255,255,255,0.5);
}

.dash-tab.active {
  background: white;
  color: #1e293b;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.dash-tab i {
  font-size: 13px;
}

.dash-tab.active i {
  color: var(--fc-accent, #ff6101);
}

/* Toast */
.mb-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  z-index: 99999;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.mb-toast-show { transform: translateY(0); opacity: 1; }
.mb-toast-success { background: #16a34a; }
.mb-toast-error { background: #dc2626; }
.mb-toast-info { background: #1e3c3c; }

/* Board Layout */
.mb-board {
  padding: 0;
}

.mb-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mb-header-left {
  flex: 0 0 auto;
}

.mb-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mb-title i {
  color: var(--fc-accent, #ff6101);
}

.mb-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  display: block;
}

.mb-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mb-search-wrap {
  position: relative;
}

.mb-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 12px;
}

.mb-search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  width: 180px;
  transition: all 0.2s;
}

.mb-search-input:focus {
  outline: none;
  border-color: var(--fc-accent, #ff6101);
  box-shadow: 0 0 0 3px rgba(255, 97, 1, 0.1);
}

.mb-filter-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  background: white;
  cursor: pointer;
}

.mb-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
}

.mb-toggle-label input[type="checkbox"] {
  accent-color: var(--fc-accent, #ff6101);
}

/* KW Info Bar */
.mb-kw-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mb-kw-current {
  font-size: 13px;
  color: #1e293b;
}

.mb-kw-current strong {
  color: var(--fc-primary, #1e3c3c);
  font-size: 16px;
}

.mb-kw-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mb-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
}

.mb-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.mb-sync-ok {
  margin-left: auto;
  font-size: 11px;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mb-sync-updating {
  margin-left: auto;
  font-size: 11px;
  color: #d97706;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mb-sync-offline {
  margin-left: auto;
  font-size: 11px;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Cards Grid */
.mb-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* Single Card */
.mb-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
}

.mb-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.mb-card-dragging {
  opacity: 0.4;
  transform: rotate(2deg) scale(0.98);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.mb-card-dragover {
  border-color: var(--fc-accent, #ff6101);
  box-shadow: 0 0 0 2px rgba(255, 97, 1, 0.3);
}

/* Card Top */
.mb-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mb-card-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mb-card-drag-handle {
  color: #cbd5e1;
  cursor: grab;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mb-card-drag-handle:hover {
  color: #64748b;
  background: #f1f5f9;
}

.mb-card-drag-handle:active {
  cursor: grabbing;
}

/* Status Badge */
.mb-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.mb-priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Card Content */
.mb-card-role {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  line-height: 1.3;
}

.mb-card-client {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mb-card-client i {
  color: var(--fc-accent, #ff6101);
  font-size: 11px;
}

.mb-card-loc {
  color: #94a3b8;
}

.mb-card-loc i {
  color: #94a3b8;
}

/* Timeline */
.mb-timeline {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #f1f5f9;
}

.mb-timeline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.mb-timeline-row:hover {
  background: #f8fafc;
}

.mb-timeline-row:not(:last-child) {
  border-bottom: 1px solid #f8fafc;
}

.mb-tl-label {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mb-tl-label i {
  width: 14px;
  text-align: center;
}

.mb-tl-value {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.mb-tl-set {
  font-weight: 700;
}

.mb-tl-empty {
  color: #cbd5e1;
  background: #f8fafc;
}

/* Tranches */
.mb-tranches {
  margin-bottom: 12px;
}

.mb-tranches-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.mb-tranches-title {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mb-tranches-title i {
  color: var(--fc-accent, #ff6101);
  margin-right: 4px;
}

.mb-tranche-add {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  transition: all 0.2s;
}

.mb-tranche-add:hover {
  color: var(--fc-accent, #ff6101);
  background: #fff7ed;
}

.mb-tranches-row {
  display: flex;
  gap: 6px;
}

.mb-tranche-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.mb-tranche-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.mb-tranche-empty {
  background: #f8fafc;
  color: #cbd5e1;
  border-style: dashed;
}

.mb-tranche-num {
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 0;
}

.mb-tranche-empty .mb-tranche-num {
  background: #e2e8f0;
  color: #94a3b8;
}

.mb-tranche-val {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Footer */
.mb-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.mb-card-candidates {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mb-card-matches {
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mb-card-deadline {
  font-size: 11px;
  color: #64748b;
}

.mb-card-deadline.mb-overdue {
  color: #dc2626;
  font-weight: 600;
}

.mb-card-detail-btn {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mb-card-detail-btn:hover {
  background: var(--fc-primary, #1e3c3c);
  color: white;
}

/* Empty & Loading States */
.mb-loading, .mb-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 14px;
}

.mb-loading i, .mb-empty i {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.4;
}

.mb-empty p {
  font-size: 16px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 4px;
}

.mb-empty span {
  font-size: 13px;
}

/* Invoice Modal */
.mb-invoice-container {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.mb-invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.mb-invoice-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.mb-invoice-header h3 i {
  color: var(--fc-accent, #ff6101);
  margin-right: 8px;
}

.mb-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mb-modal-close:hover {
  color: #dc2626;
  background: #fef2f2;
}

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

.mb-invoice-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
}

/* Tranche Form */
.mb-tranche-form {
  padding: 14px;
  border-radius: 10px;
  background: #f8fafc;
}

.mb-tranche-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.mb-tranche-form-num {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.mb-tranche-form-status {
  font-size: 12px;
  font-weight: 600;
}

.mb-tranche-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.mb-form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mb-form-group input,
.mb-form-group select {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

.mb-form-group input:focus,
.mb-form-group select:focus {
  outline: none;
  border-color: var(--fc-accent, #ff6101);
}

.mb-form-full {
  grid-column: span 2;
}

/* Buttons */
.mb-btn-primary {
  padding: 10px 20px;
  background: var(--fc-primary, #1e3c3c);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.mb-btn-primary:hover {
  background: #163030;
}

.mb-btn-secondary {
  padding: 10px 20px;
  background: white;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.mb-btn-secondary:hover {
  background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
  .mb-cards-grid {
    grid-template-columns: 1fr;
  }

  .mb-header {
    flex-direction: column;
  }

  .mb-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .mb-search-input {
    width: 100%;
  }

  .dash-tab-bar {
    width: 100%;
  }

  .dash-tab {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
  }

  .mb-kw-bar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .mb-sync-ok, .mb-sync-updating {
    margin-left: 0;
  }

  .mb-tranche-form-grid {
    grid-template-columns: 1fr;
  }

  .mb-form-full {
    grid-column: span 1;
  }

  .mb-invoice-container {
    max-width: 95%;
  }
}

@media (max-width: 480px) {
  .mb-tranches-row {
    flex-direction: column;
  }

  .mb-timeline-row {
    padding: 6px 8px;
  }
}
