/* Brand palette (v0.9.2 light theme): dark neutral for solid actions,
   blue accent for links/focus, light gray for tinted surfaces (table
   headers, card title-strips). Status colors (badge-status /
   badge-priority further below) intentionally stay on their own semantic
   red/amber/green scale, independent of this palette. */
:root {
  --navy: #111827;
  --navy-dark: #030712;
  --navy-light: #1f2937;
  --accent: #2563eb;
  --accent-soft: #f3f4f6;
  --bg: #fafafa;
  --text-muted: #6b7280;
  --radius: 10px;
}

body {
  background: var(--bg);
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #111827;
}

/* Retint Bootstrap's "primary" component variables (they're hardcoded per
   component in bootstrap.min.css, not derived from a single root variable,
   so each needs its own override here). Primary buttons are solid dark
   neutral (matches the persistent "Raportare nouă" header action), while
   links/focus rings keep a distinct blue so clickable text stays legible
   as a link rather than reading as a button. */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--navy);
  --bs-btn-border-color: var(--navy);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--navy-light);
  --bs-btn-hover-border-color: var(--navy-light);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--navy-light);
  --bs-btn-active-border-color: var(--navy-light);
  --bs-btn-disabled-bg: var(--navy);
  --bs-btn-disabled-border-color: var(--navy);
}
.btn-outline-primary {
  --bs-btn-color: var(--navy);
  --bs-btn-border-color: #d1d5db;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--navy);
  --bs-btn-active-border-color: var(--navy);
  --bs-btn-disabled-color: var(--navy);
  --bs-btn-disabled-border-color: #d1d5db;
}
.text-primary { color: var(--accent) !important; }
.bg-primary, .text-bg-primary { background-color: var(--navy) !important; }
.border-primary { border-color: var(--navy) !important; }
a { color: var(--accent); }
a:hover { color: #1d4ed8; }
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .25rem rgba(37, 99, 235, .2);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Cards */
.summary-card {
  display: flex;
  flex-direction: column-reverse;
  background: #fff;
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  border: 1px solid #e9edf3;
}

.summary-card .value {
  padding: .7rem .9rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
}

.summary-card .label {
  background: #f3f4f6;
  border-bottom: 1px solid #e9edf3;
  padding: .5rem .9rem;
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* Admin index icon tiles: icon + title + description, distinct markup
   shape from .summary-card (value/label pair), so kept as its own class
   rather than reusing summary-card's column-reverse title-strip layout. */
.admin-tile {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  background: #fff;
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  border: 1px solid #e9edf3;
  height: 100%;
}

.admin-tile i {
  color: #4b5563;
  margin-bottom: .35rem;
}

.admin-tile .value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
}

.admin-tile .label {
  font-size: .82rem;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

/* Status badges */
.badge-status {
  padding: .32rem .65rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-New, .badge-Open { background: #e3f2fd; color: #1565c0; }
.badge-Claimed, .badge-Assigned, .badge-In-Progress { background: #fff8e1; color: #f57f17; }
.badge-Redirected { background: #f3e5f5; color: #6a1b9a; }
.badge-Converted-to-Work-Order, .badge-Completed { background: #e8f5e9; color: #2e7d32; }
.badge-Closed, .badge-Cancelled { background: #eceff1; color: #455a64; }
.badge-Verified { background: #e0f2f1; color: #00695c; }
.badge-In-Analysis { background: #e3f2fd; color: #1565c0; }
.badge-Work-Order-Created { background: #e8f5e9; color: #2e7d32; }
.badge-Closed-Without-Work-Order { background: #eceff1; color: #455a64; }
.badge-Returned-to-Pool { background: #f3e5f5; color: #6a1b9a; }

.badge-priority-Low { background: #eceff1; color: #455a64; }
.badge-priority-Medium { background: #fff8e1; color: #f57f17; }
.badge-priority-High { background: #ffebee; color: #c62828; }
.badge-priority-Critical { background: #c62828; color: #fff; }

/* Data table */
.data-table {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #e9edf3;
}

.data-table table {
  margin-bottom: 0;
}

.data-table thead th {
  background: var(--accent-soft);
  color: var(--navy);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  border-bottom: none;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f8fafd;
}

.filter-bar {
  background: #fff;
  border: 1px solid #e9edf3;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

/* Auth pages */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
  border: 1px solid #e9edf3;
  box-shadow: 0 4px 20px rgba(15, 23, 42, .06);
}

.auth-card .brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

/* Mobile-first report form */
.report-form-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid #e9edf3;
  max-width: 560px;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e9edf3;
}

.thumb {
  width: 90px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e9edf3;
}

@media (max-width: 991.98px) {
  .main-content { padding: 1rem; }
}

/* Responsive layout refinements */
.offcanvas {
  --bs-offcanvas-width: min(82vw, 300px);
}

.topbar {
  min-height: 56px;
  box-shadow: 0 1px 8px rgba(8, 28, 56, .16);
}

.topbar .navbar-brand {
  font-size: 1rem;
  font-weight: 700;
}

.card, .data-table, .filter-bar, .report-form-card, .summary-card {
  box-shadow: 0 1px 3px rgba(20,40,70,.08);
}

.btn, .form-control, .form-select {
  border-radius: 9px;
}

@media (min-width: 992px) {
  .main-content {
    min-width: 0;
  }
}

@media (max-width: 991.98px) {
  body {
    background: #f7f9fc;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    padding: .9rem;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 1rem;
  }

  .page-header h1 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .summary-card .value {
    padding: .55rem .8rem;
    font-size: 1.35rem;
  }

  .summary-card .label {
    padding: .4rem .8rem;
    font-size: .68rem;
    line-height: 1.2;
  }

  .filter-bar {
    padding: .85rem;
  }

  .filter-bar .btn,
  .report-form-card .btn,
  .card .btn,
  .data-table .btn {
    min-height: 40px;
  }

  .report-form-card {
    max-width: none;
    padding: 1rem;
  }

  dl.row dt {
    margin-top: .65rem;
    color: var(--text-muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .02em;
  }

  dl.row dd {
    margin-bottom: .35rem;
  }
}

/* Table-to-card behaviour for phone screens */
@media (max-width: 575.98px) {
  .responsive-cards {
    background: transparent;
    border: 0;
    overflow: visible;
  }

  .responsive-cards.table-responsive {
    overflow-x: visible;
  }

  .responsive-cards table,
  .responsive-cards thead,
  .responsive-cards tbody,
  .responsive-cards tr,
  .responsive-cards th,
  .responsive-cards td {
    display: block;
  }

  .responsive-cards thead {
    display: none;
  }

  .responsive-cards tbody tr {
    background: #fff;
    border: 1px solid #e9edf3;
    border-radius: 12px;
    margin-bottom: .75rem;
    padding: .75rem;
    box-shadow: 0 1px 3px rgba(20,40,70,.08);
  }

  .responsive-cards tbody tr:hover {
    background: #fff;
  }

  .responsive-cards tbody td {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: .75rem;
    align-items: start;
    border: 0;
    padding: .42rem 0;
    white-space: normal;
    word-break: break-word;
  }

  .responsive-cards tbody td::before {
    content: attr(data-label);
    font-size: .72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
  }

  .responsive-cards tbody td[data-label="Acțiuni"] {
    grid-template-columns: 1fr;
    padding-top: .65rem;
  }

  .responsive-cards tbody td[data-label="Acțiuni"]::before {
    display: none;
  }

  .responsive-cards tbody td[data-label="Acțiuni"] .btn {
    width: 100%;
  }

  .page-header > .btn {
    width: 100%;
  }

  .auth-wrapper {
    align-items: stretch;
    padding: 1rem;
  }

  .auth-card {
    max-width: none;
    margin: auto 0;
    padding: 1.6rem 1.25rem;
  }
}

/* Report location picker */
.report-location-layout .sticky-lg-top {
  top: 24px;
}

.location-map-card,
.location-picker-card {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.location-picker-card {
  background: #fff;
  padding: 1rem;
}

.report-map {
  width: 100%;
  height: 430px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .1);
  overflow: hidden;
  background: #eef2f7;
}

.location-summary {
  min-height: 44px;
  padding: .75rem .85rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, .08);
  color: var(--navy-dark);
  font-size: .86rem;
}

.map-picker-modal .modal-body {
  display: flex;
  flex-direction: column;
}

.mobile-report-map {
  height: min(62vh, 560px);
}

@media (max-width: 575.98px) {
  .map-picker-modal .modal-body {
    min-height: 0;
  }

  .mobile-report-map {
    height: calc(100vh - 250px);
    min-height: 360px;
  }

  .map-picker-modal .modal-footer .btn {
    width: 100%;
  }
}

.issue-detail-map {
  width: 100%;
  height: 320px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, .1);
  overflow: hidden;
  background: #eef2f7;
}


.map-load-error {
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #334155;
  background: repeating-linear-gradient(45deg, rgba(15,23,42,.04), rgba(15,23,42,.04) 10px, rgba(15,23,42,.02) 10px, rgba(15,23,42,.02) 20px);
}

/* Issue Map */
.issues-map {
  min-height: 68vh;
  height: 680px;
  width: 100%;
  background: #e8eef7;
}
.issue-div-icon {
  background: transparent;
  border: 0;
}
.issue-marker {
  width: 30px;
  height: 30px;
  border-radius: 999px 999px 999px 4px;
  transform: rotate(-45deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .28);
  border: 2px solid rgba(255, 255, 255, .92);
}
.issue-marker i {
  transform: rotate(45deg);
  font-size: 13px;
}
.marker-new { background: #2563eb; }
.marker-claimed { background: #f59e0b; }
.marker-redirected { background: #7c3aed; }
.marker-converted { background: #0f766e; }
.marker-closed { background: #64748b; }
.marker-default { background: #334155; }
.map-issue-list {
  max-height: 590px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-issue-item {
  display: block;
  padding: 10px 11px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}
.map-issue-item:hover {
  border-color: rgba(37, 99, 235, .3);
  background: rgba(37, 99, 235, .05);
}
.issue-popup {
  min-width: 220px;
}
.issue-mini-map {
  height: 220px;
  width: 100%;
  border-radius: var(--radius);
  background: #e8eef7;
}
@media (max-width: 991.98px) {
  .issues-map {
    height: 72vh;
    min-height: 520px;
  }
  .map-issue-list {
    max-height: 260px;
  }
}

.badge-Returned { background: #f3e5f5; color: #6a1b9a; }

/* v0.7.8 Gantt (issues in analysis/work, per Business Unit, -15/+15 days) */
.gantt-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }
.gantt-swatch { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.gantt-swatch-analysis { background: var(--accent); }
.gantt-swatch-wo { background: var(--navy); }
.gantt-marker-sample { width: 9px; height: 9px; background: #f57f17; transform: rotate(45deg); display: inline-block; border-radius: 1px; }
.gantt-marker-sample.overdue { background: #c62828; }
.gantt-today-sample { width: 2px; height: 14px; background: #c62828; display: inline-block; }

.gantt-scroll { overflow-x: auto; }
.gantt-timeline { position: relative; min-width: calc(260px + var(--gantt-days) * var(--gantt-day-w)); }
.gantt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(198, 40, 40, 0.55); z-index: 2; pointer-events: none; }
.gantt-row { display: flex; align-items: stretch; border-bottom: 1px solid #eee; }
.gantt-row:last-child { border-bottom: none; }
.gantt-header-row { border-bottom: 2px solid #ddd; position: sticky; top: 0; background: #fff; z-index: 3; }
.gantt-label-cell { width: 260px; min-width: 260px; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #eee; }
.gantt-issue-link { font-weight: 600; font-size: 0.85rem; color: var(--navy); text-decoration: none; }
.gantt-issue-link:hover { text-decoration: underline; }
.gantt-label-sub { font-size: 0.78rem; max-width: 240px; }
.gantt-label-role { font-size: 0.72rem; max-width: 240px; }
.gantt-track { position: relative; height: 48px; width: calc(var(--gantt-day-w) * var(--gantt-days)); }
.gantt-header-row .gantt-track { height: 32px; }
.gantt-day-tick { position: absolute; top: 0; bottom: 0; font-size: 0.62rem; color: var(--text-muted); text-align: center; padding-top: 6px; border-left: 1px solid #f0f0f0; box-sizing: border-box; }
.gantt-day-tick.weekend { background: rgba(0, 0, 0, 0.03); }
.gantt-day-tick.today { color: #c62828; font-weight: 700; }
.gantt-bar { position: absolute; height: 12px; border-radius: 4px; opacity: 0.9; min-width: 4px; }
.gantt-bar-analysis { top: 8px; background: var(--accent); }
.gantt-bar-wo { top: 26px; background: var(--navy); }
.gantt-bar.overdue { box-shadow: 0 0 0 1px #c62828 inset; }
.gantt-marker { position: absolute; top: 5px; width: 9px; height: 9px; background: #f57f17; transform: translateX(-50%) rotate(45deg); border-radius: 1px; }
.gantt-marker-wo { top: 23px; }
.gantt-marker.overdue { background: #c62828; }
@media (max-width: 575.98px) {
  .gantt-label-cell { width: 180px; min-width: 180px; }
  .gantt-timeline { min-width: calc(180px + var(--gantt-days) * var(--gantt-day-w)); }
}

/* v0.5.5 reporting UX */
.report-summary-card{top:1rem}.completion-ring{--completion:0deg;width:82px;height:82px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--bs-primary) var(--completion),#e9ecef 0);position:relative;flex:0 0 auto}.completion-ring:before{content:"";position:absolute;inset:8px;background:#fff;border-radius:50%}.completion-ring span{position:relative;font-weight:700}.selected-element-card{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 1rem;border:1px solid #cfe2ff;background:#f7faff;border-radius:.6rem}.preserve-lines{white-space:pre-line}.analysis-note{line-height:1.45}@media(max-width:575.98px){.page-header h1{font-size:1.3rem}.card-body{padding:1rem}.input-group .btn{padding-inline:.8rem}.report-summary-card{position:static!important}.completion-ring{width:70px;height:70px}}
