/* ShiftCraft — refined editorial-planner styling.
   Warm paper, ink type, a single deep-teal accent, hairline rota grid. */

:root {
  --paper:      #faf8f4;
  --paper-2:    #f3efe7;
  --surface:    #ffffff;
  --ink:        #1c1815;
  --ink-2:      #46403a;
  --muted:      #726a5e;
  --line:       #e7e0d5;
  --line-strong:#d8cfc0;
  --accent:     #0f766e;
  --accent-700: #0c5d57;
  --accent-soft:#e6f1ef;
  --weekend:    #f6f2ea;
  --total-bg:   #fbf6ec;
  --warn:       #b3541e;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(28,24,21,.04), 0 12px 30px -16px rgba(28,24,21,.22);
  --shadow-sm:  0 1px 2px rgba(28,24,21,.06);
  --ease:       cubic-bezier(.22,.61,.36,1);
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "Hanken Grotesk", ui-monospace, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* faint planner grid in the page backdrop — pure CSS, zero requests */
  background-image:
    linear-gradient(to bottom, rgba(15,118,110,.05), rgba(15,118,110,0) 380px),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 380px, 32px 32px, 32px 32px;
  background-position: 0 0, 0 0, 0 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 36px) 64px;
}

.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;
}

/* ---------- App bar ---------- */
.appbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  animation: rise .5s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 14px; }
.mark { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 6px 14px rgba(15,118,110,.28)); }
.mark > rect { fill: var(--accent); }
.mark-cells rect { fill: #fff; }
.mark-cells .dim { fill: #fff; opacity: .42; }
.brand-text { line-height: 1.1; }
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -.02em;
  margin: 0;
  color: var(--ink);
}
.tagline { margin: 3px 0 0; color: var(--muted); font-size: 14.5px; }

/* ---------- Toolbar / buttons ---------- */
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.btn:hover { border-color: var(--accent); color: var(--accent-700); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #14857c, var(--accent-700));
  border-color: var(--accent-700);
  box-shadow: 0 1px 2px rgba(12,93,87,.4), 0 10px 22px -12px rgba(12,93,87,.8);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--paper-2); color: var(--warn); border-color: transparent; transform: none; }
.plus { font-weight: 700; margin-right: 1px; }

/* ---------- Meta row ---------- */
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  animation: rise .5s var(--ease) .04s both;
}
.weekpick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  box-shadow: var(--shadow-sm);
}
.weekpick input {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 999px;
  padding: 5px 12px;
}
.weekpick input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.stats { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.stat b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.saved {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 4px 11px; border-radius: 999px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.saved.flash { animation: savedpulse .8s var(--ease); }

/* ---------- Grid card ---------- */
.grid-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .55s var(--ease) .08s both;
}
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  font-size: 14px;
}
.grid thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  text-align: center;
  font-weight: 600;
  color: var(--ink-2);
  padding: 13px 8px 11px;
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}
.grid thead .col-name { text-align: left; }
.col-day .dname { display: block; font-weight: 700; letter-spacing: .01em; }
.col-day .ddate { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 1px; min-height: 13px; font-variant-numeric: tabular-nums; }
.col-day.weekend, td.weekend { background: var(--weekend); }
.col-name { width: 24%; min-width: 168px; }
.col-day { width: 9%; }
.col-total { width: 11%; min-width: 86px; background: var(--total-bg); }
.col-x { width: 40px; }

