:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #5f6b7a;
  --primary: #2563eb;
  --primary-soft: #eaf1ff;
  --success: #15803d;
  --danger: #b91c1c;
  --border: #dce3f0;
  --radius: 12px;
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f3f7fb;
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 0.65rem;
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  color: #003d77;
  letter-spacing: 0.2px;
  text-transform: none;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-list a {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.nav-list a:hover,
.nav-list a.active {
  background: var(--primary-soft);
  text-decoration: none;
}

main {
  padding: 0.8rem 0 2.6rem;
}

.hero {
  padding-top: 1rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin-top: 0;
  color: #003d77;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

.lead {
  color: var(--muted);
  margin: 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.3rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ccd7ea;
  border-radius: 10px;
  padding: 0.68rem 0.72rem;
  background: #fff;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.input-row {
  margin-bottom: 0.45rem;
}

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 0.68rem 1rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.93;
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.stat {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdfb;
}

.stat-title {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.status-pass {
  color: var(--success);
}

.status-fail {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  max-height: 280px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

th,
td {
  padding: 0.6rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: #eef4ff;
}

tr.violation {
  background: #fff1f1;
}

.section {
  margin-top: 1.5rem;
}

.daily-toggle {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8faff;
  padding: 0.5rem 0.6rem;
}

.daily-inputs-panel {
  margin-top: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f5f8ff;
  scrollbar-width: auto;
  scrollbar-color: #9db8ec #e9effb;
}

.compact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.compact-grid .input-row {
  margin-bottom: 0;
  padding: 0.5rem;
  border-radius: 10px;
  background: #edf3ff;
  border: 1px solid #d8e4fb;
}

.compact-grid .input-row:nth-child(2n) {
  background: #f3f7ff;
}

.compact-grid .input-row label {
  font-size: 0.84rem;
  color: #334b78;
}

.scroll-note {
  margin-top: 0.45rem;
}

.daily-inputs-panel::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.nav-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.daily-inputs-panel::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.nav-list::-webkit-scrollbar-track {
  background: #e9effb;
  border-radius: 999px;
}

.daily-inputs-panel::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.nav-list::-webkit-scrollbar-thumb {
  background: #9db8ec;
  border-radius: 999px;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
}

.faq details + details {
  margin-top: 0.65rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.1rem 0 1.3rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 600px) {
  .container {
    width: 94%;
  }

  .nav-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .logo {
    text-align: center;
  }

  .nav-list {
    justify-content: center;
    padding-bottom: 0.2rem;
  }

  .daily-inputs-panel {
    max-height: 180px;
  }

  .btn-row .btn {
    flex: 1 1 100%;
  }

  table {
    min-width: 0;
    font-size: 0.9rem;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }

  th,
  td {
    padding: 0.52rem 0.45rem;
  }
}

.form-feedback {
  margin-top: 0.7rem;
  font-weight: 600;
}

.ok {
  color: var(--success);
}

.error {
  color: var(--danger);
}

@media (min-width: 840px) {
  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }

  .calc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem 1rem;
  }

  .calc-grid .full {
    grid-column: span 3;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
