:root {
  --paper: #f7f7f1;
  --paper-2: #ededdf;
  --ink: #151515;
  --muted: #686861;
  --line: #d7d3c5;
  --white: #ffffff;
  --red: #e64a35;
  --teal: #087f73;
  --teal-soft: #b9ebe3;
  --yellow: #f0b83c;
  --blue: #306ed8;
  --shadow: 7px 7px 0 var(--ink);
  --soft-shadow: 0 22px 70px rgba(21, 21, 21, .12);
  --radius: 8px;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 21, 21, .04) 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(rgba(21, 21, 21, .04) 1px, transparent 1px) 0 0 / 38px 38px,
    var(--paper);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100svh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 2px solid var(--ink);
  background: rgba(247, 247, 241, .9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.product-brand {
  transition: transform .16s ease;
}

.product-brand:hover {
  transform: translateY(-1px);
}

.brand-mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 44%, var(--ink) 44%, var(--ink) 56%, transparent 56%),
    linear-gradient(var(--red), var(--red));
  background-position: 0 0, 50% 50%;
  background-repeat: no-repeat;
  background-size: 100% 100%, 54% 54%;
  box-shadow: 5px 5px 0 var(--yellow);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.topbar-controls,
.day-nav,
.dialog-actions,
.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.date-control input,
.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  box-shadow: 3px 3px 0 rgba(21, 21, 21, .13);
}

.date-control input:focus,
.field input:focus,
.field select:focus {
  box-shadow: 4px 4px 0 var(--yellow);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(420px, 1fr) minmax(290px, 380px);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 34px) 34px;
}

.workspace > *,
.form-grid,
.field,
.task-card,
.calendar-grid,
.calendar-lane {
  min-width: 0;
}

.task-composer,
.agenda-panel,
.task-board {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--soft-shadow);
}

.task-composer,
.task-board {
  height: calc(100svh - 98px);
  overflow: auto;
}

.task-composer {
  padding: 16px;
}

.section-title,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-title {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--teal);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

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

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-action,
.ghost-action,
.text-button,
.icon-button,
.task-pill,
.tab {
  min-height: 38px;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary-action {
  background: var(--ink);
  color: var(--white);
  padding: 0 14px;
  box-shadow: 4px 4px 0 var(--red);
}

.ghost-action {
  padding: 0 14px;
  box-shadow: 4px 4px 0 var(--yellow);
}

.text-button {
  min-height: 34px;
  border-color: var(--line);
  padding: 0 10px;
  font-size: 13px;
}

.text-button.strong {
  border-color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.primary-action:hover,
.ghost-action:hover,
.text-button:hover,
.icon-button:hover,
.task-pill:hover,
.tab:hover {
  transform: translate(2px, 2px);
}

.primary-action:hover {
  box-shadow: 2px 2px 0 var(--red);
}

.ghost-action:hover {
  box-shadow: 2px 2px 0 var(--yellow);
}

.agenda-panel {
  min-height: calc(100svh - 98px);
  overflow: hidden;
}

.panel-head {
  padding: 18px;
  border-bottom: 2px solid var(--ink);
  background:
    linear-gradient(135deg, rgba(8, 127, 115, .12) 0 28%, transparent 28% 100%),
    #fefbf3;
}

.kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  letter-spacing: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
}

h2 {
  font-size: 32px;
}

.overdue-stack {
  display: grid;
  gap: 10px;
  padding: 0 18px;
  background: #fefbf3;
}

.overdue-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #ffd8d1;
  box-shadow: 5px 5px 0 var(--red);
}

.overdue-card strong {
  display: block;
  margin-bottom: 3px;
}

.overdue-card span {
  color: #6b3028;
  font-size: 13px;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  height: calc(100svh - 198px);
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(21, 21, 21, .035) 1px, transparent 1px) 0 0 / 30px 30px,
    var(--white);
}

.hour-rail,
.calendar-lane {
  position: relative;
  min-height: 720px;
}

.hour-rail {
  border-right: 2px solid var(--ink);
  background: #fbfbf7;
}

.hour-label {
  position: absolute;
  right: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--line);
}

.calendar-event {
  position: absolute;
  left: 14px;
  right: 14px;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 38px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--teal-soft);
  padding: 9px 11px;
  box-shadow: 5px 5px 0 rgba(21, 21, 21, .18);
}

.calendar-event:nth-of-type(3n) {
  background: #ffe9a8;
}

.calendar-event:nth-of-type(4n) {
  background: #d7e4ff;
}

.calendar-event.is-done {
  opacity: .62;
  text-decoration: line-through;
}

.calendar-event strong {
  font-size: 14px;
  line-height: 1.18;
}

.calendar-event span {
  color: #33332f;
  font-size: 12px;
  font-weight: 700;
}

.task-board {
  display: flex;
  flex-direction: column;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-bottom: 2px solid var(--ink);
}

.tab {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 8px;
  font-size: 12px;
}

.tab:last-child {
  border-right: 0;
}

.tab.is-active {
  background: var(--yellow);
}

