* {
  box-sizing: border-box;
}

:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f5f7fb;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 72px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.title-block h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.title-block p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  font-size: 12px;
  border-radius: 999px;
  padding: 7px 11px;
  background: #eef2f7;
  color: #4b5563;
}

.status-pill.connected {
  background: #ecfdf5;
  color: #047857;
}

.status-pill.disconnected {
  background: #fef2f2;
  color: #b91c1c;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  font-size: 20px;
}

.page {
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px 24px 36px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.date-group {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.field input {
  height: 40px;
  min-width: 160px;
  border: 1px solid #d7dce4;
  border-radius: 9px;
  background: #ffffff;
  padding: 0 10px;
}

.primary-button,
.export-button,
.back-button {
  height: 40px;
  border: 0;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: #2563eb;
  color: #ffffff;
  padding: 0 18px;
}

.export-button {
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 0 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.12);
}

.kpi-card span {
  font-size: 12px;
  opacity: 0.9;
}

.kpi-card strong {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.report-card {
  background: #ffffff;
  border: 1px solid #e7eaf0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04);
}

.report-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #edf0f4;
}

.report-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.breadcrumb {
  color: #6b7280;
  font-size: 12px;
}

.back-button {
  background: #f8fafc;
  color: #334155;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
}

.hidden {
  display: none !important;
}

.message {
  min-height: 0;
  color: #6b7280;
  font-size: 12px;
  padding: 0 18px;
}

.message:not(:empty) {
  padding-top: 10px;
  padding-bottom: 10px;
}

.message.error {
  color: #b91c1c;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
}

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #edf0f4;
  font-size: 13px;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  text-align: right;
  color: #475569;
}

.report-table th.name-col,
.report-table td:first-child {
  text-align: left;
}

.report-table td:not(:first-child) {
  text-align: right;
}

.area-row {
  cursor: pointer;
}

.area-row:hover,
.model-row:hover,
.color-row:hover {
  background: #f8fbff;
}

.area-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1d4ed8;
  font-weight: 700;
}

.chevron {
  width: 16px;
  color: #94a3b8;
  flex: 0 0 auto;
}

.section-row td {
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 12px;
}

.model-row {
  cursor: pointer;
}

.model-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e3a8a;
  font-weight: 700;
}

.color-row td {
  background: #fbfdff;
}

.color-name {
  padding-left: 28px;
  color: #64748b;
}

.muted {
  color: #94a3b8;
}

.report-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: #eff6ff;
  font-weight: 800;
  border-top: 2px solid #bfdbfe;
  border-bottom: 0;
}

.report-table tfoot td:not(:first-child) {
  color: #ea580c;
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .export-button {
    align-self: flex-end;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: auto;
    min-height: 66px;
    padding: 10px 14px;
  }

  .title-block h1 {
    font-size: 19px;
  }

  .page {
    padding: 14px 10px 28px;
  }

  .kpi-grid {
    gap: 10px;
  }

  .kpi-card {
    min-height: 92px;
    padding: 14px;
    border-radius: 12px;
  }

  .kpi-card strong {
    font-size: 22px;
  }

  .field input {
    min-width: 140px;
  }

  .report-card {
    border-radius: 12px;
  }

  .report-table th,
  .report-table td {
    padding: 10px;
    font-size: 12px;
  }
}


/* Inline area -> model -> color presentation */
.area-row td {
  background: #ffffff;
  font-weight: 700;
  border-top: 1px solid #dbe4f0;
}

.area-name {
  color: #1d4ed8;
  font-weight: 800;
  cursor: pointer;
}

.model-indent {
  padding-left: 22px;
}

.color-indent {
  padding-left: 58px;
}

.models-loading-row td {
  background: #fbfdff;
}

.models-loading {
  padding-left: 22px;
  color: #94a3b8;
  font-size: 12px;
}

.error-text {
  color: #b91c1c;
}


/* Global fuzzy search */
.search-shell {
  position: relative;
  flex: 1 1 420px;
  max-width: 620px;
  min-width: 280px;
}

.search-box {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #d7dce4;
  border-radius: 10px;
  padding: 0 10px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: #60a5fa;
  box-shadow:
    0 0 0 3px
    rgba(59, 130, 246, 0.12);
}

.search-icon {
  color: #64748b;
  font-size: 20px;
  line-height: 1;
}

#globalSearch {
  width: 100%;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
}

#globalSearch::placeholder {
  color: #94a3b8;
}

.search-clear {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.search-results {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 430px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  box-shadow:
    0 18px 48px
    rgba(15, 23, 42, 0.16);
  padding: 6px;
}

.search-result {
  width: 100%;
  border: 0;
  background: #ffffff;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  padding: 10px 11px;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;
  gap: 8px 12px;
}

.search-result:hover,
.search-result.active {
  background: #eff6ff;
}

.search-result-main {
  min-width: 0;
}

.search-result-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-result-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 13px;
  font-weight: 750;
}

