:root {
  --navy: #102647;
  --navy-soft: #19365f;
  --blue: #2864dc;
  --background: #f3f6fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6f7a8d;
  --border: #e3e9f1;
  --success: #14965f;
  --warning: #c37a09;
  --shadow: 0 12px 32px rgba(17, 38, 71, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: var(--navy);
  color: white;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 30px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--navy);
  font-weight: 800;
}

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

.brand span {
  margin-top: 4px;
  color: #aebbd0;
  font-size: 13px;
}

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

.nav-item {
  border: 0;
  background: transparent;
  color: #cbd5e4;
  padding: 13px 15px;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  background: var(--navy-soft);
  color: white;
  font-weight: 700;
}

.nav-item.disabled {
  opacity: 0.6;
  cursor: default;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e4;
  font-size: 13px;
  padding: 18px 8px 0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38c889;
}

.main-content {
  padding: 34px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

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

h1 {
  margin-bottom: 7px;
  font-size: 34px;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.topbar-actions label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input[type="date"] {
  display: block;
  margin-top: 7px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text);
}

.refresh-button {
  border: 0;
  border-radius: 9px;
  padding: 12px 19px;
  background: var(--blue);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.notice {
  margin: 28px 0 20px;
  background: #eaf1ff;
  border: 1px solid #d4e1fb;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #28466f;
  font-size: 13px;
}

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

.notice span {
  margin-top: 4px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.kpi-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 22px;
}

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

.kpi-value {
  margin: 13px 0 12px;
  font-size: 29px;
  font-weight: 800;
  color: var(--navy);
}

.kpi-footer {
  color: var(--muted);
  font-size: 12px;
}

.warning-text {
  color: var(--warning);
}

.secondary-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 20px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 19px;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf2f9;
  color: #4d5c71;
  font-size: 12px;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tbody tr:hover {
  background: #f8fafd;
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.module-list {
  display: grid;
}

.module-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.module-row span {
  font-weight: 700;
}

.module-row strong {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
}

footer {
  padding: 25px 4px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: rgba(243, 246, 250, 0.78);
  backdrop-filter: blur(3px);
  z-index: 50;
  color: var(--navy);
  font-weight: 700;
}

.loading-overlay.visible {
  display: grid;
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid #cfdaeb;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    min-height: auto;
    padding: 18px;
  }

  nav {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    padding: 20px 15px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    margin-top: 20px;
  }

  .notice {
    display: block;
  }

  #last-updated {
    margin-top: 10px;
  }

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

.variety-panel {
  margin-top: 20px;
}

.variety-panel td:nth-child(2),
.variety-panel td:nth-child(3),
.variety-panel td:nth-child(4),
.variety-panel th:nth-child(2),
.variety-panel th:nth-child(3),
.variety-panel th:nth-child(4) {
  text-align: right;
}
