/*
 * Bright dashboard design shared by the project pages, their menus and the admin:
 * blue gradient accents, white soft cards, tinted icon tiles, colourful charts (ApexCharts).
 */
:root {
  --d-blue: #2563EB; --d-blue-2: #0EA5E9; --d-blue-ink: #1D4ED8; --d-sky: #E0F2FE; --d-indigo: #4F46E5;
  --d-red: #EF4444; --d-teal: #14B8A6; --d-amber: #F59E0B; --d-violet: #8B5CF6; --d-pink: #EC4899; --d-green: #10B981; --d-orange: #F97316;
  --d-ink: #0F172A; --d-muted: #64748B; --d-line: #E5EAF2; --d-bg: #F4F7FC; --d-card: #FFFFFF;
  --d-grad: linear-gradient(120deg, #1D63F0 0%, #2B7BF6 45%, #0EA5E9 100%);
  --d-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05);
  --d-radius: 18px;
}

/* Welcome / page banner */
.d-banner { position: relative; overflow: hidden; background: var(--d-grad); color: #fff; border-radius: var(--d-radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: 0 10px 30px rgba(37, 99, 235, .25); }
.d-banner::after { content: ""; position: absolute; right: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .10); }
.d-banner::before { content: ""; position: absolute; right: 120px; top: -70px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.d-banner h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.d-banner p { margin: 0; color: rgba(255, 255, 255, .88); font-size: 14px; }
.d-banner .d-banner-tools { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.d-banner .d-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); color: #fff; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 10px; text-decoration: none; }
.d-banner .d-pill.amber { background: #FACC15; border-color: #FACC15; color: #3B2F00; }

/* KPI tiles */
.d-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.d-kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.d-kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.d-kpi { position: relative; overflow: hidden; background: var(--d-card); border: 1px solid var(--d-line); border-radius: 16px; padding: 14px 14px 12px; box-shadow: var(--d-shadow); min-width: 0; }
.d-kpi::after { content: ""; position: absolute; right: -22px; top: -22px; width: 76px; height: 76px; border-radius: 50%; background: var(--k-soft, #EEF4FF); opacity: .9; }
.d-kpi .ico { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--k-soft, #EEF4FF); color: var(--k, var(--d-blue)); font-size: 18px; margin-bottom: 10px; }
.d-kpi .lbl { display: block; font-size: 12.5px; color: var(--d-muted); font-weight: 600; }
.d-kpi .val { display: block; font-size: 24px; font-weight: 800; color: var(--d-ink); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.d-kpi .val small { font-size: 14px; color: var(--d-muted); font-weight: 700; }
.d-kpi .sub { display: block; font-size: 12px; color: var(--d-muted); margin-top: 2px; }
.d-kpi.blue { --k: #2563EB; --k-soft: #E8F0FF; } .d-kpi.sky { --k: #0284C7; --k-soft: #E0F2FE; } .d-kpi.red { --k: #DC2626; --k-soft: #FEE7E7; }
.d-kpi.teal { --k: #0D9488; --k-soft: #DDF7F3; } .d-kpi.amber { --k: #D97706; --k-soft: #FEF3D7; } .d-kpi.violet { --k: #7C3AED; --k-soft: #EFE9FE; }
.d-kpi.pink { --k: #DB2777; --k-soft: #FCE7F3; } .d-kpi.green { --k: #059669; --k-soft: #DCFCE7; }

/* Chart cards */
.d-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.d-col-12 { grid-column: span 12; } .d-col-8 { grid-column: span 8; } .d-col-7 { grid-column: span 7; } .d-col-6 { grid-column: span 6; }
.d-col-5 { grid-column: span 5; } .d-col-4 { grid-column: span 4; } .d-col-3 { grid-column: span 3; }
.ch-card { background: var(--d-card); border: 1px solid var(--d-line); border-radius: var(--d-radius); padding: 16px 16px 8px; box-shadow: var(--d-shadow); min-width: 0; display: flex; flex-direction: column; }
.ch-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.ch-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #EEF4FF; font-size: 16px; }
.ch-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--d-ink); line-height: 1.3; }
.ch-head p { margin: 1px 0 0; font-size: 12.5px; color: var(--d-muted); }
.ch-head .ch-badge { margin-left: auto; flex: none; font-size: 11.5px; font-weight: 800; color: var(--d-blue-ink); background: #E8F0FF; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ch-body { min-height: 120px; flex: 1; }
.ch-empty { display: grid; place-items: center; min-height: 180px; color: var(--d-muted); font-size: 13.5px; text-align: center; background: repeating-linear-gradient(135deg, #FAFCFF 0 10px, #F4F7FC 10px 20px); border-radius: 12px; margin: 8px 0 10px; }
.ch-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.ch-foot div { background: #F6F8FC; border: 1px solid var(--d-line); border-radius: 12px; padding: 8px 10px; }
.ch-foot span { display: block; font-size: 11.5px; color: var(--d-muted); }
.ch-foot b { font-size: 16px; color: var(--d-ink); font-variant-numeric: tabular-nums; }
.d-section-title { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; font-size: 18px; font-weight: 800; color: var(--d-ink); }
.d-section-title small { font-size: 13px; color: var(--d-muted); font-weight: 600; }
.apexcharts-menu { border-radius: 10px !important; border-color: var(--d-line) !important; box-shadow: var(--d-shadow); }
.apexcharts-toolbar { z-index: 2 !important; }
.apexcharts-tooltip { border-radius: 10px !important; box-shadow: var(--d-shadow) !important; }
@media (max-width: 1200px) { .d-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .d-kpis.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .d-col-8, .d-col-7, .d-col-6, .d-col-5, .d-col-4 { grid-column: span 12; } .d-col-3 { grid-column: span 6; } }
@media (max-width: 640px) { .d-kpis, .d-kpis.k4, .d-kpis.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .d-col-3 { grid-column: span 12; } .d-kpi .val { font-size: 20px; } }
@media print { .apexcharts-toolbar { display: none !important; } .ch-card, .d-kpi { box-shadow: none; break-inside: avoid; } }

/* Sub-pages' own KPI boxes: colour-coded top edge and soft shadow. */
.kpis > .kpi { box-shadow: var(--d-shadow); border-top: 4px solid var(--kc, #2563EB); }
.kpis > .kpi:nth-child(6n+2) { --kc: #0EA5E9; } .kpis > .kpi:nth-child(6n+3) { --kc: #10B981; }
.kpis > .kpi:nth-child(6n+4) { --kc: #F59E0B; } .kpis > .kpi:nth-child(6n+5) { --kc: #8B5CF6; } .kpis > .kpi:nth-child(6n) { --kc: #EF4444; }

/* Date pickers (flatpickr, js/dates.js): readable field + calendar in the dashboard palette. */
input.fp-alt { cursor: pointer; background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px !important; }
input.fp-date { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
input.fp-time { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.flatpickr-calendar { font-family: inherit; border-radius: 14px; box-shadow: 0 12px 40px rgba(15, 23, 42, .18); border: 1px solid #E5EAF2; }
.flatpickr-calendar:before, .flatpickr-calendar:after { display: none; }
.flatpickr-months { padding: 6px 4px 0; }
.flatpickr-current-month { font-size: 15px; font-weight: 700; }
.flatpickr-day { border-radius: 10px; font-weight: 500; }
.flatpickr-day.today { border-color: #93C5FD; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: #2563EB; border-color: #2563EB; }
.flatpickr-time input, .flatpickr-time .flatpickr-am-pm { font-weight: 700; font-size: 17px; }
.flatpickr-time { border-top: 1px solid #E5EAF2 !important; }
.fp-now { display: block; width: calc(100% - 16px); margin: 8px; padding: 8px; border: 1px solid #BFD3FF; border-radius: 10px; background: #EAF1FF; color: #1D4ED8; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.fp-now:hover { background: #DBE7FF; }

/* Dashboard map + maintenance trips (js/project-map.js). */
.pm { background: #fff; border: 1px solid #E5EAF2; border-radius: 18px; box-shadow: var(--d-shadow, 0 1px 3px rgba(15,23,42,.06)); padding: 16px 18px; margin: 16px 0; }
.pm-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.pm-head h3 { margin: 0; font-size: 16px; font-weight: 800; color: #0F172A; }
.pm-head p { margin: 2px 0 0; font-size: 13px; color: #64748B; }
.pm-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pm-layer { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; padding: 6px 10px; border: 1px solid #E5EAF2; border-radius: 999px; cursor: pointer; background: #fff; }
.pm-layer input { margin: 0; }
.pm-layer i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pm-layer b { color: #0F172A; }
.pm-trip { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid #E5EAF2; border-radius: 10px; max-width: 360px; background: #fff; }
.pm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: #2563EB; color: #fff !important; text-decoration: none; border: 0; cursor: pointer; }
.pm-btn:hover { background: #1D4ED8; }
.pm-btn.wide { display: flex; width: 100%; margin-top: 8px; }
.pm-warn { background: #FFF8E1; border: 1px solid #F2DFA6; color: #7A5600; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 12px; }
.pm-warn.small { font-size: 12.5px; padding: 6px 10px; margin: 8px 0; }
.pm-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.pm-map { height: 560px; border-radius: 14px; overflow: hidden; border: 1px solid #E5EAF2; z-index: 0; }
.pm-side { max-height: 560px; overflow-y: auto; border: 1px solid #E5EAF2; border-radius: 14px; padding: 14px; font-size: 13.5px; }
.pm-side h4 { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: #0F172A; }
.pm-muted { color: #64748B; margin: 4px 0; }
.pm-muted.small { font-size: 12px; }
.pm-link { display: inline-block; margin-top: 10px; color: #2563EB; font-weight: 700; font-size: 13px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.pm-side-foot { display: flex; justify-content: space-between; border-top: 1px dashed #E5EAF2; margin-top: 10px; }
.pm-trips { list-style: none; margin: 8px 0; padding: 0; }
.pm-trips button { width: 100%; text-align: left; background: #F8FAFF; border: 1px solid #E5EAF2; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; font: inherit; }
.pm-trips button:hover { border-color: #2563EB; }
.pm-trips b { display: block; font-size: 13.5px; color: #0F172A; }
.pm-trips span { font-size: 12px; color: #64748B; }
.pm-badge { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-bottom: 4px; background: #E0ECFF; color: #1D4ED8; }
.pm-badge.s-ongoing { background: #FEF3C7; color: #92400E; } .pm-badge.s-done { background: #DCFCE7; color: #047857; } .pm-badge.s-cancel { background: #F1F5F9; color: #64748B; }
.pm-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pm-chips span { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #F1F5F9; color: #334155; }
.pm-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.pm-kpis div { background: #F6F9FF; border-radius: 10px; padding: 7px 8px; }
.pm-kpis b { display: block; font-size: 16px; color: #0F172A; }
.pm-kpis span { font-size: 11.5px; color: #64748B; }
.pm-stops { list-style: none; margin: 6px 0; padding: 0; }
.pm-stops li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-bottom: 1px solid #F1F5F9; cursor: pointer; }
.pm-stops li:hover { background: #F8FAFF; }
.pm-stops li > div { flex: 1; min-width: 0; }
.pm-stops li b { display: block; font-size: 13.5px; color: #0F172A; }
.pm-stops li > div span { display: block; font-size: 12px; color: #64748B; }
.pm-stops li > div span.ok { color: #047857; font-weight: 700; }
.pm-stops li > a { color: #2563EB; font-weight: 800; text-decoration: none; padding: 2px 6px; }
.pm-num-wrap { background: none; border: 0; }
.pm-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12.5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); flex-shrink: 0; }
.pm-num.done { box-shadow: 0 0 0 3px #10B981, 0 1px 4px rgba(0,0,0,.35); }
.pm-num.start { background: #0F172A; font-size: 13px; }
.pm-num.office { background: #FACC15; font-size: 14px; min-width: 30px; height: 30px; }
.pm-pop b { font-size: 14px; color: #0F172A; }
.pm-pop-sub { font-size: 12px; color: #64748B; margin: 2px 0 6px; display: flex; align-items: center; gap: 5px; }
.pm-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pm-pop-meta { font-size: 12px; color: #334155; margin-bottom: 8px; line-height: 1.5; }
.pm-pop-meta.ok { color: #047857; font-weight: 700; }
.pm-pop-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pm-pop-btns a { font-size: 12px; font-weight: 700; padding: 6px 9px; border-radius: 8px; border: 1px solid #BFD3FF; color: #1D4ED8 !important; text-decoration: none; }
.pm-pop-btns a.pri { background: #2563EB; color: #fff !important; border-color: #2563EB; }
@media (max-width: 1100px) { .pm-body { grid-template-columns: 1fr; } .pm-map { height: 420px; } .pm-side { max-height: none; } }

/* Trip → WhatsApp message. */
.pm-wa { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #E5EAF2; }
.pm-wa-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pm-btn.wa { background: #16A34A; } .pm-btn.wa:hover { background: #15803D; } .pm-btn.wa.ok { background: #047857; }
.pm-btn.ghost { background: #fff; color: #15803D !important; border: 1px solid #86EFAC; } .pm-btn.ghost:hover { background: #F0FDF4; }
.pm-wa details { margin-top: 6px; } .pm-wa summary { font-size: 12.5px; color: #2563EB; font-weight: 700; cursor: pointer; }
.pm-wa textarea { width: 100%; margin-top: 6px; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid #E5EAF2; border-radius: 10px; padding: 8px; resize: vertical; }
