:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --border: #e2e8f0;
  --rounded: 0.75rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.logo {
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  font-size: 1.125rem;
}

nav { display: flex; gap: 0.75rem; flex-wrap: wrap; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.35rem;
}
nav a:hover { color: var(--text); background: var(--bg); }

main {
  max-width: 1100px;
  margin: 1.25rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rounded);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

h1 { font-size: 1.75rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 1rem; }

label { display: block; margin: 0.75rem 0 0.25rem; font-size: 0.875rem; font-weight: 600; }
input[type="date"], input[type="number"], input[type="text"], input[type="range"] {
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  width: 100%;
  max-width: 20rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 0.45rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
button.primary:hover { filter: brightness(1.05); }

.result {
  margin-top: 1rem;
  padding: 1rem;
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
  border-radius: 0.45rem;
}
.result .big {
  font-size: 1.35rem;
  font-weight: 800;
  color: #166534;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
}

.tool-list { list-style: none; padding: 0; }
.tool-list li { margin: 0.25rem 0; }
.tool-list a { text-decoration: none; color: var(--accent); }
.tool-list a:hover { text-decoration: underline; }

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.ad-sidebar {
  display: none;
}

@media(min-width: 1100px) {
  .ad-sidebar { display: block; position: fixed; right: 1rem; top: 5rem; width: 160px; min-height: 250px; }
}

/* Print-friendly for calculators */
@media print {
  .site-header, .site-footer, .ad-sidebar, .adsbygoogle { display: none !important; }
}
