/* === Scaffolds === */

* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
*::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

html {
  font-size: 80%;
}

@media (max-width: 768px) {
  html { font-size: 100%; }
}

body {
  background-color: var(--color-bg-page);
  color: var(--color-text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", "Noto Sans", "Liberation Sans",
               Arial, sans-serif, "Apple Color Emoji",
               "Segoe UI Emoji", "Segoe UI Symbol",
               "Noto Color Emoji";
  font-size: 1rem;
  line-height: 1.5;
  margin: 2.0625rem;
}

p,
ol,
ul,
td {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

pre {
  background-color: var(--color-bg-raised);
  padding: 0.625rem;
  font-size: var(--text-xs);
}

a {
  color: var(--color-text-link);
}

a:visited {
  color: var(--color-text-link-visited);
}

a:hover {
  color: var(--color-text-link-hover);
}

th {
  padding-bottom: 0.3125rem;
}

td {
  padding: 0 0.3125rem 0.4375rem;
}

div.field,
div.actions {
  margin-bottom: 0.625rem;
}

#notice {
  color: var(--color-success);
}

.field_with_errors {
  padding: 0.125rem;
  background-color: red;
  display: table;
}

.dark .field_with_errors {
  background-color: rgba(236, 72, 153, 0.3);
}

#error_explanation {
  width: 28.125rem;
  border: 2px solid red;
  padding: 0.4375rem 0.4375rem 0;
  margin-bottom: 1.25rem;
  background-color: var(--color-bg-raised);
}

#error_explanation h2 {
  text-align: left;
  font-weight: bold;
  padding: 0.3125rem 0.3125rem 0.3125rem 0.9375rem;
  font-size: var(--text-xs);
  margin: -0.4375rem -0.4375rem 0;
  background-color: #c00;
  color: #fff;
}

#error_explanation ul li {
  font-size: var(--text-xs);
  list-style: square;
}

label {
  display: block;
}

/* === Application === */

/* Calendar navigation performance optimizations */
.nav-link-optimized {
  cursor: pointer;
  text-decoration: none;
  font-size: var(--text-base) !important;
  padding: 0.0625rem 0.375rem;
  margin: 0 0.125rem;
  border-radius: 0.5rem;
  background-color: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  transition: all 0.15s ease-in-out;

  &:hover {
    background-color: var(--color-bg-hover);
    transform: translateY(-1px);
  }

  &:active {
    transform: translateY(0);
    background-color: var(--color-border);
  }
}

/* Optimize turbo loading states */
[data-turbo-permanent] {
  opacity: 1 !important;
}

.day_nav_links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1rem;
}

/*
 * Content pane body -- default 5px padding
 * Use .content-pane-body--flush-h to zero horizontal
 */
.content-pane-body {
  padding: 5px;
}

.content-pane-body--flush-h {
  padding-left: 0;
  padding-right: 0;
}

.overflowy {
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  scrollbar-width: none; /* Firefox */
}

.overflowy::-webkit-scrollbar {
  display: none;
}

h4 a {
  text-decoration: none;
}

.contentEditable:read-write:focus {
  outline: 0px solid transparent !important;
}

[contenteditable]:focus {
  outline: 0px solid transparent;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

.simple-calendar-year {
  .day {
    height: 2.5rem;
    position: relative;
    padding: 0.125rem 0.25rem;
    font-size: var(--text-xs);
    line-height: 1.2;

    /* Fix for overlapping date numbers */
    a:first-child {
      display: block;
      font-size: var(--text-sm);
      font-weight: bold;
      margin-bottom: 0.125rem;
    }

    /* Container for emoji indicators */
    > div {
      display: flex;
      flex-wrap: wrap;
      gap: 0.0625rem;
      justify-content: center;

      span {
        font-size: var(--text-2xs);
        line-height: 1;
      }
    }
  }
  .prev-month {
    background-color: var(--color-bg-hover);
  }
  .next-month {
    background-color: var(--color-bg-hover);
  }
  .today {
    background-color: green;
  }
}

.simple-calendar-year-for-day {
  table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--color-border);
    width: 100%;
  }

  th {
    background-color: var(--color-bg-raised);
    text-align: center;
    border: none;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }
  th:last-child {
    border-right: none;
  }

  td {
    border: none;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }
  td:last-child {
    border-right: none;
  }
  tbody tr:last-child td {
    border-bottom: none;
  }

  /* Round corner cells so backgrounds don't clip */
  thead tr:first-child th:first-child {
    border-top-left-radius: 0.75rem;
  }
  thead tr:first-child th:last-child {
    border-top-right-radius: 0.75rem;
  }
  tbody tr:last-child td:first-child {
    border-bottom-left-radius: 0.75rem;
  }
  tbody tr:last-child td:last-child {
    border-bottom-right-radius: 0.75rem;
  }

  /* Day-of-week row: no vertical dividers */
  thead:not(.header) th {
    border-right: none;
  }

  .day {
    background-color: var(--color-bg-page);
    height: 2.5rem;
    position: relative;
    a:link,
    a:visited {
      color: var(--color-text-secondary);
    }

    a:hover {
      background-color: transparent;
      color: var(--color-text-muted);
      text-decoration: none;
    }
  }
  .prev-month,
  .next-month {
    background: var(--color-bg-hover);
    a:link,
    a:visited {
      color: var(--color-text-muted);
    }
  }

  .today {
    background-color: var(--color-bg-today);
  }
  .start-date {
    background-color: #b2f2ec;
    outline: 2px solid #4db8ac;
    outline-offset: -2px;
  }

  .dark & .start-date {
    background-color: rgba(99, 102, 241, 0.2);
    outline-color: rgba(139, 92, 246, 0.4);
  }

  thead.header {
    th {
      background-color: var(--color-bg-page);
      border: none;
      border-bottom: 1px var(--color-border) solid;
    }
    th:first-child {
      text-align: left;
      padding-left: 0.5rem;
    }
    th[colspan="5"] {
      text-align: center;
    }
    th:last-child {
      text-align: right;
      padding-right: 0.5rem;
    }
  }
}

.day_nav_links {
  a:link,
  a:visited,
  a:hover {
    font-size: 2.5rem;
    font-weight: 200;
    color: var(--color-text-muted);
    text-decoration: none;
  }
}

.led-clock {
  font-family: 'DSEG14', monospace;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  line-height: 1;
}

.led-clock-ampm {
  font-size: 0.55em;
  margin-left: 0.5rem;
  font-weight: 600;
}

a {
  text-decoration: none;
}
.day_metrics {
  a:link,
  a:visited,
  a:hover {
    font-size: var(--text-base);
    font-weight: 400;
    color: var(--color-text-secondary);
    text-decoration: none;
  }
}
.task_body {
  a:link,
  a:visited,
  a:hover {
    font-size: var(--text-sm);
    font-weight: 200;
    color: var(--color-text-muted);
    text-decoration: none;
  }

  p {
    margin: 0;
  }
}

a:link,
a:visited,
a:hover {
  color: var(--color-text-secondary);
}

tr.selected_week {
  border: 5px var(--color-accent) solid;
  td {
    background-color: var(--color-bg-today);
  }
}

.weekly_row {
  table {
    table-layout: fixed;
  }
  table,
  th,
  td {
    border: 1px var(--color-border) solid;
  }
  th {
    border-bottom: 2px var(--color-border) solid;
    height: 3.125rem;
    text-align: center;
    background-color: var(--color-bg-raised);
  }

  tbody td {
    vertical-align: top;
    height: 8.125rem;
    padding: 0.3125rem;
  }
}

.weekly_metrics_for_week {
  th {
    padding: 0.375rem;
  }
  td {
    padding: 0.375rem;
    vertical-align: top;
  }
}

.push_count {
  background-color: #50d050;
  border: 1px #50d050 solid;
  padding: 0.1875rem;
  border-radius: 0.75rem;
  text-align: center;
  font-size: var(--text-xs);
  align-items: center;
  color: white;
}

.push_count_warning {
  background-color: #ff6700;
  border: 1px #ff6700 solid;
  color: white;
}

.push_count_danger {
  background-color: red;
  border: 1px red solid;
  color: white;
}

