:root {
  --bg: #F5F2ED;
  --bg-card: #FDFCFA;
  --navy: #1C2B3A;
  --navy-mid: #2E4057;
  --amber: #C8873A;
  --amber-light: #F5E6D3;
  --muted: #7A7A72;
  --border: #E2DDD6;
  --text: #1C2B3A;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* NAV */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.nav-logo {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-logo span { color: var(--amber); }
.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
  font-size: 13px; font-weight: 400; color: var(--muted);
  text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  font-family: var(--sans);
}
.nav-link:hover { background: var(--border); color: var(--navy); }
.nav-link.active { color: var(--navy); font-weight: 500; }

/* HOMEPAGE */
.hero {
  max-width: 860px; margin: 0 auto;
  padding: 7rem 2rem 4rem;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--amber);
  background: var(--amber-light);
  padding: 5px 14px; border-radius: 99px;
  margin-bottom: 1.8rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.1; letter-spacing: -0.02em;
  color: var(--navy); margin-bottom: 1.4rem;
}
.hero h1 em { font-style: italic; color: var(--amber); }
.hero p {
  font-size: 1.1rem; color: var(--muted);
  max-width: 520px; margin: 0 auto 3rem;
  font-weight: 300; line-height: 1.7;
}
.hero-rule {
  width: 40px; height: 2px;
  background: var(--amber); margin: 0 auto 3rem;
  border-radius: 2px;
}

.tools-grid {
  max-width: 1000px; margin: 0 auto;
  padding: 0 2rem 6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  text-align: left;
  text-decoration: none;
  display: block;
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--amber);
  box-shadow: 0 8px 32px rgba(28,43,58,0.08);
}
.tool-icon {
  width: 42px; height: 42px;
  background: var(--amber-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.tool-icon svg { width: 20px; height: 20px; }
.tool-card h3 {
  font-family: var(--serif);
  font-size: 1.15rem; color: var(--navy);
  margin-bottom: 0.4rem; letter-spacing: -0.01em;
}
.tool-card p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.tool-card-arrow {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--amber);
  margin-top: 1rem; letter-spacing: 0.02em;
}

/* INNER PAGES */
.inner-page { max-width: 720px; margin: 0 auto; padding: 3rem 2rem 6rem; }
.inner-page h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--navy); margin-bottom: 0.5rem;
  letter-spacing: -0.02em; line-height: 1.15;
}
.inner-page .subtitle {
  color: var(--muted); font-size: 15px; margin-bottom: 2.5rem;
  font-weight: 300;
}

