:root {
  --ink: #171717;
  --muted: #666b73;
  --line: #d9dde4;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --sage: #dfe8dd;
  --teal: #0e6f72;
  --gold: #b9822d;
  --red: #b44535;
  --blue: #2d5b9a;
  --shadow: 0 14px 35px rgba(20, 26, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

button:hover {
  filter: brightness(0.95);
}

.app-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #f3f5f1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
}

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

.brand h1,
.brand p,
.topbar h2,
.date-line,
.metric p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p,
.date-line,
.status-line,
.metric p,
.meta {
  color: var(--muted);
  font-size: 13px;
}

.view-tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-color: transparent;
  border-left: 4px solid transparent;
}

.tab.active {
  background: #fff;
  border-color: var(--line);
  border-left-color: var(--teal);
  box-shadow: var(--shadow);
}

.side-block,
.sync-panel {
  display: grid;
  gap: 8px;
}

label,
.panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #34383f;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px;
  border-radius: 0;
}

textarea {
  resize: vertical;
}

.sync-panel {
  margin-top: auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
  box-shadow: var(--shadow);
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar h2 {
  font-size: 34px;
  line-height: 1;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
}

.metric span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.task-board {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.segmented button {
  border: 0;
  background: #fff;
  color: var(--ink);
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.task-list {
  display: grid;
}

.task-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.task-card > div {
  min-width: 0;
}

.task-list.compact .task-card {
  padding: 8px 12px;
}

.task-card.done {
  background: #f7f7f4;
}

.task-card.done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 0;
  line-height: 18px;
}

.check.is-done {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.task-title {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
}

.task-notes {
  margin-top: 5px;
  color: #3f444b;
  line-height: 1.35;
  display: -webkit-box;
  max-height: 58px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

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

.chip {
  border: 1px solid var(--line);
  background: #f8f8f4;
  color: #3f444b;
  padding: 3px 7px;
  font-size: 12px;
}

.chip.hot {
  border-color: #e0b5ae;
  background: #fff1ef;
  color: var(--red);
}

.chip.google {
  border-color: #adc6ef;
  background: #eef5ff;
  color: var(--blue);
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.icon-button {
  min-width: 32px;
  min-height: 32px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

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

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 1px solid var(--line);
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

form h3 {
  margin: 0;
  font-size: 24px;
}

form label {
  display: grid;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 0;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .view-tabs {
    grid-template-columns: repeat(5, 1fr);
  }

  .tab {
    text-align: center;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .tab.active {
    border-left-color: var(--line);
    border-bottom-color: var(--teal);
  }

  .metrics,
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }

  .view-tabs,
  .metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: 28px 1fr;
  }

  .card-actions {
    grid-column: 2;
  }
}
