:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --ink: #1d2825;
  --muted: #64706c;
  --line: #d8d4c8;
  --brand: #205090;
  --brand-strong: #102f5f;
  --accent: #f2c14e;
  --danger: #b54242;
  --ok: #2b7a54;
  --panel: #ffffff;
  --soft: #ecf1eb;
  --shadow: 0 18px 50px rgba(29, 40, 37, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(245, 244, 239, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 4vw, 32px) 56px;
}

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(32, 80, 144, 0.94), rgba(16, 47, 95, 0.92)),
    url("./icon.svg") center 18% / 220px no-repeat;
}

.login-panel {
  width: min(430px, 100%);
  padding: 28px;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  margin-bottom: 14px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus {
  outline: 3px solid rgba(242, 184, 75, 0.32);
  border-color: var(--accent);
}

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

.btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.btn:hover { background: var(--brand-strong); }
.btn.secondary { background: #e8e5dc; color: var(--ink); }
.btn.warning { background: var(--accent); color: #2d2107; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(29, 40, 37, 0.05);
}

.hero-band {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
}

.hero-band .muted { color: rgba(255, 255, 255, 0.72); }

.status-tile {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  min-height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.status-tile strong {
  font-size: 28px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  min-height: 86px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f0eee6;
  color: #4c5753;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.location-cell {
  display: grid;
  gap: 2px;
}

.location-cell a {
  color: var(--brand);
  font-weight: 800;
}

.location-cell small {
  display: block;
  font-size: 11px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

@media (max-width: 820px) {
  .hero-band {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .span-12, .span-8, .span-6, .span-4 {
    grid-column: span 1;
  }

  .filters, .kpis {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .userbar {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
