:root {
  color-scheme: light;
  --ink: #182026;
  --muted: #687580;
  --line: #dce3e8;
  --paper: #ffffff;
  --wash: #eef3f6;
  --brand: #0c7c86;
  --brand-dark: #065b63;
  --gold: #c9861a;
  --done: #218553;
  --danger: #b93232;
  --shadow: 0 18px 45px rgba(24, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 243, 246, 0.94), rgba(238, 243, 246, 1)),
    repeating-linear-gradient(135deg, rgba(12, 124, 134, 0.08) 0 2px, transparent 2px 18px);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 4vw, 42px);
  background: #14232a;
  color: #ffffff;
}

.topbar h1,
.section-heading h2,
.dialog-form h2,
.history h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.shift-clock {
  min-width: 158px;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  text-align: right;
}

.shift-clock span,
.shift-clock strong {
  display: block;
}

.shift-clock span {
  color: #cbd8de;
  font-size: 0.85rem;
}

.shift-clock strong {
  font-size: 1.45rem;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.45fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 32px) 32px;
}

.job-panel,
.task-panel,
.notes-panel {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.job-panel,
.task-panel,
.notes-panel,
.dialog-form {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: 1.25rem;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
  font-size: 1.35rem;
  font-weight: 800;
}

.icon-button:hover,
.template-tab:hover,
.text-button:hover {
  border-color: var(--brand);
}

.job-form,
.signoff-grid {
  display: grid;
  gap: 12px;
}

label {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 124, 134, 0.12);
}

.meter-block {
  margin: 18px 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf1;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--done));
  transition: width 180ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stats-grid div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.stats-grid span,
.task-meta,
.history-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

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

.template-tab,
.text-button,
.dialog-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.template-tab.active {
  border-color: var(--brand);
  background: #e9f6f6;
  color: var(--brand-dark);
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: #ffffff;
}

.task-card.done {
  border-left-color: var(--done);
  background: #f3faf6;
}

.task-card.running {
  border-left-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 134, 26, 0.13);
}

.task-check {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--done);
}

.task-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 850;
}

.task-meta {
  margin-top: 5px;
  text-transform: none;
}

.task-mini-checks {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-check-title {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.mini-check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--done);
}

.mini-check.disabled {
  background: #edf1f3;
  color: #8b969e;
  cursor: not-allowed;
  opacity: 0.65;
}

.task-assignee {
  display: grid;
  max-width: 240px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.task-assignee select {
  min-height: 38px;
}

.task-controls {
  display: grid;
  grid-template-columns: 92px 58px;
  gap: 8px;
  align-items: center;
}

.task-time {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
}

.timer-button {
  display: inline-grid;
  width: 58px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
}

.timer-button.stop {
  background: var(--danger);
}

.notes-field {
  display: block;
  margin-bottom: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink);
  font-size: 0.95rem;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--done);
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin: 18px 0;
  border: 0;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #ffffff;
  font-weight: 900;
}

.primary-action:hover,
.timer-button:hover {
  filter: brightness(0.94);
}

.history {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.history-item strong {
  display: block;
  margin: 3px 0;
}

dialog {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 35, 42, 0.55);
}

.dialog-form {
  display: grid;
  gap: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions button {
  min-width: 92px;
  padding: 0 14px;
}

.dialog-actions button:last-child {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr 1fr;
  }

  .task-panel {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

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

  .shift-clock {
    width: 100%;
    padding: 12px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
    text-align: left;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .task-controls {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 58px;
  }

  .task-time {
    text-align: left;
  }
}
