/* Tally — styles translated from "Tally Todo App.dc.html" */

:root {
  --accent: #C98A2E;

  --bg: #F7F6F2;
  --sidebar: #F2F0EA;
  --surface: #FBFAF7;
  --hover: #E9E6DD;
  --active: #E4E0D4;

  --ink: #1E2A3A;
  --ink-soft: #3C3A32;
  --nav-ink: #4E4A3E;
  --muted: #6B6657;
  --muted-2: #6E6A5C;
  --muted-3: #615D50;
  --done-ink: #8A8474;
  --strike: #CFCABA;

  --border: #E4E1D8;
  --rule: #EAE7DE;
  --rule-soft: #EDEAE1;
  --line-strong: #DCD8CC;
  --ring: #C4BFB0;

  --blue: #3A5A7D;
  --overdue-bg: #F3E2E0;
  --overdue-ink: #8C3A2E;
  --high-bg: #F4E7CE;
  --high-ink: #8A5D14;

  --serif: Spectral, Georgia, serif;
  --sans: 'Libre Franklin', system-ui, sans-serif;
  --mono: ui-monospace, monospace;

  --row-pad: 11px 8px;
}

body[data-density="dense"] { --row-pad: 7px 8px; }
body[data-density="airy"]  { --row-pad: 15px 8px; }

/* Base */

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

html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
input, textarea, button { font: inherit; color: inherit; }
::selection { background: #F1DFBD; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

a { color: var(--blue); text-decoration: none; border-bottom: 1px solid rgba(58, 90, 125, .35); }
a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* Layout */

.app {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

/* Sidebar */

.sidebar {
  flex: 0 0 244px;
  min-width: 200px;
  padding: 28px 20px 24px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand { display: flex; align-items: baseline; gap: 9px; padding-left: 8px; }
.brand-name { font-family: var(--serif); font-size: 25px; letter-spacing: -.01em; }
.brand-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--accent); margin-bottom: 5px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }

.section-label {
  padding: 0 10px 8px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 14.5px;
  font-weight: 400;
  background: transparent;
  color: var(--nav-ink);
}
.nav-item.is-active { font-weight: 600; background: var(--active); color: var(--ink); }
.nav-item:hover { background: var(--hover); }

.nav-label { display: flex; align-items: center; gap: 10px; }
.dot { width: 7px; height: 7px; border-radius: 99px; flex: none; background: var(--dot, var(--ring)); }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label { min-width: 0; }

.nav-add { color: var(--muted); font-size: 13.5px; }
.nav-add-icon { width: 7px; display: inline-flex; justify-content: center; font-size: 15px; line-height: 1; }

.project-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ring);
}
.project-input {
  flex: 1;
  min-width: 0;
  padding: 3px 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14.5px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted-3);
}
.shortcut {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: inherit;
  color: inherit;
  text-align: left;
}
.shortcut:hover { color: var(--ink); }

.account {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.account form { margin: 0; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--nav-ink); }

/* Main column */

.main {
  flex: 3 1 420px;
  min-width: 300px;
  padding: 40px clamp(20px, 4vw, 52px) 64px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.page-header { display: flex; flex-direction: column; gap: 18px; }

.dateline {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.6vw, 46px);
  letter-spacing: -.02em;
  line-height: 1.05;
}

.subhead {
  margin: 0;
  max-width: 46ch;
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  font-weight: 300;
  color: var(--muted-2);
  text-wrap: pretty;
}

.rename-form { margin: 0; }
.page-title-input {
  width: 100%;
  max-width: 16em;
  padding: 0 8px;
  margin: -1px -9px;
  border: 1px solid var(--ring);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

.view-actions { display: flex; gap: 16px; margin-top: -8px; font-size: 12.5px; color: var(--muted); }

.progress { display: flex; align-items: center; gap: 14px; max-width: 420px; }
.progress-track { flex: 1; height: 3px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.progress-label { font-size: 12.5px; color: var(--muted-3); white-space: nowrap; }

/* Composer */

.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.composer:focus-within { border-color: var(--ring); }
.composer-ring { width: 17px; height: 17px; border-radius: 99px; border: 1.5px dashed var(--ring); flex: none; }
.composer-input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; min-width: 0; }
.composer .kbd { color: var(--muted); padding: 2px 7px; border-color: var(--border); background: none; }

/* Task groups */

.groups { display: flex; flex-direction: column; gap: 34px; }
.group { display: flex; flex-direction: column; gap: 4px; }

.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.group-title {
  margin: 0;
  font-size: 12px;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted-2);
}
.group-count { font-size: 12px; color: var(--muted); }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: var(--row-pad);
  margin: 0 -8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.task:hover,
.task.is-selected { background: var(--surface); }
.task.is-selected { box-shadow: inset 2px 0 0 var(--accent); }

.task-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  border-radius: 99px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all .15s;
  border: 1.5px solid var(--ring);
  background: transparent;
  color: var(--surface);
  font-size: 11px;
  line-height: 1;
}
.task-check:hover { border-color: var(--accent); }
.task.is-done .task-check { border-color: var(--accent); background: var(--accent); }

.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-title { font-size: 15px; line-height: 1.45; text-wrap: pretty; color: var(--ink); }
.task.is-done .task-title { color: var(--done-ink); text-decoration: line-through; text-decoration-color: var(--strike); }
.task-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }

.flag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  margin-top: 1px;
}
.flag--overdue { background: var(--overdue-bg); color: var(--overdue-ink); }
.flag--high { background: var(--high-bg); color: var(--high-ink); }

