:root {
  --ink: #17242B;
  --ink-soft: #3C4B52;
  --paper: #EEEAE0;
  --paper-raised: #F7F4EC;
  --rule: #C9C0AC;
  --brass: #9C7A3C;
  --brass-deep: #7A5E2C;
  --gain: #3C6E47;
  --loss: #A6402E;
  --muted-line: #A79B7E;
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; }

a { color: var(--brass-deep); }
a:hover { color: var(--brass); }
a:visited { color: var(--brass-deep); }

#app-root {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  background: var(--ink);
  position: sticky;
  top: 0;
  z-index: 110;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--paper);
}

.app-shell {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 0;
  background: var(--paper-raised);
  border-right: 0px solid var(--rule);
  padding: 12px 0;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  transition: width 0.2s ease;
}

html.sidebar-open .sidebar {
  width: 240px;
  border-right-width: 1px;
}

.sidebar-link {
  display: block;
  padding: 12px 24px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: var(--paper);
  color: var(--ink);
}

.sidebar-link.active {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--brass);
  background: var(--paper);
}

button.sidebar-link {
  width: 100%;
  text-align: left;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  font-family: inherit;
  cursor: pointer;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 8px 0;
}

.sidebar-user {
  padding: 4px 24px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  white-space: normal;
}

.sidebar-user-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-line);
}

.sidebar-user-email {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  word-break: break-all;
  margin-top: 2px;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

@media (max-width: 640px) {
  .wrap { padding: 32px 18px 60px; }
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
  margin-bottom: 6px;
  gap: 16px;
  flex-wrap: wrap;
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.01em;
  margin: 0;
}

.period-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.period-arrow {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 3px 9px;
}
.period-arrow:hover:not(:disabled) { background: var(--paper-raised); color: var(--ink); }
.period-arrow:disabled { opacity: 0.35; cursor: default; }

.period-select {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 2px;
  max-width: 40vw;
}
.period-select:hover:not(:disabled) { color: var(--ink); }
.period-select:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.period-select:disabled { cursor: default; }

.subline {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 10px 0 40px;
  line-height: 1.5;
  max-width: 64ch;
}

.hero-equal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding: 30px 0;
  border-bottom: 1px solid var(--rule);
}

.hero-equal.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 22px; }
.hero-equal.cols-4 .stat-number { font-size: 30px; }

@media (max-width: 640px) {
  .hero-equal,
  .hero-equal.cols-4 { grid-template-columns: 1fr; gap: 22px; }
}

/* Annual Budget report: worked value shown in place of a not-yet-invoiced amount. */
.report-estimate { font-style: italic; color: var(--brass-deep); }

.stat-label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.stat-number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 38px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stat-number.gain { color: var(--gain); }
.stat-number.loss { color: var(--loss); }

.stat-delta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.stat-subnote {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted-line);
}

.editable-stat {
  cursor: pointer;
  border-radius: 4px;
}

.editable-stat:hover,
.editable-stat:focus {
  outline: none;
  background: var(--paper-soft, rgba(0, 0, 0, 0.04));
}

