/* Админ-панель Qadam: палитра знака (синий #0A2A78, жёлтый #F2CD13)
   поверх переменных стандартной админки Django. Светлая и тёмная темы. */

:root {
  --qd-blue: #0a2a78;
  --qd-blue-2: #123c9e;
  --qd-yellow: #f2cd13;
  --qd-ink: #0a1a44;

  --primary: #4a6fd1;
  --secondary: var(--qd-blue);
  --accent: var(--qd-yellow);
  --primary-fg: #fff;

  --body-fg: #1c2540;
  --body-bg: #f5f7fc;
  --body-quiet-color: #5d6a8c;
  --body-medium-color: #36415f;
  --body-loud-color: #0a1a44;

  --header-color: #dfe6ff;
  --header-branding-color: #fff;
  --header-bg: var(--qd-blue);
  --header-link-color: #fff;

  --breadcrumbs-fg: #c9d4f5;
  --breadcrumbs-link-fg: #fff;
  --breadcrumbs-bg: var(--qd-blue-2);

  --link-fg: var(--qd-blue-2);
  --link-hover-color: var(--qd-blue);
  --link-selected-fg: var(--qd-blue);

  --hairline-color: #e3e8f4;
  --border-color: #cfd7ea;

  --darkened-bg: #eef2fb;
  --selected-bg: #e4eaf8;
  --selected-row: #fff6c7;

  --button-fg: #fff;
  --button-bg: var(--qd-blue);
  --button-hover-bg: var(--qd-blue-2);
  --default-button-bg: var(--qd-blue-2);
  --default-button-hover-bg: var(--qd-blue);

  --object-tools-fg: #fff;
  --object-tools-bg: var(--qd-blue-2);
  --object-tools-hover-bg: var(--qd-blue);

  --qd-card: #fff;
  --qd-bar: var(--qd-blue-2);
  --qd-pill-active-bg: var(--qd-blue);
  --qd-pill-active-fg: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #2b4aa8;
    --primary-fg: #fff;
    --body-fg: #e8eefb;
    --body-bg: #071433;
    --body-quiet-color: #9fb0d4;
    --body-medium-color: #c9d4ee;
    --body-loud-color: #fff;
    --header-bg: #0a2a78;
    --breadcrumbs-bg: #0d1e4a;
    --link-fg: var(--qd-yellow);
    --link-hover-color: #ffe56b;
    --link-selected-fg: var(--qd-yellow);
    --hairline-color: #1b2d63;
    --border-color: #24397a;
    --darkened-bg: #0d1e4a;
    --selected-bg: #13275e;
    --selected-row: #1d2f61;
    --button-fg: var(--qd-ink);
    --button-bg: var(--qd-yellow);
    --button-hover-bg: #ffe56b;
    --default-button-bg: var(--qd-yellow);
    --default-button-hover-bg: #ffe56b;
    --close-button-bg: #24397a;
    --close-button-hover-bg: #31499a;
    --message-success-bg: #0f4b3a;
    --message-warning-bg: #5a4a07;
    --message-error-bg: #5a1426;
    --qd-card: #0d1e4a;
    --qd-bar: var(--qd-yellow);
    --qd-pill-active-bg: var(--qd-yellow);
    --qd-pill-active-fg: var(--qd-ink);
  }
}

html[data-theme="dark"] {
  --primary: #2b4aa8;
  --primary-fg: #fff;
  --body-fg: #e8eefb;
  --body-bg: #071433;
  --body-quiet-color: #9fb0d4;
  --body-medium-color: #c9d4ee;
  --body-loud-color: #fff;
  --header-bg: #0a2a78;
  --breadcrumbs-bg: #0d1e4a;
  --link-fg: var(--qd-yellow);
  --link-hover-color: #ffe56b;
  --link-selected-fg: var(--qd-yellow);
  --hairline-color: #1b2d63;
  --border-color: #24397a;
  --darkened-bg: #0d1e4a;
  --selected-bg: #13275e;
  --selected-row: #1d2f61;
  --button-fg: var(--qd-ink);
  --button-bg: var(--qd-yellow);
  --button-hover-bg: #ffe56b;
  --default-button-bg: var(--qd-yellow);
  --default-button-hover-bg: #ffe56b;
  --close-button-bg: #24397a;
  --close-button-hover-bg: #31499a;
  --message-success-bg: #0f4b3a;
  --message-warning-bg: #5a4a07;
  --message-error-bg: #5a1426;
  --qd-card: #0d1e4a;
  --qd-bar: var(--qd-yellow);
  --qd-pill-active-bg: var(--qd-yellow);
  --qd-pill-active-fg: var(--qd-ink);
}

