:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #0f172a;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: #f4f6f8;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-actions .button {
  text-decoration: none;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 2.5vw, 3rem);
  line-height: 1.05;
}

.hero p {
  margin: 12px 0 0;
  max-width: 760px;
  color: #475569;
}

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  gap: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.hint {
  color: #64748b;
  font-size: 0.92rem;
}

.form-grid,
.summary-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 0.95rem;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(59, 130, 246, 0.18);
  outline-offset: 2px;
}

button,
a.button {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  transition: background 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

button:hover,
a.button:hover {
  background: #1d4ed8;
}

button.secondary {
  background: #475569;
}

button.secondary:hover {
  background: #334155;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.action-gap {
  justify-content: flex-start;
  margin-top: 8px;
}

.message {
  margin-top: 14px;
  color: #0f172a;
  min-height: 24px;
}

.periods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.periods span {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.95rem;
}

.summary-label {
  display: block;
  color: #64748b;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.summary-note {
  margin-top: 6px;
  color: #475569;
  font-size: 0.95rem;
}

strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.1;
  margin-top: 4px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
}

th {
  background: #f8fafc;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
}

tbody tr:nth-child(odd) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #eef2ff;
}

tbody tr.group-header {
  background: #e2e8f0;
  color: #0f172a;
}

tbody tr.group-header td {
  font-weight: 700;
}

.toggle-icon {
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.2s ease;
}

tbody tr.group-header[data-collapsed="true"] .toggle-icon {
  transform: rotate(-90deg);
}

tbody tr.group-row {
  display: table-row;
  transition: opacity 0.15s ease;
}

tbody tr.group-row.hidden {
  display: none;
}

td {
  color: #334155;
  vertical-align: top;
}

.footer-summary {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
  color: #334155;
}

.footer-summary strong {
  font-size: 1.05rem;
  color: #0f172a;
}

.footer-details {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 12px;
  color: #475569;
}

.footer-details span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 0.95rem;
}

.footer-details strong {
  color: #0f172a;
  font-size: 1rem;
}

@media (max-width: 720px) {
  .hero,
  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    width: 100%;
  }
}