.search-result-type {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e8efff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.search-result-secondary {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 10px;
  white-space: nowrap;
}

.search-empty,
.search-loading {
  padding: 18px 12px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
}

.search-hint {
  padding: 8px 10px;
  color: #94a3b8;
  font-size: 10px;
  border-top: 1px solid #eef2f7;
}

.search-focus {
  animation:
    searchFocusPulse
    1.4s ease-out;
}

@keyframes searchFocusPulse {
  0% {
    background: #dbeafe;
  }

  100% {
    background: transparent;
  }
}

@media (max-width: 900px) {
  .search-shell {
    order: 3;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .search-shell {
    min-width: 100%;
  }

  .search-results {
    position: fixed;
    top: 76px;
    left: 10px;
    right: 10px;
    max-height: 60vh;
  }

  .search-result-metrics {
    display: none;
  }
}


/* Active fuzzy-search dashboard filter */
.active-filter-bar {
  max-width: 1380px;
  margin: -8px auto 14px;
  padding: 0 24px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 6px 8px 6px 12px;
  font-size: 12px;
}

.active-filter-prefix {
  color: #64748b;
}

.active-filter-type {
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.active-filter-remove {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 620px) {
  .active-filter-bar {
    padding: 0 10px;
  }
}


/* =========================================================
   EKSBASE Yellow + White Theme
   ========================================================= */
:root {
  --eks-yellow: #ffd400;
  --eks-yellow-strong: #f5c400;
  --eks-yellow-soft: #fff8cc;
  --eks-ink: #171717;
  --eks-muted: #6b7280;
  --eks-border: #e5e7eb;
  --eks-bg: #fffdf5;
}

body {
  background: var(--eks-bg);
  color: var(--eks-ink);
}

.topbar {
  background: #ffffff;
  border-bottom:
    3px solid
    var(--eks-yellow);
}

.title-block h1 {
  color: #171717;
}

.primary-button {
  background:
    var(--eks-yellow);
  color: #171717;
  border:
    1px solid
    var(--eks-yellow-strong);
}

.primary-button:hover {
  background:
    var(--eks-yellow-strong);
}

.export-button {
  background: #ffffff;
  color: #171717;
  border:
    1px solid
    var(--eks-yellow-strong);
}

.export-button:hover {
  background:
    var(--eks-yellow-soft);
}

.kpi-card {
  background:
    linear-gradient(
      135deg,
      #ffd400,
      #ffe45c
    );
  color: #171717;
  box-shadow:
    0 6px 20px
    rgba(245, 196, 0, 0.17);
}

.kpi-card span {
  color: #554800;
  opacity: 1;
}

.report-card {
  border-color:
    #ece7cf;
}

.report-table th {
  background:
    #fff9db;
  color: #4b4300;
}

.area-name,
.model-name {
  color: #3c3500;
}

.area-row:hover,
.model-row:hover,
.color-row:hover {
  background:
    #fffbea;
}

.report-table tfoot td {
  background:
    #fff4aa;
  border-top:
    2px solid
    var(--eks-yellow);
}

.report-table tfoot td:not(:first-child) {
  color: #171717;
}

.status-pill.connected {
  background:
    #fff7bf;
  color: #5f5200;
}

.search-box:focus-within {
  border-color:
    var(--eks-yellow-strong);
  box-shadow:
    0 0 0 3px
    rgba(255, 212, 0, 0.18);
}

.search-result:hover,
.search-result.active {
  background:
    #fff8cc;
}

.search-result-type {
  background:
    #fff0a3;
  color: #5c4c00;
}

.search-focus {
  background:
    #fff0a3 !important;
}

.active-filter-chip {
  background:
    #fff8cc;
  border-color:
    var(--eks-yellow-strong);
  color: #4d4100;
}

.active-filter-type {
  background:
    var(--eks-yellow);
  color: #171717;
}

/* =========================================================
   Dual Date Filters
   ========================================================= */
.toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.date-filter-panel {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 760px;
}

.date-filter-block {
  min-width: 315px;
  padding: 10px 12px;
  border:
    1px solid
    #e8e3c8;
  border-radius: 12px;
  background: #ffffff;
}

.date-filter-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.date-enable {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  color: #2b2700;
  cursor: pointer;
}

.date-enable input {
  accent-color:
    var(--eks-yellow-strong);
}

.date-field-note {
  color: #9a8d44;
  font-size: 10px;
}

.period-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.period-buttons button {
  border:
    1px solid
    #e1dcc0;
  border-radius: 8px;
  background: #ffffff;
  color: #514900;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.period-buttons button:hover {
  background:
    #fffbea;
}

.period-buttons button.active {
  background:
    var(--eks-yellow);
  color: #171717;
  border-color:
    var(--eks-yellow-strong);
}

.period-buttons.disabled {
  opacity: 0.42;
  pointer-events: none;
}

.custom-date-row {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #827300;
  font-size: 10px;
}

.custom-date-row.custom-active {
  display: flex;
}

.custom-date-row.disabled {
  opacity: 0.42;
}

.custom-date-row input {
  height: 32px;
  min-width: 128px;
  border:
    1px solid
    #ddd6aa;
  border-radius: 7px;
  background: #fffef8;
  color: #171717;
  padding: 0 7px;
  font-size: 11px;
}

.date-apply-button {
  height: 42px;
  padding: 0 20px;
}

.activation-date-block:has(
  #activationDateEnabled:not(:checked)
) {
  background:
    #faf9f3;
}

@media (max-width: 900px) {
  .date-filter-panel {
    width: 100%;
  }

  .date-filter-block {
    flex:
      1 1 320px;
  }
}

@media (max-width: 620px) {
  .date-filter-block {
    min-width: 100%;
  }

  .period-buttons button {
    flex:
      1 1 auto;
  }

  .custom-date-row {
    flex-wrap: wrap;
  }
}


/* =========================================================
   Authorization-aware dashboard context
   ========================================================= */
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.identity-context {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 120px;
  line-height: 1.15;
}

.identity-context strong {
  font-size: 12px;
  color: #242000;
}

.identity-context span {
  margin-top: 3px;
  font-size: 10px;
  color: #8b7e2e;
}

.scope-context {
  margin: 8px 0 12px;
  padding: 8px 11px;
  border: 1px solid #eadf9b;
  border-radius: 9px;
  background: #fffbea;
  color: #5b4f00;
  font-size: 11px;
  font-weight: 700;
}

.dashboard-loading .report-card,
.dashboard-loading .kpi-grid {
  opacity: 0.72;
}

.export-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 720px) {
  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .identity-context {
    align-items: flex-start;
  }
}


/* =========================================================
   Standalone Authentication
   ========================================================= */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, #fff8cc 0%, #fffdf5 42%, #f7f7f2 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 30px;
  background: #ffffff;
  border: 1px solid #e8e3c8;
  border-top: 5px solid var(--eks-yellow);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(23, 23, 23, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 26px;
}

.login-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--eks-yellow);
  color: #171717;
  font-size: 24px;
  font-weight: 900;
}

