:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

/* ── Nav ── */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo svg { flex-shrink: 0; }
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  padding: 6px 9px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: white;
  padding: 3.5rem 1.5rem;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.2; }
.hero p { font-size: 1.15rem; opacity: 0.9; max-width: 540px; margin: 0 auto; }

/* ── Page header (inner pages) ── */
.page-header {
  background: var(--primary-light);
  border-bottom: 2px solid #bfdbfe;
  padding: 2rem 1.5rem;
}
.page-header h1 { font-size: 1.8rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 0.4rem; }
.page-header .trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--primary-dark);
  background: white;
  border: 1px solid #bfdbfe;
  border-radius: 99px;
  padding: 3px 10px;
  margin-top: 0.65rem;
  font-weight: 500;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.tool-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.tool-card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.5rem;
}
.tool-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.tool-card p { font-size: 0.9rem; color: var(--text-muted); flex: 1; }
.tool-card .cta { color: var(--primary); font-size: 0.9rem; font-weight: 600; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--text); }
label.optional::after { content: ' (optional)'; font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"],
textarea, select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
textarea { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-group { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

/* ── Result / output boxes ── */
.result-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}
.result-box h3 { color: var(--primary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.result-value { font-size: 2rem; font-weight: 800; color: var(--primary-dark); }
.result-label { font-size: 0.85rem; color: var(--text-muted); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }

.output-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.8;
  color: var(--text);
}

/* ── Answer bank specific ── */
.filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-bar select { flex: 1; min-width: 180px; }
.answer-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.answer-card-header {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  user-select: none;
  transition: background 0.15s;
}
.answer-card-header:hover { background: var(--bg); }
.answer-card-header h3 { font-size: 0.95rem; font-weight: 600; }
.answer-card-header .tag {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  font-weight: 600;
}
.answer-card-body {
  padding: 0 1.25rem 1.25rem;
  display: none;
}
.answer-card-body.open { display: block; }
.answer-card-body .tip {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #fefce8;
  border-left: 3px solid var(--warning);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.answer-card-body .answer-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
}
.chevron { transition: transform 0.2s; flex-shrink: 0; }
.chevron.open { transform: rotate(180deg); }

/* ── Shift schedule ── */
.schedule-grid { overflow-x: auto; margin-top: 1.5rem; }
.schedule-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.schedule-table th {
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
.schedule-table th:first-child { text-align: left; }
.schedule-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  text-align: center;
  background: var(--white);
}
.schedule-table td:first-child { text-align: left; padding-left: 0.75rem; font-weight: 600; font-size: 0.9rem; }
.shift-cell {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}
.shift-morning { background: #fef9c3; border-color: #fde047; color: #713f12; }
.shift-afternoon { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }
.shift-night { background: #ede9fe; border-color: #c4b5fd; color: #3b0764; }
.shift-off { background: var(--bg); border-color: var(--border); color: var(--text-muted); }

/* ── Invoice ── */
.invoice-preview {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-md);
}
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.invoice-title { font-size: 2rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.invoice-meta { text-align: right; font-size: 0.9rem; line-height: 1.8; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.invoice-party-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; margin-bottom: 0.4rem; }
.invoice-party-name { font-weight: 700; font-size: 1rem; }
.invoice-party-details { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }
.invoice-items { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.invoice-items th {
  padding: 0.6rem 0.75rem;
  background: var(--primary);
  color: white;
  font-size: 0.85rem;
  text-align: left;
  font-weight: 600;
}
.invoice-items th:last-child { text-align: right; }
.invoice-items td { padding: 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: top; }
.invoice-items td:last-child { text-align: right; font-weight: 600; }
.invoice-totals { display: flex; justify-content: flex-end; }
.invoice-totals table { min-width: 240px; }
.invoice-totals td { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
.invoice-totals td:last-child { text-align: right; font-weight: 600; }
.invoice-total-row td { font-size: 1.1rem; font-weight: 800; border-top: 2px solid var(--text); padding-top: 0.6rem; }
.invoice-notes { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); }

/* ── Ad slots ── */
.ad-slot {
  margin: 1.5rem 0;
  text-align: center;
}

/* ── Footer ── */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 3rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--primary); }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }

/* ── Misc ── */
.section-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.section-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #dcfce7; color: #15803d; }
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .invoice-parties { grid-template-columns: 1fr; }
  .invoice-header { flex-direction: column; gap: 1rem; }
  .invoice-meta { text-align: left; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: white; border-bottom: 1px solid var(--border); padding: 1rem; gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 1rem; }
  .nav-toggle { display: block; }
  .filter-bar { flex-direction: column; }
}

/* ── Print ── */
@media print {
  nav, footer, .btn, .btn-group, .ad-slot, .no-print, .page-header { display: none !important; }
  html, body { height: auto; margin: 0; background: white; }
  .invoice-preview { box-shadow: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; }
  .letter-output { border: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; margin: 0 !important; }
  .agenda-preview { border: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; margin: 0 !important; }
  .two-col { display: block; }
  .container, .container-sm { padding: 0; margin: 0; }
}
