/* ClockMath — shared styles */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #5b6478;
  --border: #dfe3ec;
  --brand: #1f5fbf;
  --brand-dark: #174a96;
  --brand-soft: #e8f0fc;
  --accent: #0e8a6a;
  --accent-soft: #e3f5ef;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .06);
  --max: 860px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
}
.logo img { width: 30px; height: 30px; }
.logo b { color: var(--brand); font-weight: 800; }

.site-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  padding: 4px 0;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand); }

/* Main */
main { padding: 28px 0 40px; }

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -.02em;
}
h2 { font-size: 1.35rem; line-height: 1.3; margin: 36px 0 10px; }
h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.lead { color: var(--muted); margin: 0 0 22px; font-size: 1.05rem; }

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

/* Forms */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field label {
  display: block;
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: 4px; }

input[type="time"], input[type="number"], input[type="text"], select {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  min-height: 46px;
}
input:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(31, 95, 191, .25);
  border-color: var(--brand);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button, .btn {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: 0;
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  min-height: 46px;
}
button:hover { background: var(--brand-dark); }
button.secondary {
  background: var(--surface);
  color: var(--brand);
  border: 1.5px solid var(--border);
}
button.secondary:hover { background: var(--brand-soft); }

/* Results */
.result {
  margin-top: 20px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #bfe6d8;
  padding: 16px 18px;
}
.result[hidden] { display: none; }
.result .big {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--accent);
}
.result .sub { color: var(--text); margin-top: 4px; }
.result .note { color: var(--muted); font-size: .92rem; margin-top: 6px; }
.result.error { background: var(--warn-soft); border-color: #f1d39d; }
.result.error .big { color: var(--warn); font-size: 1.15rem; }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 10px; }
.stat { background: rgba(255,255,255,.7); border-radius: 10px; padding: 10px 12px; }
.stat .label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.25rem; font-weight: 800; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tbody tr:nth-child(even) { background: #fafbfd; }

/* Timesheet */
.timesheet td { padding: 6px; vertical-align: middle; }
.timesheet input { min-height: 42px; padding: 7px 8px; font-size: 1rem; }
.timesheet .day { font-weight: 700; white-space: nowrap; }
.timesheet .hrs { font-weight: 700; white-space: nowrap; text-align: right; }
.timesheet input[type="number"] { max-width: 90px; }
.timesheet tfoot td { font-weight: 800; border-top: 2px solid var(--border); }
.timesheet .long { display: none; }

/* Timesheet on phones: one small card per day */
@media (max-width: 640px) {
  .timesheet thead { display: none; }
  .timesheet tbody tr, .timesheet tfoot tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    background: transparent !important;
  }
  .timesheet td { border: 0; padding: 0; }
  .timesheet td.day { grid-column: 1; grid-row: 1; }
  .timesheet td.hrs { grid-column: 2; grid-row: 1; }
  .timesheet td.c-in { grid-column: 1; grid-row: 2; }
  .timesheet td.c-out { grid-column: 2; grid-row: 2; }
  .timesheet td.c-brk { grid-column: 1 / span 2; grid-row: 3; display: flex; align-items: center; gap: 10px; }
  .timesheet td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
  }
  .timesheet td.c-brk::before { margin: 0; white-space: nowrap; }
  .timesheet .short { display: none; }
  .timesheet .long { display: inline; }
  .timesheet tfoot tr { border-bottom: 0; }
  .timesheet tfoot td { border-top: 0; }
  .timesheet tfoot td:first-child { grid-column: 1; }
}

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  background: var(--surface);
  color: var(--muted);
  border: 1.5px solid var(--border);
  font-size: .95rem;
  padding: 8px 14px;
  min-height: 40px;
}
.tabs button[aria-selected="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Content */
.content p, .content li { color: #2b3447; }
.content ul, .content ol { padding-left: 22px; }

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 10px 0 0; }

.tool-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tool-links a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.tool-links a small { display: block; font-weight: 400; color: var(--muted); }
.tool-links a:hover { border-color: var(--brand); }

/* Ad slots: empty until AdSense is added, so they take no space */
.ad-slot { margin: 24px 0; text-align: center; }
.ad-slot:empty { display: none; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .9rem;
  padding: 22px 0;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 1.55rem; }
  .card { padding: 16px; }
  .result .big { font-size: 1.6rem; }
}

@media print {
  .site-header, .site-footer, .btn-row, .ad-slot, .no-print, .faq, .content { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* Time card week rows */
.timesheet tr.wk td { background: var(--brand-soft); color: var(--brand-dark); padding: 8px 10px; }
.timesheet tr.wk-total td { font-weight: 700; border-bottom: 2px solid var(--border); }
@media (max-width: 640px) {
  .timesheet tbody tr.wk { display: block; padding: 0; border: 0; margin-top: 10px; }
  .timesheet tbody tr.wk td { display: block; border-radius: 8px; }
  .timesheet tbody tr.wk-total td:first-child { grid-column: 1; }
}
