/* =========================================================
   Daily DAT & DS Tracker — Stylesheet
   Aesthetic: refined editorial, soft paper / charcoal, with
   a serif display accent and warm accent stripe.
   ========================================================= */

:root {
  /* Palette — light */
  --bg:           #f7f5f1;          /* warm paper */
  --surface:      #ffffff;
  --surface-2:    #fbfaf6;
  --line:         #e6e1d6;
  --line-2:       #efebe1;
  --ink:          #15161a;
  --ink-2:        #45474f;
  --ink-3:        #797b85;
  --accent:       #d2502b;          /* terracotta */
  --accent-soft:  #f7e9df;
  --ok:           #1f7a4d;
  --ok-soft:      #e2f0e7;
  --shadow-sm:    0 1px 2px rgba(20, 20, 30, .04), 0 0 0 1px rgba(20, 20, 30, .04);
  --shadow-md:    0 4px 24px -8px rgba(20, 20, 30, .12), 0 0 0 1px rgba(20, 20, 30, .04);
  --radius:       14px;
  --radius-sm:    9px;

  /* Type */
  --font-display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --font-body:    "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg:           #0d0e10;
  --surface:      #16171a;
  --surface-2:    #1b1d20;
  --line:         #25272c;
  --line-2:       #1e2024;
  --ink:          #f4f3ee;
  --ink-2:        #c4c2bb;
  --ink-3:        #8c8a83;
  --accent:       #ed7a55;
  --accent-soft:  #2a1a13;
  --ok:           #61c193;
  --ok-soft:      #142621;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-md:    0 8px 32px -10px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);
}

/* =========================================================
   Base
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
input  { font-family: inherit; }
a      { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at top right, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(ellipse at bottom left, #ece6d6 0%, transparent 60%),
    var(--bg);
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, #e2a463 60%, transparent 100%);
}

.login-mark {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}
.mark-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.mark-dot--2 { background: var(--ink); }

.login-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 6vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ink);
}
.login-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.login-sub {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 38ch;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px -8px rgba(0,0,0,.4); }
.google-btn:active { transform: translateY(0); }

.login-err {
  margin-top: 14px;
  background: var(--accent-soft);
  color: #8c2d10;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.login-fine {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.55;
}

.login-foot {
  display: flex;
  gap: 8px;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* =========================================================
   APP HEADER
   ========================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun  { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }

.user-menu { position: relative; }
.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-fallback {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  text-transform: uppercase;
}

.user-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: pop-in .15s ease both;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-pop-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}
.user-pop-name  { font-weight: 600; font-size: 14px; }
.user-pop-email { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.user-pop-item {
  display: block;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.user-pop-item:hover { background: var(--surface-2); color: var(--ink); }

/* =========================================================
   APP LAYOUT
   ========================================================= */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 120px;
}

/* -------- DATE BAR -------- */
.date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.date-nav {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease;
}
.date-nav:hover { background: var(--surface-2); color: var(--ink); }

.date-pill {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  user-select: none;
}
.date-pill:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }

.date-pill input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  pointer-events: none;
}

/* Hide the small calendar icon some browsers show */
.date-pill input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}

.date-label-big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}
.date-label-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 3px;
}

.date-today {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 0 14px;
  height: 38px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  transition: opacity .15s ease;
}
.date-today:hover { opacity: .85; }

/* -------- PANELS -------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-2);
}

.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.panel-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}
.panel-tag--ok { background: var(--ok-soft); color: var(--ok); }

.panel-meta { display: flex; align-items: center; gap: 8px; }

.count-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 26px;
  text-align: center;
}
.count-pill--ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 20%, transparent);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ghost-btn:hover { background: var(--surface-2); color: var(--ink); border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.ghost-btn.copied { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }

/* -------- ADD ROW -------- */
.add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-2);
  transition: background .15s ease;
}
.add-row:focus-within { background: var(--surface-2); }
.add-plus {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 18px;
  font-weight: 400;
  flex-shrink: 0;
}
#addInput {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
  padding: 4px 0;
}
#addInput::placeholder { color: var(--ink-3); }

/* -------- TASK LIST -------- */
.task-list, .ds-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  position: relative;
  border-bottom: 1px solid var(--line-2);
  transition: background .15s ease;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.task.dragging { opacity: .5; }
.task.is-removing {
  animation: slide-out .25s ease forwards;
}
@keyframes slide-out {
  to { opacity: 0; transform: translateX(20px); }
}
.task.is-adding {
  animation: slide-in .25s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* drag handle */
.task-drag {
  width: 14px;
  flex-shrink: 0;
  color: var(--ink-3);
  opacity: 0;
  cursor: grab;
  align-self: center;
  font-size: 16px;
  user-select: none;
  transition: opacity .15s ease;
}
.task:hover .task-drag { opacity: .5; }
.task-drag:active { cursor: grabbing; }

/* checkbox */
.task-check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink-3);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin: 3px 0 0;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.task-check:hover { border-color: var(--ok); }
.task-check:checked {
  background: var(--ok);
  border-color: var(--ok);
}
.task-check:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
}

/* text */
.task-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  padding: 2px 0;
  resize: none;
  word-break: break-word;
  font-family: inherit;
  min-height: 22px;
}
.task[data-status="1"] .task-text {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--ink-3) 60%, transparent);
}

/* carry-forward badge */
.task-flag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  align-self: center;
  flex-shrink: 0;
}

.task-del {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
  align-self: center;
}
.task:hover .task-del { opacity: 1; }
.task-del:hover { background: var(--accent-soft); color: var(--accent); }

/* -------- DS LIST -------- */
.ds-list { padding: 8px 20px 16px; }
.ds-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 15px;
  color: var(--ink);
}
.ds-list li:last-child { border-bottom: 0; }
.ds-list .ds-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  min-width: 22px;
}

/* -------- EMPTY -------- */
.empty-state {
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  font-style: italic;
  font-family: var(--font-display);
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in .25s ease both;
}
.toast.toast--out { animation: toast-out .25s ease both; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(8px); } }

.toast--ok::before  { content: "✓"; color: var(--ok); font-weight: 700; }
.toast--err::before { content: "✕"; color: var(--accent); font-weight: 700; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 540px) {
  .app { padding: 18px 14px 100px; }
  .app-header { padding: 12px 14px; }
  .panel-head { padding: 16px 16px 12px; }
  .add-row, .task { padding-left: 16px; padding-right: 16px; }
  .ds-list { padding-left: 16px; padding-right: 16px; }
  .task-del { opacity: 1; }            /* always visible on touch */
  .task-drag { display: none; }        /* drag is awkward on mobile */
  .login-card { padding: 28px 22px 24px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
