:root {
  --bg: #f6f1e8;
  --panel: rgba(255, 252, 246, 0.92);
  --ink: #1d2a24;
  --muted: #57655d;
  --accent: #2d6a4f;
  --accent-strong: #1f4b39;
  --line: rgba(29, 42, 36, 0.12);
  --danger: #9b2226;
  --shadow: 0 18px 50px rgba(32, 31, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(45, 106, 79, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(188, 108, 37, 0.16), transparent 24%),
    linear-gradient(180deg, #fbf8f1 0%, var(--bg) 100%);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero,
.panel,
.toolbar,
dialog {
  backdrop-filter: blur(12px);
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
}

.user-card {
  flex: 1 1 0;
  min-width: 0;
  padding: 12px;
  border-radius: 18px;
  background: rgba(45, 106, 79, 0.08);
}

.user-label,
.user-id,
.meta {
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.panel {
  margin-top: 18px;
  padding: 24px;
}

label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
}

textarea,
input {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fffdf8;
}

textarea {
  resize: vertical;
}

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

.form-actions,
.task-actions,
.dialog-heading,
.section-heading {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-actions {
  margin-top: 8px;
}

button,
a.ghost-button,
a.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  cursor: pointer;
}

a.ghost-button,
a.primary-button {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
}

a.ghost-button[hidden],
a.primary-button[hidden] {
  display: none;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.ghost-button {
  background: rgba(45, 106, 79, 0.08);
  color: var(--ink);
}

.danger-button {
  background: rgba(155, 34, 38, 0.12);
  color: var(--danger);
}

.count-badge {
  margin-left: auto;
  background: rgba(45, 106, 79, 0.12);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
}

.task-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.task-item {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.task-item.completed {
  background: rgba(100, 188, 120, 0.12);
  border-color: rgba(45, 106, 79, 0.26);
}

.task-item h3 {
  margin: 0 0 8px;
}

.task-header,
.task-title-row,
.task-order-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-header {
  justify-content: space-between;
  margin-bottom: 8px;
}

.task-title-row {
  min-width: 0;
}

.task-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(45, 106, 79, 0.12);
  color: var(--accent-strong);
  font-weight: 700;
  flex: 0 0 auto;
}

.task-title-row h3 {
  margin: 0;
}

.move-button {
  padding: 8px 14px;
}

.move-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.task-item.completed h3 {
  text-decoration: line-through;
  color: var(--accent-strong);
}

.task-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}

.task-switch input {
  display: none;
}

.task-switch-ui {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(88, 95, 91, 0.28);
  position: relative;
  transition: background 0.2s ease;
}

.task-switch-ui::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.task-switch input:checked + .task-switch-ui {
  background: var(--accent);
}

.task-switch input:checked + .task-switch-ui::after {
  transform: translateX(20px);
}

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

.image-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.image-card strong,
.history-item strong {
  display: block;
  padding: 12px 14px 0;
}

.image-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  padding: 12px;
  border-radius: 24px;
  cursor: zoom-in;
}

.image-card.empty {
  min-height: 304px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
}

.image-card.empty strong,
.image-card.empty .meta {
  padding: 0;
  margin: 0;
}

.image-card.empty strong {
  margin-bottom: 10px;
}

.image-actions {
  display: flex;
  gap: 10px;
  padding: 0 14px 14px;
}

.image-action {
  background: rgba(45, 106, 79, 0.08);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.delete-photo-action {
  background: rgba(155, 34, 38, 0.12);
  color: var(--danger);
}

.users-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.users-list-top {
  margin-top: 10px;
}

.user-pill {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(88, 95, 91, 0.12);
  color: #3f4844;
}

.user-pill.current {
  background: rgba(100, 188, 120, 0.2);
  color: #1f4b39;
  border-color: rgba(45, 106, 79, 0.3);
}

.user-pill .meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.user-pill strong {
  display: block;
  margin-bottom: 4px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  width: min(920px, calc(100% - 24px));
  background: rgba(255, 252, 246, 0.98);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(22, 25, 24, 0.42);
}

.progress-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
}

.notification-feed {
  position: fixed;
  right: 20px;
  bottom: 148px;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 45;
}

.notification-toast {
  position: relative;
  padding: 14px 36px 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(45, 106, 79, 0.16);
  background: rgba(255, 252, 246, 0.97);
  box-shadow: 0 16px 34px rgba(29, 42, 36, 0.16);
  cursor: pointer;
}

.notification-toast:hover {
  background: rgba(255, 252, 246, 1);
}

.notification-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.notification-close:hover {
  color: var(--ink);
  background: rgba(29, 42, 36, 0.08);
}

.notification-toast strong {
  display: block;
  margin-bottom: 6px;
}

.notification-toast .meta {
  margin-top: 8px;
  font-size: 12px;
}

.progress-ring {
  --progress: 0%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--accent) var(--progress), rgba(88, 95, 91, 0.16) 0),
    radial-gradient(circle at center, rgba(255, 252, 246, 0.98) 58%, transparent 59%);
  box-shadow: 0 18px 40px rgba(29, 42, 36, 0.18);
  border: 1px solid rgba(29, 42, 36, 0.08);
}

