:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9dee7;
  --red: #dc2626;
  --yellow: #ca8a04;
  --green: #16a34a;
  --blue: #2563eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
}
button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  border-radius: 7px;
  padding: 9px 12px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand {
  font-weight: 800;
  font-size: 20px;
}
.nav {
  display: flex;
  gap: 4px;
  overflow: auto;
}
.nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 7px;
  white-space: nowrap;
}
.nav a.active {
  background: #edf2ff;
  color: var(--blue);
}
.session {
  display: flex;
  align-items: center;
  gap: 8px;
}
.session span::before,
.signin-list span {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--user-color);
}
.session button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto 60px;
}
.narrow { width: min(820px, calc(100% - 28px)); }
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 34px; letter-spacing: 0; }
h2 { font-size: 19px; margin-bottom: 5px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.lead {
  color: var(--muted);
  line-height: 1.5;
}
.stats {
  min-width: 104px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
}
.stats strong { display: block; font-size: 24px; }
.stats span, .meta, .list-head p, .empty {
  color: var(--muted);
}

.filters,
.quick-capture,
.date-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
}
.filters select,
.filters input { min-height: 42px; }
.filters a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  padding: 0 8px;
}
.mode-switch {
  display: flex;
  margin: -6px 0 16px;
}
.mode-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}
.notification-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.notification-panel p {
  margin: 0;
  color: var(--muted);
}
.notification-panel button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.quick-capture input { flex: 1 1 420px; }
.more-options {
  position: relative;
}
.more-options summary {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}
.more-options summary::-webkit-details-marker { display: none; }
.more-options > div {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 2;
  display: grid;
  gap: 10px;
  min-width: 260px;
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 35px rgba(24, 33, 47, 0.14);
}
.more-options label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.more-options select,
.more-options input { width: 100%; }

.board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.list,
.inbox-strip,
.unresolved-panel,
.capture-box,
.map-editor,
.day,
.review-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.list { padding: 14px; }
.unresolved-panel {
  margin-bottom: 14px;
  padding: 14px;
  border-color: #f5c6c6;
  background: #fffafa;
}
.peace-board {
  grid-template-columns: 1fr;
}
.peace-sections {
  display: grid;
  gap: 14px;
}
.list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tag {
  align-self: start;
  color: var(--muted);
  background: #f1f3f7;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}
.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 0;
  border-top: 1px solid #eef1f5;
}
.item-main {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
  min-width: 0;
}
.priority {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  vertical-align: middle;
}
.priority.red { background: var(--red); }
.priority.yellow { background: var(--yellow); }
.priority.green { background: var(--green); }
.item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.item.checked .item-title {
  color: var(--muted);
  text-decoration: line-through;
}
.item.skipped .item-title { color: var(--muted); }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
  font-size: 12px;
}
.meta span, .meta strong {
  background: #f5f6f8;
  border-radius: 999px;
  padding: 3px 7px;
}
.meta .reason {
  background: #edf2ff;
  color: var(--blue);
  font-weight: 700;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}
.actions button {
  min-width: 78px;
  padding: 7px 9px;
}
.actions form:last-child button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.postpone-menu {
  position: relative;
}
.postpone-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 35px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}
.postpone-menu summary::-webkit-details-marker { display: none; }
.postpone-menu > div {
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 2;
  display: grid;
  gap: 6px;
  min-width: 190px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 35px rgba(24, 33, 47, 0.14);
}
.postpone-menu button,
.postpone-date input {
  width: 100%;
}
.postpone-date {
  display: grid;
  gap: 6px;
}
.inbox-strip {
  margin-top: 14px;
  padding: 14px;
}
.inbox-strip p {
  margin-bottom: 7px;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth section {
  width: min(560px, 100%);
}
.signin-list {
  display: grid;
  gap: 10px;
}
.signin-list button {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 8px 12px;
  align-items: center;
  text-align: left;
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.signin-list small {
  grid-column: 2;
  color: var(--muted);
}
.error {
  color: var(--red);
  font-weight: 700;
}

.capture-box,
.map-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}
.organize-editor {
  display: grid;
  gap: 10px;
}
.organize-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.organize-editor textarea {
  min-height: 620px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}
.organize-help {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.organize-help summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}
.organize-help > div {
  display: grid;
  gap: 7px;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 13px;
}
.organize-help p {
  margin: 0;
}
.organize-help code,
.organize-help pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.organize-help code {
  padding: 1px 4px;
  border-radius: 4px;
  background: white;
  color: var(--ink);
}
.organize-help pre {
  overflow-x: auto;
  margin: 4px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  line-height: 1.45;
}
.notice {
  padding: 10px 12px;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
}
textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.45;
}
.capture {
  padding: 11px 0;
  border-top: 1px solid #eef1f5;
}
.week-list {
  display: grid;
  gap: 12px;
}
.day {
  padding: 12px;
}
.day ul {
  display: grid;
  gap: 6px;
  padding-left: 0;
  color: var(--muted);
  list-style: none;
}
.day li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: baseline;
  margin-bottom: 0;
  line-height: 1.35;
}
.day li .priority {
  justify-self: center;
  margin-top: 0;
}
.week-item-text {
  min-width: 0;
}
.day li span:not(.priority) {
  color: var(--muted);
  font-size: 12px;
}
.day li .week-item-text {
  color: var(--muted);
  font-size: 15px;
}
.day li .week-item-text span {
  margin-left: 4px;
  white-space: nowrap;
}
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.review-summary article {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.review-summary strong {
  display: block;
  font-size: 26px;
}
.review-summary span {
  color: var(--muted);
}
.review-card {
  padding: 14px;
  border-top: 4px solid var(--user-color);
}
.review-patterns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.review-patterns article {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.review-patterns p {
  color: var(--muted);
}
.review-patterns ol {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}
.review-patterns li {
  padding-left: 4px;
}
.review-patterns li span {
  overflow-wrap: anywhere;
}
.review-patterns li strong {
  float: right;
  margin-left: 10px;
}
.review-patterns small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .session { justify-content: space-between; }
  .page-head { align-items: stretch; }
  .board { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .actions { justify-content: start; }
  .notification-panel { align-items: stretch; flex-direction: column; }
  h1 { font-size: 28px; }
}