/* sticky first column so names stay visible while scrolling days */
.grid th.col-name, .grid td.cell-name { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.grid thead th.col-name { z-index: 4; }

.grid tbody td { border-bottom: 1px solid var(--line); padding: 0; vertical-align: middle; }
.grid tbody tr { transition: background .12s var(--ease); }
.grid tbody tr:hover { background: #fcfbf8; }
.grid tbody tr:hover .cell-name { background: #fcfbf8; }
.grid tbody tr.row-enter { animation: rowin .32s var(--ease) both; }

/* name cell */
.cell-name { padding: 6px 8px 6px 16px !important; }
.name-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.name-input::placeholder { color: var(--muted); font-weight: 500; }
.name-input:hover { background: var(--paper); }
.name-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }

/* day hour cells */
td.cell { text-align: center; position: relative; transition: background .18s var(--ease); }
td.cell[data-tier="1"] { background: rgba(15,118,110,.05); }
td.cell[data-tier="2"] { background: rgba(15,118,110,.10); }
td.cell[data-tier="3"] { background: rgba(15,118,110,.17); }
td.cell[data-tier="4"] { background: rgba(15,118,110,.25); }
td.cell.weekend[data-tier="0"] { background: var(--weekend); }
.hour-input {
  width: 100%;
  height: 46px;
  text-align: center;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 0 2px;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.hour-input::-webkit-outer-spin-button,
.hour-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hour-input::placeholder { color: #cdc6bb; font-weight: 500; }
.hour-input:hover { border-color: var(--line-strong); }
.hour-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }

/* weekly total cell */
td.cell-total {
  text-align: center;
  background: var(--total-bg);
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--accent-700);
  padding: 0 8px;
}
td.cell-total .zero { color: var(--muted); font-weight: 600; }

/* remove button */
td.cell-x { text-align: center; }
.row-remove {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  opacity: .5;
  transition: all .15s var(--ease);
}
tr:hover .row-remove { opacity: 1; }
.row-remove:hover { background: #fbeae0; color: var(--warn); border-color: #f0d3c2; }
.row-remove:focus-visible { outline: 2px solid var(--warn); outline-offset: 1px; opacity: 1; }

/* footer rows */
.grid tfoot td, .grid tfoot th {
  border-top: 1.5px solid var(--line-strong);
  padding: 12px 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.grid tfoot th {
  text-align: left; padding-left: 16px;
  font-weight: 700; color: var(--ink); white-space: nowrap;
}
.foot-sub { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.foot-coverage td { padding: 9px 8px; }
.foot-hours { background: var(--total-bg); }
.foot-hours td { color: var(--ink-2); font-weight: 600; font-family: var(--mono); }
.foot-hours #grandTotal, .grid tfoot td.col-total { color: var(--accent-700); font-weight: 700; }

.cover-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 26px; padding: 0 9px;
  border-radius: 999px;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--paper-2); color: var(--muted);
}
.cover-pill[data-on="1"] { background: var(--accent-soft); color: var(--accent-700); }
.cover-pill[data-on="2"] { background: rgba(15,118,110,.16); color: var(--accent-700); }
.cover-pill[data-on="3"] { background: var(--accent); color: #fff; }

/* ---------- Empty state ---------- */
.empty { padding: 56px 24px 64px; text-align: center; }
.empty-mark {
  width: 56px; height: 56px; margin: 0 auto 18px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.empty-mark span { border-radius: 7px; background: var(--paper-2); }
.empty-mark span:nth-child(1), .empty-mark span:nth-child(4) { background: var(--accent-soft); }
.empty h2 { font-family: var(--serif); font-weight: 600; font-size: 23px; margin: 0 0 8px; letter-spacing: -.01em; }
.empty p { max-width: 430px; margin: 0 auto 22px; color: var(--muted); font-size: 15px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Page footer ---------- */
.pagefoot { margin-top: 22px; color: var(--ink-2); font-size: 13.5px; }
.pagefoot p { margin: 6px 0; }
.pagefoot .muted { color: var(--muted); }
.pagefoot code, .pagefoot kbd {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; color: var(--ink-2);
}
.pagefoot kbd { box-shadow: 0 1px 0 var(--line-strong); }

/* print title (screen-hidden) */
.print-title { display: none; }

/* ---------- SEO content (below the tool) ---------- */
.wordmark { display: block; }
.seo {
  margin: 40px auto 6px;
  max-width: 820px;
  padding: 30px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.seo h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.18;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0 0 14px;
}
.seo h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17.5px;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 26px 0 8px;
}
.seo p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.62; }
.seo-lead { font-size: 16.5px !important; color: var(--ink-2); }
.seo strong { color: var(--ink); font-weight: 600; }
.seo-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 38px;
  margin-top: 22px;
}
.seo-cols h2 { margin-top: 6px; }
.seo ul, .seo-steps { margin: 0 0 8px; padding-left: 20px; }
.seo ul li, .seo-steps li { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.seo ul { list-style: none; padding-left: 4px; }
.seo ul li { position: relative; padding-left: 22px; }
.seo ul li::before {
  content: ""; position: absolute; left: 2px; top: .62em;
  width: 7px; height: 7px; border-radius: 2px; background: var(--accent);
}
.seo-steps li { margin: 4px 0; padding-left: 4px; }
.seo-steps li::marker { color: var(--accent); font-weight: 700; }
@media (max-width: 640px) {
  .seo-cols { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rowin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes savedpulse {
  0% { background: var(--accent); color: #fff; }
  100% { background: var(--accent-soft); color: var(--accent); }
}
.saved.flash::before { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .appbar { align-items: flex-start; }
  .toolbar { width: 100%; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .meta { gap: 10px; }
}

/* ---------- Print: clean rota sheet ---------- */
@media print {
  @page { margin: 14mm; }
  body {
    background: #fff !important;
    background-image: none !important;
    color: #000;
  }
  .page { max-width: none; padding: 0; }
  .appbar .toolbar, .btn, .weekpick, .saved, .sep, .pagefoot,
  .col-x, .cell-x, .row-remove, .empty, .seo { display: none !important; }
  .appbar { margin-bottom: 4px; }
  .tagline { display: none; }
  .meta { justify-content: flex-start; margin: 0 0 10px; }
  .stats { color: #333; font-size: 12px; }
  .print-title {
    display: block;
    font-family: var(--serif);
    font-size: 16px; font-weight: 600;
    margin: 0 0 12px; color: #000;
  }
  .grid-card { border: none; box-shadow: none; border-radius: 0; }
  .scroll { overflow: visible; }
  table.grid { min-width: 0; font-size: 11px; }
  .grid thead th { position: static; border-bottom: 1.5px solid #000; color: #000; padding: 6px 4px; }
  .grid td.cell, .grid td.cell-total, .grid tbody td, .grid tfoot td, .grid tfoot th {
    border: 1px solid #999 !important; background: #fff !important; color: #000 !important;
  }
  .grid th.col-name, .grid td.cell-name { position: static; }
  .name-input, .hour-input {
    border: none !important; background: transparent !important; box-shadow: none !important;
    color: #000 !important; height: auto; font-family: var(--sans); font-weight: 600;
    -webkit-text-fill-color: #000;
  }
  .hour-input { font-family: var(--mono); }
  .cover-pill { background: transparent !important; color: #000 !important; font-weight: 700; }
  td.cell-total, .foot-hours #grandTotal { color: #000 !important; }
  .col-day .ddate { color: #333; }
}