.progress-inner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.98);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(29, 42, 36, 0.06);
}

.progress-inner strong {
  font-size: 1.15rem;
  line-height: 1;
}

.progress-inner span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dialog-body {
  padding: 24px;
}

.dialog-body.wide {
  min-height: 320px;
}

#image-dialog {
  width: max-content;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  padding: 0;
  overflow: hidden;
}

#image-dialog .dialog-body,
#image-dialog .dialog-body.wide {
  min-height: 0;
}

.image-dialog-body {
  max-width: none;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

#image-dialog .dialog-heading {
  padding: 0 2px;
  gap: 8px;
}

#image-dialog .dialog-heading h2 {
  font-size: 16px;
  margin: 0;
}

#image-dialog #close-image {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 999px;
}

.image-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 72px);
  object-fit: contain;
  border-radius: 10px;
  background: rgba(29, 42, 36, 0.06);
}

@media (max-width: 700px) {
  #image-dialog {
    max-width: calc(100vw - 6px);
    max-height: calc(100vh - 6px);
    border-radius: 12px;
  }
  .image-dialog-body {
    padding: 4px;
    gap: 4px;
  }
  .image-preview {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 56px);
    border-radius: 6px;
  }
  #image-dialog #close-image {
    padding: 3px 10px;
    font-size: 11px;
  }
}

.history-group {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(45, 106, 79, 0.06);
}

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

.history-item h4 {
  margin: 8px 0 12px;
}

.history-item.task-item {
  margin-bottom: 14px;
  padding: 18px 18px 18px 22px;
}

.history-item p,
.history-item h4 {
  padding-left: 2px;
}

.history-images {
  margin-top: 8px;
}

.history-item .image-card {
  pointer-events: none;
}

.history-item .image-actions {
  display: none;
}

.history-item:first-of-type {
  border-top: 0;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .hero {
    flex-direction: column;
  }

  .toolbar,
  .form-actions,
  .task-actions,
  .task-header,
  .task-title-row,
  .task-order-actions,
  .dialog-heading,
  .section-heading {
    flex-wrap: wrap;
  }

  .notification-feed {
    right: 10px;
    bottom: 138px;
    width: calc(100vw - 20px);
  }
}

.user-pill.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.user-pill.clickable:hover,
.user-pill.clickable:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.18);
  outline: none;
}

.user-edit-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.user-hide-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.user-section {
  margin-top: 18px;
}

.user-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.user-list-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.user-list-item strong {
  display: block;
  font-size: 14px;
}

.user-list-item p {
  margin: 4px 0 0;
  font-size: 13px;
}

.user-list-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgba(29, 42, 36, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
  word-break: break-all;
}

.user-list-item p.user-agent code {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
}

.user-meta-row {
  display: block;
  margin: 2px 0;
}

.user-deleted-meta {
  color: var(--danger);
  font-weight: 600;
}

.photo-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-slot .photo-slot-title {
  font-weight: 600;
}

.photo-slot-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.paste-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.paste-preview {
  display: block;
  font-size: 12px;
  color: var(--accent-strong);
  background: rgba(45, 106, 79, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  word-break: break-all;
}

.history-admin-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.project-pill {
  position: relative;
  padding-right: 32px;
}

.project-pill.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.25);
}

.project-edit {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.project-edit:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.messages-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.messages-dialog-body {
  width: min(880px, calc(100vw - 32px));
}

.messages-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  margin-top: 12px;
  min-height: 420px;
}

.messages-sidebar h3,
.messages-thread h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.messages-threads {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 460px;
  overflow-y: auto;
}

.messages-thread-pill {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  text-align: left;
}

.messages-thread-pill.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.2);
}

.messages-thread-name {
  font-weight: 600;
}

.messages-thread-preview {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-thread-unread {
  align-self: start;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  text-align: center;
}

.messages-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.messages-thread-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
  overflow-y: auto;
  min-height: 280px;
  max-height: 420px;
}

.message-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}

.message-bubble.mine {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.7;
}

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

.messages-form textarea {
  resize: vertical;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}