.login-brand h1 {
  margin: 0;
  font-size: 23px;
  color: #171717;
}

.login-brand p {
  margin: 4px 0 0;
  color: #77705a;
  font-size: 12px;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field label {
  color: #2b2700;
  font-size: 12px;
  font-weight: 800;
}

.login-field input {
  width: 100%;
  height: 44px;
  border: 1px solid #d9d4ba;
  border-radius: 9px;
  background: #fffef8;
  color: #171717;
  padding: 0 12px;
  outline: none;
}

.login-field input:focus {
  border-color: var(--eks-yellow-strong);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.18);
}

.login-button {
  height: 44px;
  margin-top: 3px;
  border: 1px solid var(--eks-yellow-strong);
  border-radius: 9px;
  background: var(--eks-yellow);
  color: #171717;
  font-weight: 900;
  cursor: pointer;
}

.login-button:hover {
  background: var(--eks-yellow-strong);
}

.login-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.login-message {
  min-height: 18px;
  font-size: 12px;
  color: #5b4f00;
}

.login-message.error {
  color: #b91c1c;
}

.login-message.success {
  color: #047857;
}

.login-note {
  margin: 20px 0 0;
  text-align: center;
  color: #9a8d44;
  font-size: 10px;
}

.logout-button {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e1dcc0;
  border-radius: 9px;
  background: #ffffff;
  color: #514900;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.logout-button:hover {
  background: #fff8cc;
}

@media (max-width: 620px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  .identity-context {
    display: none;
  }
}


/* First-time password setup */
.password-change-intro {
  margin: 18px 0 20px;
  text-align: center;
}

.password-change-intro h2 {
  margin: 0 0 7px;
  color: #242000;
  font-size: 18px;
}

.password-change-intro p {
  margin: 0 auto;
  max-width: 390px;
  color: #6d6a55;
  font-size: 12px;
  line-height: 1.5;
}

#passwordChangeButton:disabled {
  opacity: 0.6;
  cursor: wait;
}


.login-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #f0d77a;
  text-align: center;
  color: #4a4a4a;
  font-size: 13px;
}

.login-footer p {
  margin: 6px 0;
}

.login-footer strong {
  color: #e5ad00;
  font-weight: 600;
}


/* =========================================================
   EKSBASE Dashboard UI Optimization — final responsive layer
   ========================================================= */

.topbar {
  min-height: 68px;
  height: auto;
  padding: 10px clamp(14px, 2vw, 28px);
}

.top-actions {
  gap: 8px;
}

.icon-button,
.icon-only-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.icon-only-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #e8e3c8;
  border-radius: 10px;
  background: #fff;
  color: #3f3800;
  cursor: pointer;
}

.icon-only-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-only-button:hover,
.icon-button:hover {
  background: #fffbea;
  border-color: #d8c95c;
}

/* API status is intentionally removed from the visual header. */
.status-pill { display: none !important; }

.toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr) auto;
  align-items: end;
  gap: 12px;
  width: 100%;
}

.date-filter-panel {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  flex: none !important;
}

.date-filter-block {
  min-width: 0 !important;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
}

.date-filter-title-row {
  margin-bottom: 7px;
}

.period-select-wrap {
  width: 100%;
}

