:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1b1f24;
  --muted: #5c6672;
  --line: #d9dee5;
  --accent: #176b5d;
  --accent-strong: #0f4f45;
  --warning: #9b2c2c;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 24px;
}

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

.nav a,
.nav button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: #eaf3f1;
}

.main {
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.page-header p {
  color: var(--muted);
  margin: 0;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.card h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.card p {
  color: var(--muted);
  margin: 0 0 14px;
}

.button {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.field {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

label {
  font-weight: 700;
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.secondary {
  background: #334155;
}

.secondary:hover {
  background: #1f2937;
}

.error {
  color: var(--warning);
  margin: 10px 0 0;
}

.task-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
}

.task-rail,
.task-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-rail {
  display: grid;
  gap: 18px;
  padding: 16px;
  position: sticky;
  top: 18px;
}

.panel-heading,
.detail-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.panel-heading h2,
.create-task h3,
.detail-header h2,
.empty-detail h2 {
  margin: 0;
}

.panel-heading h2,
.detail-header h2 {
  font-size: 20px;
  line-height: 1.25;
}

.panel-heading span,
.status-pill {
  background: #eaf3f1;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 9px;
  white-space: nowrap;
}

.task-list {
  display: grid;
  gap: 8px;
  max-height: 58vh;
  overflow: auto;
}

.task-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  text-decoration: none;
}

.task-item:hover,
.task-item.selected {
  border-color: #9fc8bf;
  background: #f1f8f6;
}

.task-item strong,
.task-item span {
  overflow-wrap: anywhere;
}

.task-item span,
.empty-state,
.empty-detail p,
.eyebrow {
  color: var(--muted);
}

.task-item span,
.eyebrow {
  font-size: 13px;
}

.create-task,
.log-form,
.task-edit-form {
  display: grid;
  gap: 12px;
}

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

.create-task h3 {
  font-size: 16px;
}

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

.task-detail {
  min-width: 0;
}

.task-panel {
  display: grid;
  gap: 16px;
  padding: 0;
}

.detail-header {
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.eyebrow {
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
}

.log-form {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.journal-toolbar {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.journal-toolbar button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  justify-content: center;
  min-height: 36px;
  min-width: 40px;
  padding: 7px 10px;
}

.journal-toolbar button:hover {
  background: #eef5f3;
  border-color: #9fc8bf;
}

.journal-toolbar .button {
  background: var(--accent);
  border: 0;
  color: #ffffff;
  margin-left: auto;
  min-height: 38px;
  min-width: 76px;
}

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

.journal-document {
  background:
    linear-gradient(#ffffff 31px, #eef1f4 32px) top left / 100% 32px,
    #ffffff;
  border: 0;
  border-radius: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 32px;
  margin: 0 auto;
  min-height: calc(100vh - 260px);
  outline: none;
  overflow-wrap: anywhere;
  padding: 34px 46px 56px;
  width: min(100%, 920px);
}

.journal-document:focus {
  box-shadow: inset 0 0 0 2px #9fc8bf;
}

.journal-document:empty::before {
  color: var(--muted);
  content: attr(data-placeholder);
}

.journal-document h2 {
  font-size: 24px;
  line-height: 32px;
  margin: 0 0 16px;
}

.journal-document p,
.journal-document ul,
.journal-document ol {
  margin: 0 0 16px;
}

.journal-document figure {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 20px 0;
  padding: 10px;
}

.journal-document img {
  border-radius: 6px;
  display: block;
  height: auto;
  max-width: 100%;
}

.journal-document figcaption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 8px;
}

.task-settings {
  border-top: 1px solid var(--line);
  padding: 14px 20px 20px;
}

.task-settings summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 14px;
}

.empty-detail {
  min-height: 220px;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

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

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

  .main {
    padding: 20px;
  }

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

  .task-rail {
    position: static;
  }

  .task-list {
    max-height: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .journal-toolbar {
    position: static;
  }

  .journal-toolbar .button {
    margin-left: 0;
  }

  .journal-document {
    font-size: 16px;
    min-height: 60vh;
    padding: 24px 18px 40px;
  }
}