/* ── шапка ── */
#header { border-bottom: 3px solid var(--qd-yellow); }
.qd-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.qd-brand img { border-radius: 8px; }
.qd-word { font-weight: 800; letter-spacing: .22em; color: #fff; font-size: 20px; }
.qd-sub { color: var(--qd-yellow); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
#site-name a:hover { text-decoration: none; }
.module h2, .module caption, .inline-group h2 { background: var(--qd-blue); color: #fff; }
.module caption a.section { color: #fff; }

/* ── сводка ── */
/* Стандартный dashboard.css зажимает главную в 600px — сводке нужна ширина */
.dashboard #content { width: auto; max-width: 1240px; }
.qd-dash { margin-bottom: 24px; max-width: 1200px; }
.qd-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 16px; }
.qd-periods { display: flex; gap: 6px; flex-wrap: wrap; }
.qd-pill {
  border: 1px solid var(--border-color); background: var(--qd-card); color: var(--body-fg);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.qd-pill.is-active { background: var(--qd-pill-active-bg); color: var(--qd-pill-active-fg); border-color: transparent; font-weight: 700; }
.qd-region { display: inline-flex; align-items: center; gap: 8px; color: var(--body-quiet-color); font-size: 13px; }
.qd-region select { min-width: 200px; }
.qd-range { margin: 0; color: var(--body-quiet-color); font-size: 13px; flex-basis: 100%; }

.qd-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.qd-kpi {
  background: var(--qd-card); border: 1px solid var(--hairline-color); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.qd-kpi::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--qd-yellow); }
.qd-kpi-label { font-size: 12px; color: var(--body-quiet-color); }
.qd-kpi strong { font-size: 24px; line-height: 1.15; color: var(--body-loud-color); font-variant-numeric: tabular-nums; }
.qd-kpi small { font-size: 11px; color: var(--body-quiet-color); }

.qd-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .qd-grid { grid-template-columns: 1fr; } }
.qd-card { background: var(--qd-card); border: 1px solid var(--hairline-color); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.qd-grid .qd-card { margin-bottom: 0; }
.qd-card h2 { font-size: 14px; margin: 0 0 12px; color: var(--body-loud-color); background: none; padding: 0; text-transform: none; letter-spacing: 0; font-weight: 700; }
.qd-mt { margin-top: 18px !important; }

.qd-chart { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding-top: 18px; }
.qd-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.qd-bar i { display: block; width: 100%; max-width: 34px; min-height: 2px; background: var(--qd-bar); border-radius: 5px 5px 2px 2px; }
.qd-bar-val { font-size: 10px; color: var(--body-quiet-color); font-variant-numeric: tabular-nums; }
.qd-bar-day { font-size: 10px; color: var(--body-quiet-color); white-space: nowrap; height: 14px; overflow: visible; }
.qd-bar-val { min-height: 12px; }

.qd-list { list-style: none; margin: 0; padding: 0; }
.qd-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hairline-color); list-style: none; }
.qd-list li:first-child { border-top: 0; }
.qd-list b { font-variant-numeric: tabular-nums; }
.qd-warn { background: var(--qd-yellow); color: var(--qd-ink); border-radius: 999px; padding: 0 9px; }

.qd-table { width: 100%; }
.qd-table th { font-size: 12px; }
.qd-table td, .qd-table th { text-align: right; font-variant-numeric: tabular-nums; }
.qd-table td:first-child, .qd-table th:first-child { text-align: left; }

.qd-section-title { font-size: 16px; margin: 8px 0 12px; color: var(--body-loud-color); }
