:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --border: #d7dfdc;
  --text: #17211d;
  --muted: #66736e;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --shadow: 0 18px 45px rgba(20, 35, 30, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

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

.content {
  padding: 22px 24px 32px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(460px, calc(100vw - 32px));
  margin: 10vh auto 0;
  padding: 24px;
}

.login-panel h1,
.panel h2 {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.button:hover {
  background: var(--accent-strong);
}

.button.secondary {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff7ed;
  color: #8a3b0c;
  border: 1px solid #fed7aa;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar .wide {
  grid-column: span 2;
}

.summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.matrix-wrap {
  overflow: auto;
  max-height: calc(100vh - 245px);
}

.matrix {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.project-col {
  width: clamp(230px, 24vw, 310px);
}

.month-col {
  width: clamp(58px, 4.6vw, 66px);
}

.total-col {
  width: 76px;
}

.matrix th,
.matrix td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.matrix th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8faf9;
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.matrix th:not(.project-head):not(.total-head) {
  min-width: 58px;
  max-width: 66px;
}

.matrix .project-head,
.matrix .project-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  text-align: left;
  min-width: 230px;
  max-width: 310px;
  background: #fff;
}

.matrix .project-cell {
  padding: 6px 10px;
}

.project-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.project-line strong {
  flex: 0 0 auto;
}

.project-line span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hours-cell {
  min-width: 58px;
  max-width: 66px;
  height: 32px;
  text-align: center;
  font-weight: 400;
  color: #102019;
  font-size: clamp(11px, 1vw, 13px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding: 0 3px;
}

.hours-cell.empty {
  color: #b9c3bf;
  background: #fbfcfc;
  font-weight: 400;
}

.total-head,
.total-cell {
  min-width: 76px;
  max-width: 76px;
}

.month-head {
  display: grid;
  gap: 1px;
  line-height: 1.05;
}

.month-head span {
  color: #8a9691;
  font-size: 10px;
  font-weight: 400;
}

.month-head strong {
  color: var(--muted);
  font-size: clamp(10px, 0.95vw, 12px);
  font-weight: 700;
}

.empty-state {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar .wide {
    grid-column: auto;
  }

  .content {
    padding: 14px;
  }
}
