/* ============================================================
   TwoDo.ir — design tokens
   ============================================================ */

:root {
  --ink:        #1E2A33;
  --ink-soft:   #5B6670;
  --paper:      #FBF7F1;
  --card:       #FFFFFF;
  --sand:       #E4D9C2;
  --sand-line:  #D8CBAE;

  --coral:      #F4623A;
  --coral-dark: #D94F29;
  --teal:       #1F8A82;
  --teal-dark:  #176E67;

  --cat-household: #F4623A;
  --cat-purchases: #00FFF0;
  --cat-errands:   #1F8A82;
  --cat-groceries: #C98A2E;
  --cat-money:     #4B7F52;
  --cat-work:      #46608C;
  --cat-together:  #B85277;
  --cat-topics:    #861b9b;
  --cat-vacations: #0c8a13;
  --cat-other:     #857F70;




  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --radius: 16px;
  --shadow: 0 12px 32px -12px rgba(30, 42, 51, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 10% 8%, rgba(244, 98, 58, 0.10), transparent 40%),
    radial-gradient(circle at 92% 90%, rgba(31, 138, 130, 0.12), transparent 45%);
  background-attachment: fixed;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

h1, h2 { font-family: var(--font-display); margin: 0; }

.logo-img {
    margin-left: auto;
    margin-right: auto;
    display: block;
    width: 50%;
    margin-bottom: 25px;
}

/* ============================================================
   Signature element: the knot brandmark
   ============================================================ */

.brandmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 auto 20px;
  width: fit-content;
}

.knot-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.knot-circle--a { background: var(--coral); }
.knot-circle--b { background: var(--teal); }
.knot-circle--empty {
  background: transparent;
  border: 2px dashed var(--sand-line);
  color: var(--ink-soft);
}

.thread {
  width: 56px;
  height: 3px;
  margin: 0 -6px;
  background: repeating-linear-gradient(
    to right,
    var(--sand-line) 0, var(--sand-line) 6px,
    transparent 6px, transparent 11px
  );
}

.thread--tied {
  background: repeating-linear-gradient(
    to right,
    var(--ink) 0, var(--ink) 6px,
    transparent 6px, transparent 11px
  );
}

.thread--loose {
  background: repeating-linear-gradient(
    to right,
    var(--sand-line) 0, var(--sand-line) 4px,
    transparent 4px, transparent 10px
  );
}

.brandmark--sm .knot-circle { width: 38px; height: 38px; font-size: 0.9rem; }
.brandmark--sm .thread { width: 30px; }

/* ============================================================
   Auth screen
   ============================================================ */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.wordmark {
  font-size: 1.9rem;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.wordmark--sm { font-size: 1.1rem; }

.tagline {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 14px 0 24px;
}

.flash-msg {
  background: #FBEAE3;
  border: 1px solid #F0C2AE;
  color: var(--coral-dark);
  font-size: 0.88rem;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 20px;
}

.tab-row {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--sand);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 28px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn.is-active {
  background: var(--ink);
  color: #fff;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.auth-form.is-active { display: flex; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
}

.field small {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.field input, .field select {
  font-family: inherit;
  font-size: 0.96rem;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--sand);
  background: var(--paper);
  color: var(--ink);
}

.field input:focus, .field select:focus {
  border-color: var(--coral);
  outline: none;
  background: #fff;
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover { background: var(--coral-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--sand);
  color: var(--ink-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ============================================================
   App shell
   ============================================================ */

.app-shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 22px;
}

.app-header .brandmark { margin: 0; }

.app-header-text { flex: 1; min-width: 0; }

.who {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.waiting-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}

.waiting-card h2 { font-size: 1.3rem; margin-bottom: 10px; }
.waiting-card p { color: var(--ink-soft); line-height: 1.55; margin: 0 0 8px; }
.waiting-card .hint { font-size: 0.85rem; }

.composer {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 18px;
}

#add-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#add-text {
  flex: 1 1 220px;
  font-family: inherit;
  font-size: 0.98rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--sand);
  background: var(--paper);
  color: var(--ink);
}

#add-category {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 12px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--sand);
  background: var(--paper);
  color: var(--ink);
}

#add-text:focus, #add-category:focus {
  border-color: var(--coral);
  outline: none;
  background: #fff;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1.5px solid var(--sand);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  padding-left: 22px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.chip[data-filter="all"] { padding-left: 14px; }
.chip[data-filter="all"]::before { display: none; }

.chip.cat-household { color: var(--cat-household); }
.chip.cat-errands   { color: var(--cat-errands); }
.chip.cat-groceries { color: var(--cat-groceries); }
.chip.cat-money     { color: var(--cat-money); }
.chip.cat-work      { color: var(--cat-work); }
.chip.cat-together  { color: var(--cat-together); }
.chip.cat-topics    { color: var(--cat-topics); }
.chip.cat-vacations { color: var(--cat-vacations); }
.chip.cat-other     { color: var(--cat-other); }
.chip.cat-purchases { color: var(--cat-purchases); }

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff !important;
}

.chip.is-active::before { background: #fff; opacity: 0.9; }

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.knot-check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--sand-line);
  background: var(--paper);
  cursor: pointer;
  position: relative;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.knot-check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(40deg) scale(0);
  transition: transform 0.15s ease;
}

.todo-item.is-done .knot-check {
  background: var(--teal);
  border-color: var(--teal);
}

.todo-item.is-done .knot-check::after { transform: rotate(40deg) scale(1); }

.todo-text {
  flex: 1;
  min-width: 0;
  font-size: 0.96rem;
  word-break: break-word;
}

.todo-item.is-done .todo-text {
  text-decoration: line-through;
  color: var(--ink-soft);
}

.todo-tag {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--sand);
}

.todo-tag.cat-household { color: var(--cat-household); border-color: color-mix(in srgb, var(--cat-household) 35%, var(--sand)); }
.todo-tag.cat-errands   { color: var(--cat-errands);   border-color: color-mix(in srgb, var(--cat-errands) 35%, var(--sand)); }
.todo-tag.cat-groceries { color: var(--cat-groceries); border-color: color-mix(in srgb, var(--cat-groceries) 35%, var(--sand)); }
.todo-tag.cat-money     { color: var(--cat-money);     border-color: color-mix(in srgb, var(--cat-money) 35%, var(--sand)); }
.todo-tag.cat-work      { color: var(--cat-work);      border-color: color-mix(in srgb, var(--cat-work) 35%, var(--sand)); }
.todo-tag.cat-together  { color: var(--cat-together);  border-color: color-mix(in srgb, var(--cat-together) 35%, var(--sand)); }
.todo-tag.cat-other     { color: var(--cat-other);     border-color: color-mix(in srgb, var(--cat-other) 35%, var(--sand)); }

.todo-remove {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--sand-line);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.todo-remove:hover { color: var(--coral); background: var(--paper); }

.empty-state {
  list-style: none;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 32px 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.footer p {
    font-size: 0.8rem;
    font-family: 'Fraunces';
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.footer a {
    color: #F4623A;
}

/* ============================================================
   Small screens
   ============================================================ */

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px 28px; }
  .app-header { flex-wrap: wrap; }
  #add-form { flex-direction: column; }
  #add-category { width: 100%; }
}