.task-project { flex: none; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.empty {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.empty-title { font-family: var(--serif); font-size: 24px; color: var(--blue); }
.empty-text { font-size: 14px; color: var(--muted-3); max-width: 34ch; text-wrap: pretty; }

/* Detail panel */

.detail {
  flex: 1 1 328px;
  min-width: 280px;
  max-width: 560px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.detail-head { display: flex; justify-content: space-between; align-items: center; }

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}
.icon-btn:hover { color: var(--ink); }

.detail-intro { display: flex; flex-direction: column; gap: 8px; }

/* Text that reads as plain copy until you edit it */
.field-plain {
  display: block;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  resize: none;
  overflow: hidden;
  outline: none;
  transition: background .12s, border-color .12s;
}
.field-plain:hover { background: var(--sidebar); }
.field-plain:focus { background: #fff; border-color: var(--ring); }
.field-plain::placeholder { color: var(--done-ink); }

.detail-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--ink);
}
.detail-note { font-size: 14px; color: var(--muted-2); line-height: 1.6; min-height: 2.4em; }

.facts { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.fact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  min-height: 42px;
  border-bottom: 1px solid var(--rule-soft);
}
.fact-label { color: var(--muted); }

.fact-select,
.fact-button {
  min-width: 0;
  padding: 4px 22px 4px 8px;
  margin-right: -8px;
  border: none;
  border-radius: 6px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236B6657' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  font-size: inherit;
  color: var(--ink);
  text-align: right;
  text-align-last: right;
  cursor: pointer;
  appearance: none;
}
.fact-select:hover,
.fact-button:hover { background-color: var(--sidebar); }
.fact-button.is-overdue { color: var(--overdue-ink); font-weight: 600; }
.fact-button.is-empty { color: var(--done-ink); }

.fact-due { position: relative; display: flex; align-items: center; gap: 2px; }
.fact-clear {
  order: -1;
  padding: 2px 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
.fact:hover .fact-clear,
.fact-clear:focus-visible { opacity: 1; }
.fact-date {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.steps-block { display: flex; flex-direction: column; gap: 10px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps:empty { display: none; }

.step-row { position: relative; display: flex; align-items: flex-start; }

.step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: calc(100% + 16px);
  padding: 7px 34px 7px 8px;
  margin: 0 -8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.step:hover { background: var(--sidebar); }

.step-delete {
  position: absolute;
  top: 5px;
  right: -4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
.step-row:hover .step-delete,
.step-delete:focus-visible { opacity: 1; }
.step-delete:hover { color: var(--overdue-ink); }

.step-add { display: flex; align-items: center; gap: 11px; padding: 4px 0; margin: 0; }
.step-box--new { border-style: dashed; margin-top: 0; }
.step-input {
  flex: 1;
  min-width: 0;
  padding: 3px 0;
  border: none;
  border-bottom: 1px solid transparent;
  outline: none;
  background: transparent;
  font-size: 14px;
}
.step-input:focus { border-bottom-color: var(--ring); }
.step-input::placeholder { color: var(--done-ink); }

.step-box {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  color: var(--surface);
  border: 1.5px solid var(--ring);
  background: transparent;
}
.step.is-done .step-box { border-color: var(--accent); background: var(--accent); }

.step-text { font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.step.is-done .step-text { color: var(--done-ink); text-decoration: line-through; }

.detail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
}

.btn-complete {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: opacity .15s;
  background: var(--accent);
  color: #FFFDF8;
}
.btn-complete.is-reopen { border-color: var(--line-strong); background: transparent; color: var(--muted-2); }
.btn-complete:hover { opacity: .88; }

.detail-actions { display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--muted); }
.text-btn { border: none; background: transparent; padding: 2px 0; cursor: pointer; color: inherit; font-size: inherit; }
.text-btn:hover { color: var(--ink); }

/* Search */

.search {
  width: min(560px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(30, 42, 58, .35);
  overflow: hidden;
}
.search[open] { display: flex; flex-direction: column; }
.search::backdrop { background: rgba(30, 42, 58, .22); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
}
.search-bar .kbd { color: var(--muted); background: none; }

.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-option {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.search-option.is-active { background: var(--active); }
.search-option:hover { background: var(--hover); }
.search-title { font-size: 14.5px; }
.search-option.is-done .search-title { color: var(--done-ink); text-decoration: line-through; text-decoration-color: var(--strike); }
.search-meta { font-size: 12px; color: var(--muted); }
.search-empty { padding: 18px 12px; color: var(--muted-3); font-size: 14px; }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  box-shadow: 0 12px 30px -12px rgba(30, 42, 58, .5);
  transform: translateX(-50%);
}
.toast-action {
  padding: 0;
  border: none;
  background: transparent;
  color: #F1DFBD;
  font-weight: 600;
  cursor: pointer;
}
.toast-action:hover { color: #fff; }

/* Sign in / sign up */

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card .brand { padding-left: 0; margin-bottom: 18px; }
.auth-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.field input {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 15px;
  outline: none;
}
.field input:focus { border-color: var(--ring); background: #fff; }
.field-error,
.form-error { font-size: 13px; color: var(--overdue-ink); }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--overdue-bg); }
.field-help { font-size: 12.5px; color: var(--muted); }
.field-help ul { margin: 4px 0 0; padding-left: 18px; }
.auth-form .btn-complete { margin-top: 6px; }
.auth-switch { margin: 8px 0 0; font-size: 14px; color: var(--muted-3); }

/* Phones: stack the sidebar above the list */

@media (max-width: 640px) {
  .sidebar { flex-basis: 100%; border-right: none; border-bottom: 1px solid var(--border); gap: 20px; }
  .shortcut { display: none; }
  .sidebar-foot { padding-top: 0; }
  .account { margin-top: 0; }
  .detail { border-left: none; border-top: 1px solid var(--border); max-width: none; }
  .step-delete, .fact-clear { opacity: 1; }
}

@media (hover: none) {
  .step-delete, .fact-clear { opacity: 1; }
}
