/* ──────────────────────────────────────────────────────────
   Daily view — two-column body layout
   ────────────────────────────────────────────────────────── */

.daily-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  overflow: hidden;
}

.daily-body > .scroll-area {
  flex: 1;
  min-width: 0;
}

/* ──────────────────────────────────────────────────────────
   Right aside — History panel
   ────────────────────────────────────────────────────────── */

.daily-aside {
  width: 288px;
  flex-shrink: 0;
  border-left: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

/* Aside header */
.das-hist-header {
  padding: var(--s-5) var(--s-5) var(--s-3);
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
}
.das-hist-title {
  display: block;
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.das-hist-sub {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 3px;
}

/* Scrollable list area */
.das-hist-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: var(--s-3) 0 var(--s-6);
}

/* ──────────────────────────────────────────────────────────
   History day groups
   ────────────────────────────────────────────────────────── */

.hist-day { margin-bottom: var(--s-1); }

.hist-day-header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4) var(--s-2);
  cursor: pointer;
  user-select: none;
  transition: background .12s;
  border-radius: 0;
}
.hist-day-header:hover { background: var(--surface-2); }

.hist-day-label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  flex: 1;
}
.hist-day-count-pill {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-faint);
  background: var(--surface-3);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}
.hist-day-chevron {
  color: var(--ink-faint);
  transition: transform .15s var(--ease);
  flex-shrink: 0;
}
.hist-day-chevron.is-collapsed { transform: rotate(-90deg); }

.hist-day-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--s-3) var(--s-2);
}
.hist-day-rows.hidden { display: none; }

/* ──────────────────────────────────────────────────────────
   Rich history card
   ────────────────────────────────────────────────────────── */

.hist-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--hair);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
  overflow: hidden;
  min-height: 56px;
}
.hist-card:hover {
  background: var(--surface-3);
  border-color: var(--hair-2);
  transform: translateY(-1px);
}
.hist-card:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

/* Left accent edge — coloured by status */
.hist-card__edge {
  width: 3px;
  flex-shrink: 0;
  background: var(--ink-faint);
}
.hist-card.is-done    .hist-card__edge { background: var(--done); }
.hist-card.is-overdue .hist-card__edge { background: var(--overdue); box-shadow: 0 0 6px var(--overdue); }
.hist-card.is-blocked .hist-card__edge { background: var(--blocked); }
.hist-card.is-progress .hist-card__edge { background: var(--accent); }

/* Card content */
.hist-card__content {
  flex: 1;
  padding: var(--s-2) var(--s-3);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.hist-card__title {
  font-size: var(--t-md);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  font-weight: 400;
}
.hist-card.is-done .hist-card__title {
  color: var(--ink-mute);
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
}
.hist-card__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.hist-card__status {
  font-family: var(--f-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-radius: var(--r-pill);
  padding: 1px 6px;
  line-height: 16px;
  font-weight: 500;
}
.hist-card__status.is-done     { color: var(--done);    background: var(--done-soft); }
.hist-card__status.is-overdue  { color: var(--overdue); background: var(--overdue-soft); }
.hist-card__status.is-blocked  { color: var(--blocked); background: var(--blocked-soft); }
.hist-card__status.is-progress { color: var(--accent);  background: var(--accent-soft); }

.hist-card__age {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--ink-faint);
}

/* Priority dot on the right */
.hist-card__pri {
  padding: 0 var(--s-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Empty / loading */
.das-hist-empty {
  padding: var(--s-5) var(--s-5);
  font-size: var(--t-sm);
  color: var(--ink-faint);
  font-style: italic;
  font-family: var(--f-mono);
  text-align: center;
}

/* ──────────────────────────────────────────────────────────
   Sidebar — Quick Notes trigger button
   ────────────────────────────────────────────────────────── */

.tf-notes-wrap {
  padding: var(--s-2) var(--s-2) 0;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 0;
}

.tf-notes-trigger {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: 9px var(--s-2);
  border-radius: var(--r-1);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-mute);
  transition: background .12s, color .12s;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
  margin-bottom: var(--s-2);
}
.tf-notes-trigger:hover { background: var(--surface-2); color: var(--ink); }
.tf-notes-trigger.is-open { color: var(--accent); }
.tf-notes-trigger.is-open svg { opacity: 1; }
.tf-notes-trigger svg { opacity: .55; flex-shrink: 0; }
.tf-notes-trigger > span:nth-child(2) { flex: 1; }
.tf-notes-badge {
  font-family: var(--f-mono);
  font-size: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 0 6px;
  line-height: 17px;
  min-width: 17px;
  text-align: center;
}
.tf-notes-badge.hidden { display: none; }

/* ──────────────────────────────────────────────────────────
   Global Notes Drawer (slide in from right)
   ────────────────────────────────────────────────────────── */

.notes-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 340px;
  background: var(--surface);
  border-left: 1px solid var(--hair-2);
  z-index: 350;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s var(--ease);
  box-shadow: -8px 0 40px rgba(0,0,0,.35);
}
.notes-drawer.is-open {
  transform: translateX(0);
}

.notes-drawer__backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 349;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
}
.notes-drawer__backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer header */
.notes-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
}
.notes-drawer__title-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.notes-drawer__title-row > span {
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}
.notes-drawer__title-row svg { color: var(--ink-mute); flex-shrink: 0; }
.notes-drawer__count {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 0 7px;
  line-height: 18px;
  min-width: 18px;
  text-align: center;
  margin-left: var(--s-1);
}
.notes-drawer__close { flex-shrink: 0; }

/* Input area */
.notes-drawer__input-area {
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
}
.notes-drawer__textarea {
  width: 100%;
  resize: none;
  background: var(--surface-2);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-2);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-base);
  line-height: 1.6;
  padding: var(--s-3) var(--s-3);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.notes-drawer__textarea::placeholder { color: var(--ink-faint); }
.notes-drawer__textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.notes-drawer__input-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-2);
}
.notes-drawer__hint {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

/* Notes list */
.notes-drawer__list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: var(--s-3) var(--s-4) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

/* Individual note card */
.note-card {
  background: var(--surface-2);
  border: 1px solid var(--hair);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-3);
  position: relative;
  transition: border-color .12s, background .12s;
}
.note-card:hover {
  border-color: var(--hair-2);
  background: var(--surface-3);
}
.note-card:hover .note-card__del { opacity: 1; }

.note-card__body {
  font-size: var(--t-base);
  color: var(--ink-2);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  padding-right: var(--s-5);
}
.note-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-2);
}
.note-card__ts {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-faint);
}
.note-card__del {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  width: 22px; height: 22px;
  border-radius: var(--r-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity .12s, color .12s, background .12s;
  background: transparent;
  border: none;
  cursor: pointer;
}
.note-card__del:hover {
  color: var(--overdue);
  background: var(--overdue-soft);
}

.notes-empty {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  color: var(--ink-faint);
  font-size: var(--t-sm);
  font-style: italic;
  font-family: var(--f-mono);
}

/* ──────────────────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .daily-aside { display: none; }
}

@media (max-width: 600px) {
  .notes-drawer { width: 100%; }
}
