:root {
  color-scheme: light;
  --ik-blue: #23548c;
  --ik-blue-2: #28609f;
  --ik-sky: #b7d9ff;
  --ik-soft: #deedfc;
  --ik-dark: #173b63;
  --bg: #eaf4ff;
  --panel: #ffffff;
  --text: #1d2d3f;
  --muted: #65758a;
  --line: #c8d8ea;
  --green: #16833a;
  --red: #c93c37;
  --amber: #9a6700;
  --shadow: 0 8px 18px rgba(35, 84, 140, .16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ik-sky) url("fond.jpg") center top / cover fixed;
  color: var(--text);
  font: 13px/1.45 Arial, Helvetica, sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(183, 217, 255, .72);
  pointer-events: none;
}
a { color: var(--ik-blue); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #1d487a;
  border-radius: 4px;
  background: linear-gradient(#3675b8, var(--ik-blue-2));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.25);
}
button.primary, .button.primary { background: linear-gradient(#2f7ac3, var(--ik-blue)); border-color: var(--ik-blue); color: #fff; }
button.danger { background: #fff; border-color: var(--red); color: var(--red); box-shadow: none; }
input, select, textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #9bb9d9;
  border-radius: 4px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(35,84,140,.22); border-color: var(--ik-blue); }
textarea { min-height: 86px; resize: vertical; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
th, td { padding: 9px 11px; border-bottom: 1px solid #e6eef8; text-align: left; vertical-align: top; }
th {
  color: #fff;
  font-weight: 700;
  background: #333;
  border-bottom-color: #333;
}
tbody tr:nth-child(even) { background: #f5f9fe; }
h1 {
  display: inline-block;
  font-size: 26px;
  line-height: 34px;
  margin: 0;
  padding: 3px 24px;
  color: var(--ik-blue);
  background: #f1f4f7;
  border: 1px solid #c6cbd2;
  border-radius: 6px;
}
h2 { font-size: 17px; margin: 0 0 12px; color: var(--ik-blue); }
.shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}
.auth-shell {
  display: block;
  padding: clamp(24px, 7vh, 72px) 18px;
}
.auth-shell .main {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 24px;
  background: rgba(255,255,255,.97);
}
.auth-shell .topbar {
  justify-content: center;
  border-bottom-width: 3px;
}
.auth-shell h1 {
  border: 0;
  background: transparent;
  padding: 0;
}
.sidebar {
  background: var(--ik-blue) url("bgheader.png") repeat-x top;
  color: #fff;
  padding: 18px 12px;
  border-right: 1px solid #173b63;
}
.brand {
  display: block;
  margin: 0 8px 24px;
  padding: 10px 8px;
  text-align: center;
  background: rgba(255,255,255,.92);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.brand img { width: 170px; max-width: 100%; height: auto; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar a:not(.brand) {
  color: #fff;
  padding: 9px 12px;
  border-radius: 4px;
  background: rgba(40, 96, 159, .82);
  border: 1px solid rgba(255,255,255,.12);
}
.sidebar a:hover { background: #1d487a; text-decoration: none; }
.main {
  position: relative;
  min-width: 0;
  width: min(1180px, calc(100vw - 276px));
  margin: 18px auto;
  padding: 18px;
  background: rgba(255,255,255,.94);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 4px solid var(--ik-blue);
}
.topbar > div { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  background: var(--ik-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.inline input { width: auto; }
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpis div {
  background: linear-gradient(#fff, #f4f9ff);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpis strong { display: block; font-size: 24px; margin-bottom: 4px; color: var(--ik-blue); }
.kpis span, .muted { color: var(--muted); }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid.two > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid label span { display: block; color: var(--ik-blue); margin-bottom: 5px; font-weight: 700; }
.form-grid textarea, .form-grid .form-actions, .danger-zone { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; min-height: auto; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.danger-zone {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #f0b8b5;
  border-radius: 4px;
  background: #fff8f8;
}
.flash {
  padding: 12px 14px;
  border-radius: 4px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.success { border-color: #a6d8b4; background: #f0fff4; color: var(--green); }
.flash.warning { border-color: #f0d28a; background: #fff8dc; color: var(--amber); }
.flash.danger { border-color: #f0b8b5; background: #fff8f8; color: var(--red); }
.auth {
  width: 100%;
  margin: 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.auth label span { display: block; margin-bottom: 5px; color: var(--ik-dark); font-weight: 700; }
.auth label.has-error input { border-color: var(--red); background: #fff8f8; box-shadow: 0 0 0 1px rgba(221,75,57,.12); }
.auth .field-error { display: flex; align-items: flex-start; gap: 5px; margin-top: 5px; color: var(--red); font-size: 12px; font-weight: 700; line-height: 1.3; }
.auth > button { width: 100%; min-height: 42px; }
.auth-logo {
  width: 300px;
  max-width: 100%;
  height: auto;
  justify-self: center;
  margin-bottom: 8px;
}
.actions { white-space: nowrap; }
.distance-status { align-self: center; }
.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.invoice-head img { width: 220px; max-width: 45%; height: auto; }
.big-action { min-height: 42px; font-size: 15px; }
.stat-boxes .stat-card {
  display: grid;
  min-height: 132px;
  padding: 16px;
  border-radius: 4px;
  color: #fff;
  box-shadow: var(--shadow);
}
.stat-boxes .stat-card:hover { text-decoration: none; filter: brightness(.96); }
.stat-boxes .stat-card strong { color: #fff; font-size: 28px; }
.stat-boxes .stat-card span { color: #fff; font-size: 14px; }
.stat-boxes .stat-card em { align-self: end; color: rgba(255,255,255,.85); font-size: 11px; font-style: normal; }
.stat-card.aqua { background: #00a7b7; }
.stat-card.navy { background: #23548c; }
.stat-card.yellow { background: #e3a008; }
.stat-card.red { background: #c93c37; }
.progress-list { display: grid; gap: 14px; }
.progress-list > div { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 6px 16px; }
.progress-list progress { grid-column: 1 / -1; width: 100%; height: 10px; accent-color: var(--ik-blue); }
.calendar-toolbar h2 { margin: 0; text-align: center; }
.calendar-nav, .calendar-actions { display: flex; gap: 6px; }
.calendar {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span {
  padding: 9px;
  color: #fff;
  background: #333;
  border-right: 1px solid #555;
  text-align: center;
  font-weight: 700;
}
.calendar-day {
  min-width: 0;
  min-height: 130px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: #f3f6f9; color: var(--muted); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--ik-blue); }
.calendar-day > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.calendar-day > header time { font-weight: 700; }
.calendar-day > header a {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: var(--ik-blue);
  background: var(--ik-soft);
}
.calendar-events { display: grid; gap: 4px; }
.calendar-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  padding: 5px 6px;
  border-left: 3px solid var(--ik-blue);
  border-radius: 3px;
  background: #eaf4ff;
  font-size: 11px;
}
.calendar-event.recurring { border-left-color: var(--green); background: #edf9f0; }
.calendar-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event small { color: var(--muted); white-space: nowrap; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: static; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { width: auto; margin: 12px; padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .kpis, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .toolbar, .toolbar form { align-items: stretch; flex-direction: column; }
  .toolbar input, .toolbar select, .inline input { width: 100%; }
  .calendar-toolbar, .calendar-nav, .calendar-actions { align-items: stretch; }
  .calendar-nav, .calendar-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .calendar-actions { grid-template-columns: 1fr 1fr; }
  .calendar { overflow-x: auto; }
  .calendar-weekdays, .calendar-grid { min-width: 760px; }
  table { display: block; overflow-x: auto; }
}

@media print {
  body { background: #fff; }
  body::before, .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .shell, .main { display: block; width: auto; margin: 0; padding: 0; box-shadow: none; background: #fff; }
  .panel, table { box-shadow: none; border-color: #999; }
  a { color: #000; text-decoration: none; }
}
