:root {
  --bg: #f3f0ea;
  --paper: #fffcf8;
  --ink: #1c1915;
  --muted: #6f675e;
  --line: rgba(28, 25, 21, 0.12);
  --accent: #145c4a;
  --accent-dark: #0e3d32;
  --pine: #12372e;
  --cream: #f4ead7;
  --open: #8a5a12;
  --open-bg: #f8efd8;
  --done: #1d6b45;
  --done-bg: #e5f2ea;
  --danger: #8f3d32;
  --shadow: 0 24px 60px rgba(36, 28, 18, 0.08);
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Figtree", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 420px at -10% -10%, #efe2cc 0%, transparent 55%),
    radial-gradient(800px 380px at 110% 0%, #d7e6df 0%, transparent 46%),
    var(--bg);
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

h1, h2, .eyebrow {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
}

.login-brand {
  padding: 56px 48px;
  color: var(--cream);
  background:
    radial-gradient(500px 240px at 15% 12%, rgba(244, 234, 215, 0.14), transparent 60%),
    linear-gradient(165deg, #1b5344 0%, var(--pine) 62%, #0c241e 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}

.login-brand h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.96;
  max-width: 9ch;
}

.eyebrow {
  margin: 18px 0 0;
  font-size: 22px;
}

.lede { margin: 0; max-width: 34ch; font-size: 18px; line-height: 1.5; color: rgba(244, 234, 215, 0.82); }

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.card, .sheet {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form { width: min(420px, 100%); padding: 32px 28px; }
.form h2, .sheet h2, .composer h2 { margin: 0 0 6px; font-size: 34px; }
.muted { color: var(--muted); }
.form label, .sheet label, .composer label, .filter {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 500;
}

textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 108px; }
.text-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 6px 8px;
}

.btn {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: rgba(28, 25, 21, 0.04); }
.btn.sm { padding: 8px 12px; font-size: 14px; }
.btn.light { color: white; border-color: rgba(255, 255, 255, 0.4); background: rgba(0, 0, 0, 0.35); }
.form .btn { width: 100%; margin-top: 8px; }

.error { min-height: 1.2em; margin: 10px 0 0; color: var(--danger); font-weight: 600; }
.hint {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--open-bg);
  color: var(--open);
  font-weight: 600;
}

.app { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(243, 240, 234, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand, .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: -0.03em; }
.who strong, .who .muted { display: block; }
.who .muted { font-size: 13px; }
.mark { display: inline-flex; }
.mark.sm svg { display: block; }

.wrap { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 72px; }
.page-head, .toolbar, .row-actions, .composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 48px; line-height: 1; }
.page-head p { margin: 8px 0 0; }

.toolbar { margin: 22px 0; align-items: end; flex-wrap: wrap; }
.segment {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.8);
  border: 1px solid var(--line);
}
.seg {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  color: var(--muted);
}
.seg span {
  display: inline-grid;
  place-items: center;
  min-width: 1.4em;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(28, 25, 21, 0.06);
  font-size: 12px;
}
.seg.active { background: var(--ink); color: white; }
.seg.active span { background: rgba(255, 255, 255, 0.16); }
.filter { margin: 0; min-width: 180px; }
.filter select { margin: 0; }

.clients {
  margin-bottom: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 18px 4px;
}
.clients summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.client-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 200px) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.client-row strong, .client-row span { display: block; }
.client-row .muted { font-size: 13px; font-weight: 500; }

.composer { padding: 22px; margin-bottom: 22px; }
.composer-head { align-items: baseline; }
.composer-head h2 { font-size: 28px; }
.fields {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr;
  gap: 0 14px;
}
.span-2 { grid-column: 1 / -1; }
.fields label { margin-top: 14px; }

.drop {
  margin-top: 14px;
  position: relative;
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: 14px;
  border: 1.5px dashed rgba(20, 92, 74, 0.35);
  background: rgba(20, 92, 74, 0.04);
  font-weight: 500;
  color: var(--muted);
}
.drop strong { color: var(--ink); }
.drop.over { background: rgba(20, 92, 74, 0.1); }
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preview { position: relative; }
.preview img, .shots button img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.preview .x {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 25, 21, 0.78);
  color: white;
  width: 22px;
  height: 22px;
  line-height: 22px;
  padding: 0;
}

.list { display: grid; gap: 14px; }
.group-label {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.task {
  padding: 18px 18px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.task.is-done { background: #f8f6f2; }
.task-top, .task-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.open { color: var(--open); background: var(--open-bg); }
.pill.done { color: var(--done); background: var(--done-bg); }
.when { color: var(--muted); font-size: 13px; }
.kicker { margin: 12px 0 0; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.task h3 { margin: 4px 0 0; font-size: 22px; letter-spacing: -0.03em; }
.task.is-done h3 { color: var(--muted); }
.task p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.5; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.shots button {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 12px;
}
.shots button:focus-visible { outline: 2px solid var(--accent); }
.meta { margin-top: 12px; font-size: 14px; }
.task-actions { margin-top: 14px; }
.empty {
  padding: 36px 8px;
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(460px, calc(100vw - 28px));
}
#task-dialog { width: min(720px, calc(100vw - 28px)); }
#task-dialog .fields { grid-template-columns: 1fr 1fr; }
#task-dialog .span-2 { grid-column: 1 / -1; }
dialog::backdrop { background: rgba(18, 16, 12, 0.48); }
.sheet { padding: 26px; }
pre {
  margin: 16px 0;
  padding: 14px;
  border-radius: 12px;
  background: #f6f1e8;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

#lightbox {
  width: min(980px, calc(100vw - 24px));
  background: transparent;
}
#lightbox img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 16px;
  background: #111;
}
#lightbox-close { margin-bottom: 8px; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: white;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(520px, calc(100% - 24px));
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 32px 24px 28px; }
  .login-brand h1 { max-width: none; font-size: 42px; }
  .fields, .client-row { grid-template-columns: 1fr; }
  .page-head, .topbar { align-items: flex-start; }
  .topbar, .page-head { flex-direction: column; }
  .page-head h1 { font-size: 38px; }
  .wrap { width: min(100% - 28px, 980px); }
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}
