@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/lora-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/lora-italic-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-italic-400.woff2') format('woff2');
}

:root {
  --oat: #F4EFE6;
  --paper: #FBF8F2;
  --linen: #F0E9DC;
  --thread: #E6DDCF;
  --grid: #EDE5D8;
  --ink: #3B322A;
  --umber: #6E6255;
  --stone: #8A7B6C;
  --sand: #B3A492;
  --ochre: #C6913E;
  --ochre-link: #A8732A;
  --sage: #7E9A7A;
  --clay: #B9694F;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--oat);
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ochre-link);
  text-decoration: none;
}
a:hover {
  color: var(--ink);
  text-decoration: underline;
}

h1, h2, h3 {
  font-family: 'Lora', serif;
  font-weight: 500;
  margin: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 20;
  margin-bottom: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--ochre);
}
.logo-text {
  font-family: 'Lora', serif;
  font-size: 17px;
  font-weight: 600;
}

.topbar-spacer { flex: 1; }

.topbar-label {
  font-size: 14px;
  color: var(--stone);
}

.switcher-wrap {
  position: relative;
}

.switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--thread);
  background: var(--paper);
  border-radius: 14px;
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 50, 42, .05);
}
.switcher-btn:hover {
  border-color: var(--ochre);
}
.switcher-btn .username {
  font-size: 16px;
  font-weight: 700;
}
.switcher-btn .chevron {
  font-size: 12px;
  color: var(--stone);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
  object-fit: cover;
  overflow: hidden;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 13px;
}
.avatar-xs {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  font-size: 15px;
}

.refresh-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--thread);
  background: var(--paper);
  border-radius: 12px;
  color: var(--stone);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.refresh-btn:hover {
  color: var(--ink);
  border-color: var(--ochre);
}
.refresh-btn.spinning {
  color: var(--ochre);
}
.refresh-btn.spinning span {
  display: inline-block;
  animation: spin 1.2s linear infinite;
}

/* ===== Switcher dropdown ===== */
.switcher-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  background: var(--paper);
  border: 1px solid var(--thread);
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 16px 40px rgba(59, 50, 42, .14);
}

.switcher-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--oat);
  border-radius: 11px;
  padding: 10px 14px;
  margin-bottom: 4px;
}
.switcher-search .at { color: var(--sand); }
.switcher-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  min-width: 0;
}

.recents-heading {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 8px 12px 6px;
}

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}
.recent-row:hover {
  background: var(--linen);
}
.recent-row.is-current {
  background: var(--linen);
}
.recent-row .name {
  flex: 1;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-row.is-current .name {
  font-weight: 700;
}
.recent-row .rate {
  font-size: 13px;
  color: var(--stone);
  flex: none;
}
.recent-row .when {
  width: 52px;
  text-align: right;
  font-size: 12px;
  color: var(--sand);
  flex: none;
}

/* ===== Landing ===== */
.landing {
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
  padding: 40px 24px;
  position: relative;
}
.landing-logo {
  position: absolute;
  top: 28px;
  left: 24px;
}
.landing-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
}
.landing-hero h1 {
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.landing-hero p {
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  color: var(--umber);
}

.search-form {
  width: 560px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1.5px solid var(--ochre);
  border-radius: 18px;
  padding: 6px 6px 6px 20px;
  box-shadow: 0 0 0 5px rgba(198, 145, 62, .14), 0 8px 24px rgba(59, 50, 42, .08);
}
.search-box .at {
  font-size: 22px;
  color: var(--sand);
}
.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 22px;
  color: var(--ink);
  padding: 10px 0;
  min-width: 0;
}
.search-box .enter-hint {
  font-size: 13px;
  color: var(--stone);
  background: var(--linen);
  border-radius: 8px;
  padding: 6px 10px;
}
.btn-primary {
  border: 0;
  background: var(--ink);
  color: var(--oat);
  font-weight: 700;
  font-size: 16px;
  border-radius: 13px;
  padding: 14px 22px;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--ochre);
}