.period-select {
  width: 100%;
  height: 38px;
  appearance: auto;
  border: 1px solid #ddd6a8;
  border-radius: 9px;
  background: #fff;
  color: #2f2b00;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.period-select:focus {
  outline: 2px solid rgba(255, 212, 0, .35);
  outline-offset: 1px;
  border-color: #d5bb00;
}

.period-select:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: #faf9f2;
}

/* Keep the old date inputs as state holders; customization happens in the modal. */
.custom-date-row {
  display: none !important;
}

.date-apply-button {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 0;
}

.search-shell {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.search-box {
  width: 100%;
}

.export-button {
  align-self: end;
  white-space: nowrap;
}

/* Date customization modal */
.date-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.date-modal.hidden { display: none; }

.date-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 23, 23, .28);
  backdrop-filter: blur(2px);
}

.date-modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 18px;
  background: #fff;
  border: 1px solid #e8e3c8;
  border-top: 4px solid var(--eks-yellow);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(23,23,23,.20);
}

.date-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.date-modal-kicker {
  display: block;
  margin-bottom: 3px;
  color: #8b7e2e;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.date-modal-header h3 {
  margin: 0;
  color: #242000;
  font-size: 17px;
}

.date-modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid #e8e3c8;
  border-radius: 9px;
  background: #fff;
  color: #5b4f00;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.date-modal-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 9px;
}

.date-modal-fields label {
  display: grid;
  gap: 5px;
  color: #5b4f00;
  font-size: 11px;
  font-weight: 800;
}

.date-modal-fields input {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  border: 1px solid #d9d2a8;
  border-radius: 9px;
  padding: 0 9px;
  background: #fff;
  color: #242000;
}

.date-modal-to {
  padding-bottom: 11px;
  color: #8b7e2e;
  font-size: 11px;
}

.date-modal-message {
  min-height: 18px;
  margin-top: 9px;
  color: #b91c1c;
  font-size: 11px;
}

.date-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.secondary-button {
  height: 38px;
  padding: 0 13px;
  border: 1px solid #e2ddbf;
  border-radius: 9px;
  background: #fff;
  color: #4b4300;
  font-weight: 700;
  cursor: pointer;
}

.date-modal-actions .primary-button {
  height: 38px;
  padding: 0 14px;
}

body.modal-open { overflow: hidden; }

@media (max-width: 1050px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr);
  }

  .date-filter-panel { grid-column: 1; }
  .search-shell { grid-column: 2; }
  .export-button { grid-column: 2; justify-self: start; }
}

