:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dbe3ef;
  --blue: #1368e8;
  --cyan: #0e7490;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --purple: #7c3aed;
  --surface: rgba(255, 255, 255, .96);
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: #eef6ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(circle at 15% 20%, rgba(19, 104, 232, .14), transparent 28rem),
    radial-gradient(circle at 85% 8%, rgba(22, 163, 74, .10), transparent 24rem),
    linear-gradient(135deg, #eef6ff, #f8fbff 55%, #edfdf8);
}

body.locked {
  display: grid;
  place-items: center;
}

body.locked .sidebar,
body.locked .app,
body.locked .settings-widget {
  display: none;
}

body:not(.locked) .login-screen {
  display: none;
}

.login-screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  place-items: center;
  padding: 20px;
}

body.locked .login-screen {
  display: grid;
}

.login-card {
  width: min(420px, 92vw);
  margin: auto;
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 29, 58, .18);
  text-align: center;
}

.login-card .secondary {
  margin-top: 10px;
}

.forgot-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.forgot-panel[hidden] {
  display: none;
}

.logo.big {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  font-size: 24px;
}

.error-text {
  min-height: 20px;
  color: var(--red);
  font-weight: 800;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover { filter: brightness(.96); }

button.secondary {
  background: #eef2f7;
  color: #243149;
}

button.danger {
  background: var(--red);
  padding: 7px 9px;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

label {
  display: block;
  font-weight: 750;
  color: #243149;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 4px;
  font-size: 23px;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

p { color: var(--muted); }

.sidebar {
  position: sticky;
  top: 0;
  width: 252px;
  height: 100vh;
  padding: 22px 18px;
  color: #fff;
  background: linear-gradient(180deg, #0f1d3a, #173b7a 54%, #0e7490);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #38bdf8, #22c55e 56%, #f59e0b);
  color: #06223a;
  font-weight: 900;
}

.brand strong,
.brand span { display: block; }

.brand span {
  color: #c8d3e5;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #dbeafe;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, .15);
  box-shadow: inset 3px 0 0 var(--amber);
}

.app { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(19, 104, 232, .14);
  backdrop-filter: blur(14px);
}

.top-actions {
  display: flex;
  gap: 10px;
}

main {
  width: 100%;
  max-width: none;
  margin: 22px 0;
  padding: 0 20px 42px;
  display: grid;
  gap: 18px;
}

.hero-panel,
.panel {
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(18, 59, 116, .08);
}

.hero-panel {
  min-height: 138px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .72)),
    repeating-linear-gradient(135deg, rgba(19, 104, 232, .12) 0 14px, rgba(22, 163, 74, .10) 14px 28px);
}

.eyebrow {
  color: var(--purple);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 10px;
}

.stats div {
  min-width: 96px;
  padding: 13px 12px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  text-align: center;
}

.stats strong {
  display: block;
  color: var(--cyan);
  font-size: 24px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.view { display: none; }
.view.active { display: block; }

.layout {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
}

.wide-left { grid-template-columns: .95fr 1.05fr; }

.panel { padding: 19px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 { margin-bottom: 0; }
.panel-head input,
.panel-head select { max-width: 230px; margin-top: 0; }

.route-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.route-actions input {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #0f1d3a;
  color: #fff;
  text-align: left;
}

td,
th {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:nth-child(even) td { background: #f8fafc; }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.done {
  color: #087443;
  background: #dcfce7;
}

.badge.work {
  color: #92400e;
  background: #fef3c7;
}

.badge.hot {
  color: #991b1b;
  background: #fee2e2;
}

.job-list,
.team-list,
.load-list,
.timeline,
.monteur-list {
  display: grid;
  gap: 11px;
}

.job-card,
.team-card,
.load-card,
.timeline-item,
.monteur-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.job-card header,
.team-card header,
.timeline-item header,
.monteur-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.job-card h3,
.team-card h3,
.timeline-item h3,
.monteur-card h3 {
  margin: 0;
  font-size: 16px;
}

.monteur-panel {
  max-width: 760px;
}

.button-link {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.secondary-link {
  background: #eef2f7;
  color: #243149;
}

.button-link.disabled {
  opacity: .55;
  pointer-events: none;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.load-bar {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}

.load-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.timeline-item {
  position: relative;
  padding-left: 18px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: var(--blue);
}

.summary-box {
  display: grid;
  gap: 11px;
}

.route-summary {
  font-size: 14px;
  line-height: 1.4;
}

.route-summary table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.route-summary th,
.route-summary td {
  border: 1px solid var(--line);
  padding: 7px;
  text-align: left;
}

.route-summary th {
  background: #eef5ff;
  color: #172033;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.report-panel {
  display: grid;
  gap: 16px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.report-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.report-box strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.day-box { border-top: 5px solid var(--blue); }
.week-box { border-top: 5px solid var(--green); }
.month-box { border-top: 5px solid var(--purple); }

.empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #f8fafc;
}

.settings-widget {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 20;
}

.settings-widget > button {
  box-shadow: 0 10px 24px rgba(15, 29, 58, .22);
}

.settings-panel {
  position: absolute;
  left: 0;
  bottom: 48px;
  width: min(340px, calc(100vw - 28px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 29, 58, .22);
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel h2 {
  margin-bottom: 0;
}

.settings-message {
  min-height: 18px;
  color: var(--cyan);
  font-weight: 800;
}

@media (max-width: 980px) {
  body { display: block; }
  .sidebar {
    position: relative;
    width: auto;
    height: auto;
  }
  nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  nav a { text-align: center; }
  .layout,
  .wide-left { grid-template-columns: 1fr; }
  .hero-panel,
  .topbar { align-items: flex-start; }
}

@media (max-width: 720px) {
  .login-screen {
    place-items: start center;
    padding-block: 14px;
  }

  .login-card {
    padding: 20px;
  }

  .topbar,
  .hero-panel,
  .panel-head {
    display: grid;
  }
  .top-actions,
  .form-actions { flex-wrap: wrap; }
  .stats,
  .form-grid,
  .report-grid,
  nav {
    grid-template-columns: 1fr;
  }
  .panel-head input,
  .panel-head select { max-width: none; }
  main { padding-inline: 12px; }
}
