/* Cerpangha Field Tech — Office Dispatch Board mock (desktop-first) */
:root {
  --bg: #e8eef3;
  --surface: #ffffff;
  --ink: #0f1c2e;
  --ink-soft: #4a5d73;
  --muted: #7a8fa3;
  --line: #c9d6e2;
  --brand: #0b3d5c;
  --brand-2: #0e7490;
  --brand-soft: #e6f4f8;
  --col-w: 172px;
  --chrome-h: auto;
  --radius: 8px;
  --shadow: 0 8px 28px rgba(15, 28, 46, 0.16);
  font-family: system-ui, "Segoe UI", "DM Sans", -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden { display: none !important; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 600px;
}

/* —— Top chrome —— */
.chrome {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(11, 61, 92, 0.06);
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chrome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}
.chrome-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}
.chrome-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.app-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.board-name {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}
.mock-chip {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 3px 9px;
}

.chrome-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}
.ctrl {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
.ctrl-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ctrl input[type="date"],
.ctrl select,
.find-wrap {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}
.ctrl input[type="date"],
.ctrl select { min-width: 132px; }
.ctrl select:focus,
.ctrl input:focus,
.find-wrap:focus-within {
  outline: 2px solid rgba(11, 61, 92, 0.25);
  border-color: var(--brand);
}

.find-ctrl { flex: 1 1 220px; max-width: 360px; }
.find-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 4px;
}
.find-icon { color: var(--muted); flex: 0 0 auto; }
.find-wrap input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  min-width: 0;
  height: 100%;
}
.find-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
}
.find-clear:hover { background: var(--brand-soft); color: var(--brand); }

.chrome-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--brand-soft); border-color: #9eb8c9; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn.primary:hover { background: #0a334d; }

/* —— Board —— */
.board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(180deg, #dfe8ef 0%, var(--bg) 48px);
}
.board {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 100%;
  padding: 8px 8px 12px;
  width: max-content;
}

.column {
  flex: 0 0 var(--col-w);
  width: var(--col-w);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
  border-right: 2px solid rgba(11, 61, 92, 0.28);
  background: rgba(255, 255, 255, 0.35);
}
.column:first-child { border-left: 2px solid rgba(11, 61, 92, 0.28); }
.column.tech { background: rgba(255, 255, 255, 0.55); }
.column.bucket-right { background: rgba(254, 243, 199, 0.15); }
.column.drop-target {
  background: rgba(14, 116, 144, 0.12);
  outline: 2px dashed var(--brand-2);
  outline-offset: -2px;
}

.col-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 8px 7px;
  background: linear-gradient(180deg, #0b3d5c 0%, #0e4a6e 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  min-height: 42px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}
.col-header .name {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.col-header .count {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  padding: 1px 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.col-cards {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 5px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 80px;
}
.col-empty {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 18px 6px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.5);
}

/* —— Cards —— */
.card {
  position: relative;
  border-radius: 4px;
  border: 1px solid rgba(15, 28, 46, 0.18);
  padding: 6px 7px 7px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.25;
  box-shadow: 0 1px 1px rgba(15, 28, 46, 0.06);
  user-select: none;
  transition: box-shadow 0.12s, transform 0.12s;
}
.card:hover {
  box-shadow: 0 3px 10px rgba(15, 28, 46, 0.14);
  transform: translateY(-1px);
}
.card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.card .date {
  font-size: 10px;
  color: rgba(15, 28, 46, 0.72);
  font-weight: 500;
  margin-bottom: 2px;
}
.card .customer {
  font-weight: 700;
  color: var(--ink);
  font-size: 11.5px;
  margin-bottom: 1px;
  word-break: break-word;
}
.card .city {
  font-size: 10.5px;
  color: rgba(15, 28, 46, 0.78);
}
.card .attach {
  position: absolute;
  right: 5px;
  bottom: 4px;
  font-size: 11px;
  opacity: 0.85;
  line-height: 1;
}

.card.color-red { background: #f87171; border-color: #dc2626; }
.card.color-yellow { background: #fde047; border-color: #ca8a04; }
.card.color-lime { background: #a3e635; border-color: #65a30d; }
.card.color-orange { background: #fdba74; border-color: #ea580c; }
.card.color-blue { background: #7dd3fc; border-color: #0284c7; }
.card.color-white { background: #ffffff; border-color: #94a3b8; }

.card.dimmed { opacity: 0.22; pointer-events: none; }

/* —— Legend —— */
.legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 6px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-soft);
}
.legend-title {
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  display: inline-block;
}
.swatch.red { background: #f87171; }
.swatch.yellow { background: #fde047; }
.swatch.lime { background: #a3e635; }
.swatch.orange { background: #fdba74; }
.swatch.blue { background: #7dd3fc; }
.swatch.white { background: #fff; }
.legend-hint {
  margin-left: auto;
  color: var(--muted);
  font-style: italic;
}

/* —— Detail drawer —— */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 46, 0.35);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--surface);
  z-index: 50;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.18s ease-out;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fafc, #fff);
}
.drawer-kicker {
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.drawer-head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--brand);
  line-height: 1.25;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px 20px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.detail-grid .lbl {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 2px;
}
.detail-grid .val { color: var(--ink); word-break: break-word; }
.detail-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.detail-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
}
.detail-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre-wrap;
}
.stub-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stub-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px dashed #9eb8c9;
}
.color-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.color-pill .swatch { width: 14px; height: 14px; }

.drawer-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

/* —— Toast —— */
.toast {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 60;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .chrome-actions { margin-left: 0; }
  :root { --col-w: 158px; }
}