@media (max-width: 760px) {
  .topbar {
    padding: 9px 12px;
  }

  .toolbar {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .date-filter-panel {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
    width: 100%;
  }

  .date-apply-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .search-shell,
  .export-button {
    width: 100%;
  }

  .export-button { height: 38px; }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 62px;
    padding: 9px 10px;
  }

  .title-block h1 { font-size: 18px; }
  .title-block p { font-size: 10px; }

  .identity-context { display: none !important; }

  .top-actions {
    gap: 7px;
  }

  .icon-button,
  .icon-only-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .page {
    padding: 12px 9px 24px;
  }

  .date-filter-panel {
    grid-template-columns: 1fr !important;
  }

  .date-filter-block {
    padding: 9px;
  }

  .date-apply-button {
    min-width: 78px;
    width: auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
    margin-bottom: 12px;
  }

  .kpi-card {
    min-height: 84px;
    padding: 12px;
    border-radius: 12px;
  }

  .kpi-card span { font-size: 11px; }
  .kpi-card strong { font-size: 21px; }

  .report-card { border-radius: 12px; }

  .report-header {
    min-height: 62px;
    padding: 11px 13px;
  }

  .report-header h2 { font-size: 17px; }

  .scope-context {
    margin: 7px 0 9px;
    padding: 7px 9px;
    font-size: 10px;
  }

  .report-table th,
  .report-table td {
    padding: 9px 8px;
    font-size: 11px;
  }

  .report-table th:not(.name-col),
  .report-table td:not(:first-child) {
    white-space: nowrap;
  }

  .date-modal {
    padding: 12px;
  }

  .date-modal-card {
    padding: 15px;
    border-radius: 14px;
  }

  .date-modal-fields {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .date-modal-to {
    display: none;
  }

  .date-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .date-modal-actions button { width: 100%; }
}

@media (max-width: 360px) {
  .kpi-card strong { font-size: 19px; }
  .period-select { font-size: 11px; }
}

/* =========================================================
   EKSBASE Mobile Compact Layout Fix v3
   Prevent the toolbar from stretching vertically on phones.
   ========================================================= */
.toolbar,
.date-filter-panel,
.search-shell,
.export-button {
  min-height: 0 !important;
}

@media (max-width: 760px) {
  .toolbar {
    height: auto !important;
    max-height: none !important;
    margin-bottom: 10px !important;
    gap: 8px !important;
  }

  .date-filter-panel {
    height: auto !important;
    grid-auto-rows: auto;
  }

  .search-shell {
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
  }

  .search-box {
    height: 38px;
  }

  .export-button {
    align-self: flex-end !important;
    width: auto !important;
    min-width: 112px;
    height: 36px !important;
    padding: 0 14px !important;
  }

  .kpi-grid {
    margin-top: 0 !important;
  }
}

@media (max-width: 560px) {
  .toolbar {
    gap: 7px !important;
    margin-bottom: 9px !important;
  }

  .date-filter-block {
    padding: 8px !important;
  }

  .date-filter-title-row {
    margin-bottom: 6px !important;
  }

  .period-select {
    height: 36px !important;
  }

  .date-apply-button {
    height: 36px !important;
    margin-top: 0 !important;
  }

  .search-box {
    height: 36px !important;
  }

  .export-button {
    height: 34px !important;
    min-width: 108px;
  }
}

/* =========================================================
   EKSBASE V4 - MOBILE COMPACT TOOLBAR
   Prevent any inherited fixed/flex height from creating the
   large blank region between Apply/Export and the KPIs.
   ========================================================= */

@media (max-width: 560px) {
  .toolbar,
  .date-filter-panel,
  .date-filter-block,
  .search-shell,
  .search-box,
  .export-button,
  .date-apply-button {
    box-sizing: border-box;
  }

  .toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-bottom: 10px !important;
    padding-bottom: 0 !important;
  }

  .date-filter-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto !important;
    align-items: stretch !important;
    gap: 7px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .date-filter-block {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  .date-apply-button {
    flex: 0 0 auto !important;
    align-self: flex-start !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
  }

  .search-shell {
    order: 3 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
  }

  .search-box {
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  .export-button {
    order: 2 !important;
    align-self: flex-start !important;
    flex: 0 0 auto !important;
    width: auto !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
  }

  .kpi-grid {
    margin-top: 8px !important;
  }
}

/* Extra-small screens: keep controls compact without stretching. */
@media (max-width: 380px) {
  .toolbar {
    gap: 7px !important;
  }

  .date-filter-panel {
    gap: 6px !important;
  }

  .date-filter-block {
    padding: 8px !important;
  }

  .period-buttons button {
    padding: 6px 3px !important;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 0 !important;
    height: auto !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .title-block h1 {
    line-height: 1.05 !important;
    margin-bottom: 2px !important;
  }

  .title-block .subtitle {
    line-height: 1.15 !important;
  }
}


/* =========================================================
   EKSBASE V5 — STRUCTURAL MOBILE TOOLBAR FIX
   Use a real grid at phone widths so the date panel, Apply,
   Search and Export each occupy only their content height.
   This overrides all earlier responsive toolbar rules.
   ========================================================= */

@media (max-width: 560px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: 10px !important;
    width: 100% !important;
    min-height: 62px !important;
    height: auto !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
  }

  .title-block {
    min-width: 0 !important;
    width: auto !important;
  }

  .title-block h1 {
    font-size: 18px !important;
    line-height: 1.05 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .title-block p {
    font-size: 10px !important;
    line-height: 1.15 !important;
    margin: 3px 0 0 !important;
    white-space: normal !important;
  }

  .top-actions {
    width: auto !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 7px !important;
  }

  .top-actions .icon-button,
  .top-actions .icon-only-button {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
  }

  /* The critical fix: toolbar is a compact grid, not a tall
     flex column. */
  .toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    align-items: start !important;
    justify-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
  }

  .date-filter-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    align-items: start !important;
    justify-items: stretch !important;
    gap: 7px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
  }

  .date-filter-block {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 9px !important;
    box-sizing: border-box !important;
  }

  .date-filter-title-row {
    margin-bottom: 6px !important;
  }

  .period-select-wrap,
  .period-select {
    width: 100% !important;
  }

  .period-select {
    height: 36px !important;
    min-height: 36px !important;
  }

  .date-apply-button {
    grid-column: 1 !important;
    grid-row: auto !important;
    justify-self: start !important;
    align-self: start !important;
    width: auto !important;
    min-width: 76px !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 15px !important;
    flex: none !important;
  }

  /* Search immediately follows Apply. */
  .search-shell {
    grid-column: 1 !important;
    grid-row: auto !important;
    order: initial !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
  }

  .search-box {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
  }

  /* Export is compact and sits directly below Search. */
  .export-button {
    grid-column: 1 !important;
    grid-row: auto !important;
    order: initial !important;
    justify-self: start !important;
    align-self: start !important;
    width: auto !important;
    min-width: 108px !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    flex: none !important;
  }

  .kpi-grid {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
}

/* Small phones: keep everything readable without introducing
   any vertical filler space. */
@media (max-width: 380px) {
  .topbar {
    column-gap: 7px !important;
    padding-inline: 8px !important;
  }

  .title-block h1 {
    font-size: 17px !important;
  }

  .top-actions {
    gap: 5px !important;
  }

  .top-actions .icon-button,
  .top-actions .icon-only-button {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }

  .date-filter-block {
    padding: 8px !important;
  }
}
\n\n/* =========================================================\n   V6 — CUSTOM DATE RANGE INLINE\n   When Customize is selected, keep the three controls in one\n   row: [Customize...] [From Date] [To Date].\n   ========================================================= */\n.date-selection-row {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  width: 100%;\n  min-width: 0;\n}\n\n.date-selection-row .period-select-wrap {\n  flex: 1 1 0;\n  min-width: 0;\n}\n\n.date-selection-row .custom-date-row {\n  display: none !important;\n  align-items: center;\n  gap: 5px;\n  margin: 0;\n  flex: 1 1 0;\n  min-width: 0;\n}\n\n.date-selection-row .custom-date-row.custom-active {\n  display: flex !important;\n}\n\n.date-selection-row .custom-date-row input {\n  width: 100%;\n  min-width: 0;\n  height: 38px;\n  box-sizing: border-box;\n  border: 1px solid #ddd6a8;\n  border-radius: 9px;\n  background: #fffef8;\n  color: #2f2b00;\n  padding: 0 8px;\n  font: inherit;\n  font-size: 11px;\n  font-weight: 600;\n}\n\n.custom-date-separator {\n  flex: 0 0 auto;\n  color: #827300;\n  font-size: 10px;\n  font-weight: 700;\n}\n\n@media (max-width: 560px) {\n  .date-selection-row {\n    gap: 5px;\n  }\n\n  .date-selection-row .period-select-wrap {\n    flex: 1.05 1 0;\n  }\n\n  .date-selection-row .custom-date-row {\n    flex: 1.95 1 0;\n    gap: 4px;\n  }\n\n  .date-selection-row .period-select,\n  .date-selection-row .custom-date-row input {\n    height: 36px;\n    font-size: 10px;\n  }\n\n  .custom-date-separator {\n    font-size: 9px;\n  }\n}\n\n@media (max-width: 380px) {\n  .date-selection-row {\n    gap: 4px;\n  }\n\n  .date-selection-row .custom-date-row {\n    gap: 3px;\n  }\n\n  .date-selection-row .period-select,\n  .date-selection-row .custom-date-row input {\n    padding-inline: 5px;\n    font-size: 9px;\n  }\n}\n

/* V6.1 — force inline custom date controls to be visible when active. */
.date-selection-row .custom-date-row.custom-active {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center !important;
}
.date-selection-row .custom-date-row.custom-active input {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}


/* =========================================================
   EKSBASE V7 — DATE FILTERS + APPLY IN ONE ROW
   Sales Date | Activation Date | Apply
   The search/export controls remain on the next row.
   ========================================================= */

/* Desktop / laptop */
.toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto !important;
  align-items: start !important;
  column-gap: 10px !important;
  row-gap: 8px !important;
  width: 100% !important;
}

.date-filter-panel {
  display: contents !important;
}

.date-filter-block {
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.date-filter-block:first-child {
  grid-column: 1 !important;
}

.date-filter-block.activation-date-block {
  grid-column: 2 !important;
}

.date-apply-button {
  grid-column: 3 !important;
  grid-row: 1 !important;
  align-self: end !important;
  justify-self: start !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

.search-shell {
  grid-column: 1 / 3 !important;
  grid-row: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.export-button {
  grid-column: 3 !important;
  grid-row: 2 !important;
  align-self: start !important;
  justify-self: start !important;
  margin: 0 !important;
}

/* Keep custom dates readable inside each date block. */
.date-selection-row {
  width: 100% !important;
  min-width: 0 !important;
}

.period-select-wrap {
  min-width: 0 !important;
}

.period-select {
  width: 100% !important;
  min-width: 0 !important;
}

.custom-date-row {
  min-width: 0 !important;
}

.custom-date-row input {
  min-width: 0 !important;
}

/* Tablet */
@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  }

  .date-filter-block {
    padding: 9px !important;
  }

  .date-filter-title-row {
    margin-bottom: 5px !important;
  }

  .date-apply-button {
    min-width: 72px !important;
    padding-inline: 12px !important;
  }
}

/* Phone: still keep Sales Date | Activation Date | Apply
   in one row. The controls become compact but do not create
   artificial vertical space. */
@media (max-width: 560px) {
  .toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto auto !important;
    column-gap: 5px !important;
    row-gap: 7px !important;
    align-items: start !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 9px !important;
  }

  .date-filter-panel {
    display: contents !important;
  }

  .date-filter-block {
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 7px !important;
    margin: 0 !important;
  }

  .date-filter-block:first-child {
    grid-column: 1 !important;
  }

  .date-filter-block.activation-date-block {
    grid-column: 2 !important;
  }

  .date-filter-title-row {
    margin-bottom: 4px !important;
    gap: 3px !important;
  }

  .date-enable span {
    font-size: 10px !important;
  }

  .date-field-note {
    font-size: 8px !important;
  }

  .date-selection-row {
    display: block !important;
    width: 100% !important;
  }

  .period-select {
    width: 100% !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 22px 0 7px !important;
    font-size: 10px !important;
  }

  .date-apply-button {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: end !important;
    justify-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 7px !important;
    font-size: 10px !important;
  }

  .search-shell {
    grid-column: 1 / 4 !important;
    grid-row: 2 !important;
    width: 100% !important;
  }

  .search-box {
    height: 38px !important;
    min-height: 38px !important;
  }

  .export-button {
    grid-column: 1 / 4 !important;
    grid-row: 3 !important;
    justify-self: start !important;
    width: auto !important;
    min-width: 104px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding-inline: 12px !important;
    margin: 0 !important;
  }

  /* When Customize is selected, show the selected From/To
     dates compactly beneath the selector inside its date block. */
  .custom-date-row:not(.hidden) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    gap: 3px !important;
    margin-top: 4px !important;
  }

  .custom-date-row input {
    width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    font-size: 9px !important;
    padding: 0 3px !important;
  }

  .custom-date-separator {
    font-size: 9px !important;
    align-self: center !important;
  }
}

/* Very narrow phones: keep the three controls on one row by
   reducing typography/padding rather than adding a new row. */
@media (max-width: 380px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 54px !important;
    column-gap: 4px !important;
  }

  .date-filter-block {
    padding: 6px !important;
  }

  .date-enable span {
    font-size: 9px !important;
  }

  .date-field-note {
    display: none !important;
  }

  .period-select {
    font-size: 9px !important;
    padding-left: 5px !important;
  }

  .date-apply-button {
    font-size: 9px !important;
    padding-inline: 4px !important;
  }
}