.dark .push_count {
  background-color: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.5);
}

.dark .push_count_warning {
  background-color: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.5);
}

.dark .push_count_danger {
  background-color: rgba(236, 72, 153, 0.3);
  border-color: rgba(236, 72, 153, 0.5);
}

.rounded-header-btn {
  border-radius: 0.6rem;
}

.task {
  padding: 0.1875rem;
  border: 1px transparent solid;
  font-size: var(--text-base);
  border-radius: 0.5625rem;
}

.task__row {
  position: relative;
}

.task__main {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.task__detail {
  margin-left: 1.875rem;
}

.task__body-sidebar {
  display: none;
  position: absolute;
  left: -2.1875rem;
  top: -0.25rem;
  padding: 0.1875rem;
  width: 4.0625rem;
  background-color: var(--color-bg-raised);
  border: 1px var(--color-border) solid;
  border-left-width: 0;
  z-index: 5000;
  border-top-right-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.task_action {
  font-size: 150%;
  color: var(--color-text-muted);
}

.task_action--sm {
  font-size: 120%;
}

.handle {
  color: var(--color-text-muted);
  cursor: grab;
}

.task_name {
  flex: 1;
  color: var(--color-text-secondary);
}

.task_name--done {
  text-decoration: line-through;
}

.task_time {
  color: var(--color-text-muted);
}

.task_body,
.task_mdp {
  padding-bottom: 0;
}

.task_body--hidden,
.task_mdp--hidden {
  display: none;
}

.task_body--done,
.task_mdp--done {
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.task:hover,
.task:focus-within {
  background-color: var(--color-bg-hover);
  cursor: pointer;
  border: 1px var(--color-border) solid;
  border-top-right-radius: 0.5625rem;
  border-bottom-right-radius: 0.5625rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.task .sidebar {
  display: none;
  align-items: center;
  gap: 0.25rem;

  a {
    line-height: 0;
  }
}

.task:hover .sidebar {
  display: flex;
}

.task:hover .task__sep {
  display: inline !important;
}

.task:focus-within .sidebar {
  display: none !important;
}

.task:focus-within .task__sep {
  display: none !important;
}

/* Suppress normal hover, show shift-select hover instead */
body.shift-held .task:hover {
  background-color: rgba(135, 206, 250, 0.2);
  border: 1px solid rgba(135, 206, 250, 0.5);
  cursor: pointer;
  padding-top: 0.1875rem;
  padding-bottom: 0.1875rem;
}

.dark body.shift-held .task:hover {
  background-color: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
}

body.shift-held .task:hover .sidebar {
  display: none;
}

body.shift-held .task {
  cursor: pointer;
  user-select: none;
}

body.shift-held .task .task_name,
body.shift-held .task .task_body,
body.shift-held .task .task_time,
body.shift-held .task .task_mdp,
body.shift-held .task .cb,
body.shift-held .task .sidebar,
body.shift-held .task .handle {
  pointer-events: none;
}

/* Drag-and-drop visual feedback */
.task.dragging {
  opacity: 0.4;
}

.drag-over {
  background-color: rgba(64, 224, 208, 0.15);
  border-radius: 0.375rem;
  outline: 2px dashed var(--color-accent);
  outline-offset: -2px;
}

.next-month-calendar {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 300ms ease,
              opacity 200ms ease,
              margin-top 300ms ease;
}

.next-month-visible .next-month-calendar {
  max-height: 18.75rem;
  opacity: 1;
  margin-top: -1px;
  background-color: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: 0 0 0.625rem 0.625rem;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.calendar-container {
  position: relative;
  z-index: 1;
  transition: background-color 300ms ease,
              box-shadow 300ms ease,
              border-color 300ms ease,
              padding 300ms ease;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  padding: 0;
}

.next-month-visible {
  z-index: 100;
  background-color: var(--color-bg-raised);
  border-color: var(--color-border);
  border-radius: 0.625rem 0.625rem 0 0;
  padding: 0.5rem;
  box-shadow: none;
}

.task_action:hover {
  color: var(--color-accent);
}

.sidebar a i {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}
.sidebar a:hover i {
  color: var(--color-accent);
}

.new-task a i {
  color: var(--color-text-muted);
}

.new-task a:hover i {
  color: var(--color-accent);
}

.cb {
  padding-left: 0.3125rem;
}

[contenteditable="true"]:empty:before {
  content: attr(placeholder);
  pointer-events: none;
  color: var(--color-text-muted);
}

/* Flash content extracted by toast controller -- hide in-flow */
turbo-frame#flash_msg {
  display: none;
}

/* === Toast Notifications === */

.toast-container {
  position: fixed;
  top: 4.375rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  width: 100%;
  max-width: 45rem;
}

.toast-notification {
  position: relative;
  width: 100%;
  background: rgba(30, 30, 30, 0.95);
  color: #f0f0f0;
  border-radius: 0.5rem;
  padding: 0.75rem 3rem 0.75rem 1.5rem;
  border-left: 4px solid #60a5fa;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  font-size: var(--text-base);
  line-height: 1.5;
  display: flex;
  align-items: center;
  max-height: 10rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 300ms ease,
              transform 300ms ease,
              max-height 300ms ease,
              padding 300ms ease,
              margin 300ms ease;
}

.dark .toast-notification {
  background: rgba(157, 23, 77, 0.9);
  border: 1px solid rgba(236, 72, 153, 0.5);
  border-left: 4px solid #ec4899;
  color: #fff;
  font-weight: 700;
}

.dark .toast-notification__body,
.dark .toast-notification__body * {
  color: #fff !important;
}

.dark .toast-notification a:link,
.dark .toast-notification a:visited {
  color: #fff;
}

.dark .toast-notification a:hover {
  color: #fce7f3;
}

.toast-notification--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-notification--dismissed {
  opacity: 0;
  transform: translateY(-20px);
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition: opacity 300ms ease,
              transform 300ms ease,
              max-height 300ms ease 100ms,
              padding 300ms ease 100ms,
              margin 300ms ease 100ms;
}

.toast-notification a:link,
.toast-notification a:visited {
  color: var(--color-accent);
  text-decoration: underline;
}

.toast-notification a:hover {
  color: var(--color-accent-light);
}

.toast-notification__body b,
.toast-notification__body strong {
  color: #fff;
}

.toast-notification__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  line-height: 1;

  &:hover { color: #fff; }
}

.toast-notification .toast-undo-link {
  float: right;
  margin: 0 0 0.25rem 1rem;
  color: var(--color-accent);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;

  &:hover { color: var(--color-accent-light); }
}

.toast-notification--undone {
  animation: toast-undo-burst 800ms ease-out forwards;
}

/* Undo burst particles */
.toast-particle {
  position: fixed;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #34d399;
  pointer-events: none;
  z-index: 9600;
  animation: toast-particle-fly 600ms ease-out forwards;
}

@keyframes toast-undo-burst {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
    background: rgba(30, 30, 30, 0.95);
    border-left-color: #60a5fa;
  }
  15% {
    transform: translateY(0) scale(1.04);
    background: rgba(52, 211, 153, 0.95);
    border-left-color: #34d399;
    box-shadow: 0 0 1.25rem rgba(52, 211, 153, 0.4);
  }
  40% {
    transform: translateY(0) scale(1.01);
    opacity: 1;
    background: rgba(52, 211, 153, 0.8);
    border-left-color: #34d399;
  }
  100% {
    transform: translateY(-1.875rem) scale(0.96);
    opacity: 0;
    filter: blur(4px);
    background: rgba(52, 211, 153, 0.3);
    border-left-color: #34d399;
  }
}

@keyframes toast-particle-fly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* Timeline hover checkbox */
.timeline-row form button {
  all: unset;
  cursor: pointer;
}

.timeline-check {
  opacity: 0;
  margin-left: auto;
  flex-shrink: 0;
  transition: opacity 150ms;
}

.timeline-task:hover .timeline-check {
  opacity: 1;
}

.time-highlighted {
  background-color: #e0f7f4;
  transition: background-color 0.15s ease;
}

.dark .timeline-row.time-highlighted,
.dark .time-highlighted {
  background-color: rgba(139, 92, 246, 0.25);
}

/* Persistent current-hour indicator */
.current-hour-row {
  border-left: 3px solid #40e0d0;
}

.dark .current-hour-row {
  border-left: 3px solid #ec4899;
}

.beer-new {
  background-color: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding-left: 0.5rem;
}

.beer-pane-link {
  display: block;
  cursor: pointer;
  color: var(--color-text-primary);
}

.beer-pane-link strong {
  color: var(--color-text-primary);
}

.beer-detail {
  font-size: 0.85em;
  vertical-align: baseline;
}

.beer-dropped {
  background-color: #fef2f2;
  border-left: 3px solid #ef4444;
  padding-left: 0.5rem;
}

.dark .beer-dropped {
  background-color: rgba(236, 72, 153, 0.1);
  border-left-color: #ec4899;
}

.dark .beer-new {
  background-color: rgba(34, 197, 94, 0.1);
  border-left-color: #34d399;
}

.simple-calendar td {
  padding: 0;
}

.simple-calendar .day_div {
  height: 100%;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.simple-calendar .day_div:hover {
  background-color: var(--color-bg-hover);
}

.modal {
  z-index: 10000000 !important;
}

/* === Day Page 3-Column Layout === */
body:has(.day-layout__center-content) {
  min-width: 1024px;
}

/* Fixed positioning for independent column scrolling.
 *
 * --day-gap              : uniform gutter between columns, edges, and below header
 * --day-header-h         : height of the fixed app-header navbar
 * --day-col-w            : width of each side column (25%)
 * --day-metrics-header-h : height of the fixed "Metrics" label
 * --day-date-header-h    : height of the date/title header row
 * --day-side-offset      : left/right inset for side columns (gap)
 * --day-side-w           : computed side column width
 * --day-inner-left       : where the center column starts
 * --day-inner-right      : where the center column ends
 * --day-row1-top         : top of the first row (date header, metrics link, right sidebar)
 */
:root {
  --day-gap: 16px;
  --day-header-h: 40px;
  --day-footer-h: 40px;
  --day-col-w: 25%;
  --day-metrics-header-h: 29px;
  --day-date-header-h: 3rem;
  --day-side-offset: var(--day-gap);
  --day-side-w: calc(var(--day-col-w) - var(--day-gap) - var(--day-gap) / 2);
  --day-inner-left: calc(var(--day-col-w) + var(--day-gap) / 2);
  --day-inner-right: calc(var(--day-col-w) + var(--day-gap) / 2);
  --day-row1-top: calc(var(--day-header-h) + var(--day-gap));
}

#daily_metrics table {
  border-collapse: collapse;
}

/* Left sidebar - fixed "Metrics" header */
.day-layout__metrics-header {
  position: fixed;
  left: var(--day-side-offset);
  top: var(--day-row1-top);
  width: var(--day-side-w);
  padding-left: 1px;
  z-index: 2;
}

/* Left sidebar - metrics (scrolls under header) */
.day-layout__left-sidebar {
  position: fixed;
  left: var(--day-side-offset);
  top: calc(var(--day-row1-top) + var(--day-metrics-header-h) + 8px);
  overflow-y: auto;
  bottom: var(--day-footer-h);
  width: var(--day-side-w);
}

/* Header area - center top */
.day-layout__header {
  position: absolute;
  left: var(--day-inner-left);
  right: var(--day-inner-right);
  top: var(--day-row1-top);
}

/* Right sidebar - calendar & actions */
.day-layout__right-sidebar {
  position: absolute;
  right: var(--day-side-offset);
  width: var(--day-side-w);
  top: var(--day-row1-top);
}

/* Center content - main scrollable area */
.day-layout__center-content {
  position: fixed;
  left: var(--day-inner-left);
  right: var(--day-inner-right);
  top: calc(var(--day-row1-top) + var(--day-date-header-h));
  overflow-y: auto;
  bottom: var(--day-footer-h);
  padding-bottom: 6.25rem;
  z-index: 1;
}

/* Right sidebar bottom - timeline */
.day-layout__timeline-sidebar {
  position: fixed;
  right: var(--day-side-offset);
  top: 29.0625rem;
  overflow-y: auto;
  bottom: var(--day-footer-h);
  width: var(--day-side-w);
  padding-bottom: 0;
  z-index: 0;
}

/* === Header with CSS Variables for Dynamic Colors === */

.app-header {
  z-index: 9000;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  padding: 0.625rem;
  background-color: var(--header-bg-color, var(--color-bg-raised));
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.625rem;
}

.app-header__link {
  color: var(--header-link-color, var(--color-text-link));
}

.app-header__title {
  position: relative;
  color: var(--header-text-color, var(--color-text-primary));
  font-size: 1.25rem;
  font-weight: 700;
}

/* Vertical DEV badge */
.dev-badge {
  position: absolute;
  left: calc(-1.4rem + 6px);
  top: calc(50% - 1px);
  transform: translateY(-50%) rotate(-90deg);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1;
  color: #ec4899;
  pointer-events: none;
  user-select: none;
}
.dark .dev-badge {
  color: #ec4899;
}

/* Dark mode header: hot pink to orange gradient */
.dark .app-header {
  background: linear-gradient(
    to bottom,
    rgba(157, 23, 77, 0.5) 0%,
    rgba(80, 10, 40, 0.25) 60%,
    transparent 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(236, 72, 153, 0.3);
}

.dark .app-header__link {
  color: #d1d5db;
}
.dark .app-header__link:hover {
  color: #e2e8f0;
}

.dark .app-header__title {
  color: #ec4899;
}

/* Footer bar - day page only */
.app-footer {
  z-index: 9000;
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  height: var(--day-footer-h);
  padding: 0.625rem;
  background-color: var(--color-bg-raised);
  border-top: 1px solid var(--color-border);
}

.dark .app-footer {
  background: linear-gradient(
    to top,
    rgba(30, 30, 40, 0.8) 0%,
    rgba(20, 20, 30, 0.4) 60%,
    transparent 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* === Metric Input Fields === */

input.metric-input {
  text-align: center;
  padding: 0.3125rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  width: 3.4375rem;
  max-width: 3.4375rem;
}

input.metric-input--filled {
  color: var(--color-text-secondary);
  border: 1px var(--color-border) solid;
  background-color: var(--color-bg-input);
}

input.metric-input--empty {
  color: var(--color-text-secondary);
  border: 1px #99D9D2 solid;
  background-color: #E5FBF9;
}

input.metric-input--pending {
  border: 1px #ffc48f solid;
  background-color: #fff3d6;
}

.dark input.metric-input--empty {
  border-color: rgba(139, 92, 246, 0.4);
  background-color: rgba(139, 92, 246, 0.08);
}

.dark input.metric-input--pending {
  border-color: rgba(251, 191, 36, 0.4);
  background-color: rgba(251, 191, 36, 0.08);
}

/* === Progress Bar with CSS Variables === */

.dynamic-progress-bar {
  width: var(--progress-width, 0%);
  height: 100%;
  background-color: var(--progress-color, #4CAF50);
}

/* === Metric Badge with CSS Variables === */

.metric-badge {
  background-color: var(--badge-color, #666);
  margin-right: 0.3125rem;
  font-size: var(--text-base);
  color: white;
  padding: 0.3125rem;
  border-radius: 0.5rem;
}

/* === Goal Cell Styles with CSS Variables === */
/* Used for calendar/chain views when goals are active */

.goal-cell--success {
  background-color: var(--goal-color) !important;
}

.goal-cell--future-end {
  border: 3px solid var(--goal-color) !important;
  box-shadow: 0 0 8px var(--goal-color);
}

.goal-cell--future-end-chain {
  border: 2px solid var(--goal-color) !important;
  box-shadow: 0 0 3px var(--goal-color);
}

/* === Goal Highlight for Calendar Days === */
/* Subtle highlight when date falls within goal range */

.goal-highlight {
  background-color: rgba(135, 206, 250, 0.2);
  border: 2px solid #87CEEB;
  border-radius: 0.25rem;
}

.dark .goal-highlight {
  background-color: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
}

/* === Range 10 Metric Colors === */
/* Color scale from green (0) to red (>5) */

.range-10-value {
  font-size: var(--text-xs);
  border: 1px var(--color-border) solid;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  position: absolute;
  right: -0.125rem;
  bottom: -1.875rem;
}

.range-10-value--level-0 {
  background-color: lightgreen;
}

.range-10-value--level-1 {
  background-color: #fdd890;
}

.range-10-value--level-2 {
  background-color: #fc971d;
}

.range-10-value--level-3 {
  background-color: #fd6868;
}

.range-10-value--default {
  background-color: lightyellow;
}

.dark .range-10-value--level-0 {
  background-color: rgba(34, 197, 94, 0.25);
  color: #4ade80;
}

.dark .range-10-value--level-1 {
  background-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.dark .range-10-value--level-2 {
  background-color: rgba(249, 115, 22, 0.3);
  color: #fb923c;
}

.dark .range-10-value--level-3 {
  background-color: rgba(236, 72, 153, 0.3);
  color: #f472b6;
}

.dark .range-10-value--default {
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--color-text-muted);
}

.metric-indicator {
  background-color: var(--indicator-color, #666);
  margin: 0.0625rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  padding: 0 0.125rem;
}

/* Color swatch for metric color display */
.metric-swatch {
  background-color: var(--swatch-color, #666);
  display: inline-block;
}

/* Dynamic text color */
.dynamic-text {
  color: var(--text-color, inherit);
  font-weight: 700;
}

/* === Metric Data Point Badge === */

.mdp-badge {
  margin-left: 0.625rem;
  display: inline-block;
  padding: 0.1875rem;
  font-size: 75%;
  border-radius: 0.25rem;
  border: 1px var(--color-border) solid;
}

.mdp-badge--with-value {
  background-color: var(--color-bg-raised);
}

.mdp-badge--empty {
  background-color: pink;
}

.dark .mdp-badge--empty {
  background-color: rgba(236, 72, 153, 0.25);
}

/* Year calendar specific styles to fix overlapping */
.simple-calendar-year {
  table {
    font-size: var(--text-xs);
  }

  td {
    vertical-align: top;
    padding: 0.125rem !important;
    height: 3.125rem;
    overflow: hidden;

    .day-number {
      display: block;
      font-weight: bold;
      font-size: var(--text-sm);
      margin-bottom: 0.125rem;
    }

    .metric-indicators {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 0.0625rem;

      span {
        font-size: var(--text-2xs);
        line-height: 1;
        display: inline-block;
      }
    }
  }
}

/* === Tasks === */

.task {
  margin-top: 0.125rem;
  margin-bottom: 0.125rem;
}

.task-selected,
.task-selected:hover {
  border: 2px turquoise solid !important;
  padding: calc(0.1875rem - 1px) !important;
  background-color: rgb(180, 235, 227) !important;
  cursor: move;
}

.dark .task-selected,
.dark .task-selected:hover {
  border-color: #8b5cf6 !important;
  background-color: rgba(139, 92, 246, 0.15) !important;
}

.task-selected:hover .sidebar {
  display: none;
}

/* Highlight a task that just landed after a move */
.task.task-just-landed {
  animation: task-land-glow 1.5s ease-out;
}

@keyframes task-land-glow {
  0% {
    box-shadow:
      0 0 8px rgba(64, 224, 208, 0.6),
      inset 0 0 4px rgba(64, 224, 208, 0.15);
  }
  100% {
    box-shadow: none;
  }
}

.dark .task.task-just-landed {
  animation: task-land-glow-dark 1.5s ease-out;
}

@keyframes task-land-glow-dark {
  0% {
    box-shadow:
      0 0 8px rgba(236, 72, 153, 0.6),
      inset 0 0 4px rgba(236, 72, 153, 0.15);
  }
  100% {
    box-shadow: none;
  }
}

.task.task-burst-away,
.task.task-burst-away:hover,
.task.task-burst-away:focus-within,
.task-burst-away {
  animation: task-explode 0.8s cubic-bezier(0.1, 0, 0, 1) forwards;
  pointer-events: none;
  position: relative;
  z-index: 9999;
  overflow: visible !important;
  transform-origin: center center;
  background-color: rgba(236, 72, 153, 0.4) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

@keyframes task-explode {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0) brightness(1);
    background-color: rgba(236, 72, 153, 0.1);
    box-shadow: none;
  }
  8% {
    transform: scale(1.05);
    opacity: 1;
    filter: blur(0) brightness(1.2);
    background-color: rgba(236, 72, 153, 0.35);
    box-shadow:
      0 0 20px rgba(236, 72, 153, 0.5),
      0 0 40px rgba(244, 114, 182, 0.25);
  }
  15% {
    transform: scale(1.1);
    opacity: 1;
    filter: blur(0) brightness(1.4);
    background-color: rgba(236, 72, 153, 0.5);
    box-shadow:
      0 0 35px rgba(236, 72, 153, 0.6),
      0 0 70px rgba(244, 114, 182, 0.3),
      0 0 100px rgba(236, 72, 153, 0.15);
  }
  30% {
    transform: scale(2);
    opacity: 0.8;
    filter: blur(1px) brightness(1.8);
    background-color: rgba(236, 72, 153, 0.5);
    box-shadow:
      0 0 60px rgba(244, 114, 182, 0.6),
      0 0 120px rgba(236, 72, 153, 0.3);
  }
  55% {
    transform: scale(5);
    opacity: 0.3;
    filter: blur(6px) brightness(1.4);
    background-color: rgba(236, 72, 153, 0.15);
    box-shadow: 0 0 80px rgba(244, 114, 182, 0.2);
  }
  100% {
    transform: scale(10);
    opacity: 0;
    filter: blur(16px) brightness(1);
    background-color: transparent;
    box-shadow: none;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
}

.task-restored {
  animation: task-restored-glow 1.5s ease-out;
}

@keyframes task-restored-glow {
  0% {
    background-color: rgba(52, 211, 153, 0.4);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

/* === Metrics === */

.metrics {
  .simple-calendar-year-for-day {
    .start-date {
      background-color: var(--color-bg-page) !important;
    }
    .today.next-month {
      background-color: var(--color-bg-raised);
    }
    .today.current-month {
      background-color: var(--color-bg-today) !important;
    }
  }
}


input[id="metric_data_point_string_value"]:focus,
textarea[id="metric_data_point_notes"]:focus {
  border: 3px turquoise solid !important;
  background-color: var(--color-bg-today) !important;
}


.value-input-long {
 width: 100%;
 margin-bottom: 0.625rem;
 padding: 0.625rem;
 border-radius: 0.375rem;
 font-size: 120%;
 font-weight: 600;
}

.value-input-inline {
  width: 9.375rem;
  padding: 0.625rem;
}

.value-input-long, .notes-input {
  border: 2px var(--color-border-strong) solid;
}

.value-input-long:focus, .value-input-inline:focus, .notes-input:focus, .metric-save-btn:focus, .metric-save-btn:hover {
  border: 3px turquoise solid !important;
}

.notes-input {
  width: 100%;
  height: 20.8125rem;
  padding: 0.625rem;
  border-radius: 0.375rem;
}

.metric-save-btn {
  font-weight: 500;
  padding: 0.5rem;
  background-color: var(--color-bg-page);
  border: 1px var(--color-border-strong) solid;
  border-radius: 0.375rem;
  color: var(--color-text-primary) !important;
}

.metric-save-btn:focus, .metric-save-btn:hover {
  background-color: rgb(224, 242, 240);
}

.dark .metric-save-btn:focus,
.dark .metric-save-btn:hover {
  background-color: rgba(139, 92, 246, 0.2);
}

/* Boolean heatmap component */
.heatmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem;
}

.heatmap-cell {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 0.125rem;
}

.heatmap-cell--completed { background-color: #4ade80; }
.dark .heatmap-cell--completed { background-color: rgba(34, 197, 94, 0.6); }
.heatmap-cell--missed { }

/* === Mobile === */

/* CSS Custom Properties for Dynamic Layout */
/* These are set by mobile_header_controller.js based on actual measured heights */

:root {
  /* === Color Tokens === */

  /* Surfaces */
  --color-bg-page: #ffffff;
  --color-bg-raised: #f9fafb;
  --color-bg-overlay: #ffffff;
  --color-bg-input: #ffffff;
  --color-bg-hover: #f3f4f6;
  --color-bg-stripe: #f9fafb;
  --color-bg-today: lightyellow;

  /* Text */
  --color-text-primary: #212529;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-text-link: #40e0d0;
  --color-text-link-hover: #33b3a6;
  --color-text-link-visited: #666;

  /* Borders */
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-border-subtle: #f3f4f6;

  /* Accent */
  --color-accent: #40e0d0;
  --color-accent-light: #6ee7d7;

  /* Status (same in both modes) */
  --color-danger: #ef4444;
  --color-success: #22c55e;
  --color-warning: #f59e0b;

  /* Shadows */
  --color-shadow: rgba(0, 0, 0, 0.1);

  /* === Layout === */
  --mobile-primary-header-height: 3rem;
  --mobile-subheader-height: 3.75rem;
  --safe-area-inset-top: env(safe-area-inset-top);
  --safe-area-inset-bottom: env(safe-area-inset-bottom);
}

/* === Dark Mode (TrueStarz palette) === */
.dark {
  --color-bg-page: #0a0a1a;
  --color-bg-raised: rgba(255, 255, 255, 0.04);
  --color-bg-overlay: rgba(255, 255, 255, 0.06);
  --color-bg-input: rgba(255, 255, 255, 0.06);
  --color-bg-hover: #252040;
  --color-bg-stripe: rgba(37, 33, 62, 0.55);
  --color-bg-today: rgba(99, 102, 241, 0.2);

  --color-text-primary: #e2e8f0;
  --color-text-secondary: #d1d5db;
  --color-text-muted: #9ca3af;
  --color-text-link: #818cf8;
  --color-text-link-hover: #a5b4fc;
  --color-text-link-visited: #a78bfa;

  --color-border: rgba(139, 92, 246, 0.15);
  --color-border-strong: rgba(139, 92, 246, 0.25);
  --color-border-subtle: rgba(255, 255, 255, 0.05);

  --color-accent: #8b5cf6;
  --color-accent-light: #a78bfa;

  --color-shadow: rgba(0, 0, 0, 0.4);
}

/* Dark mode: subtle glow borders instead of shadows */
.dark .shadow,
.dark .shadow-md,
.dark .shadow-lg,
.dark .shadow-xl {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1),
              0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dark mode: action buttons and dropdowns */
.dark .btn-variant-outline {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(139, 92, 246, 0.25);
  color: #c7d2fe;
}
.dark .btn-variant-outline:hover {
  background-color: #252040;
  border-color: rgba(139, 92, 246, 0.4);
}

.dark .dropdown-menu {
  background-color: #19162e;
  border-color: rgba(139, 92, 246, 0.2);
}

.dark .dropdown-item {
  color: #c7d2fe;
}
.dark .dropdown-item:hover {
  background-color: #252040;
}

.dark .dropdown-item--warning {
  color: #f472b6;
}
.dark .dropdown-item--warning:hover {
  background-color: rgba(236, 72, 153, 0.1);
}

/* Timeline rows */
.timeline-row:hover {
  background-color: #e0f7f4;
}
.dark .timeline-row {
  background-color: rgba(37, 33, 62, 0.4);
}
.dark .timeline-row:hover {
  background-color: #252040;
}

/* Dark mode: weather hints */
.weather-hint {
  color: var(--color-border-strong);
}
.dark .weather-hint {
  color: var(--color-text-muted);
}

/* Dark mode: modals — opaque background */
.dark .modal-content {
  background-color: #19162e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--color-text-primary);
}
.dark .modal-dialog-wrapper::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}
.dark .modal-header,
.dark .modal-footer {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Dark mode: multi-select — hot pink */
.dark .task-selected,
.dark .task-selected:hover {
  border-color: #ec4899 !important;
  background-color: rgba(236, 72, 153, 0.2) !important;
}

/* Dark mode: slide-in panel opaque background */
.dark .offcanvas-panel {
  background-color: rgba(28, 22, 50, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}


/* Dark mode: section header purple tint */
.dark .section-header {
  background-color: #252040;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

/* Dark mode: form inputs inherit dark surface colors */
.dark input,
.dark textarea,
.dark select {
  background-color: var(--color-bg-input);
  color: var(--color-text-primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25);
  outline: none;
}

.dark input[type="checkbox"],
.dark input[type="radio"] {
  accent-color: var(--color-accent);
  background-color: var(--color-bg-input);
  color-scheme: dark;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: var(--color-text-muted);
}

/* Dark mode: metric input status colors */
.dark input.metric-input--empty {
  background-color: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.dark input.metric-input--pending {
  background-color: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Dark mode: TrueStarz-inspired calendar */

/* Glass container with animated gradient */
.dark .simple-calendar-year-for-day {
  table {
    background: linear-gradient(
      135deg,
      rgba(35, 20, 60, 0.6),
      rgba(20, 30, 55, 0.6),
      rgba(30, 25, 50, 0.6),
      rgba(25, 35, 55, 0.6),
      rgba(40, 22, 55, 0.6),
      rgba(35, 20, 60, 0.6)
    );
    background-size: 400% 400%;
    animation: cal-rainbow 20s ease infinite;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-color: rgba(139, 92, 246, 0.15);
  }

  /* Month header row — arrows + title */
  thead.header th {
    background-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    border-right: none;
  }
  thead.header th a:link,
  thead.header th a:visited {
    color: rgba(255, 255, 255, 0.5);
  }
  thead.header th a:hover {
    color: rgba(255, 255, 255, 0.8);
  }
  .calendar-title,
  thead.header th .calendar-title a:link,
  thead.header th .calendar-title a:visited {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    letter-spacing: 0.05em;
  }
  thead.header th .calendar-title a:hover {
    color: #ffffff;
  }

  /* Day-of-week headers */
  thead:not(.header) th {
    background-color: transparent;
    border-color: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
  }

  td {
    border-color: rgba(139, 92, 246, 0.12);
  }

  /* Day cells — subtle transparent tint */
  .day {
    background-color: rgba(255, 255, 255, 0.03);
  }
  .day a:link,
  .day a:visited {
    color: #c7d2fe;
  }

  .prev-month,
  .next-month {
    background: rgba(0, 0, 0, 0.25);
  }
  .prev-month .day_div,
  .next-month .day_div {
    opacity: 0.2;
  }

  .day_div:hover {
    background-color: rgba(139, 92, 246, 0.2);
  }

  .today {
    background-color: rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.4);
  }
  .today a:link,
  .today a:visited {
    color: #a5b4fc;
    font-weight: 700;
  }

  .start-date {
    background-color: rgba(99, 102, 241, 0.2);
    outline-color: rgba(139, 92, 246, 0.4);
    box-shadow: inset 0 0 0 2px #818cf8;
  }
  .start-date a:link,
  .start-date a:visited {
    color: #a5b4fc;
    font-weight: 700;
  }
}

@keyframes cal-rainbow {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

.dark .simple-calendar-year .today {
  background-color: rgba(99, 102, 241, 0.15);
  box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.4);
}

.dark input[id="metric_data_point_string_value"]:focus,
.dark textarea[id="metric_data_point_notes"]:focus {
  border-color: rgba(139, 92, 246, 0.6) !important;
}

.dark .value-input-long:focus,
.dark .value-input-inline:focus,
.dark .notes-input:focus,
.dark .metric-save-btn:focus,
.dark .metric-save-btn:hover {
  border-color: rgba(139, 92, 246, 0.6) !important;
}

/* === Dark mode: Starfield background === */

.dark body {
  background-image:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(88, 28, 135, 0.08) 0%, transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 20%,
      rgba(30, 58, 138, 0.06) 0%, transparent 50%
    ),
    radial-gradient(
      ellipse at 50% 80%,
      rgba(88, 28, 135, 0.05) 0%, transparent 40%
    );
}

.dark body::before,
.dark body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* Dense small stars */
.dark body::before {
  background-image:
    radial-gradient(1px 1px at 10% 15%,
      rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 25% 35%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 40% 8%,
      rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 55% 42%,
      rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 70% 20%,
      rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 85% 55%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 15% 65%,
      rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 30% 80%,
      rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 50% 72%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 65% 88%,
      rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 80% 38%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 95% 10%,
      rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 5% 45%,
      rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 35% 52%,
      rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 60% 30%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 75% 68%,
      rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 90% 78%,
      rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 20% 92%,
      rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 45% 5%,
      rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 8% 28%,
      rgba(255, 255, 255, 0.5), transparent);
  background-size: 200px 200px;
  animation:
    twinkle-small 8s ease-in-out infinite alternate,
    starfield-drift 120s linear infinite;
}

/* Larger brighter stars, sparser */
.dark body::after {
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%,
      rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 38% 18%,
      rgba(200, 210, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 62% 45%,
      rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 78% 12%,
      rgba(210, 200, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 88% 65%,
      rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 22% 75%,
      rgba(200, 220, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 48% 88%,
      rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 72% 78%,
      rgba(220, 200, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 5% 55%,
      rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 55% 62%,
      rgba(200, 210, 255, 0.7), transparent),
    radial-gradient(2.5px 2.5px at 32% 38%,
      rgba(255, 250, 230, 0.9), transparent),
    radial-gradient(2.5px 2.5px at 85% 42%,
      rgba(230, 240, 255, 0.8), transparent);
  background-size: 300px 300px;
  animation:
    twinkle-large 12s ease-in-out infinite alternate,
    starfield-drift-slow 180s linear infinite;
}


@keyframes twinkle-small {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes twinkle-large {
  0% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes starfield-drift {
  0% { background-position: 0 0; }
  100% { background-position: 200px 100px; }
}

@keyframes starfield-drift-slow {
  0% { background-position: 0 0; }
  100% { background-position: -300px 150px; }
}

/* Shooting star / comet */
.shooting-star {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  width: 120px;
  height: 1px;
  background: linear-gradient(
    270deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.4) 40%,
    transparent
  );
  border-radius: 1px;
  opacity: 0;
  animation: shooting-star-fly 1.2s ease-in forwards;
  filter: blur(0.3px);
}

.shooting-star::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 4px rgba(255, 255, 255, 0.8),
    0 0 8px rgba(200, 210, 255, 0.4);
}

/* Hot pink fiery variant */
.shooting-star--pink {
  width: 140px;
  background: linear-gradient(
    270deg,
    rgba(255, 105, 180, 0.95),
    rgba(255, 60, 150, 0.6) 30%,
    rgba(255, 20, 100, 0.3) 60%,
    transparent
  );
  filter: blur(0.4px);
}

.shooting-star--pink::before {
  background: rgba(255, 150, 200, 1);
  box-shadow:
    0 0 6px rgba(255, 105, 180, 0.9),
    0 0 12px rgba(255, 60, 150, 0.6),
    0 0 20px rgba(255, 20, 80, 0.3);
}

@keyframes shooting-star-fly {
  0% {
    opacity: 0;
    transform: rotate(var(--star-angle, 30deg))
      translateX(0);
  }
  5% {
    opacity: 1;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--star-angle, 30deg))
      translateX(400px);
  }
}

/* === Print: Force light mode === */
@media print {
  :root {
    --color-bg-page: #ffffff;
    --color-bg-raised: #f9fafb;
    --color-bg-overlay: #ffffff;
    --color-text-primary: #212529;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;
    --color-accent: #40e0d0;
  }
}

/* Safe Area Background (iOS Notch) */

/* Set page background to white */
/* The header extends into the safe area via its padding-top */
body:has(.mobile-primary-header) {
  background-color: var(--color-bg-page);
}

/* Layout & Container */

.mobile-container {
  max-width: 100%;
  padding: 0 0.4375rem 0.4375rem 0.4375rem;
  /* Padding-top is set dynamically by mobile_header_controller.js */
}

/* Primary header (orange KATALIST bar) */
.mobile-primary-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  padding: 0.625rem;
  padding-top: calc(0.625rem + var(--safe-area-inset-top));
  border-bottom: 1px solid var(--color-border);
}

/* Secondary header (arrows, day of week, date) */
.mobile-subheader {
  position: fixed;
  /* top is set dynamically by mobile_header_controller.js */
  left: 0;
  right: 0;
  background: var(--color-bg-page);
  z-index: 8000;
  padding: 0.5rem 0.4375rem;
  border-bottom: 1px solid var(--color-border);

  h4 {
    margin: 0.3125rem 0 0 0;
  }
}

/* Deprecated - keeping for backwards compatibility */
.mobile-header {
  position: sticky;
  top: 0;
  background: var(--color-bg-page);
  z-index: 100;
  padding: 0.3125rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.625rem;
  margin: 0 -0.4375rem 0.625rem -0.4375rem;
  padding-left: 0.4375rem;
  padding-right: 0.4375rem;

  h4 {
    margin: 0.625rem 0 0 0;
    padding-left: 0.4375rem;
  }
}

/* Typography & Text Styles */

.text-muted-gray {
  color: var(--color-text-muted);
}

.text-dark-gray {
  color: var(--color-text-secondary);
}

.text-medium-gray {
  color: var(--color-text-primary);
}

.breadcrumb-separator {
  color: var(--color-text-muted);
}

.empty-state {
  color: var(--color-text-muted);
  text-align: center;
  padding: 2.5rem 1.25rem;
}

/* Metrics List */

.category-section {
  margin-bottom: 0.5rem;
}

.category-header-link {
  text-decoration: none;
  color: inherit;
  display: block;

  &:hover {
    opacity: 0.8;
  }
}

.category-header {
  background: var(--color-bg-raised);
  padding: 0.625rem 0.9375rem;
  border-radius: 0.5rem;
  margin-bottom: 0.625rem;
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;

  &.compact {
    background: var(--color-bg-stripe);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
  }

  strong {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text-primary);
  }

  .caret-icon {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
  }
}

.metric-item {
  padding: 0.9375rem;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-bg-page);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-primary);
}

.metric-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 0.1875rem;

  span + span {
    margin-left: 0.5rem;
  }
}

.metric-arrow {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* Mobile Metrics (Day View) */

.metric-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--color-border-subtle);
  min-height: 2.75rem;

  /* Remove border from last metric in category */
  &:last-child {
    border-bottom: none;
  }

  .metric-name {
    flex: 1;
  }

  .metric-value {
    width: 5rem;
    text-align: right;
  }
}

/* View Tabs (List/Calendar/Chain) */

.view-tabs {
  display: flex;
  gap: 0.3125rem;
  margin-bottom: 0.9375rem;
  border-bottom: 2px solid var(--color-border-subtle);

  a {
    flex: 1;
    border-radius: 0.25rem 0.25rem 0 0;

    &.active-tab {
      border-bottom: 2px solid #007bff;
      color: white !important;

      .dark & {
        border-bottom-color: #818cf8;
      }
    }

    &.inactive-tab {
      border-bottom: none;
    }
  }
}

/* History List View */

.history-item {
  padding: 0.9375rem;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-bg-page);
}

.history-date {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.history-value {
  font-weight: 500;
  font-size: var(--text-base);

  .value-yes {
    color: #28a745;
  }

  .value-no {
    color: #dc3545;
  }

  .value-empty {
    color: var(--color-text-muted);
  }

  .dark & .value-yes {
    color: #4ade80;
  }

  .dark & .value-no {
    color: #f472b6;
  }
}

.history-notes {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-top: 0.5rem;
}

.history-photos {
  margin-top: 0.625rem;
  display: flex;
  gap: 0.3125rem;
  flex-wrap: wrap;

  img {
    border-radius: 0.25rem;
    object-fit: cover;
    width: 5rem;
    height: 5rem;
  }

  .more-photos {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }
}

/* Calendar View */

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9375rem;
  background: var(--color-bg-raised);
  border-radius: 0.5rem;
  margin-bottom: 0.9375rem;

  h5 {
    margin: 0;
  }
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3125rem;
}

.weekday-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3125rem;
  margin-bottom: 0.625rem;
  font-weight: bold;
  text-align: center;
  font-size: var(--text-sm);
}

.day-header {
  text-align: center;
  font-weight: bold;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding: 0.3125rem;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3125rem;
}

.empty-day {
  aspect-ratio: 1;
  background: var(--color-bg-stripe);
  border-radius: 0.25rem;
}

.day-cell {
  aspect-ratio: 1;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;

  &.empty {
    background: transparent;
    border: none;
  }

  &.filled {
    background: var(--color-bg-page);
  }

  &.unset {
    background: var(--color-bg-stripe);
  }

  &.today {
    background: #007bff;
    color: white;
    font-weight: 500;
  }

  /* Boolean metric colors */
  &.boolean-true {
    background: #28a745;
    color: white;
  }

  &.boolean-false {
    background: #dc3545;
    color: white;
  }

  &.boolean-unset {
    background: #ccc;
  }

  span {
    &.day-number {
      font-size: var(--text-2xs);
    }

    &.day-number-white {
      font-size: var(--text-2xs);
      color: white;
    }

    &.day-number-gray {
      font-size: var(--text-2xs);
      color: var(--color-text-muted);
    }

    &.day-value {
      font-size: var(--text-2xs);
      font-weight: bold;
    }
  }

  /* Flex layout for two-line days */
  &.two-line {
    flex-direction: column;
    padding: 0.125rem;
  }
}

/* Chain View */

.chain-header {
  background: var(--color-bg-raised);
  padding: 0.9375rem;
  border-radius: 0.5rem;
  margin-bottom: 0.9375rem;

  h5 {
    margin: 0 0 0.3125rem 0;
  }

  p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);

    span {
      margin-left: 0.625rem;
    }
  }
}

.chain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(1.875rem, 1fr));
  gap: 0.375rem;
}

.chain-cell {
  aspect-ratio: 1;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xs);
  font-weight: bold;
  min-height: 1.875rem;

  &.boolean-true {
    background: #28a745;
  }

  &.boolean-false {
    background: #dc3545;
  }

  &.boolean-unset {
    background: #ccc;
  }

  &.value-filled {
    background: var(--color-bg-page);
    border: 1px solid var(--color-border);
  }

  &.value-empty {
    background: var(--color-bg-stripe);
    border: 1px solid var(--color-border);
  }
}

/* Dark mode overrides for mobile day-cell and chain */
.dark .day-cell.today {
  background: rgba(139, 92, 246, 0.4);
}

.dark .day-cell.boolean-unset,
.dark .chain-cell.boolean-unset {
  background: rgba(255, 255, 255, 0.1);
}

.dark .day-cell.boolean-true,
.dark .chain-cell.boolean-true {
  background: #22c55e;
}

.dark .day-cell.boolean-false,
.dark .chain-cell.boolean-false {
  background: #ef4444;
}

/* Current Entry Form */

.current-entry {
  background: var(--color-bg-raised);
  padding: 0.9375rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;

  .value-input-large {
    font-size: var(--text-lg);
  }

  details {
    summary,
    .notes-summary,
    .photo-summary {
      cursor: pointer;
      color: var(--color-text-secondary);
      font-size: var(--text-sm);
      margin-bottom: 0.625rem;
    }
  }
}

/* Boolean Metric Values */

.boolean-value-yes {
  background-color: #28a745;
  color: white;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  display: inline-block;
}

.boolean-value-no {
  background-color: #dc3545;
  color: white;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  display: inline-block;
}

.dark .boolean-value-yes {
  background-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.dark .boolean-value-no {
  background-color: rgba(236, 72, 153, 0.3);
  color: #f472b6;
}

.boolean-value-empty {
  background-color: var(--color-bg-stripe);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  display: inline-block;
  min-width: 3.125rem;
}

.value-filled {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.value-empty {
  color: var(--color-text-muted);
}

/* Links */

.mobile-link-plain {
  text-decoration: none;
  color: inherit;
  display: block;
}

.mobile-link-subtle {
  text-decoration: none;
  color: var(--color-text-primary);
  padding: 0.5rem;
  margin: -0.5rem;
}

.mobile-link-value {
  text-decoration: none;
  padding: 0.5rem;
  margin: -0.5rem;
}

.mobile-link-unstyled {
  text-decoration: none;
}

.mobile-link-header {
  color: inherit;
  text-decoration: none;
}

/* Utility Classes */

.day-name {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 0;
}

.margin-top-20 {
  margin-top: 1.25rem;
}

.hidden-file-input {
  display: none;
}

/* Monthly Metric Table */

.metric-month-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.25rem;
  padding-top: 0.9375rem;
  margin-top: -0.9375rem;
}

.metric-month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  min-width: 100%;

  thead {
    position: sticky;
    top: 0;
    background: var(--color-bg-page);
    z-index: 10;

    th {
      border: 1px solid var(--color-border);
      padding: 0.25rem 0.125rem;
      text-align: center;
      font-weight: 600;
      background: var(--color-bg-raised);

      &.metric-name-col {
        text-align: left;
        padding-left: 0.5rem;
        min-width: 6.25rem;
        max-width: 7.5rem;
        position: sticky;
        left: 0;
        z-index: 11;
        background: var(--color-bg-raised);
      }

      &.day-col {
        min-width: 2rem;
        width: 2rem;
        position: relative;

        .today-indicator {
          position: absolute;
          top: -0.9375rem;
          left: 50%;
          transform: translateX(-50%);
          font-size: var(--text-xs);
          color: #007bff;
          line-height: 1;

          .dark & {
            color: #818cf8;
          }
        }

        .day-header-link {
          color: inherit;
          text-decoration: none;
          display: block;
          padding: 0.25rem 0.125rem;

          &:hover {
            opacity: 0.7;
            text-decoration: underline;
          }
        }
      }
    }
  }

  tbody {
    tr {
      &:nth-child(even) {
        background: var(--color-bg-stripe);
      }

      &.category-row {
        background: var(--color-bg-raised);

        td.category-header-cell {
          border: none;
          padding: 0.25rem 0.5rem;
          font-weight: 600;
          font-size: var(--text-2xs);
          text-transform: uppercase;
          text-align: left;
          color: var(--color-text-primary);
          background: var(--color-bg-raised);
          position: sticky;
          left: 0;
          z-index: 6;
          line-height: 1.2;
          height: auto;
          min-width: 6.25rem;
          max-width: 7.5rem;
        }

        td.category-spacer-cell {
          border: none;
          background: var(--color-bg-raised);
          min-width: 2rem;
          width: 2rem;
        }
      }

      td {
        border: 1px solid var(--color-border);
        padding: 0.25rem 0.125rem;
        text-align: center;

        &.metric-name-col {
          text-align: left;
          padding-left: 0.5rem;
          font-weight: 500;
          position: sticky;
          left: 0;
          background: var(--color-bg-page);
          z-index: 5;
          min-width: 6.25rem;
          max-width: 7.5rem;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;

          .metric-name-link {
            color: var(--color-text-primary);
            text-decoration: none;
            display: block;

            &:hover {
              color: #007bff;
              text-decoration: underline;
            }

            .dark &:hover {
              color: #818cf8;
            }
          }
        }

        &.value-cell {
          min-width: 2rem;
          width: 2rem;
          font-size: var(--text-2xs);
          padding: 0;

          .cell-link {
            display: block;
            width: 100%;
            height: 100%;
            padding: 0.25rem 0.125rem;
            text-decoration: none;
            color: inherit;
            cursor: pointer;

            &:hover {
              opacity: 0.8;
            }
          }

          &.boolean-true {
            background: #28a745;
            color: white;
            font-weight: bold;

            .dark & {
              background: #22c55e;
            }
          }

          &.boolean-false {
            background: #dc3545;
            color: white;
            font-weight: bold;

            .dark & {
              background: #ef4444;
            }
          }

          &.boolean-unset {
            background: var(--color-bg-raised);
          }

          &.has-value {
            background: var(--color-bg-page);
            font-weight: 500;
            color: var(--color-text-primary);
          }

          &.no-value {
            background: var(--color-bg-stripe);
          }
        }
      }
    }
  }
}

/* === Mobile Boolean === */

/* Mobile boolean metric toggle styles */

.boolean-toggle {
  border: none;
  border-radius: 0.375rem;
  font-size: var(--text-sm);
  min-width: 3.75rem;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.boolean-toggle:active {
  transform: scale(0.95);
}

/* Success state (YES) */
.btn-success.boolean-toggle {
  background-color: #28a745;
  color: white;
}

.btn-success.boolean-toggle:hover {
  background-color: #218838;
}

/* Danger state (NO) */
.btn-danger.boolean-toggle {
  background-color: #dc3545;
  color: white;
}

.btn-danger.boolean-toggle:hover {
  background-color: #c82333;
}

.dark .btn-success.boolean-toggle {
  background-color: #22c55e;
}

.dark .btn-success.boolean-toggle:hover {
  background-color: #16a34a;
}

.dark .btn-danger.boolean-toggle {
  background-color: #ef4444;
}

.dark .btn-danger.boolean-toggle:hover {
  background-color: #dc2626;
}

/* Undefined state */
.btn-outline-secondary.boolean-toggle {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn-outline-secondary.boolean-toggle:hover {
  background-color: var(--color-bg-raised);
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}

/* Boolean choice buttons - for metric edit screen */
.boolean-choice-btn {
  border: 2px solid transparent;
  transition: all 0.3s ease;
  touch-action: manipulation;
}

.boolean-choice-btn:active {
  transform: scale(0.95);
}

/* Bright selected states */
.boolean-choice-btn.selected {
  opacity: 1;
  border-color: currentColor;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.boolean-choice-btn.selected.boolean-yes {
  background-color: #28a745;
  color: white;
  border-color: #28a745;
}

.boolean-choice-btn.selected.boolean-no {
  background-color: #dc3545;
  color: white;
  border-color: #dc3545;
}

.boolean-choice-btn.selected:not(.boolean-yes):not(.boolean-no) {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

/* Faded unselected states */
.boolean-choice-btn.unselected {
  opacity: 0.3;
  background-color: var(--color-bg-raised);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.boolean-choice-btn.unselected.boolean-yes {
  color: #28a745;
}

.boolean-choice-btn.unselected.boolean-no {
  color: #dc3545;
}

.boolean-choice-btn.unselected:hover {
  opacity: 0.6;
  background-color: var(--color-bg-hover);
}

.dark .boolean-choice-btn.selected.boolean-yes {
  background-color: #22c55e;
  border-color: #22c55e;
}

.dark .boolean-choice-btn.selected.boolean-no {
  background-color: #ef4444;
  border-color: #ef4444;
}

.dark .boolean-choice-btn.selected:not(.boolean-yes):not(.boolean-no) {
  background-color: #6b7280;
  border-color: #6b7280;
}

.dark .boolean-choice-btn.unselected.boolean-yes {
  color: #4ade80;
}

.dark .boolean-choice-btn.unselected.boolean-no {
  color: #f87171;
}

/* Details/summary disclosure triangle positioning */
details summary {
  list-style: none;
}

details summary::marker,
details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '\25B6';
  float: right;
  transition: transform 0.2s;
}

details[open] summary::after {
  transform: rotate(90deg);
}

/* === Mobile Photos === */

/* Photo preview container */
.photo-preview-area {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* Individual thumbnail */
.photo-thumbnail {
  position: relative;
  width: 100%;
  background: var(--color-bg-stripe);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.photo-thumbnail.uploading {
  opacity: 0.7;
}

/* Thumbnail image */
.thumbnail-image {
  display: block !important;
  width: 9.375rem !important;
  max-width: 9.375rem !important;
  height: auto !important;
  cursor: pointer;
}

/* Remove button */
.photo-thumbnail .remove-photo {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border: 2px solid white;
  font-size: var(--text-xl);
  line-height: 2rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-thumbnail .remove-photo:hover {
  background: rgb(220, 53, 69);
  transform: scale(1.1);
}

/* Upload progress bar */
.upload-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 9.375rem;
  height: 0.25rem;
  background: rgba(0, 0, 0, 0.1);
}

.upload-progress {
  height: 100%;
  width: 0%;
  background: #28a745;
  transition: width 0.3s ease;
}

.dark .upload-progress {
  background: #22c55e;
}

/* === Goal Progress Bar === */

.goal-progress-fill {
  background-color: #007bff;
}

.dark .goal-progress-fill {
  background-color: #818cf8;
}

/* === Metric Data Point Exclude Toggle === */

.mdp-exclude-toggle {
  display: inline;
  border: none;
  background: none;
  padding: 0;
  font-size: 11px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.mdp-exclude-toggle--excluded {
  color: #c59000;
}

.dark .mdp-exclude-toggle--excluded {
  color: #fbbf24;
}

/* Loading state indicator */
.photo-thumbnail.uploading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Add Photo button */
button[data-photo-upload-target="uploadButton"] {
  font-size: var(--text-base);
  padding: 0.75rem;
  touch-action: manipulation;
}

/* === Button Variant Overrides (dark mode aware) === */
.btn-variant-outline {
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-page);
}
.btn-variant-outline:hover {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}
.btn-variant-outline:active {
  background-color: var(--color-bg-raised);
}

.btn-variant-ghost {
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  background-color: transparent;
}
.btn-variant-ghost:hover {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border);
}
.btn-variant-ghost:active {
  background-color: var(--color-bg-raised);
}

.btn-variant-link {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  background-color: transparent;
}
.btn-variant-link:hover {
  color: var(--color-accent-light);
}

/* === Task Highlight (after move/undo) === */

.task--highlight {
  animation: task-highlight-pulse 1.5s ease-out;
}

@keyframes task-highlight-pulse {
  0%   { background-color: rgba(251, 191, 36, 0.25); }
  100% { background-color: transparent; }
}

.dark .task--highlight {
  animation: task-highlight-pulse-dark 1.5s ease-out;
}

@keyframes task-highlight-pulse-dark {
  0%   { background-color: rgba(236, 72, 153, 0.2); }
  100% { background-color: transparent; }
}

/* === Task Sub-group Headers === */

.task-subgroup-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2dd4bf;
  padding: 0.35rem 0.75rem 0.15rem;
  margin-top: 0.25rem;
  cursor: default;
  border-radius: 0.375rem;
  transition: background-color 0.15s ease,
              border-color 0.15s ease;
}

.task-subgroup-tasks {
  padding-left: 2px;
  margin-left: 20px;
  border-left: 2px dotted rgba(45, 212, 191, 0.5);
}

.dark .task-subgroup-tasks {
  border-left-color: rgba(236, 72, 153, 0.5);
}

.dark .task-subgroup-header {
  color: #ec4899;
}

/* Subgroup header: drag-over indicator (light) */
.task-subgroup-header.drag-over {
  background-color: rgba(64, 224, 208, 0.15);
  outline: 2px dashed #40e0d0;
  outline-offset: -2px;
}

/* Subgroup header: drag-over indicator (dark) */
.dark .task-subgroup-header.drag-over {
  background-color: rgba(139, 92, 246, 0.2);
  outline-color: #8b5cf6;
}

/* Category header: drag-over-strip indicator (light) */
.task-group-header.drag-over-strip {
  background-color: rgba(251, 146, 60, 0.1);
  outline: 2px dashed #fb923c;
  outline-offset: -2px;
  border-radius: 0.375rem;
}

/* Category header: drag-over-strip indicator (dark) */
.dark .task-group-header.drag-over-strip {
  background-color: rgba(251, 146, 60, 0.15);
  outline-color: #fb923c;
}

/* Ungrouped area: drag-over indicator (light) */
.task-ungrouped-area.drag-over {
  background-color: rgba(251, 146, 60, 0.08);
  outline: 2px dashed #fb923c;
  outline-offset: -2px;
  border-radius: 0.375rem;
}

/* Ungrouped area: drag-over indicator (dark) */
.dark .task-ungrouped-area.drag-over {
  background-color: rgba(251, 146, 60, 0.12);
  outline-color: #fb923c;
}