.task-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.task-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-left-width: 7px;
  border-radius: var(--radius);
  background: #fbfbf7;
  box-shadow: 4px 4px 0 rgba(21, 21, 21, .12);
}

.task-card[data-status="planned"] {
  border-left-color: var(--teal);
}

.task-card[data-status="backlog"] {
  border-left-color: var(--yellow);
}

.task-card[data-status="done"] {
  border-left-color: var(--blue);
}

.task-title {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-pill {
  min-height: 26px;
  border-width: 1px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: default;
}

.task-actions {
  flex-wrap: wrap;
  align-items: stretch;
}

.task-actions button {
  flex: 1 1 auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.metric {
  min-height: 76px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbf7;
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
}

.metric span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.empty-state {
  padding: 18px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.slot-dialog {
  max-width: min(520px, calc(100vw - 28px));
  border: 0;
  background: transparent;
  padding: 0;
}

.slot-dialog::backdrop {
  background: rgba(21, 21, 21, .42);
}

.dialog-card {
  display: grid;
  gap: 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white);
  padding: 18px;
  box-shadow: var(--shadow);
}

.dialog-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 340px) minmax(420px, 1fr);
  }

  .task-board {
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }

  .task-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .task-composer,
  .agenda-panel,
  .task-board {
    height: auto;
    min-height: 0;
  }

  .calendar-grid {
    height: 620px;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .task-list {
    grid-template-columns: 1fr;
  }

  .overdue-card,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .overdue-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .form-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding-inline: 12px;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .date-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
  }

  .date-control input {
    width: 100%;
  }

  .day-nav,
  .dialog-actions {
    flex-wrap: wrap;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Compact product mode: keeps the visual style, but fits more work on screen. */
body {
  font-size: 14px;
}

.topbar {
  gap: 14px;
  padding: 10px clamp(12px, 2.4vw, 24px);
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.brand strong {
  font-size: 16px;
}

.brand span,
.date-control,
.text-button {
  font-size: 12px;
}

.date-control input,
.field input,
.field select {
  min-height: 36px;
  padding: 0 9px;
}

.workspace {
  grid-template-columns: minmax(250px, 300px) minmax(390px, 1fr) minmax(270px, 340px);
  gap: 12px;
  padding: 12px clamp(12px, 2.4vw, 24px) 24px;
}

.task-composer,
.task-board {
  height: calc(100svh - 76px);
}

.agenda-panel {
  min-height: calc(100svh - 76px);
}

.task-composer,
.panel-head,
.dialog-card {
  padding: 12px;
}

.section-title {
  margin-bottom: 10px;
  font-size: 12px;
}

.form-grid {
  gap: 9px;
}

.field {
  gap: 4px;
}

.field span,
.kicker,
.tab,
.task-pill,
.metric span,
.hour-label,
.calendar-event span {
  font-size: 11px;
}

.primary-action,
.ghost-action,
.text-button,
.icon-button,
.task-pill,
.tab {
  min-height: 34px;
}

.text-button {
  min-height: 30px;
}

.primary-action,
.ghost-action {
  padding: 0 12px;
  box-shadow: 3px 3px 0 var(--red);
}

.ghost-action {
  box-shadow: 3px 3px 0 var(--yellow);
}

.icon-button {
  width: 36px;
  height: 36px;
  font-size: 20px;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
}

h2 {
  font-size: 26px;
}

.overdue-stack {
  gap: 8px;
  padding: 0 12px;
}

.overdue-card,
.task-card {
  gap: 8px;
  padding: 10px;
}

.overdue-card {
  margin-top: 10px;
}

.calendar-grid {
  grid-template-columns: 58px minmax(0, 1fr);
  height: calc(100svh - 154px);
}

.hour-rail,
.calendar-lane {
  min-height: 640px;
}

.hour-label {
  right: 9px;
}

.calendar-event {
  left: 10px;
  right: 10px;
  min-height: 32px;
  padding: 7px 9px;
  box-shadow: 3px 3px 0 rgba(21, 21, 21, .18);
}

.calendar-event strong {
  font-size: 13px;
}

.task-list {
  gap: 8px;
  padding: 10px;
}

.task-meta {
  gap: 5px;
  margin-top: 6px;
}

.task-pill {
  min-height: 22px;
  padding: 1px 6px;
}

.metrics {
  margin-top: 12px;
}

.metric {
  min-height: 58px;
  padding: 9px;
}

.metric strong {
  font-size: 22px;
}

.empty-state {
  padding: 14px;
}

.dialog-card {
  gap: 14px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(250px, 300px) minmax(390px, 1fr);
  }

  .task-board {
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }

  .task-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .task-composer,
  .agenda-panel,
  .task-board {
    height: auto;
    min-height: 0;
  }

  .calendar-grid {
    height: 560px;
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .task-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .form-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding-inline: 12px;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .date-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
  }

  .date-control input {
    width: 100%;
  }

  .day-nav,
  .dialog-actions {
    flex-wrap: wrap;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