.editable-stat input {
  font: inherit;
  color: inherit;
  width: 100%;
  border: 1px solid var(--brass-deep, #999);
  border-radius: 4px;
  padding: 0 4px;
  background: var(--paper, #fff);
}

.goal-block {
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
}

.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-head-left { font-size: 14px; color: var(--ink-soft); }
.goal-head-left strong { color: var(--ink); font-weight: 600; }

.goal-track {
  height: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  background: var(--brass);
  transition: width 0.5s ease;
}

.goal-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.notes-callout {
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.notes-callout-label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.notes-callout-body {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}

.notes-callout-body.empty {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
}

section.block {
  padding: 32px 0;
  border-bottom: 1px solid var(--rule);
}

section.block h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.section-head h2 { margin: 0 0 20px; }

.section-head-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

dialog.modal {
  width: min(560px, calc(100vw - 48px));
  padding: 28px 30px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 12px 32px rgba(23, 36, 43, 0.25);
}

dialog.modal::backdrop {
  background: rgba(23, 36, 43, 0.45);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}
.modal-close:hover { color: var(--loss); }

@media (max-width: 640px) {
  dialog.modal { padding: 22px 20px; }
}

.chart-wrap { width: 100%; overflow-x: auto; }
.chart-caption {
  display: flex;
  gap: 18px;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 10px;
  flex-wrap: wrap;
}
.chart-caption span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; display: inline-block; }
.swatch.line { width: 14px; height: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: right;
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }

td {
  text-align: right;
  padding: 10px 8px 10px 0;
  border-bottom: 1px dotted var(--rule);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#employeesTable th, #workedDollarsTable th { white-space: normal; vertical-align: bottom; padding: 0 12px 10px; }
#employeesTable td, #workedDollarsTable td { padding: 10px 12px; }
#employeesTable th:first-child, #employeesTable td:first-child,
#workedDollarsTable th:first-child, #workedDollarsTable td:first-child { padding-left: 0; }
#employeesTable th:last-child, #employeesTable td:last-child,
#workedDollarsTable th:last-child, #workedDollarsTable td:last-child { padding-right: 0; }

#employeesTable .col-bold { font-weight: 700; }

td.month-cell { font-family: var(--font-body); white-space: nowrap; }

td.ytd-current { font-weight: 600; }

td.pos { color: var(--gain); }
td.neg { color: var(--loss); }
td.pct-hit { color: var(--gain); }
td.pct-miss { color: var(--loss); }

tr.report-total td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: none; }
.stat-number.neg { color: var(--loss); }

.row-actions { white-space: nowrap; }
.row-actions button {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 8px;
}
.row-actions button:hover { color: var(--loss); }
.row-actions button.notes-toggle:hover { color: var(--brass-deep); }

tr.row-viewed td { background: var(--paper-raised); }

tr.notes-row td {
  font-family: var(--font-body);
  text-align: left;
  white-space: normal;
  background: var(--paper-raised);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 12px 16px;
}

.empty-note {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  padding: 12px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid.notes-grid {
  grid-template-columns: 1fr;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}
.form-grid.two-col .span-2 {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .form-grid,
  .form-grid.two-col { grid-template-columns: 1fr; }
  .form-grid.two-col .span-2 { grid-column: auto; }
}

label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

label .hint {
  font-style: italic;
  color: var(--muted-line);
}

input[type="text"], input[type="number"], input[type="month"], input[type="date"], textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
}

textarea {
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

input:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
}
.btn:hover { background: var(--brass-deep); }

.btn-ghost {
  background: none;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { background: var(--paper-raised); color: var(--ink); }

.form-actions { display: flex; gap: 10px; align-items: center; }

.save-note {
  font-size: 12.5px;
  color: var(--gain);
  margin-left: 4px;
}

.footer-note {
  margin-top: 30px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.edit-banner {
  background: var(--paper-raised);
  border: 1px solid var(--brass);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.check-list { margin-bottom: 12px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 8px;
  cursor: pointer;
}

.hint-note {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 8px 0 12px;
}

/* Dashboard */
.dash-project { margin-bottom: 28px; }
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.dash-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.dash-stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--ink);
}
.dash-pct {
  display: inline-block;
  padding: 0 8px;
  border-radius: 3px;
  color: #fff;
}
.dash-green, .dash-fill-green { background: #3C6E47; }
.dash-yellow, .dash-fill-yellow { background: #D9B12B; }
.dash-orange, .dash-fill-orange { background: #D9822B; }
.dash-red, .dash-fill-red { background: #A6402E; }
.dash-pct.dash-yellow { color: var(--ink); }

/* Dashboard: stacked today / this week / this month usage bars */
.dash-bars { display: grid; gap: 14px; }
.dash-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 4px;
}
.dash-bar .goal-track { grid-column: 1 / -1; }
.dash-bar-label { font-size: 13px; color: var(--ink-soft); }
.dash-bar-numbers {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: right;
  white-space: nowrap;
}
.dash-bar-numbers .dash-pct { margin-left: 6px; padding: 1px 6px; }
.dash-bar-empty { border-style: dashed; }

/* "i" button + popover explaining how a remaining-hours figure was calculated (pacing.js) */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--muted-line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font: italic 600 11px/1 var(--font-display);
  text-transform: none;
  letter-spacing: 0;
  vertical-align: 1px;
  cursor: pointer;
}
.info-btn:hover, .info-btn[aria-expanded="true"] {
  background: var(--brass);
  border-color: var(--brass);
  color: #fff;
}
.info-btn:focus-visible { outline: 2px solid var(--brass-deep); outline-offset: 2px; }
.breakdown-pop {
  position: absolute;
  z-index: 50;
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  box-shadow: 0 6px 20px rgba(23, 36, 43, 0.15);
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
}
.breakdown-title { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.breakdown-pop table { width: 100%; border-collapse: collapse; }
.breakdown-pop th, .breakdown-pop td {
  padding: 3px 0;
  font-size: 13px;
  border: none;
  white-space: normal;
}
.breakdown-pop th { text-align: left; font-weight: 400; color: var(--ink-soft); padding-right: 16px; }
.breakdown-pop td { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.breakdown-pop .breakdown-result th, .breakdown-pop .breakdown-result td {
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  font-weight: 700;
  color: var(--ink);
}
.breakdown-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

.share-url-row { display: flex; gap: 10px; margin: 16px 0 4px; }
.share-url-row input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; }

/* Expense scenarios */
.form-subhead {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0 0;
}
.form-grid .span-all { grid-column: 1 / -1; }

.group-checks { display: flex; flex-wrap: wrap; gap: 0 18px; }
.group-checks .check-row { margin-bottom: 4px; }
.group-checks.compact { flex-direction: column; gap: 0; }
.group-checks.compact .check-row { font-size: 12.5px; margin: 0 0 2px; white-space: nowrap; }

td.name-cell { font-family: var(--font-body); text-align: left; }

.entry-tag {
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-soft);
}

/* The employee table is much wider than the page, so it scrolls sideways with the name column pinned. */
.scenario-table-wrap { width: 100%; overflow-x: auto; }
.scenario-table th { white-space: normal; vertical-align: bottom; padding: 0 10px 10px; min-width: 76px; }
.scenario-table td { padding: 10px; }
.scenario-table th:first-child, .scenario-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--paper);
  padding-left: 0;
  min-width: 170px;
  box-shadow: inset -1px 0 0 var(--rule);
}
.scenario-table td.groups-cell { font-family: var(--font-body); text-align: left; white-space: normal; min-width: 110px; }
.scenario-table .highlight-cell { background: var(--paper-raised); font-weight: 600; }

.scenario-table .cell-input {
  width: 92px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
}
.scenario-table .cell-input.name-input { width: 76px; font-family: var(--font-body); margin-right: 4px; }
.scenario-table .cell-input.description-input { width: 200px; font-family: var(--font-body); }
.scenario-table select.cell-input { width: auto; font-family: var(--font-body); }

.row-delete {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 6px 0 0;
}
.row-delete:hover { color: var(--loss); }

/* Inline-save state, shown as a bar on the row's pinned first cell. */
.scenario-table tr.row-saving td:first-child { box-shadow: inset 3px 0 0 var(--brass), inset -1px 0 0 var(--rule); }
.scenario-table tr.row-saved td:first-child { box-shadow: inset 3px 0 0 var(--gain), inset -1px 0 0 var(--rule); }
.scenario-table tr.row-error td:first-child { box-shadow: inset 3px 0 0 var(--loss), inset -1px 0 0 var(--rule); }
.scenario-table tr.row-saving td:first-child,
.scenario-table tr.row-saved td:first-child,
.scenario-table tr.row-error td:first-child { padding-left: 8px; }

/* Import page: the hint under each import mode sits tight to its option. */
.import-modes .hint-note { margin: -4px 0 12px 24px; }

/* Blog and news post editors */
.md-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.md-tabs button {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
}
.md-tabs button.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
textarea.md-body { min-height: 420px; font-family: var(--font-mono); font-size: 14px; }
.md-preview {
  min-height: 420px;
  padding: 4px 16px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  line-height: 1.65;
  overflow-wrap: break-word;
}
.md-preview pre { overflow-x: auto; }
.md-preview img, .md-preview iframe { max-width: 100%; }
.post-select { font-family: var(--font-body); font-size: 15px; padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper-raised); color: var(--ink); }
.status-pill {
  display: inline-block;
  padding: 1px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.status-pill.live { border-color: var(--gain); color: var(--gain); }

/* Contact messages: long, multi-line text rather than numbers */
#messagesTable td { vertical-align: top; text-align: left; font-family: var(--font-body); }
#messagesTable td.message-received { white-space: nowrap; color: var(--ink-soft); }
#messagesTable td.message-from { white-space: nowrap; padding-right: 20px; }
#messagesTable td.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; min-width: 240px; }

/* Time off: notes wrap; each person's entries get a small heading */
.time-off-table td.time-off-notes { white-space: normal; font-family: var(--font-body); text-align: left; min-width: 180px; }
.time-off-table th:nth-child(4) { text-align: left; }
.time-off-totals { font-size: 13px; color: var(--ink-soft); margin: -8px 0 16px; }
.time-off-totals:empty { display: none; }
.time-off-person { margin-top: 24px; }
.time-off-person h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.time-off-person .section-head-actions { margin-bottom: 12px; }
.time-off-person .hint-note { margin: 0 0 12px; }
