/* TimeCard Hub — global styles. "Ledger" system: paper neutrals, one deep
   ledger-green accent, tabular numerals, hairline ruling. Mobile-first,
   no framework, print-aware. */
:root {
  --paper: #fafaf8;
  --card: #ffffff;
  --ink: #131b17;
  --ink-2: #3e4a44;
  --muted: #6d7a72;
  --brand: #0e6b4f;
  --brand-dark: #0b513c;
  --brand-soft: #ebf3ee;
  --brand-line: #cde0d5;
  --line: #e5e6e0;
  --line-2: #d3d6ce;
  --ot: #a85e0b;
  --ot-soft: #fbf3e3;
  --bad: #b42318;
  --bad-soft: #fcefec;
  --good: #0e6b4f;
  --good-soft: #ebf3ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(19, 27, 23, .05), 0 10px 28px -14px rgba(19, 27, 23, .14);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--paper); line-height: 1.6; font-size: 16px;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1140px; } /* uniform page width: tools and prose share one grid */
/* long-form measure: cap prose so lines stay readable inside the 1140px grid */
.section .wrap p, .section .wrap ul, .section .wrap ol, .faq-a { max-width: 880px; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); letter-spacing: -.022em; font-weight: 800; text-wrap: balance; }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); margin-top: 1.3em; letter-spacing: -.015em; }
h3 { font-size: 1.08rem; }
p { margin: .6em 0; color: var(--ink-2); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: .92em; background: var(--brand-soft); padding: .1em .35em; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 99; }
.skip-link:focus { left: 0; }

/* header */
.site-header { background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.header-in { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; }
.logo:hover { text-decoration: none; }
.nav-toggle { margin-left: auto; border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; padding: 6px 12px; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.site-nav { display: none; }
.site-nav.open { display: block; position: absolute; top: 56px; left: 0; right: 0; background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; }
.site-nav a { display: block; padding: 8px 4px; color: var(--ink-2); font-weight: 500; border-bottom: 1px solid #f1f2ee; }
@media (min-width: 840px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex !important; gap: 2px; margin-left: auto; position: static; border: 0; padding: 0; box-shadow: none; }
  .site-nav a { border: 0; padding: 8px 11px; border-radius: 8px; font-size: .95rem; }
  .site-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
}
.lang-links { margin-left: auto; display: flex; gap: 2px; }
.lang-links a { padding: 4px 9px; border-radius: 7px; font-size: .85rem; color: var(--muted); }
.lang-links a:hover { color: var(--brand-dark); background: var(--brand-soft); text-decoration: none; }
.lang-links a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
@media (min-width: 840px) { .lang-links { margin-left: 6px; } }

/* hero — the ledger-ruling signature: faint green-bar ruling over a paper wash */
.hero {
  padding: 34px 0 30px;
  position: relative;
  isolation: isolate;
  background: linear-gradient(180deg, #f1f6f1 0%, var(--paper) 100%);
}
/* ledger-ruling texture on its own masked layer so text stays crisp */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 47px, rgba(14, 107, 79, .07) 47px 48px);
  -webkit-mask-image: linear-gradient(180deg, #000 20%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 20%, transparent 92%);
}
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 1px solid var(--line); }
.hero .sub { color: var(--muted); max-width: 640px; margin: 6px 0 0; font-size: 1.03rem; }
.section { padding: 28px 0 8px; }

/* tool card */
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 18px 0; }
.tool-card h2:first-child { margin-top: 0; }

/* forms: equal-width grid keeps inputs aligned even when one field carries
   extra note text or a checkbox */
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px 14px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .fnote { font-size: .78rem; color: var(--ink-2); }
.field-row .field.check { flex-direction: row; align-items: center; gap: 8px; grid-column: 1 / -1; }
.field-row .field.check label { font-weight: 400; color: var(--ink); }
input[type="text"], input[type="number"], input[type="time"], input[type="date"], select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff;
  color: var(--ink); min-width: 0; width: 100%; font-variant-numeric: tabular-nums;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