/* FORM ELEMENTS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1rem;
}
.field-group { margin-bottom: 1.2rem; }
.field-group:last-child { margin-bottom: 0; }
label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--navy); letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 6px;
}
input[type=text], input[type=number], input[type=date],
input[type=email], select, textarea {
  width: 100%; padding: 10px 13px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 14px; color: var(--text);
  outline: none; transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(200,135,58,0.12);
}
textarea { resize: vertical; min-height: 90px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  padding: 11px 22px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}
.btn:hover { background: var(--navy-mid); }
.btn:active { transform: scale(0.98); }
.btn-amber { background: var(--amber); }
.btn-amber:hover { background: #b5782e; }
.btn-outline {
  background: transparent; color: var(--navy);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--border); }

/* RESULT CARDS */
.result-card {
  background: var(--navy);
  color: #fff; border-radius: var(--radius);
  padding: 1.75rem; margin-top: 1rem;
}
.result-card h2 {
  font-family: var(--serif); font-size: 1rem;
  color: rgba(255,255,255,0.55); font-weight: 400;
  margin-bottom: 0.5rem; letter-spacing: 0.02em;
}
.result-big {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: #fff; letter-spacing: -0.02em; line-height: 1;
  margin-bottom: 1.2rem;
}
.result-big span { color: var(--amber); }
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.75rem 0; font-size: 13px;
}
.result-label { color: rgba(255,255,255,0.5); }
.result-value { color: #fff; font-weight: 500; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.5rem; }

/* INVOICE */
.invoice-items { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-items th {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.invoice-items td { padding: 8px 10px; vertical-align: middle; }
.invoice-items td input { padding: 7px 10px; font-size: 13px; }
.invoice-items tr.item-row:hover { background: var(--bg); }
.remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px; padding: 4px;
  transition: color 0.15s;
}
.remove-btn:hover { color: #c0392b; }
.add-item-btn {
  font-size: 13px; color: var(--amber); background: none;
  border: none; cursor: pointer; font-family: var(--sans);
  font-weight: 500; padding: 4px 0; display: flex;
  align-items: center; gap: 5px; margin-top: 6px;
}
.total-row {
  display: flex; justify-content: flex-end; gap: 2rem;
  font-size: 14px; padding: 0.75rem 0;
  border-top: 1px solid var(--border); margin-top: 0.5rem;
}
.total-row .total-label { color: var(--muted); }
.total-row .total-amount { font-weight: 500; color: var(--navy); }
.total-row.grand { font-size: 16px; }
.total-row.grand .total-amount {
  color: var(--amber); font-family: var(--serif); font-size: 1.2rem;
}

/* TIMESHEET */
.ts-table { width: 100%; border-collapse: collapse; }
.ts-table th {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.ts-table td { padding: 6px 10px; }
.ts-table td input, .ts-table td select { padding: 7px 8px; font-size: 13px; }
.ts-total-bar {
  background: var(--amber-light); border-radius: var(--radius-sm);
  padding: 1rem 1.25rem; display: flex; justify-content: space-between;
  align-items: center; margin-top: 1rem;
}
.ts-total-bar .label { font-size: 13px; color: var(--navy); font-weight: 500; }
.ts-total-bar .value { font-family: var(--serif); font-size: 1.4rem; color: var(--amber); }

/* CONTRACT / EMAIL OUTPUT */
.contract-output {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  white-space: pre-wrap; font-size: 13px;
  line-height: 1.8; color: var(--text); font-family: var(--sans);
  max-height: 500px; overflow-y: auto;
}
.email-output {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  font-size: 14px; line-height: 1.8; color: var(--text);
  white-space: pre-wrap;
}
.email-subject {
  font-weight: 500; color: var(--navy);
  padding-bottom: 0.75rem; margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border); font-size: 13px;
}

/* SEARCH BAR */
.tools-search-wrap {
  max-width: 1000px; margin: 0 auto;
  padding: 0 2rem 1.5rem;
}
.tools-search-inner {
  position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 13px;
  width: 16px; height: 16px;
  color: var(--muted); pointer-events: none;
}
#tool-search {
  width: 100%; padding: 11px 40px 11px 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px; color: var(--text);
  outline: none; transition: border-color 0.15s;
  -webkit-appearance: none; appearance: none;
}
#tool-search:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(200,135,58,0.12); }
#tool-search::placeholder { color: var(--muted); }
.search-clear {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1;
  padding: 4px 6px;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--navy); }
.search-no-results {
  text-align: center; color: var(--muted);
  font-size: 14px; font-weight: 300;
  padding-top: 0.75rem;
}
@media (max-width: 600px) {
  .tools-search-wrap { padding: 0 1.25rem 1.25rem; }
}

/* FEATURE REQUEST */
.feature-btn {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 200;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--navy); color: #fff;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 10px 18px;
  border: none; border-radius: 99px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(28,43,58,0.22);
  transition: background 0.15s, transform 0.15s;
}
.feature-btn:hover { background: var(--navy-mid); transform: translateY(-2px); }
.feature-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(28,43,58,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%; max-width: 460px;
  box-shadow: 0 24px 64px rgba(28,43,58,0.22);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.modal-header h2 {
  font-family: var(--serif);
  font-size: 1.5rem; color: var(--navy); letter-spacing: -0.02em;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 22px; line-height: 1; padding: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--navy); }

/* CHECKBOX LABEL */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 0;
}
.checkbox-label input[type=checkbox] {
  width: auto;
  padding: 0;
  cursor: pointer;
  accent-color: var(--amber);
}

/* TOOLTIPS */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 9px; font-weight: 600;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.tooltip-icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 12px; font-weight: 400;
  text-transform: none; letter-spacing: 0;
  line-height: 1.5;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 210px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(28,43,58,0.18);
}
.tooltip-icon::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--navy);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
}
.tooltip-icon:hover::after,
.tooltip-icon:hover::before,
.tooltip-icon:focus::after,
.tooltip-icon:focus::before { opacity: 1; }

/* UTILITIES */
.section-title-sm {
  font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 1rem;
}
.hidden { display: none !important; }

@media (max-width: 600px) {
  nav { padding: 0 1rem; }
  .nav-links { display: none; }
  .hero { padding: 4rem 1.25rem 2rem; }
  .tools-grid { padding: 0 1.25rem 4rem; }
  .inner-page { padding: 2rem 1.25rem 4rem; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
}