/* =========================================================
   EKSBASE V8 — SEARCH + EXPORT ONE ROW
   Desktop/tablet/mobile:
   Date row    = Sales Date | Activation Date | Apply
   Search row  = Search | Export Excel
   ========================================================= */

@media (max-width: 560px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    column-gap: 6px !important;
    row-gap: 7px !important;
    align-items: end !important;
  }

  /* Date controls remain the first row. */
  .date-filter-panel {
    display: contents !important;
  }

  .date-filter-block:first-child {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .date-filter-block.activation-date-block {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .date-apply-button {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  /* Search + Export are now the same second row. */
  .search-shell {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .export-button {
    grid-column: 2 / 4 !important;
    grid-row: 2 !important;
    justify-self: end !important;
    align-self: end !important;
    width: auto !important;
    min-width: 96px !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
  }

  .search-box {
    height: 38px !important;
    min-height: 38px !important;
  }
}

/* Very narrow phones: Search gets most of the row and Export
   stays compact beside it. */
@media (max-width: 380px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) 88px !important;
    column-gap: 5px !important;
  }

  .export-button {
    grid-column: 2 !important;
    min-width: 88px !important;
    padding-inline: 5px !important;
    font-size: 10px !important;
  }
}


/* =========================================================
   EKSBASE V9 — CUSTOM DATE + ACTIVATION FIX
   ========================================================= */

/* Never show custom date inputs unless the selected period is
   actually Customize. This overrides older responsive rules. */
.date-selection-row .custom-date-row {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.date-selection-row .custom-date-row.custom-active {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  gap: 5px !important;
  flex: 1.9 1 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.date-selection-row .custom-date-row.custom-active input {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  height: 36px !important;
  padding: 0 6px !important;
  font-size: 10px !important;
}

.date-selection-row .custom-date-row.custom-active .custom-date-separator {
  display: block !important;
  white-space: nowrap !important;
}

/* Disabled Activation Date must visibly look disabled, but once
   checked its selector and custom inputs are fully usable. */
#activationPeriodSelect:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}

#activationDateEnabled:not(:checked) ~ * {
  /* no-op structural safeguard */
}

@media (max-width: 560px) {
  .date-selection-row .custom-date-row.custom-active {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    gap: 3px !important;
  }

  .date-selection-row .custom-date-row.custom-active input {
    height: 32px !important;
    font-size: 9px !important;
    padding-inline: 3px !important;
  }

  .custom-date-separator {
    font-size: 8px !important;
  }
}

/* =========================================================
   EKSBASE UI V11 — clean responsive date controls + export icon
   ========================================================= */
.toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr) auto !important;
  align-items: end !important;
  gap: 12px !important;
}

