/* --- Palette ---
   Navy:    #1a1a2e / #0f0f1a
   Light:   #e0e0e0
   Purple:  #4a2d6b (logo accent) → #7c4fa8 (usable primary)
*/

/* ── Bootstrap primary → purple ──────────────────────────────── */
:root {
  --bs-primary:          #7c4fa8;
  --bs-primary-rgb:      124, 79, 168;
  --bs-link-color:       #7c4fa8;
  --bs-link-hover-color: #9b67c5;
}

.btn-primary {
  --bs-btn-bg:                 #7c4fa8;
  --bs-btn-border-color:       #7c4fa8;
  --bs-btn-hover-bg:           #6b3a94;
  --bs-btn-hover-border-color: #6b3a94;
  --bs-btn-active-bg:          #5c2e80;
  --bs-btn-active-border-color:#5c2e80;
}

.btn-outline-primary {
  --bs-btn-color:              #7c4fa8;
  --bs-btn-border-color:       #7c4fa8;
  --bs-btn-hover-bg:           #7c4fa8;
  --bs-btn-hover-border-color: #7c4fa8;
  --bs-btn-active-bg:          #6b3a94;
  --bs-btn-active-border-color:#6b3a94;
}

.border-primary { border-color: #7c4fa8 !important; }
.text-primary   { color: #7c4fa8 !important; }

/* ── Base ─────────────────────────────────────────────────────── */
body {
  background-color: #f5f4f9;
}

/* ── Navbar ───────────────────────────────────────────────────── */
.navbar {
  background-color: #1a1a2e !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.nav-link.active { color: #b07fd4 !important; }
.nav-link:hover  { color: #d4b0f0 !important; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  border: none;
  box-shadow: 0 2px 10px rgba(26, 26, 46, 0.09);
}

/* ── Page header ──────────────────────────────────────────────── */
.fm-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  row-gap: 0.5rem;
  padding-bottom: 0.65rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #7c4fa8;
}
.fm-page-header > .ms-auto {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}
.fm-page-header h2 {
  margin: 0;
  font-weight: 700;
  color: #1a1a2e;
  font-size: 1.5rem;
}
.fm-page-header .bi {
  font-size: 1.6rem;
  color: #7c4fa8;
}

/* ── Detail card header ───────────────────────────────────────── */
.fm-card-header {
  background: linear-gradient(120deg, #1a1a2e 0%, #2d1f45 100%);
  color: #e0e0e0;
  padding: 1rem 1.25rem;
  border-radius: 0.375rem 0.375rem 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fm-card-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #e0e0e0;
}
.fm-card-header a.badge:hover { color: #d4b0f0 !important; }

/* ── Purple pill label ────────────────────────────────────────── */
.fm-pill {
  display: inline-block;
  background: #f0ecfa;
  color: #7c4fa8 !important;
  padding: 0.15rem 0.55rem;
  border-radius: 1rem;
  font-weight: 500;
}
.fm-pill:hover { background: #e4d9f5; }
.fm-card-header .badge {
  background-color: #7c4fa8 !important;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ── Section labels ───────────────────────────────────────────── */
.fm-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c4fa8;
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e0d6f0;
}

/* ── Costsheet expandable detail rows ─────────────────────────── */
.cs-detail td {
  background: #faf9fc;
  border-top: none;
  padding: 0.75rem 1rem 0.85rem;
}

.cs-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.4rem 1.5rem;
}

.cs-detail-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c4fa8;
  margin-bottom: 0.25rem;
}

/* ── Tables ───────────────────────────────────────────────────── */
.fm-table thead tr {
  background-color: #1a1a2e;
  color: #e0e0e0;
}
.fm-table thead th {
  font-weight: 500;
  border: none;
  white-space: nowrap;
}
.fm-table tbody tr { cursor: pointer; }

@media (max-width: 767.98px) {
  .fm-wide-table { min-width: 960px; }
  .btn-sm {
    --bs-btn-padding-y: 0.4rem;
    --bs-btn-padding-x: 0.65rem;
  }
}

/* ── Readonly fields ──────────────────────────────────────────── */
.form-control[readonly],
.form-control:disabled {
  background-color: #faf9fc;
  border-color: #ece8f4;
  color: #444;
}
input[type="date"][readonly],
input[type="date"]:disabled {
  pointer-events: none;
}

/* ── Auto-capitalize license plates ──────────────────────────── */
input[name="license"] {
  text-transform: uppercase;
}

input[name="license"]::placeholder {
  text-transform: none;
}

/* ── Dashboard full-window layout ────────────────────────────── */
body.fm-dashboard-page {
  display: flex;
  flex-direction: column;
}
body.fm-dashboard-page #content {
  flex: 1;
  min-height: 0;
}
.fm-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
}
.fm-dashboard .card {
  min-height: 0;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
}
.fm-dashboard .card .card-body {
  flex: 1;
  min-height: 0;
}

@media (min-width: 768px) {
  body.fm-dashboard-page {
    height: 100vh;
    overflow: hidden;
  }
  body.fm-dashboard-page #content {
    overflow: hidden;
  }
  .fm-dashboard {
    height: 100%;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .fm-dashboard .card {
    max-height: none;
  }
  .fm-dashboard.fm-dashboard--courier {
    grid-template-rows: 1fr;
  }
}

/* ── Costsheet total bar ──────────────────────────────────────── */
.fm-total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: #f0ecfa;
  border-top: 1px solid #e0d6f0;
  border-radius: 0 0 0.375rem 0.375rem;
  font-weight: 600;
  color: #1a1a2e;
}
.fm-total-bar .fm-total-value { font-size: 1.1rem; }
.fm-total-bar .fm-total-value.positive { color: #198754; }
.fm-total-bar .fm-total-value.negative { color: #dc3545; }

/* ── Task state selects ───────────────────────────────────────── */
.fm-state-select { font-size: .85rem; padding: .25rem .5rem; }
.fm-state-to-do       { background-color: #f0f0f0; color: #555; }
.fm-state-in-progress { background-color: #fff3cd; color: #856404; }
.fm-state-done        { background-color: #d1e7dd; color: #0f5132; }

/* ── Kanban board ─────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .fm-kanban-scroll { overflow-x: auto; }
  .fm-kanban-rowwidth { min-width: 720px; }
}

.fm-kanban-hdr-todo,
.fm-kanban-hdr-inprogress,
.fm-kanban-hdr-done { flex: 1 1 0; min-width: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }

.fm-kanban-hdr-todo       { background: #dcdcdc; color: #333;    border-top: 3px solid #999;    }
.fm-kanban-hdr-inprogress { background: #ffe082; color: #6b4e00; border-top: 3px solid #ffc107; }
.fm-kanban-hdr-done       { background: #a8d5b5; color: #0a3622; border-top: 3px solid #198754; }

.fm-kanban-col-todo,
.fm-kanban-col-inprogress,
.fm-kanban-col-done { flex: 1 1 0; min-width: 0; min-height: 56px; }

.fm-kanban-col-todo       { background: #ebebeb; }
.fm-kanban-col-inprogress { background: #fff8e1; }
.fm-kanban-col-done       { background: #eaf4ee; }

.fm-kanban-row { border-bottom: 1px solid #ddd; }

.fm-task-card {
  background: #fff;
  border: 1px solid #c8c8c8;
  border-radius: .375rem;
  padding: .5rem .65rem;
  margin-bottom: .5rem;
  cursor: pointer;
  transition: box-shadow .15s;
}
.fm-task-card:hover { box-shadow: 0 4px 12px rgba(26,26,46,.2); }

/* Auto-sized textareas manage their own height; disable the manual drag handle
   and the scrollbar (the script keeps them tall enough to show all content). */
textarea.fm-autosize { resize: none; overflow: hidden; }
