/* ============== Dark theme ============== */
:root {
  --bg: #0b1020;
  --bg-2: #121830;
  --bg-3: #1a2240;
  --line: #2a3158;
  --text: #e6edf7;
  --muted: #8b94b8;
  --accent: #3b82f6;
  --accent-2: #06b6d4;
  --red: #ef4444;
  --green: #10b981;
  --yellow: #f59e0b;
  --orange: #fb923c;
  --priority-high: #ef4444;
  --priority-mid: #f59e0b;
  --priority-low: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  font-size: 14px;
}

/* ============== Login ============== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px 28px; min-width: 320px; max-width: 380px; width: 90%;
  box-shadow: 0 12px 48px rgba(0,0,0,.4);
}
.login-box .logo { font-size: 24px; font-weight: 700; }
.login-box .subtitle { color: var(--muted); margin: 6px 0 22px; }
.login-box label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.login-box input {
  width: 100%; padding: 10px 12px; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.login-box button {
  width: 100%; margin-top: 14px; padding: 10px; background: var(--accent);
  border: 0; border-radius: 8px; color: white; font-weight: 600; cursor: pointer;
}
.login-box .error { color: var(--red); margin-top: 8px; font-size: 13px; }
.login-box .hint { color: var(--muted); font-size: 12px; margin-top: 18px; }
.login-box code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; }

/* ============== Top bar ============== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============== Buttons ============== */
.btn {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); cursor: pointer; font-size: 13px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s ease;
}
.btn:hover { background: #232c52; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: var(--bg-3); }
.btn-danger { background: var(--red); border-color: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }

/* ============== Dashboard ============== */
.dashboard {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; padding: 16px 24px;
}
.card.stat {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat[data-status="Bago"]        .stat-value { color: #93c5fd; }
.stat[data-status="Naka-assign"] .stat-value { color: #fbbf24; }
.stat[data-status="In Progress"] .stat-value { color: #fb923c; }
.stat[data-status="Tapos"]       .stat-value { color: #34d399; }
.stat.total .stat-value { color: var(--accent); }

/* ============== Filters ============== */
.filters {
  display: flex; gap: 10px; padding: 0 24px 14px; align-items: center; flex-wrap: wrap;
}
.filters input, .filters select {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px; font-size: 13px;
}
#searchBox { min-width: 280px; flex: 1; max-width: 420px; }
.sync-status {
  color: var(--muted); font-size: 12px; margin-left: auto;
  transition: color 0.3s;
}
.sync-status.stale { color: #f87171; }   /* red tint when last sync > 5min old */

/* ============== Kanban ============== */
.kanban {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 0 24px 32px; align-items: flex-start;
}
.kanban-col {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; min-height: 200px;
}
.kanban-col header {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
  font-weight: 600; font-size: 14px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-bago { background: #93c5fd; }
.dot-assigned { background: #fbbf24; }
.dot-progress { background: #fb923c; }
.dot-done { background: #34d399; }
.col-count {
  margin-left: auto; background: var(--bg-3); padding: 2px 8px;
  border-radius: 10px; font-size: 12px; color: var(--muted); font-weight: 500;
}
.kanban-list { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kanban-list.drag-over { background: rgba(59, 130, 246, .08); border-radius: 6px; }

/* When closed tickets surface inside the 'New' column via a search match,
   they're preceded by this header so the user knows where they ended up. */
.done-search-header {
  margin-top: 12px; padding: 8px 10px;
  background: rgba(52, 211, 153, .08);
  border: 1px dashed rgba(52, 211, 153, .4);
  border-radius: 6px;
  font-size: 11px; font-weight: 600; color: #34d399;
  text-transform: uppercase; letter-spacing: 0.3px;
}

/* ============== Task card ============== */
.task-card {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; cursor: grab; transition: transform .12s, box-shadow .12s;
  position: relative;
}
.task-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.task-card.dragging { opacity: 0.5; }
.task-card .t-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.task-card .t-meta { color: var(--muted); font-size: 11px; margin-bottom: 6px; line-height: 1.4; }
.task-card .t-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.task-card .tag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--muted);
}
/* Granular gnet.ph category tag colors */
.task-card .tag.type-Install            { background: rgba(34,197,94,.15);  color: #86efac; border-color: rgba(34,197,94,.4); }
.task-card .tag.type-MaintenanceRepair  { background: rgba(251,146,60,.15); color: #fdba74; border-color: rgba(251,146,60,.4); }
.task-card .tag.type-Repair             { background: rgba(251,146,60,.15); color: #fdba74; border-color: rgba(251,146,60,.4); }  /* legacy */
.task-card .tag.type-Support            { background: rgba(59,130,246,.15); color: #93c5fd; border-color: rgba(59,130,246,.4); }  /* legacy */
.task-card .tag.type-Pullout            { background: rgba(239,68,68,.15);  color: #fca5a5; border-color: rgba(239,68,68,.4); }
.task-card .tag.type-Bills              { background: rgba(168,85,247,.15); color: #d8b4fe; border-color: rgba(168,85,247,.4); }
.task-card .tag.type-Cable              { background: rgba(20,184,166,.15); color: #5eead4; border-color: rgba(20,184,166,.4); }
.task-card .tag.type-Transfer           { background: rgba(234,179,8,.15);  color: #fde047; border-color: rgba(234,179,8,.4); }
.task-card .tag.type-Verification       { background: rgba(99,102,241,.15); color: #a5b4fc; border-color: rgba(99,102,241,.4); }
.task-card .tag.type-Application        { background: rgba(236,72,153,.15); color: #f9a8d4; border-color: rgba(236,72,153,.4); }
.task-card .tag.type-Monitoring         { background: rgba(14,165,233,.15); color: #7dd3fc; border-color: rgba(14,165,233,.4); }
.task-card .tag.type-NAP                { background: rgba(217,70,239,.15); color: #f0abfc; border-color: rgba(217,70,239,.4); }
.task-card .tag.type-LCP                { background: rgba(217,70,239,.15); color: #f0abfc; border-color: rgba(217,70,239,.4); }
.task-card .tag.type-Other              { background: var(--bg-3); color: var(--muted); border-color: var(--line); }
.task-card .tag.prio-Mataas       { background: rgba(239,68,68,.15);  color: #fca5a5; border-color: rgba(239,68,68,.4); }
.task-card .tag.prio-Katamtaman   { background: rgba(245,158,11,.15); color: #fcd34d; border-color: rgba(245,158,11,.4); }
.task-card .tag.prio-Mababa       { background: rgba(107,114,128,.15);color: #d1d5db; border-color: rgba(107,114,128,.4); }
.task-card .t-bottom {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  padding-top: 8px; border-top: 1px dashed var(--line);
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; color: white; font-size: 11px;
  font-weight: 600;
}
.t-assignee { font-size: 11px; color: var(--muted); }
.t-deadline { margin-left: auto; font-size: 11px; color: var(--muted); }
.t-deadline.overdue { color: var(--red); font-weight: 600; }
.t-deadline.soon { color: var(--yellow); }
.t-ticket { color: var(--accent-2); font-size: 10px; font-weight: 600; }
.t-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.t-top .t-date { color: var(--muted); font-size: 10px; }
.t-top .t-image { margin-left: auto; text-decoration: none; font-size: 14px; }
.t-top .t-image:hover { opacity: 0.7; }
.t-top .t-carried {
  margin-left: auto; font-size: 9px; font-weight: 600; letter-spacing: 0.3px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(251,191,36,.15); color: #fbbf24;
  border: 1px solid rgba(251,191,36,.4);
  text-transform: uppercase;
}
/* When .t-image is also present we want the badge on the right; both have
   margin-left:auto so the second one wins — order in template puts carried last. */
.task-card.carried-over { border-left: 3px solid #fbbf24; }
.t-addr { color: var(--muted); font-size: 10px; margin-top: 2px; font-style: italic; }
.t-phone { color: var(--accent-2); font-size: 11px; margin-left: 4px; text-decoration: none; }
.t-phone:hover { text-decoration: underline; }
.tag.repeat { background: rgba(239,68,68,.2); color: #fca5a5; border-color: rgba(239,68,68,.5); font-weight: 600; }
.tag.coverage { background: rgba(6,182,212,.15); color: #67e8f9; border-color: rgba(6,182,212,.4); }

/* Aging indicators on cards (left border tint) */
.task-card.aging-near    { border-left: 3px solid var(--yellow); padding-left: 9px; }
.task-card.aging-urgent  { border-left: 3px solid var(--red);    padding-left: 9px; }

/* Filter chip toggle */
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.chip-toggle input { margin: 0; }

/* Extra info in modal */
.extra-info {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; font-size: 12px; color: var(--muted); margin-top: 10px;
  line-height: 1.6;
}
.extra-info strong { color: var(--text); margin-right: 4px; }
.extra-info a { color: var(--accent-2); }

/* ============== Modal ============== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex;
  align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-content {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 24px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
}
.modal-content.wide  { max-width: 720px; }
.modal-content.xwide { max-width: 1280px; }

/* ============== View-only ticket modal (info-card style) ============== */
/* Modal header */
.modal-content.view-only header h3 {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* The form root acts as a vertical stack of info "rows" */
.modal-content.view-only .readonly-form {
  display: flex; flex-direction: column; gap: 12px;
}

/* Label = small caps above the value (NOT inline) */
.modal-content.view-only .readonly-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 600;
  margin: 0;
}

/* Inputs/textareas: look like clean info displays, not form fields */
.modal-content.view-only .readonly-form input[readonly],
.modal-content.view-only .readonly-form textarea[readonly] {
  background: rgba(59, 130, 246, 0.04);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: text;       /* allow copy-paste UX */
  opacity: 1;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  transition: background 0.15s;
}
.modal-content.view-only .readonly-form input[readonly]:hover,
.modal-content.view-only .readonly-form textarea[readonly]:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
}
.modal-content.view-only .readonly-form input[readonly]:focus,
.modal-content.view-only .readonly-form textarea[readonly]:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}
.modal-content.view-only .readonly-form textarea[readonly] {
  resize: none; min-height: 50px; line-height: 1.5;
}

/* Two-column rows (Job Type | Priority, etc.) */
.modal-content.view-only .readonly-form .row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* Show empty fields with a friendly placeholder */
.modal-content.view-only .readonly-form input[readonly]:placeholder-shown,
.modal-content.view-only .readonly-form input[readonly][value=""] {
  font-style: italic; color: var(--muted);
}

/* Footer mini-info bar (Ticket # + Created by) */
.modal-content.view-only .extra-info {
  margin-top: 8px; padding: 10px 12px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 6px;
  font-size: 11px; line-height: 1.7;
  color: var(--muted);
}
.modal-content.view-only .extra-info strong {
  color: var(--text); font-weight: 600; margin-right: 4px;
}
.modal-content.view-only .extra-info a { color: #a78bfa; text-decoration: none; }
.modal-content.view-only .extra-info a:hover { text-decoration: underline; }

/* ============ Ticket Details — extra sections ============ */
.td-section {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--line);
  position: relative;
}
.td-section::before {
  content: ''; position: absolute; top: -1px; left: 0;
  width: 40px; height: 2px;
  background: linear-gradient(90deg, #60a5fa, transparent);
}
.td-section-h {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.td-loading {
  padding: 8px 12px; color: var(--muted); font-size: 12px;
  font-style: italic;
  background: var(--bg-3); border-radius: 6px;
  border: 1px dashed var(--line);
}
.td-loading::before { content: '⏳ '; }
.td-empty {
  padding: 8px 12px; color: var(--muted); font-size: 12px;
  background: var(--bg-3); border-radius: 6px;
}

/* Technician list table */
.td-tech-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.td-tech-table thead th {
  text-align: left; padding: 6px 8px; color: var(--muted);
  font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
}
.td-tech-table tbody td {
  padding: 8px; border-bottom: 1px solid rgba(42,49,88,.5);
  vertical-align: middle;
}
.td-tech-table tbody tr:last-child td { border-bottom: none; }
.td-tech-table .td-tech-name { margin-left: 6px; font-weight: 600; }
.td-tech-table a { color: #60a5fa; text-decoration: none; }
.td-tech-table a:hover { text-decoration: underline; }

/* ============ Customer Profile card ============ */
.cp-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), rgba(59, 130, 246, 0.04));
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 10px; padding: 14px 16px;
}
.cp-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.cp-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cp-id {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  background: rgba(168, 85, 247, 0.2); color: #c4b5fd;
}
.cp-id.muted { background: var(--bg-3); color: var(--muted); font-style: italic; }
.cp-warn {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  background: rgba(251, 191, 36, 0.18); color: #fbbf24;
}
.cp-sub { color: var(--muted); font-size: 11px; margin-top: 4px; }
.cp-cov-badge {
  font-size: 11px; font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(59, 130, 246, 0.15); color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}
.cp-cov-badge small { opacity: 0.7; font-weight: 400; margin-left: 4px; }
.cp-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px;
  margin-bottom: 12px;
}
.cp-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.cp-field.cp-wide { grid-column: 1 / -1; }
.cp-field label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); font-weight: 600;
}
.cp-field a { color: #60a5fa; text-decoration: none; }
.cp-field a:hover { text-decoration: underline; }
.cp-field .mono { font-family: 'SF Mono', Menlo, monospace; font-size: 12px; }

.cp-history {
  padding-top: 10px; border-top: 1px solid var(--line);
}
.cp-history-h {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px; font-weight: 600; color: var(--text);
}
.cp-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.cp-total { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.cp-total strong { color: var(--text); }
.cp-pill {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 600;
}
.cp-pill-Bago        { background: rgba(96, 165, 250, 0.15); color: #93c5fd; }
.cp-pill-Nakaassign  { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.cp-pill-InProgress  { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.cp-pill-Tapos       { background: rgba(34, 197, 94, 0.15);  color: #86efac; }

.cp-recent { width: 100%; border-collapse: collapse; font-size: 11px; }
.cp-recent thead th {
  text-align: left; padding: 6px 8px; color: var(--muted);
  font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
}
.cp-recent tbody td { padding: 6px 8px; border-bottom: 1px solid rgba(42, 49, 88, 0.5); }
.cp-recent tbody tr:last-child td { border-bottom: none; }

/* Technician swap dropdown */
.td-tech-swap {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.td-tech-select {
  flex: 1; padding: 8px 10px; font-size: 13px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer;
}
.td-tech-select:disabled { opacity: 0.6; cursor: wait; }
.td-tech-select:focus { outline: none; border-color: #3b82f6; }
.td-tech-status {
  font-size: 11px; font-weight: 600;
  min-width: 90px; text-align: right;
}
.td-tech-status.pending { color: var(--muted); }
.td-tech-status.ok      { color: #22c55e; }
.td-tech-status.err     { color: #ef4444; }

.td-tech-details {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 6px; font-size: 12px;
  flex-wrap: wrap;
}
.td-tech-details .td-tech-name { font-weight: 600; margin-left: 4px; }
.td-tech-link { color: #60a5fa; text-decoration: none; margin-left: 8px; }
.td-tech-link:hover { text-decoration: underline; }
.td-tech-co {
  margin-left: auto; font-size: 10px; color: var(--muted);
  font-style: italic;
}
.td-tech-none { color: var(--muted); font-style: italic; }

/* Timeline (vertical) */
.td-timeline { display: flex; flex-direction: column; gap: 0; }
.td-tl-row {
  display: grid; grid-template-columns: 130px 18px 1fr;
  gap: 12px; align-items: flex-start;
  padding: 8px 0;
  position: relative;
}
.td-tl-date {
  font-size: 11px; line-height: 1.3; color: var(--muted);
  text-align: right;
}
.td-tl-day  { display: block; font-weight: 600; color: var(--text); }
.td-tl-time { display: block; font-size: 10px; opacity: 0.75; }
.td-tl-marker {
  position: relative; width: 12px; height: 12px;
  background: #3b82f6; border: 2px solid var(--bg-2);
  border-radius: 50%; margin-top: 4px; z-index: 1;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}
.td-tl-row::before {
  content: ''; position: absolute;
  left: 137px; top: 0; bottom: -8px; width: 2px;
  background: var(--line); z-index: 0;
}
.td-tl-row:last-child::before { bottom: 50%; }   /* don't extend past last item */
.td-tl-body {
  background: var(--bg-3); padding: 8px 12px;
  border-radius: 6px; border: 1px solid var(--line);
}
.td-tl-action { font-size: 12px; color: var(--text); line-height: 1.4; }
.td-tl-img { display: inline-block; margin-top: 8px; }
.td-tl-img img {
  max-width: 200px; max-height: 150px; border-radius: 4px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.td-tl-img:hover img { opacity: 0.9; }

/* ============ Reports modal ============ */
.reports-tabs { display: flex; gap: 8px; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.rtab {
  background: transparent; border: none; color: var(--muted);
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.rtab:hover { color: var(--text); }
.rtab.active { color: var(--text); border-bottom-color: #3b82f6; }

.reports-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-bottom: 16px;
}
.rs-card {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px;
}
.rs-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.rs-value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }

.reports-pane { max-height: 60vh; overflow: auto; }

.report-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.report-table thead th {
  position: sticky; top: 0; background: var(--bg-2); z-index: 1;
  text-align: left; padding: 10px 8px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
  cursor: pointer; user-select: none;
}
.report-table thead th:hover { color: var(--text); }
.report-table thead th.sort-active { color: #60a5fa; }
.report-table thead th.sort-asc::after  { content: ' ▲'; font-size: 9px; }
.report-table thead th.sort-desc::after { content: ' ▼'; font-size: 9px; }
.report-table thead th.num { text-align: right; }

.report-table tbody td {
  padding: 8px; border-bottom: 1px solid rgba(42, 49, 88, 0.5);
  vertical-align: middle;
}
.report-table tbody tr:hover { background: rgba(59, 130, 246, .05); }
.report-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table .r-name { margin-left: 8px; font-weight: 600; }
.report-table .r-role { color: var(--muted); font-size: 11px; }
.report-table .r-toptype { font-size: 11px; color: var(--muted); }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; vertical-align: middle; }

.pct-bar {
  position: relative; width: 90px; height: 18px;
  background: var(--bg-3); border-radius: 4px; overflow: hidden;
  display: inline-block; text-align: left;
}
.pct-bar span { display: block; height: 100%; transition: width 0.3s; }
.pct-bar.pb-good span { background: #22c55e; }
.pct-bar.pb-mid  span { background: #f59e0b; }
.pct-bar.pb-low  span { background: #ef4444; }
.pct-bar em {
  position: absolute; inset: 0; line-height: 18px; text-align: center;
  font-style: normal; font-size: 10px; font-weight: 600; color: var(--text);
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
}

/* ---- Coverage Audit ---- */
.audit-summary { margin-bottom: 20px; }
.audit-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.audit-card {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line);
}
.audit-card.hi   { border-color: rgba(34, 197, 94, 0.4); }
.audit-card.med  { border-color: rgba(251, 191, 36, 0.4); }
.audit-card.low  { border-color: rgba(249, 115, 22, 0.4); }
.audit-card.miss { border-color: rgba(107, 114, 128, 0.4); }
.audit-card.conf { border-color: rgba(239, 68, 68, 0.4); }
.audit-card-icon { font-size: 24px; }
.audit-card-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.audit-card-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.audit-card-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }

.audit-conclusion {
  padding: 12px 16px; border-radius: 8px; font-size: 13px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}
.audit-conclusion.warn {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.audit-issues-title {
  margin: 16px 0 8px;
  font-size: 13px; color: var(--text); font-weight: 700;
}
.audit-issues-controls {
  display: flex; gap: 14px; margin-bottom: 8px;
  font-size: 12px; color: var(--muted);
}
.audit-issues-controls label {
  cursor: pointer; display: flex; align-items: center; gap: 4px;
}

.audit-table .audit-sev {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.audit-table .sev-high   { background: rgba(239, 68, 68, 0.2);  color: #fca5a5; }
.audit-table .sev-medium { background: rgba(251, 191, 36, 0.2); color: #fde047; }
.audit-table .sev-low    { background: rgba(107, 114, 128, 0.2); color: var(--muted); }
.audit-table .audit-cov-was { color: #fca5a5; }
.audit-table .audit-cov-exp { color: #86efac; font-weight: 600; }
.audit-table .audit-source { color: var(--muted); font-size: 11px; font-style: italic; }
.audit-table .mono { font-family: 'SF Mono', Menlo, monospace; font-size: 11px; }

/* ---- Install vs Pullout pivot + chart ---- */
.ip-controls {
  display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
  align-items: center;
}
.ip-legend {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--muted);
}
.ip-leg-sw {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 3px; vertical-align: middle;
  margin-right: 4px; margin-left: 8px;
}
.ip-leg-sw.closed { background: #16a34a; }
.ip-leg-sw.open   { background: #86efac; opacity: 0.7; }
.ip-chart-wrap {
  margin-bottom: 18px; padding: 14px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px;
}
.ip-chart-wrap.area-chart {
  background: linear-gradient(180deg, rgba(59,130,246,0.04), transparent);
  border: 1px solid rgba(59,130,246,0.15);
}
.ip-chart-title {
  font-size: 13px; font-weight: 700; color: #60a5fa;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}
.ip-chart { width: 100%; height: auto; display: block; }
.ip-chart rect { transition: opacity 0.15s; }
.ip-chart rect:hover { opacity: 1 !important; filter: brightness(1.2); }
.ip-area-chart { width: 100%; height: auto; display: block; }
.ip-area-chart circle { transition: r 0.15s, stroke-width 0.15s; cursor: pointer; }
.ip-area-chart circle:hover { r: 6; stroke-width: 3; }

/* Closed-count badge inside table cells */
.ip-closed-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 3px;
  background: rgba(34,197,94,.2); color: #86efac;
  margin-left: 2px;
}
.ip-cat {
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-3);
  font-size: 12px; font-weight: 600; color: var(--muted);
  transition: all 0.15s;
}
.ip-cat:hover { color: var(--text); }
.ip-cat.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa; border-color: #3b82f6;
}
.ip-table-wrap { max-height: 60vh; overflow: auto; }
.ip-table th, .ip-table td { padding: 6px 10px; white-space: nowrap; }
.ip-table tbody td.ip-zero { color: rgba(255,255,255,0.15); }
.ip-table tbody td.ip-lo   { color: #fbbf24; }
.ip-table tbody td.ip-mid  { color: #f97316; font-weight: 600; }
.ip-table tbody td.ip-hi   { color: #ef4444; font-weight: 700; }
.ip-table tfoot th {
  position: sticky; bottom: 0; background: var(--bg-2);
  border-top: 2px solid var(--line);
  font-weight: 700; color: var(--text);
}
.ip-table tbody td:first-child { position: sticky; left: 0; background: var(--bg-2); }
.ip-table thead th:first-child { position: sticky; left: 0; z-index: 2; }

.type-bar {
  display: flex; height: 22px; border-radius: 4px; overflow: hidden;
  background: var(--bg-3); min-width: 160px;
}
.ts-seg {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 700; color: #0b1020;
  overflow: hidden; white-space: nowrap;
}
.ts-seg small { font-weight: 600; opacity: 0.75; }
.modal-content header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-content header h3 { margin: 0; }
.modal-close {
  background: transparent; border: 0; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px 8px;
}
.modal-content form label {
  display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted);
}
.modal-content form input,
.modal-content form select,
.modal-content form textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font-size: 13px; font-family: inherit;
}
.modal-content form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ============== Staff list ============== */
.staff-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.staff-import-status {
  color: var(--muted); font-size: 12px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.staff-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; margin: 6px 0 14px;
}
.staff-item {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; display: flex; gap: 10px; align-items: center;
}
.staff-item .info { flex: 1; min-width: 0; }
.staff-item .nm { font-weight: 600; font-size: 13px; }
.staff-item .rl { color: var(--muted); font-size: 11px; }
.staff-item .acts { display: flex; gap: 6px; }
.staff-item button { padding: 4px 8px; font-size: 11px; }
.staff-add-h { margin: 4px 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.staff-add {
  display: grid; grid-template-columns: 1.4fr 1fr 60px auto auto; gap: 8px;
  align-items: center;
}
.staff-add input, .staff-add select {
  padding: 8px; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 6px; color: var(--text);
}
.staff-add input[type=color] { padding: 0; height: 36px; cursor: pointer; }

/* ============== Toasts ============== */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; max-width: 360px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  animation: slidein .2s ease;
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; } }

/* ============== Responsive ============== */
@media (max-width: 1000px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kanban { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .dashboard, .filters, .kanban { padding-left: 14px; padding-right: 14px; }
  .modal-content form .row,
  .modal-content.view-only .readonly-form .row { grid-template-columns: 1fr; }
  .staff-add { grid-template-columns: 1fr; }
}
