:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --text: #1f2b23;
  --muted: #5f6f63;
  --primary: #007a5e;
  --primary-press: #00624b;
  --ok: #e8f7ef;
  --ok-text: #0f5f43;
  --error: #fbeaea;
  --error-text: #8d2a2a;
  --line: #d8e0db;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #e6efe8 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Atkinson Hyperlegible", "Noto Sans", sans-serif;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}

.top-nav-left,
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand {
  margin-right: 8px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  color: #1b3b2f;
  text-decoration: none;
  background: transparent;
}

.nav-link:hover {
  background: #edf5f0;
}

.nav-link.active {
  background: #dcefe5;
}

.nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  background: #e6efea;
  color: #1b3b2f;
}

.app-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.app-shell.single-panel {
  max-width: 560px;
  grid-template-columns: 1fr;
}

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

.app-shell.single-list {
  grid-template-columns: 1fr;
  max-width: 980px;
}

.capture-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.auth-panel {
  margin-top: 48px;
}

h1,
h2 {
  margin-top: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.session-copy {
  margin: -4px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  font-weight: 600;
}

.notice.success {
  background: var(--ok);
  color: var(--ok-text);
}

.notice.error {
  background: var(--error);
  color: var(--error-text);
}

.capture-form label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 700;
}

.capture-form textarea,
.capture-form input,
.capture-form select,
.search-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
}

.capture-form textarea {
  min-height: 110px;
  resize: vertical;
}

.capture-form details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdfc;
}

.capture-form summary {
  cursor: pointer;
  font-weight: 700;
}

.optional-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

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

button,
.primary {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.primary {
  margin-top: 14px;
  width: 100%;
  background: var(--primary);
  color: #fff;
}

.secondary {
  background: #e6efea;
  color: #1b3b2f;
}

.danger {
  background: #fbeaea;
  color: #8d2a2a;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary:active {
  background: var(--primary-press);
}

.search-form {
  display: flex;
  gap: 8px;
}

.search-form button {
  background: #e6efea;
  color: #1b3b2f;
}

.note-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.note-list li {
  border: 0;
  padding: 0;
  background: transparent;
}

.note-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfefd;
  overflow: hidden;
}

.note-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
}

.note-card summary::-webkit-details-marker {
  display: none;
}

.note-title {
  font-weight: 700;
  line-height: 1.35;
}

.note-chip {
  flex-shrink: 0;
  border-radius: 999px;
  background: #e6efea;
  color: #1b3b2f;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.note-details {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.note-list .meta {
  margin: 10px 0 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.note-list .content {
  margin: 0;
  font-size: 1rem;
}

.note-list .timestamp {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.offset-group {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfdfc;
  display: grid;
  gap: 6px;
}

.offset-title {
  margin: 0 0 2px;
  font-weight: 700;
}

.admin-user-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fcfefd;
}

.admin-user-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.admin-user-title {
  margin: 0;
  font-weight: 700;
}

.admin-user-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.inline-form {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.inline-form label {
  font-weight: 700;
}

.inline-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.95rem;
}

.inline-form button {
  justify-self: flex-start;
}

.task-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfefd;
  overflow: hidden;
}

.task-card details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
}

.task-card details > summary::-webkit-details-marker {
  display: none;
}

.task-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.task-badge {
  margin-left: auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #edf5f0;
  color: #2a5f49;
}

.priority-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.priority-dot.p1 {
  background: #d64545;
}

.priority-dot.p2 {
  background: #e88a24;
}

.priority-dot.p3 {
  background: #3ea75e;
}

.compact-form {
  margin-top: 10px;
}

.subtasks-block {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.tree-hint {
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 0.88rem;
}

.task-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-actions .inline-form {
  margin-top: 0;
}

.node-editor {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.node-editor > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px;
}

.node-editor > .capture-form {
  padding: 0 10px 10px;
}

.subtasks-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.subtree-list {
  margin: 0;
  padding: 0 0 0 14px;
  list-style: none;
  border-left: 2px solid #dfe8e2;
  display: grid;
  gap: 8px;
}

.subtree-item {
  position: relative;
  padding-left: 12px;
}

.subtree-item::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 16px;
  width: 12px;
  border-top: 2px solid #dfe8e2;
}

.subtree-node {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.subtree-node > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
}

.subtree-node > summary::-webkit-details-marker {
  display: none;
}

.subtree-title {
  font-weight: 700;
}

.subtree-editor {
  border-top: 1px solid var(--line);
  padding: 10px;
}

.subtask-row,
.subtask-create {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.subtask-row {
  margin-bottom: 10px;
}

.subtask-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-offsets {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.activity-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: #fff;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.activity-table th,
.activity-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

.activity-table th {
  background: #f7faf8;
  font-weight: 700;
}

.notifications-panel {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.notification-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.notification-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fcfefd;
}

.notification-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.notification-message {
  margin: 0;
}

@media (max-width: 860px) {
  .top-nav {
    align-items: flex-start;
  }

  .brand {
    width: 100%;
    margin-bottom: 4px;
  }

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

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

  .optional-grid {
    grid-template-columns: 1fr;
  }

  .inline-offsets {
    grid-template-columns: 1fr 1fr;
  }
}
