:root {
  --account-bg: #f5f7fb;
  --account-surface: #ffffff;
  --account-surface-muted: #eef4ff;
  --account-text: #0f172a;
  --account-muted: #64748b;
  --account-border: #dbe4f0;
  --account-primary: #2563eb;
  --account-primary-dark: #1d4ed8;
  --account-good: #0f766e;
  --account-warn: #b45309;
  --account-danger: #b91c1c;
  --account-shadow: 0 18px 55px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body.account-body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(14, 165, 233, 0) 36%),
    var(--account-bg);
  color: var(--account-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }

.account-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.account-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--account-border);
  backdrop-filter: blur(14px);
}

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

.account-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

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

.account-topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-switch,
.account-lang {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: #eef4ff;
  border: 1px solid var(--account-border);
  border-radius: 10px;
}

.mode-switch__item,
.account-lang__option {
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--account-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.mode-switch__item.is-active,
.account-lang__option.is-active {
  background: #ffffff;
  color: var(--account-primary);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.account-main {
  box-sizing: border-box;
  width: min(1220px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.auth-main {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
  padding: 28px 16px 48px;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 28px;
  background: var(--account-surface);
  border: 1px solid var(--account-border);
  border-radius: 12px;
  box-shadow: var(--account-shadow);
}

.auth-panel h1,
.dashboard-hero h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-panel p,
.dashboard-hero p {
  margin: 10px 0 0;
  color: var(--account-muted);
  line-height: 1.6;
}

.auth-form,
.filter-bar {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.field label {
  color: var(--account-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--account-text);
  background: white;
  border: 1px solid var(--account-border);
  border-radius: 9px;
  font: inherit;
}

.field input:focus,
.field select:focus {
  border-color: var(--account-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--account-primary);
  color: white;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.account-btn:hover {
  transform: translateY(-1px);
  background: var(--account-primary-dark);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.account-btn--secondary {
  background: white;
  color: var(--account-primary);
  border-color: var(--account-border);
}

.account-btn--secondary:hover {
  background: var(--account-surface-muted);
  box-shadow: none;
}

.account-btn--ghost {
  background: transparent;
  color: var(--account-muted);
  border-color: transparent;
}

.account-btn--ghost:hover {
  background: var(--account-surface-muted);
  color: var(--account-text);
  box-shadow: none;
}

.message {
  display: none;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.message--show { display: block; }
.message--ok { background: #ecfdf5; color: var(--account-good); }
.message--warn { background: #fffbeb; color: var(--account-warn); }
.message--error { background: #fef2f2; color: var(--account-danger); }

.dashboard-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.dashboard-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.data-quality-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: -4px 0 18px;
  padding: 12px 14px;
  background: #fffaf0;
  border: 1px solid #fde6b8;
  border-radius: 10px;
  color: #78350f;
}

.data-quality-strip__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.data-quality-strip__kicker {
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.data-quality-strip__summary strong {
  font-size: 0.94rem;
  line-height: 1.35;
}

.data-quality-strip__details {
  position: relative;
}

.data-quality-strip__details summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #f3d49b;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
}

.data-quality-strip__lists {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  width: min(680px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--account-border);
  border-radius: 10px;
  box-shadow: var(--account-shadow);
  color: var(--account-text);
}

.data-quality-strip__lists h3 {
  margin: 0 0 8px;
  color: var(--account-text);
  font-size: 0.86rem;
}

.data-quality-strip__lists ul {
  display: grid;
  gap: 7px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.data-quality-strip__lists li {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: #f8fbff;
  border: 1px solid var(--account-border);
  border-radius: 8px;
}

.data-quality-strip__lists span {
  font-weight: 800;
}

.data-quality-strip__lists small {
  color: var(--account-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--account-surface-muted);
  color: #1e3a8a;
  font-size: 0.82rem;
  font-weight: 800;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px;
}

.tab-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--account-border);
  border-radius: 9px;
  background: white;
  color: var(--account-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab-btn[aria-selected="true"] {
  background: var(--account-primary);
  border-color: var(--account-primary);
  color: white;
}

.tab-panel { display: none; }
.tab-panel--active { display: grid; gap: 18px; }

.panel {
  background: var(--account-surface);
  border: 1px solid var(--account-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 0;
}

.panel__header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.panel__body { padding: 18px; }

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

.kpi {
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--account-border);
  border-radius: 10px;
}

.kpi span {
  display: block;
  color: var(--account-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  letter-spacing: 0;
}

.chart {
  min-height: 380px;
  width: 100%;
}

.filter-bar {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-top: 0;
}

.table-wrap {
  overflow: auto;
  max-height: 460px;
  border: 1px solid var(--account-border);
  border-radius: 10px;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--account-border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  color: var(--account-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.empty-state {
  padding: 22px;
  color: var(--account-muted);
  background: #f8fbff;
  border: 1px dashed var(--account-border);
  border-radius: 10px;
  line-height: 1.55;
}

.loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--account-muted);
}

.dash-shell {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(14, 165, 233, 0) 36%),
    var(--account-bg);
  color: var(--account-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dash-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(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--account-border);
  backdrop-filter: blur(14px);
}

.dash-brand {
  font-weight: 850;
  text-decoration: none;
}

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

.dash-main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.dash-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.dash-hero h1 {
  margin: 8px 0 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.dash-hero p {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--account-muted);
  line-height: 1.6;
}

.dash-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-size: 0.78rem;
  font-weight: 900;
}

.dash-quality {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #fffaf0;
  border: 1px solid #fde6b8;
  border-radius: 10px;
  color: #78350f;
}

.dash-quality details {
  position: relative;
}

.dash-quality summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #f3d49b;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
}

.dash-quality__lists {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  width: min(680px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--account-border);
  border-radius: 10px;
  box-shadow: var(--account-shadow);
  color: var(--account-text);
}

.dash-quality__lists h3 {
  margin: 0 0 8px;
  font-size: 0.86rem;
}

.dash-quality__lists ul {
  display: grid;
  gap: 7px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.dash-quality__lists li {
  padding: 8px;
  background: #f8fbff;
  border: 1px solid var(--account-border);
  border-radius: 8px;
}

.dash-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--account-surface);
  border: 1px solid var(--account-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.dash-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.dash-filters label {
  display: grid;
  gap: 7px;
  color: var(--account-muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.dash-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #f8fbff;
  border: 1px solid var(--account-border);
  border-radius: 10px;
  color: var(--account-muted);
  font-size: 0.84rem;
}

.dash-diagnostics strong,
.dash-diagnostics span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  background: #ffffff;
  border: 1px solid var(--account-border);
  border-radius: 999px;
}

.dash-diagnostics__error {
  color: var(--account-danger);
}

@media (max-width: 860px) {
  .dashboard-hero,
  .panel__header {
    align-items: stretch;
    flex-direction: column;
  }

  .data-quality-strip {
    grid-template-columns: 1fr;
  }

  .data-quality-strip__details {
    width: 100%;
  }

  .data-quality-strip__details summary {
    justify-content: center;
    width: 100%;
  }

  .data-quality-strip__lists {
    left: 0;
    right: auto;
    grid-template-columns: 1fr;
  }

  .dash-hero,
  .dash-quality {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .dash-hero {
    flex-direction: column;
  }

  .dash-quality details,
  .dash-quality summary {
    width: 100%;
  }

  .dash-quality summary {
    justify-content: center;
  }

  .dash-quality__lists {
    left: 0;
    right: auto;
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 560px) {
  .account-topbar,
  .account-main {
    inline-size: 100vw;
    max-inline-size: 100vw;
    min-inline-size: 0;
  }

  .account-main,
  .account-topbar,
  .dashboard-hero,
  .tab-panel,
  .panel,
  .panel__header,
  .panel__body {
    overflow-x: clip;
  }

  .account-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-topbar__actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .mode-switch,
  .account-lang {
    width: 100%;
  }

  .mode-switch__item,
  .account-lang__option {
    flex: 1 1 0;
    text-align: center;
  }

  .account-btn {
    width: 100%;
  }

  .auth-panel { padding: 22px; }

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

  .chart { min-height: 330px; }

  .dash-topbar,
  .dash-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .dash-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dash-actions .account-btn,
  .dash-actions .mode-switch__item,
  .dash-hero .account-btn {
    width: 100%;
  }

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