:root {
  --brand: #4158D0;
  --brand-2: #5a6fd8;
  --accent: #2d42a8;
  --grad: linear-gradient(135deg, #4158D0 0%, #5a6fd8 100%);
  --grad-secondary: linear-gradient(135deg, #1e88e5 0%, #42a5f5 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app-container {
  max-width: 700px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 1.5rem);
}

.app-header {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.app-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 1.5rem);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-3);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 1rem 0;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 150ms var(--ease-out);
}

.tab-btn:hover {
  background: var(--surface);
  border-color: var(--brand);
}

.tab-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.year-section {
  margin-bottom: 1.5rem;
}

.btn-group {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.625rem;
}

.choice-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 150ms var(--ease-out);
  white-space: nowrap;
}

.choice-btn:hover {
  background: var(--surface);
  border-color: var(--brand);
  transform: translateY(-1px);
}

.choice-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.period-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.date-input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  font-size: 0.9375rem;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  transition: border-color 150ms var(--ease-out);
}

.date-input:focus {
  outline: none;
  border-color: var(--brand);
}

.results {
  margin-top: 1rem;
}

.period-summary {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  margin: 0 0 1.25rem 0;
  letter-spacing: 0.02em;
}

.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-card {
  border-radius: var(--radius-3);
  padding: clamp(1.5rem, 4vw, 2rem);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}

.result-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-primary {
  background: var(--grad);
  color: white;
}

.card-secondary {
  background: var(--grad-secondary);
  color: white;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  opacity: 0.9;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.result-value {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.result-sub {
  font-size: 0.875rem;
  opacity: 0.85;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 1.75rem;
  text-align: center;
}

.detail-label {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text);
}

.detail-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--brand);
}

@media (max-width: 640px) {
  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .result-cards {
    grid-template-columns: 1fr;
  }
  
  .period-inputs {
    grid-template-columns: 1fr;
  }
  
  .btn-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 400px) {
  .btn-group {
    flex-direction: column;
  }
  
  .choice-btn {
    width: 100%;
  }
}

/* --- Недостающие дизайн-токены (значения из theme.css платформы) --- */
:root{
  --bg: #f7f7fb;
  --text: #14141c;
  --surface: #ffffff;
  --radius-3: 22px;
  --border: #e7e7ef;
  --shadow-1: 0 1px 2px rgba(20, 20, 40, .06);
  --muted: #6a6a7b;
  --surface-2: #f1f1f7;
  --radius-2: 16px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --radius-pill: 999px;
  --shadow-2: 0 1px 2px rgba(20, 20, 40, .06), 0 10px 24px rgba(20, 20, 40, .08);
  --font-sans: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: var(--step-0, clamp(1rem, .96rem + .2vw, 1.125rem));
  --line-height: 1.6;
}