.recents-box {
  margin-top: 6px;
  background: var(--paper);
  border: 1px solid var(--thread);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(59, 50, 42, .05);
}
.recents-box.empty {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.recents-box.populated {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recents-empty-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--linen);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sand);
  font-size: 18px;
  flex: none;
}
.recents-empty-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recents-empty-text .title {
  font-size: 15px;
  font-weight: 700;
  color: var(--umber);
}
.recents-empty-text .desc {
  font-size: 14px;
  color: var(--stone);
}

.landing-footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--sand);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.footer-links {
  display: flex;
  gap: 14px;
  font-size: 13px;
}
.footer-links a {
  color: var(--stone);
}
.footer-links a:hover {
  color: var(--ink);
}

/* ===== Dashboard ===== */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.heading-titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.heading h2 {
  font-size: 34px;
  letter-spacing: -.01em;
}
.heading .subline {
  font-size: 15px;
  color: var(--stone);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--paper);
  border-radius: 18px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(59, 50, 42, .04), 0 6px 20px rgba(59, 50, 42, .05);
}
.stat-card.accent-ochre { border-top: 3px solid var(--ochre); }
.stat-card.accent-sage { border-top: 3px solid var(--sage); }
.stat-card.accent-clay { border-top: 3px solid var(--clay); }
.stat-card .label { font-size: 13px; color: var(--stone); }
.stat-card .value {
  font-family: 'Lora', serif;
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
}
.stat-card .value .unit {
  font-size: 18px;
  color: var(--stone);
  margin-left: 4px;
}
.stat-card .caption { font-size: 13px; color: var(--sand); }

.chart-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 24px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 1px 2px rgba(59, 50, 42, .04), 0 6px 20px rgba(59, 50, 42, .05);
}
.chart-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chart-card-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chart-card-titles .title {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 500;
}
.chart-card-titles .subtitle {
  font-size: 14px;
  color: var(--stone);
}
.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: var(--umber);
  flex-wrap: wrap;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
.legend-swatch-bar {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--ochre);
}
.legend-swatch-dash {
  width: 18px;
  border-top: 2px dashed;
  display: inline-block;
}
.legend-swatch-line {
  width: 18px;
  border-top: 3px solid;
  border-radius: 2px;
  display: inline-block;
}
.chart-canvas-wrap {
  height: 260px;
  position: relative;
}

/* ===== Table ===== */
.table-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
}
.table-heading-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.table-heading-titles .title {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 500;
}
.table-heading-titles .subtitle {
  font-size: 14px;
  color: var(--stone);
}

.month-table {
  background: var(--paper);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(59, 50, 42, .04), 0 6px 20px rgba(59, 50, 42, .05);
  margin-top: -12px;
}
.month-table-header {
  display: grid;
  grid-template-columns: 28px 1.4fr 1fr 1fr 1fr 1fr;
  gap: 16px;
  padding: 14px 28px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--stone);
  border-bottom: 1px solid var(--grid);
}
.month-table-header .num { text-align: right; }

.month-row-wrap {
  border-bottom: 1px solid var(--grid);
}
.month-row {
  display: grid;
  grid-template-columns: 28px 1.4fr 1fr 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 28px;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font-size: 16px;
  font-family: inherit;
  color: inherit;
}
.month-row:hover {
  background: var(--oat);
}
.month-row.is-open {
  background: var(--oat);
}
.month-row .chevron {
  color: var(--sand);
  font-size: 13px;
  transition: transform .25s ease;
  width: 20px;
  text-align: center;
  transform: rotate(0deg);
}
.month-row.is-open .chevron {
  transform: rotate(90deg);
}
.month-row .month-label { font-weight: 700; }
.month-row.is-current-month {
  opacity: .68;
}
.month-row.is-current-month.is-open {
  opacity: 1;
}
.in-progress-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--stone);
  background: var(--linen);
  border-radius: 6px;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
}
.month-row .mrs-cell {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.mini-bar {
  height: 8px;
  background: var(--ochre);
  border-radius: 4px;
  opacity: .6;
  display: inline-block;
}
.month-row .mrs-cell .count {
  font-weight: 700;
  min-width: 22px;
  text-align: right;
}
.month-row .num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.month-row .num-cell .unit {
  color: var(--sand);
  font-size: 13px;
}

.month-detail {
  background: var(--oat);
  padding: 8px 28px 22px 72px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px dashed var(--thread);
}
.month-detail-header {
  display: grid;
  grid-template-columns: 1fr 120px 130px;
  gap: 16px;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sand);
}
.month-detail-header .right { text-align: right; }