.date-filter-panel {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 10px !important;
  width: 100% !important;
}

.date-filter-block {
  min-width: 0 !important;
}

.date-selection-row {
  display: block !important;
  min-width: 0;
}

.custom-date-state {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.custom-range-caption {
  display: none;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fff9d9;
  color: #6b5d00;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-range-caption.visible {
  display: block;
}

.date-apply-button {
  grid-column: auto !important;
  align-self: end !important;
  justify-self: start !important;
  white-space: nowrap;
}

.search-shell {
  grid-column: 1 / 3 !important;
  width: 100% !important;
  min-width: 0 !important;
}

.export-button.icon-only-button {
  grid-column: 3 !important;
  justify-self: end !important;
  align-self: end !important;
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
}

.export-button.icon-only-button svg {
  width: 19px;
  height: 19px;
}

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr) auto !important;
  }

  .date-filter-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  }
}

@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 8px !important;
  }

  .date-filter-panel {
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .date-filter-block {
    padding: 8px !important;
  }

  .date-apply-button {
    grid-column: 3 !important;
    width: auto !important;
    min-width: 70px !important;
    height: 38px !important;
  }

  .search-shell {
    grid-column: 1 !important;
    width: 100% !important;
  }

  .export-button.icon-only-button {
    grid-column: 2 !important;
    justify-self: end !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 38px !important;
  }
}