input.err { border-color: var(--bad); background: var(--bad-soft); }
input[type="time"] { width: 7.2em; }
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .45; }
.hint { font-size: .8rem; color: var(--muted); }
.err-msg { color: var(--bad); font-size: .82rem; min-height: 1em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; border-radius: 9px; border: 1px solid transparent; padding: 9px 16px;
  cursor: pointer; background: var(--brand); color: #fff; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--card); color: var(--brand); border-color: var(--brand-line); }
.btn.secondary:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn.small { padding: 5px 10px; font-size: .85rem; border-radius: 7px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ic { flex: none; }

/* results */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.result-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.result-box.primary { background: var(--brand); border-color: var(--brand-dark); color: #fff; }
.result-box.primary .k, .result-box.primary .v { color: #fff; }
.result-box.primary .note { color: #cfe4da; }
.result-box.ot { background: var(--ot-soft); border-color: #ecd9b4; }
.result-box .k { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.result-box .v { font-size: 1.45rem; font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.result-box .v small { font-size: .8rem; font-weight: 500; }
.result-box .note { font-size: .78rem; color: var(--muted); margin-top: 2px; }
@media (min-width: 640px) { .result-grid { grid-template-columns: repeat(4, 1fr); } }

/* timesheet table — compact rows; time inputs use the browser's native picker */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
table.timesheet { border-collapse: collapse; width: 100%; min-width: 640px; background: #fff; font-size: .92rem; }
table.timesheet th, table.timesheet td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: middle; }
table.timesheet th { background: #f3f6f2; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; font-weight: 700; }
table.timesheet tbody tr:hover td { background: #f7faf7; }
table.timesheet td.day-name { font-weight: 600; white-space: nowrap; }
table.timesheet td.nowrap { white-space: nowrap; }
table.timesheet .dash { color: var(--line-2); margin: 0 2px; }
table.timesheet input[type="time"] { width: 6.2em; padding: 5px 4px; font-size: .88rem; border-color: var(--line); }
table.timesheet input[type="number"] { padding: 5px 6px; font-size: .9rem; border-color: var(--line); }
table.timesheet input.n { width: 4.2em; }
table.timesheet tr.week-sep td { background: var(--brand-soft); font-size: .78rem; color: var(--brand-dark); padding: 3px 8px; font-weight: 600; letter-spacing: .02em; }
table.timesheet .day-total { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
table.timesheet tfoot td { font-weight: 700; background: #f8faf7; }

/* employee tabs */
.tab-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 5px 14px; cursor: pointer; font: inherit; font-size: .9rem; color: var(--ink-2); transition: border-color .15s, background-color .15s, color .15s; }
.tab:hover { border-color: var(--brand-line); color: var(--brand-dark); }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab.active:hover { background: var(--brand-dark); }
.tab .pen { display: inline-flex; opacity: .5; }
.tab:hover .pen, .tab.active .pen { opacity: 1; }

/* modal dialog (replaces prompt/confirm) */
.modal-overlay { position: fixed; inset: 0; background: rgba(19, 27, 23, .48); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--card); border-radius: 14px; box-shadow: 0 24px 60px rgba(19, 27, 23, .35); max-width: 460px; width: 100%; padding: 20px 22px; }
.modal h3 { margin: 0 0 4px; font-size: 1.15rem; }
.modal .field { margin: 8px 0; }
.modal textarea { width: 100%; min-height: 110px; font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; resize: vertical; }
.modal textarea:focus, .modal input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.fw-days { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 6px; }
.fw-day { font-size: .92rem; color: var(--ink-2); }
.fw-over { display: block; font-size: .9rem; color: var(--ink-2); margin-top: 4px; }

/* misc UI */
.badge { display: inline-block; font-size: .74rem; font-weight: 700; border-radius: 999px; padding: 3px 11px; background: var(--brand-soft); color: var(--brand-dark); letter-spacing: .02em; }
.badge.ot { background: var(--ot-soft); color: var(--ot); }
.badge.good { background: var(--good-soft); color: var(--good); }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; padding: 10px 14px; margin: 12px 0; font-size: .92rem; color: var(--ink-2); }
.callout.warn { border-color: var(--ot); background: var(--ot-soft); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.mini-card { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.mini-card:hover { border-color: var(--brand-line); text-decoration: none; box-shadow: var(--shadow); }
.mini-card:hover strong { color: var(--brand-dark); }
.mini-card span { font-size: .82rem; color: var(--muted); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin: 8px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq-a { color: var(--ink-2); padding-top: 6px; }

/* chart / table content pages */
table.plain { border-collapse: collapse; width: 100%; background: #fff; font-size: .92rem; margin: 10px 0; }
table.plain th, table.plain td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
table.plain th { background: #f3f6f2; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
table.plain td.mono, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* footer */
.site-footer { margin-top: 44px; background: #101814; color: #b9c6be; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; padding: 30px 16px 12px; }
.site-footer h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 8px; color: #93c2ab; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 4px 0; }
.site-footer a { color: #b9c6be; font-size: .9rem; }
.site-footer a:hover { color: #fff; }
.footer-note { padding: 4px 16px 22px; font-size: .8rem; color: #7d8c84; border-top: 1px solid #223028; }
.footer-note p { color: #7d8c84; margin: 6px 0; }
.footer-note a { color: #b9c6be; }

/* ad slot placeholder (reserved per product-spec §4; AdSense script only after approval) */
.ad-slot { margin: 18px 0; min-height: 0; }

/* print — print ONLY the tool card (timesheet/calculator), never nav/hero/FAQ/buttons */
@media print {
  .site-header, .site-footer, .nav-toggle, .no-print, .btn-row, .ad-slot, .skip-link,
  .hero, .section, .tab-row, #tc-settings, .hint, .callout, #tc-weeksum { display: none !important; }
  body { background: #fff; }
  .wrap, .wrap-wide { max-width: none; padding: 0; }
  .tool-card, .result-box { box-shadow: none; border-color: #999; }
  .tool-card { border: 0; padding: 0; margin: 0; }
  .print-header { display: block !important; margin-bottom: 8px; border-bottom: 1.5pt solid #000; padding-bottom: 4px; }
  /* fit the FULL table width on one printed page: kill the scroll container,
     drop min-width, shrink type — vertical overflow still paginates naturally */
  .table-scroll { overflow: visible !important; border: 0; border-radius: 0; }
  table.timesheet { min-width: 0 !important; width: 100% !important; font-size: 8pt; table-layout: auto; }
  table.timesheet th { font-size: 7pt; padding: 3px 3px; }
  table.timesheet td { padding: 2.5px 3px; }
  table.timesheet input[type="time"] { width: 5.4em; padding: 0; font-size: 7.5pt; }
  table.timesheet input[type="number"] { width: 3em; padding: 0; font-size: 7.5pt; }
  table.timesheet thead { display: table-header-group; } /* repeat headers on every page */
  table.timesheet tr { break-inside: avoid; page-break-inside: avoid; }
  table.timesheet input, table.timesheet select { appearance: none; -webkit-appearance: none; border: 0 !important; background: none !important; padding: 0 !important; color: #000 !important; }
  .result-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
  .result-box { border: 1pt solid #999; padding: 6px 8px; }
}
.print-header { display: none; margin-bottom: 10px; }
.print-header .ph-title { font-size: 1.2rem; font-weight: 700; }
.print-header .ph-meta { color: #4b5a52; font-size: .9rem; }

/* hero home */
.home-hero { text-align: center; padding: 44px 0 30px; }
.home-hero .sub { margin-left: auto; margin-right: auto; }
.tool-list { list-style: none; padding: 0; margin: 14px 0; }
.tool-list li { margin: 6px 0; }
.checklist { list-style: none; padding-left: 0; }
.checklist li { padding-left: 26px; position: relative; margin: 6px 0; color: var(--ink-2); }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: .32em; width: 14px; height: 14px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' fill='none' stroke='%230e6b4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