.mr-row {
  display: grid;
  grid-template-columns: 1fr 120px 130px;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--grid);
}
.mr-row:hover {
  border-color: var(--ochre);
}
.mr-row .mr-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.mr-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
  flex: none;
}
.mr-row .mr-link {
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mr-row .mr-link:hover {
  color: var(--ochre-link);
}
.mr-row .mr-iid {
  font-size: 13px;
  color: var(--sand);
  flex: none;
}
.mr-row .mr-project {
  text-align: right;
  font-size: 13px;
  color: var(--stone);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mr-row .mr-ttm {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.show-all-wrap {
  padding: 16px 28px;
  display: flex;
  justify-content: center;
}
.btn-outline {
  border: 1px solid var(--thread);
  background: transparent;
  color: var(--stone);
  font-size: 14px;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
}
.btn-outline:hover {
  color: var(--ink);
  border-color: var(--ochre);
}

/* ===== Loading state ===== */
.loading-heading {
  font-family: 'Lora', serif;
  font-size: 34px;
  font-weight: 500;
  color: var(--sand);
  font-style: italic;
  margin-bottom: 8px;
}
.loading-subtext {
  font-size: 15px;
  color: var(--stone);
}
.skeleton {
  background: linear-gradient(90deg, #EFE8DB 25%, #F7F2E9 50%, #EFE8DB 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}
.skeleton-stat {
  height: 112px;
  border-radius: 18px;
}
.skeleton-chart {
  height: 320px;
  border-radius: 20px;
  background: var(--paper);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}
.skeleton-chart-title {
  width: 240px;
  height: 18px;
  border-radius: 6px;
}
.skeleton-chart-subtitle {
  width: 360px;
  height: 12px;
  border-radius: 6px;
}
.skeleton-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding-top: 24px;
}
.skeleton-bars .bar {
  flex: 1;
  border-radius: 6px 6px 3px 3px;
  background: var(--grid);
}

/* ===== Error state ===== */
.error-wrap {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-card {
  width: 560px;
  max-width: 90vw;
  background: var(--paper);
  border-radius: 20px;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
  box-shadow: 0 1px 2px rgba(59, 50, 42, .04), 0 10px 30px rgba(59, 50, 42, .07);
  border-top: 3px solid var(--clay);
}
.error-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #F3DFD8;
  color: var(--clay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 600;
}
.error-title {
  font-family: 'Lora', serif;
  font-size: 26px;
  font-weight: 500;
}
.error-desc {
  font-size: 16px;
  line-height: 1.55;
  color: var(--umber);
}
.error-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-secondary {
  border: 1px solid var(--thread);
  background: transparent;
  color: var(--umber);
  font-size: 15px;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
}
.btn-secondary:hover {
  border-color: var(--ochre);
  color: var(--ink);
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .search-form { width: 100%; }
}

@media (max-width: 640px) {
  .month-table-header,
  .month-row {
    grid-template-columns: 20px 1.4fr 0.7fr 0.7fr 0.7fr;
    gap: 8px;
    padding-left: 16px;
    padding-right: 16px;
    font-size: 14px;
  }
  .month-table-header > :last-child,
  .month-row .num-cell:last-child {
    display: none;
  }
  .month-detail {
    padding-left: 40px;
  }
  .mr-row {
    grid-template-columns: 1fr 90px;
  }
  .mr-row .mr-project {
    display: none;
  }
  .heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .topbar-label {
    display: none;
  }
}