@media (max-width: 560px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
  }

  .date-filter-panel {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px !important;
  }

  .date-filter-block {
    width: 100% !important;
    padding: 9px !important;
  }

  .date-apply-button {
    grid-column: 1 !important;
    justify-self: start !important;
    margin-top: 1px !important;
    height: 38px !important;
  }

  .search-shell {
    grid-column: 1 !important;
  }

  .export-button.icon-only-button {
    grid-column: 2 !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 38px !important;
  }

  .period-select {
    height: 38px !important;
    font-size: 12px !important;
  }

  .custom-range-caption {
    font-size: 10px !important;
  }
}

/* =========================================================
   EKSBASE UI V12 — responsive date filter cleanup
   Fixes mobile overlap and keeps custom dates readable.
   ========================================================= */
.date-filter-panel {
  align-items: stretch !important;
}

.date-filter-block {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
}

.date-selection-row {
  min-width: 0 !important;
}

.period-select-wrap {
  min-width: 0 !important;
  width: 100% !important;
}

.period-select {
  width: 100% !important;
  min-width: 0 !important;
}

.custom-range-caption.visible {
  width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-height: 24px !important;
  display: flex !important;
  align-items: center !important;
}

.date-apply-button {
  align-self: end !important;
  flex: 0 0 auto !important;
}

@media (max-width: 600px) {
  .toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 42px !important;
    gap: 8px !important;
    align-items: end !important;
  }

  .date-filter-panel {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .date-filter-block {
    grid-column: 1 !important;
    width: 100% !important;
    padding: 10px !important;
  }

  .date-filter-title-row {
    width: 100% !important;
  }

  .date-selection-row {
    width: 100% !important;
  }

  .period-select {
    height: 40px !important;
    font-size: 12px !important;
    padding-inline: 10px 30px !important;
  }

  .custom-range-caption.visible {
    margin-top: 6px !important;
    padding: 5px 8px !important;
    font-size: 10px !important;
  }

  .date-apply-button {
    grid-column: 1 !important;
    justify-self: start !important;
    align-self: start !important;
    width: auto !important;
    min-width: 72px !important;
    height: 38px !important;
    margin: 0 !important;
  }

  .search-shell {
    grid-column: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .export-button.icon-only-button {
    grid-column: 2 !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 38px !important;
    justify-self: end !important;
    align-self: end !important;
  }
}

@media (min-width: 601px) {
  .date-filter-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  }
}

/* =========================================================
   EKSBASE UI V13 — mobile date filter stacking
   Mobile order:
     1. Sales Date
     2. Activation Date
     3. Apply (single clean row)
   Search/export remain below the date controls.
   ========================================================= */
@media (max-width: 600px) {
  .date-filter-panel {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .date-filter-block,
  .date-filter-block:first-child,
  .date-filter-block.activation-date-block {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
  }

  .date-filter-block .date-selection-row {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .date-filter-block .period-select-wrap {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .date-filter-block .period-select {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .date-filter-block .custom-range-caption.visible {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 6px !important;
    min-height: 24px !important;
  }

  .date-apply-button {
    display: block !important;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 40px !important;
    margin: 0 !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
  }
}

/* =========================================================
   V14 — MOBILE REPORT DATA VISIBILITY
   Keep all four report columns visible on narrow screens.
   The previous 760px table width forced the data columns
   outside the viewport and made mobile look like only the
   Area / Model column was available.
   ========================================================= */
@media (max-width: 600px) {
  .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 360px) !important;
  }

  .report-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  .report-table th,
  .report-table td {
    box-sizing: border-box !important;
    padding: 10px 6px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    vertical-align: middle !important;
  }

  .report-table th.name-col,
  .report-table td:first-child {
    width: 48% !important;
    max-width: 48% !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  .report-table th:nth-child(2),
  .report-table td:nth-child(2) {
    width: 16% !important;
  }

  .report-table th:nth-child(3),
  .report-table td:nth-child(3) {
    width: 21% !important;
  }

  .report-table th:nth-child(4),
  .report-table td:nth-child(4) {
    width: 15% !important;
  }

  .report-table th:not(.name-col),
  .report-table td:not(:first-child) {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: right !important;
  }

  .report-table th {
    font-size: 9px !important;
    white-space: normal !important;
    text-overflow: clip !important;
  }

  .report-table .area-name,
  .report-table .model-name,
  .report-table .color-name {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }

  .report-table .model-indent {
    padding-left: 8px !important;
  }

  .report-table .color-indent {
    padding-left: 16px !important;
  }

  .report-table tfoot td {
    font-size: 10px !important;
    font-weight: 800 !important;
    padding-top: 11px !important;
    padding-bottom: 11px !important;
  }

  .models-loading-row td {
    padding: 7px 6px !important;
  }

  .models-loading {
    font-size: 9px !important;
  }
}
/* EKSBASE FIX — Restore Apply button font formatting */
.date-apply-button {
  font-size: 11px !important;
  font-weight: 700 !important;
}
