:root {
  --blue: #1d5f99;
  --blue-dark: #14476f;
  --blue-soft: #e9f3fb;
  --border: #d8e0e7;
  --text: #26333d;
  --muted: #687782;
  --panel: #ffffff;
  --page: #f4f6f8;
  --accent: #3a7a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: var(--blue);
  border-bottom: 4px solid var(--blue-dark);
  color: #fff;
}

.header-inner,
.footer-inner,
.page {
  max-width: 1120px;
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  gap: 20px;
}

.brand {
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}

.brand img {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.main-nav a {
  color: #fff;
  display: inline-flex;
  padding: 18px 12px;
  font-size: 14px;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.page {
  padding: 18px;
}

.ad-strip,
.ad-box,
.mobile-ad-slot {
  display: grid;
  place-items: center;
  min-height: 90px;
  background: #eef1f4;
  border: 1px dashed #bdc7cf;
  color: #88929a;
  font-size: 13px;
  margin-bottom: 18px;
}

.mobile-ad-slot {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
}

.content,
.sidebar {
  min-width: 0;
}

.intro,
.tool-card,
.text-section,
.examples,
.faq,
.side-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 18px;
}

.intro {
  padding: 20px 22px;
}

h1,
h2 {
  margin: 0 0 10px;
  color: #202a31;
  line-height: 1.2;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

p {
  margin: 0 0 12px;
}

.tool-card {
  overflow: hidden;
}

.tool-heading {
  padding: 16px 20px;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--border);
}

.tool-heading p {
  color: var(--muted);
  margin: 0;
}

.calculator-form {
  padding: 18px 20px 8px;
}

fieldset {
  border: 1px solid var(--border);
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 4px;
}

legend {
  padding: 0 6px;
  color: var(--blue-dark);
  font-weight: 700;
}

.form-grid,
.duration-grid,
.two-column,
.converter,
.example-grid,
.conversion-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.duration-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: #34434d;
  font-weight: 700;
  font-size: 14px;
}

.check-row {
  align-content: end;
  grid-template-columns: auto 1fr;
  min-height: 40px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #bfcbd4;
  border-radius: 3px;
  color: var(--text);
  background: #fff;
  padding: 8px 10px;
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(29, 95, 153, 0.18);
  border-color: var(--blue);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 4px 0 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--blue-dark);
  background: var(--blue);
  color: #fff;
  border-radius: 3px;
  min-height: 40px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--blue-dark);
}

button.secondary {
  background: #fff;
  color: var(--blue-dark);
  border-color: #aebbc6;
}

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

.result-panel {
  margin: 0 20px 20px;
  padding: 16px;
  border: 1px solid #b7d4ad;
  background: #f0faed;
  border-radius: 4px;
  display: grid;
  gap: 4px;
}

.result-panel strong {
  color: var(--accent);
  font-size: 24px;
  line-height: 1.25;
}

.result-panel span:last-child {
  color: #53615b;
}

.result-label {
  text-transform: uppercase;
  color: #5b7a52;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.result-panel.compact strong {
  font-size: 22px;
}

.calculator-form.tight {
  padding-top: 0;
}

.converter {
  grid-template-columns: minmax(0, 1fr) 180px auto;
  align-items: end;
  padding: 18px 20px;
}

.conversion-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 20px 20px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  background: #fbfcfd;
}

.metric strong {
  display: block;
  font-size: 20px;
  color: var(--blue-dark);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  margin: 0 20px 20px;
  overflow-x: auto;
}

.table-wrap.no-margin {
  margin: 0 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

th {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

td:last-child,
th:last-child {
  text-align: right;
}

.time-card-table input {
  min-width: 112px;
}

.time-card-table td:first-child,
.time-card-table th:first-child {
  font-weight: 700;
  text-align: left;
}

.info-page {
  max-width: 820px;
}

.text-section,
.examples,
.faq {
  padding: 18px 20px;
}

.example-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.example-grid button {
  background: #fff;
  color: var(--blue-dark);
  border-color: #c3d0da;
  text-align: left;
}

.example-grid button:hover {
  background: var(--blue-soft);
}

details {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

details:first-of-type {
  border-top: 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

details p {
  color: var(--muted);
  margin: 10px 0 0;
}

.sidebar {
  position: relative;
}

.side-card {
  padding: 16px;
}

.side-card a {
  display: block;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.side-card a:first-of-type {
  border-top: 0;
}

.ad-box {
  min-height: 250px;
}

.ad-box.small {
  min-height: 180px;
}

.site-footer {
  background: #e5eaee;
  border-top: 1px solid #cbd4dc;
  margin-top: 24px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
  padding: 0 18px;
  color: var(--muted);
  gap: 14px;
}

.footer-inner nav {
  display: flex;
  gap: 16px;
}

@media (max-width: 860px) {
  .header-inner,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .main-nav a {
    flex: 0 0 auto;
    padding: 8px 10px 8px 0;
  }

  .main-nav {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .ad-strip {
    display: none;
  }

  .mobile-ad-slot {
    display: grid;
    min-height: 64px;
    margin-bottom: 18px;
  }

  .layout,
  .form-grid,
  .duration-grid,
  .two-column,
  .converter,
  .example-grid,
  .conversion-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }

  .ad-box {
    min-height: 110px;
  }
}

@media (max-width: 520px) {
  .page {
    padding: 12px;
  }

  h1 {
    font-size: 26px;
  }

  .intro,
  .tool-heading,
  .calculator-form,
  .text-section,
  .examples,
  .faq,
  .side-card {
    padding-left: 14px;
    padding-right: 14px;
  }

  .result-panel {
    margin-left: 14px;
    margin-right: 14px;
  }

  .result-panel strong {
    font-size: 21px;
  }
}
