/* Wilma Actometer — main stylesheet (mobile-first) */
:root {
  --primary: #4a6fa5;
  --primary-hover: #5a82bd;
  --primary-soft: #e8eef7;
  --bg: #f8f9fb;
  --card: #ffffff;
  --border: #e0e5eb;
  --border-strong: #c9d1da;
  --text: #2c3e50;
  --muted: #7f8c9a;
  --success: #5cb85c;
  --success-soft: #e7f4e7;
  --warning: #f0ad4e;
  --warning-soft: #fcf3e0;
  --danger: #d9534f;
  --danger-soft: #fae6e5;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(74, 111, 165, 0.12);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --max-width: 768px;
  --header-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --font-heading: 'Cardo', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  padding-bottom: calc(24px + var(--safe-bottom));
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}

h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.4rem; line-height: 1.25; }
h3 { font-size: 1.15rem; line-height: 1.3; }

p { margin: 0 0 12px 0; }

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}

.container.narrow {
  max-width: 540px;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--font-mono); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  box-shadow: var(--shadow-sm);
}

.app-header h1 {
  color: white;
  font-size: 1.15rem;
  margin: 0;
}

.app-header .header-link {
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
}

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

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.card-title h2 { margin: 0; }

.stack > * + * {
  margin-top: 12px;
}

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

.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr 1fr; }
}

.banner {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.banner.warning { background: var(--warning-soft); border-color: #f4d9a0; color: #7a5418; }
.banner.info    { background: var(--primary-soft); border-color: #cfdcef; color: #2c3e50; }
.banner.danger  { background: var(--danger-soft); border-color: #e8b8b3; }

.banner .banner-icon { flex-shrink: 0; width: 20px; height: 20px; }

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar .fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + var(--safe-bottom));
}

.tabbar a {
  flex: 1;
  text-align: center;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  min-height: 44px;
}

.tabbar a.active { color: var(--primary); }
.tabbar svg { width: 22px; height: 22px; }

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 720px) {
  body { font-size: 17px; }
  .container { padding: 24px; }
}