:root {
      --bg: #f4f7fb;
      --card: #ffffff;
      --text: #172033;
      --muted: #6b7280;
      --border: #e5e7eb;
      --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
      --radius: 18px;
      --green: #16a34a;
      --red: #dc2626;
      --blue: #2563eb;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: var(--bg);
      color: var(--text);
    }

    .page {
      width: min(1400px, calc(100% - 32px));
      margin: 24px auto;
    }

    .main-nav {
      display: flex;
      gap: 8px;
      margin: 0 0 16px;
    }

    .nav-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 42px;
      padding: 0 18px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--card);
      color: var(--muted);
      text-decoration: none;
      font-size: 14px;
      font-weight: 700;
      box-shadow: 0 5px 16px rgba(15, 23, 42, 0.05);
      transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    }

    .nav-button:hover {
      transform: translateY(-1px);
      color: var(--blue);
      border-color: #bfdbfe;
      background: #eff6ff;
    }

    .nav-button.active {
      color: #fff;
      background: var(--blue);
      border-color: var(--blue);
      box-shadow: 0 7px 18px rgba(37, 99, 235, 0.20);
    }

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

    .header {
      padding: 22px;
      margin-bottom: 18px;
    }

    .header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 18px;
    }

    .title-wrap h1 {
      margin: 0;
      font-size: clamp(24px, 3vw, 34px);
      line-height: 1.1;
    }

    .title-wrap p {
      margin: 7px 0 0;
      color: var(--muted);
      font-size: 14px;
    }

    .status {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
      font-weight: 600;
      color: var(--muted);
      font-size: 14px;
    }

    .status-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #9ca3af;
      box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.12);
    }

    .status-dot.ok {
      background: var(--green);
      box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
    }

    .status-dot.error {
      background: var(--red);
      box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
    }

    .controls {
      display: grid;
      grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(170px, 1fr) auto;
      gap: 12px;
      align-items: end;
    }

    .field {
      display: flex;
      flex-direction: column;
      gap: 7px;
    }

    .field label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    select,
    input,
    button {
      min-height: 44px;
      border-radius: 12px;
      font: inherit;
    }

    select,
    input {
      width: 100%;
      padding: 0 12px;
      border: 1px solid var(--border);
      color: var(--text);
      background: #fff;
      outline: none;
    }

    select:focus,
    input:focus {
      border-color: #93c5fd;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
    }

    button {
      border: 0;
      padding: 0 18px;
      background: var(--blue);
      color: #fff;
      font-weight: 700;
      cursor: pointer;
      transition: transform 0.12s ease, opacity 0.12s ease;
    }

    button:hover {
      transform: translateY(-1px);
    }

    button:disabled {
      cursor: default;
      opacity: 0.65;
      transform: none;
    }

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

    .summary-card {
      padding: 18px;
    }

    .summary-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 8px;
    }

    .summary-value {
      font-size: clamp(22px, 3vw, 30px);
      font-weight: 800;
      line-height: 1.1;
    }

    .summary-sub {
      color: var(--muted);
      font-size: 13px;
      margin-top: 7px;
      line-height: 1.4;
    }

    .latest-card .summary-value {
      font-size: clamp(20px, 2.5vw, 28px);
    }

    .chart-panel {
      padding: 20px;
      min-height: 540px;
    }

    .chart-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 14px;
      margin-bottom: 14px;
    }

    .chart-head h2 {
      margin: 0;
      font-size: 20px;
    }

    .chart-head p {
      margin: 5px 0 0;
      color: var(--muted);
      font-size: 13px;
    }

    .chart-wrap {
      position: relative;
      height: 440px;
    }

    .no-data {
      display: none;
      position: absolute;
      inset: 0;
      align-items: center;
      justify-content: center;
      text-align: center;
      color: var(--muted);
      font-weight: 600;
      padding: 20px;
      background: rgba(255, 255, 255, 0.88);
      border-radius: 12px;
      z-index: 2;
    }

    .footer-line {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      padding: 13px 4px 0;
      color: var(--muted);
      font-size: 12px;
    }

    @media (max-width: 900px) {
      .controls {
        grid-template-columns: 1fr 1fr;
      }

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

    @media (max-width: 600px) {
      .page {
        width: min(100% - 18px, 1400px);
        margin: 10px auto 18px;
      }

      .main-nav {
        width: 100%;
        gap: 6px;
        margin-bottom: 10px;
      }

      .nav-button {
        flex: 1;
        padding: 0 8px;
      }

      .header {
        padding: 16px;
      }

      .header-top {
        align-items: flex-start;
        flex-direction: column;
      }

      .controls,
      .summary-grid {
        grid-template-columns: 1fr;
      }

      .chart-panel {
        padding: 14px;
        min-height: 470px;
      }

      .chart-wrap {
        height: 380px;
      }

      button {
        width: 100%;
      }
    }
