/* Study Tracker: iOS-style interface.
   Colors follow Apple's system palette; light is the default, dark applies
   when the device is in dark mode (Theme: System) or when Theme is set to Dark. */

:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --sheet-bg: #F2F2F7;
  --sheet-card: #FFFFFF;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.29);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.16);
  --press: #D1D1D6;
  --bar-bg: rgba(249, 249, 249, 0.82);
  --seg-active: #FFFFFF;
  --switch-off: #E9E9EA;
  --action-bg: rgba(255, 255, 255, 0.92);
  --tint: #007AFF;
  --tint-soft: rgba(0, 122, 255, 0.12);
  --green: #34C759;
  --green-text: #248A3D;
  --green-soft: rgba(52, 199, 89, 0.16);
  --orange-text: #C93400;
  --orange-soft: rgba(255, 149, 0, 0.18);
  --red: #FF3B30;
  --backdrop: rgba(0, 0, 0, 0.32);
  /* Corner radii. Capsules (pills, chips, buttons) use half their height. */
  --r-control: 7px;   /* icons, inputs, segmented buttons */
  --r-card: 12px;     /* grouped lists, cards, tiles */
  --r-card-lg: 16px;  /* task cards */
  --r-sheet: 14px;    /* sheets and action sheets */
  /* Safe areas, with a floor so bars never touch the screen edge on
     devices (or previews) that report none. */
  --safe-top: max(env(safe-area-inset-top), 12px);
  --safe-bottom: max(env(safe-area-inset-bottom), 12px);
  /* Tab bar content height: 22pt icons and labels with 10pt above and below. */
  --tabbar-h: 58px;
  /* Bar buttons sit 20pt from the screen edge. */
  --bar-inset: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1C1C1E;
    --sheet-bg: #1C1C1E;
    --sheet-card: #2C2C2E;
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.32);
    --press: #3A3A3C;
    --bar-bg: rgba(22, 22, 22, 0.82);
    --seg-active: #636366;
    --switch-off: #39393D;
    --action-bg: rgba(44, 44, 46, 0.94);
    --tint: #0A84FF;
    --tint-soft: rgba(10, 132, 255, 0.2);
    --green: #30D158;
    --green-text: #30D158;
    --green-soft: rgba(48, 209, 88, 0.2);
    --orange-text: #FF9F0A;
    --orange-soft: rgba(255, 159, 10, 0.2);
    --red: #FF453A;
    --backdrop: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1C1C1E;
  --sheet-bg: #1C1C1E;
  --sheet-card: #2C2C2E;
  --label: #FFFFFF;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --separator: rgba(84, 84, 88, 0.6);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.32);
  --press: #3A3A3C;
  --bar-bg: rgba(22, 22, 22, 0.82);
  --seg-active: #636366;
  --switch-off: #39393D;
  --action-bg: rgba(44, 44, 46, 0.94);
  --tint: #0A84FF;
  --tint-soft: rgba(10, 132, 255, 0.2);
  --green: #30D158;
  --green-text: #30D158;
  --green-soft: rgba(48, 209, 88, 0.2);
  --orange-text: #FF9F0A;
  --orange-soft: rgba(255, 159, 10, 0.2);
  --red: #FF453A;
  --backdrop: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

input,
select,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Elements hidden from script stay hidden whatever display a class gives them. */
[hidden] {
  display: none !important;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--tint);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.rounded-nums {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* ---------- App frame ---------- */

.app {
  position: fixed;
  inset: 0;
  max-width: 700px;
  margin: 0 auto;
}

.tab {
  position: absolute;
  inset: 0;
  display: none;
}

.tab.is-active {
  display: block;
}

.scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(var(--safe-top) + 44px)
    max(16px, env(safe-area-inset-right))
    calc(var(--safe-bottom) + var(--tabbar-h) + 36px)
    max(16px, env(safe-area-inset-left));
}

.navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: calc(var(--safe-top) + 44px);
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.tab.is-scrolled .navbar {
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--separator);
}

.navbar-title {
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
}

.tab.is-scrolled .navbar-title {
  opacity: 1;
}

.navbar-action {
  position: absolute;
  right: max(calc(var(--bar-inset) - 10px), env(safe-area-inset-right));
  bottom: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--tint);
}

.navbar-action svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.navbar-action:active {
  opacity: 0.4;
}

.large-eyebrow {
  margin: 6px 4px 0;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.large-title {
  margin: 2px 4px 14px;
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ---------- Grouped lists ---------- */

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding: 0 16px 7px;
  color: var(--label-2);
  font-size: 13px;
  text-transform: uppercase;
}

.section-header .value {
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.section-footer {
  margin: 0;
  padding: 7px 16px 0;
  color: var(--label-2);
  font-size: 13px;
}

.section-footer:empty {
  display: none;
}

.group {
  background: var(--card);
  border-radius: var(--r-card);
  overflow: hidden;
}

.group + .group,
.section-footer + .group,
.segmented + .group {
  margin-top: 20px;
}

.group:empty {
  display: none;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--label);
  font-size: 17px;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.15s;
}

/* Hairline separators. Each row draws the line above itself, inset to
   where its own text starts. */
.group > .row + .row::before,
.group > .row + input + .row::before,
.group > .swipe + .swipe > .row::before,
.group > .swipe + .row::before,
.group > .chips + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: var(--sep-inset, 16px);
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
  transform-origin: top;
  pointer-events: none;
}

.row:has(.row-icon) { --sep-inset: 57px; }
.row.has-dot { --sep-inset: 38px; }
.row.row-add { --sep-inset: 52px; }

button.row:active,
a.row:active,
label.row:active,
.row.is-tappable:active {
  background: var(--press);
}

.row-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: var(--r-control);
  background: var(--icon-bg, var(--tint));
  color: #FFFFFF;
}

.row-icon svg {
  width: 18px;
  height: 18px;
}

.row-icon .icon-fill {
  fill: currentColor;
  stroke: none;
}

.row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-text {
  flex: 1;
  min-width: 0;
}

.row-text .row-title {
  display: block;
}

.row-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--label-2);
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-value {
  flex: 0 0 auto;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

.chev {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-right: -4px;
  color: var(--label-3);
  stroke-width: 2.6;
}

.row-destructive {
  justify-content: center;
  color: var(--red);
}

.row-destructive .row-title {
  flex: 0 1 auto;
}

.row-tint {
  color: var(--tint);
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot, var(--label-3));
}

.dot-small {
  width: 7px;
  height: 7px;
}

.empty {
  padding: 13px 16px;
  color: var(--label-2);
  font-size: 15px;
}

/* Switch */
.switch {
  flex: 0 0 auto;
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--switch-off);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.25s;
}

.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.switch:checked {
  background: var(--green);
}

.switch:checked::before {
  transform: translateX(20px);
}

/* Segmented control */
.segmented {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 2px;
  border-radius: calc(var(--r-control) + 2px);
  background: var(--fill);
}

.segmented-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 4px) / var(--seg-count, 2));
  border-radius: var(--r-control);
  background: var(--seg-active);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transform: translateX(calc(100% * var(--seg-index, 0)));
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.segmented button {
  position: relative;
  height: 28px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  transition: font-weight 0.2s;
}

.segmented button.is-active {
  font-weight: 600;
}

.segmented button:active:not(.is-active) {
  opacity: 0.55;
}

.card {
  background: var(--card);
  border-radius: var(--r-card);
}

/* ---------- Focus ---------- */

.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 4px;
}

.ring-wrap {
  position: relative;
  width: min(74vw, 290px);
  aspect-ratio: 1;
}

.ring {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 18;
}

.ring-track {
  stroke: var(--fill);
}

.ring-fill {
  stroke: var(--ring-color, var(--tint));
  stroke-linecap: round;
  stroke-dasharray: 779.11;
  stroke-dashoffset: 779.11;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.32, 0.72, 0, 1), stroke 0.3s;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.timer-clock {
  font-size: clamp(48px, 17vw, 68px);
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.timer-clock.is-long {
  font-size: clamp(40px, 13vw, 54px);
}

.timer-sub {
  color: var(--label-2);
  font-size: 15px;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 38px;
  margin-top: 20px;
  padding: 0 14px 0 16px;
  border: 0;
  border-radius: 19px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.15s;
}

.topic-pill span:not(.dot) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topic-pill .chev-down {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--label-2);
  stroke-width: 2.6;
}

.topic-pill:active:not(:disabled) {
  transform: scale(0.96);
}

.topic-pill:disabled .chev-down {
  display: none;
}

.timer-controls {
  display: flex;
  justify-content: space-between;
  width: min(100%, 320px);
  margin-top: 26px;
  padding: 0 4px;
}

.round-button {
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 17px;
  font-weight: 500;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--btn-bg);
  transition: transform 0.15s, opacity 0.2s;
}

.round-button:active:not(:disabled) {
  transform: scale(0.95);
}

.round-button:disabled {
  opacity: 0.4;
}

.round-secondary {
  --btn-bg: var(--fill-2);
  --btn-text: var(--label);
}

.round-start {
  --btn-bg: var(--green-soft);
  --btn-text: var(--green-text);
}

.round-pause {
  --btn-bg: var(--orange-soft);
  --btn-text: var(--orange-text);
}


/* ---------- Tasks ---------- */

/* The Tasks page sits on a deep blue in light mode and near-black in dark,
   with each task as its own card, a day strip and a floating toolbar. */
.tab-tasks {
  --page: #0659AE;
  --t-card: #1A66B4;
  --t-card-done: #2F77C0;
  --t-card-edge: transparent;
  --t-text: #FFFFFF;
  --t-sub: rgba(255, 255, 255, 0.64);
  --t-fill: rgba(255, 255, 255, 0.14);
  --t-fill-strong: rgba(255, 255, 255, 0.26);
  --t-bar: rgba(6, 89, 174, 0.82);
  --t-dock: rgba(255, 255, 255, 0.16);
  --t-fab: #FFFFFF;
  --t-fab-icon: #0659AE;
  --t-overdue: #FFC56B;
  background: var(--page);
  color: var(--t-text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tab-tasks {
    --page: #0E0E10;
    --t-card: #1C1C1E;
    --t-card-done: #2C2C2E;
    --t-card-edge: rgba(255, 255, 255, 0.06);
    --t-fill: rgba(255, 255, 255, 0.1);
    --t-fill-strong: rgba(255, 255, 255, 0.2);
    --t-bar: rgba(14, 14, 16, 0.82);
    --t-dock: rgba(44, 44, 46, 0.78);
    --t-fab: #0A84FF;
    --t-fab-icon: #FFFFFF;
    --t-overdue: #FF9F0A;
  }
}

:root[data-theme="dark"] .tab-tasks {
  --page: #0E0E10;
  --t-card: #1C1C1E;
  --t-card-done: #2C2C2E;
  --t-card-edge: rgba(255, 255, 255, 0.06);
  --t-fill: rgba(255, 255, 255, 0.1);
  --t-fill-strong: rgba(255, 255, 255, 0.2);
  --t-bar: rgba(14, 14, 16, 0.82);
  --t-dock: rgba(44, 44, 46, 0.78);
  --t-fab: #0A84FF;
  --t-fab-icon: #FFFFFF;
  --t-overdue: #FF9F0A;
}

.tab-tasks.is-scrolled .navbar {
  background: var(--t-bar);
  box-shadow: none;
}

.tab-tasks .scroll {
  padding-bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 112px);
}

.tab-tasks .large-title {
  margin-bottom: 2px;
}

.tasks-summary {
  margin: 0 4px 18px;
  color: var(--t-sub);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* Day strip */
.day-strip {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 20px calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 0 max(16px, env(safe-area-inset-left));
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding: 0 16px;
}

.day-strip::-webkit-scrollbar {
  display: none;
}

.day-strip::after {
  content: "";
  flex: 0 0 8px;
}

.day-pill {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 17px;
  background: var(--t-fill);
  color: var(--t-sub);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.day-pill.is-active {
  background: var(--t-fill-strong);
  color: var(--t-text);
}

.day-pill:active {
  transform: scale(0.95);
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

/* Task cards */
.task-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  border-radius: var(--r-card-lg);
  box-shadow: inset 0 0 0 1px var(--t-card-edge);
}

.task-card.is-collapsing {
  margin-top: -8px;
}

.tab-tasks .task-card-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 64px;
  padding: 16px;
  border-radius: var(--r-card-lg);
  background: var(--t-card);
  color: var(--t-text);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.25s;
}

.tab-tasks .task-card-row.is-pressed,
.tab-tasks .task-card-row:active {
  background: var(--t-card-done);
}

.tab-tasks .task-card-row.is-done {
  background: var(--t-card-done);
}

.task-check {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -1px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--t-fill-strong);
  color: transparent;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.task-check {
  position: relative;
}

.task-check::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.task-check svg {
  width: 15px;
  height: 15px;
  stroke-width: 3;
  transform: scale(0.6);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-check:active {
  transform: scale(0.86);
}

.is-done > .task-check {
  background: #FFFFFF;
  color: var(--page);
}

.is-done > .task-check svg {
  transform: scale(1);
}

.task-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-title {
  font-size: 17px;
  line-height: 22px;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.is-done .task-title {
  color: var(--t-sub);
}

.task-topic {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--t-sub);
  font-size: 13px;
}

.task-topic .dot {
  width: 8px;
  height: 8px;
  margin: 0;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}

.task-meta {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--t-sub);
  font-size: 13px;
  font-weight: 500;
}

.task-meta.is-overdue {
  color: var(--t-overdue);
}

.tab-tasks .empty-state {
  padding: 40px 24px;
  border-radius: var(--r-card-lg);
  background: var(--t-fill);
}

.tab-tasks .empty-icon svg,
.tab-tasks .empty-state p {
  color: var(--t-sub);
}

.tab-tasks .empty-action {
  background: #FFFFFF;
  color: #0659AE;
}

/* Floating toolbar and add button */
.task-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 14px);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.dock-pill,
.fab {
  pointer-events: auto;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.dock-pill {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 6px;
  border-radius: 28px;
  background: var(--t-dock);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16);
}

.dock-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: none;
  color: #FFFFFF;
  transition: opacity 0.2s, background-color 0.2s;
}

.dock-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.dock-button .i-hidden,
.dock-button.is-on .i-shown {
  display: none;
}

.dock-button.is-on .i-hidden {
  display: block;
}

.dock-button.is-on {
  background: var(--t-fill-strong);
}

.dock-button:active {
  opacity: 0.5;
}

.dock-button:disabled {
  opacity: 0.32;
}

.fab {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--t-fab);
  color: var(--t-fab-icon);
  transition: transform 0.15s;
}

.fab svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.6;
}

.fab:active {
  transform: scale(0.92);
}

.stat-big,
.tile strong {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* ---------- Calendar ---------- */

.calendar-card {
  padding: 10px 10px 8px;
}

.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px 8px;
}

.month-bar h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}

.month-actions {
  display: flex;
  gap: 4px;
}

.icon-plain {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tint);
}

.icon-plain svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.icon-plain:active {
  background: var(--fill);
}

.weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.weekdays span {
  padding: 4px 0;
  color: var(--label-3);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

/* Each studied day carries a small ring that fills toward the daily goal. */
.day {
  position: relative;
  display: grid;
  place-items: center;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
}

.day-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%) rotate(-90deg);
  pointer-events: none;
}

.day-ring circle {
  fill: none;
  stroke-width: 3;
}

.day-ring-track {
  stroke: var(--fill);
}

.day-ring-fill {
  stroke: var(--tint);
  stroke-linecap: round;
}

.day-ring.is-complete .day-ring-fill {
  stroke: var(--green);
}

.day-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s, color 0.15s;
}

.day.is-outside .day-num {
  color: var(--label-3);
}

.day.is-future .day-num {
  color: var(--label-2);
}

.day.is-today .day-num {
  color: var(--tint);
  font-weight: 600;
}

.day.is-selected .day-num {
  background: var(--label);
  color: var(--bg);
  font-weight: 600;
}

.day.is-selected.is-today .day-num {
  background: var(--tint);
  color: #FFFFFF;
}

.day:active .day-num {
  background: var(--fill);
}

.month-grid.slide-left { animation: slideLeft 0.28s cubic-bezier(0.32, 0.72, 0, 1); }
.month-grid.slide-right { animation: slideRight 0.28s cubic-bezier(0.32, 0.72, 0, 1); }

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(24px); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-24px); }
}

/* ---------- Insights ---------- */

.chart-card {
  margin-top: 16px;
  padding: 16px 16px 12px;
}

.stat-label {
  margin: 0;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-big {
  margin: 2px 0 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
}

.stat-big .unit,
.tile .unit {
  margin: 0 6px 0 2px;
  color: var(--label-2);
  font-size: 17px;
  font-weight: 600;
}

.stat-caption {
  margin: 2px 0 0;
  color: var(--label-2);
  font-size: 15px;
}

/* Bar chart: plot area with hairline gridlines and axis labels on the right,
   stacked bars per topic, and a dashed goal line. Bars are tappable. */
.bar-chart {
  margin-top: 16px;
  padding-bottom: 24px;
}

.bar-plot {
  position: relative;
  height: 168px;
  margin-right: 34px;
  border-bottom: 1px solid var(--separator);
}

.grid-line,
.goal-line {
  position: absolute;
  left: 0;
  right: -34px;
  height: 0;
  pointer-events: none;
}

.grid-line {
  border-top: 1px solid var(--fill);
}

.grid-line span {
  position: absolute;
  right: 0;
  top: -7px;
  width: 30px;
  color: var(--label-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.goal-line {
  right: 0;
  border-top: 1.5px dashed var(--green);
  opacity: 0.9;
}

.bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--bar-gap, 8px);
}

.bar-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
}

.bar-stack {
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  border-radius: 4px 4px 2px 2px;
  transition: opacity 0.2s, height 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.bar-stack.is-empty {
  background: var(--fill);
}

.bar-stack span {
  display: block;
  min-height: 1px;
  background: var(--seg-color);
}

.bar-stack span + span {
  box-shadow: 0 1px 0 var(--card);
}

.bar-chart.has-selection .bar-col:not(.is-selected) .bar-stack {
  opacity: 0.3;
}

.bar-label {
  position: absolute;
  left: 50%;
  bottom: -21px;
  transform: translateX(-50%);
  color: var(--label-2);
  font-size: 11px;
  white-space: nowrap;
}

.bar-col.is-current .bar-label,
.bar-col.is-selected .bar-label {
  color: var(--label);
  font-weight: 600;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.tile-label {
  color: var(--label-2);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.tile strong {
  margin-top: 4px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.tile-caption {
  color: var(--label-2);
  font-size: 13px;
}

.meter {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--fill);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--dot, var(--tint));
}

/* ---------- Sheets ---------- */

.sheet-layer,
.action-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-layer[hidden],
.action-layer[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.3s;
}

.is-open > .sheet-backdrop {
  opacity: 1;
}

.sheet {
  --card: var(--sheet-card);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 700px;
  max-height: calc(100% - var(--safe-top) - 10px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--sheet-bg);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), bottom 0.25s;
  bottom: var(--kb, 0px);
}

.is-open > .sheet {
  transform: none;
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 6px auto 0;
  border-radius: 3px;
  background: var(--label-3);
}

.sheet-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 48px;
  /* With the buttons' own 8pt padding, their labels sit at --bar-inset. */
  padding: 0 calc(var(--bar-inset) - 8px);
}

.sheet-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.sheet-button {
  justify-self: start;
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--tint);
  font-size: 17px;
}

.sheet-done {
  justify-self: end;
  font-weight: 600;
}

.sheet-button:disabled {
  color: var(--label-3);
}

.sheet-button:active:not(:disabled) {
  opacity: 0.4;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(var(--safe-bottom) + 24px);
}

.sheet-body .group + .section-header {
  margin-top: 24px;
}

.field {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
}

.field::placeholder {
  color: var(--label-3);
}

.field-right {
  flex: 0 1 auto;
  width: auto;
  text-align: right;
  color: var(--label-2);
}

.date-field {
  min-width: 0;
  border: 0;
  background: var(--fill);
  border-radius: var(--r-control);
  padding: 5px 10px;
  height: auto;
  color: var(--label);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}

.duration-pickers {
  display: flex;
  gap: 6px;
}

.mini-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-control);
  background: var(--fill);
  font-variant-numeric: tabular-nums;
}

.mini-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  font-size: 17px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  padding: 16px;
  justify-items: center;
}

.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--dot);
  transition: transform 0.15s;
}

.swatch.is-selected {
  box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--dot);
}

.swatch:active {
  transform: scale(0.9);
}

.check-mark {
  width: 18px;
  height: 18px;
  color: var(--tint);
  stroke-width: 2.6;
}

/* Action sheet */
.action-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 8px calc(var(--safe-bottom) + 8px);
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.is-open > .action-sheet {
  transform: none;
}

.action-group,
.action-cancel {
  border-radius: var(--r-sheet);
  background: var(--action-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.action-title {
  padding: 14px 16px;
  color: var(--label-2);
  font-size: 13px;
  text-align: center;
}

.action-title strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

.action-item,
.action-cancel {
  display: block;
  width: 100%;
  height: 57px;
  border: 0;
  background: none;
  color: var(--tint);
  font-size: 20px;
}

.action-item {
  border-top: 0.5px solid var(--separator);
}

.action-item:first-child {
  border-top: 0;
}

.action-item.is-destructive {
  color: var(--red);
}

.action-cancel {
  margin-top: 8px;
  background: var(--action-bg);
  font-weight: 600;
}

.action-item:active,
.action-cancel:active {
  background: var(--fill);
}

/* Toast */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 24px;
  background: var(--sheet-card);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--green);
  stroke-width: 2.6;
}

.toast-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.toast.has-action {
  gap: 14px;
  padding: 6px 6px 6px 18px;
}

.toast.has-action.is-visible {
  pointer-events: auto;
}

.toast-action {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: var(--tint-soft);
  color: var(--tint);
  font-size: 15px;
  font-weight: 600;
}

.toast-action:active {
  opacity: 0.6;
}

/* ---------- Components ---------- */

/* Timer status chip */
.timer-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  margin-bottom: 2px;
  padding: 0 10px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color 0.25s, color 0.25s;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.timer-status[data-status="running"] {
  background: var(--green-soft);
  color: var(--green-text);
}

.timer-status[data-status="running"] .status-dot {
  animation: pulse 1.6s ease-in-out infinite;
}

.timer-status[data-status="paused"] {
  background: var(--orange-soft);
  color: var(--orange-text);
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

.timer-sub.is-reached {
  color: var(--green-text);
  font-weight: 600;
}

/* Swipe-to-delete rows */
.swipe {
  position: relative;
  overflow: hidden;
  transition: height 0.24s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s;
}

.swipe.is-collapsing {
  opacity: 0;
}

.swipe-content {
  z-index: 1;
  background: var(--card);
  touch-action: pan-y;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.15s;
}

.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--red);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: width 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.swipe-action span {
  flex: 0 0 auto;
  margin-left: 20px;
}

.swipe-content:focus-visible {
  outline-offset: -2px;
}

/* Topic and preset chips */
.chips {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.chips-center {
  justify-content: safe center;
  padding-top: 4px;
  padding-bottom: 16px;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 17px;
  background: var(--fill);
  color: var(--label);
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.chip:active {
  transform: scale(0.95);
}

.chip.is-selected {
  background: var(--chip-soft, var(--fill-2));
  box-shadow: inset 0 0 0 1.5px var(--chip, var(--label-2));
  font-weight: 600;
}

/* Duration control */
.duration-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
}

.duration-value {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.duration-value .unit {
  margin: 0 6px 0 2px;
  color: var(--label-2);
  font-size: 19px;
  font-weight: 600;
}

.duration-value .unit:last-child {
  margin-right: 0;
}

.icon-round {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--tint);
  transition: transform 0.15s, opacity 0.2s;
}

.icon-round svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
}

.icon-round:active:not(:disabled) {
  transform: scale(0.9);
}

.icon-round:disabled {
  opacity: 0.35;
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 24px 24px;
  text-align: center;
}

.empty-icon svg {
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  color: var(--label-3);
  stroke-width: 2.2;
}

.empty-state strong {
  font-size: 17px;
  font-weight: 600;
}

.empty-state p {
  max-width: 260px;
  margin: 4px 0 0;
  color: var(--label-2);
  font-size: 15px;
}

.empty-action {
  margin-top: 14px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 17px;
  background: var(--tint-soft);
  color: var(--tint);
  font-size: 15px;
  font-weight: 600;
}

.empty-action:active {
  opacity: 0.6;
}

/* Add rows */
.add-badge {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 0;
  border-radius: 50%;
  background: var(--tint);
  color: #FFFFFF;
}

.add-badge svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

/* Insights topic rows */
.row-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-line .row-title {
  flex: 1;
}

.row-line .meter {
  flex: 1;
  margin-top: 0;
}

.row-line + .row-line {
  margin-top: 7px;
}

#topicBreakdown .row {
  align-items: flex-start;
  padding-top: 11px;
  padding-bottom: 11px;
}

#topicBreakdown .dot {
  margin-top: 6px;
}

.row-percent {
  width: 36px;
  color: var(--label-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Topic editor */
.topic-preview {
  display: grid;
  place-items: center;
  padding: 8px 0 20px;
}

.topic-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--dot);
  color: #FFFFFF;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-size: 36px;
  font-weight: 700;
  transition: background-color 0.25s;
}

.field-center {
  text-align: center;
  font-weight: 600;
}

.spacer {
  height: 20px;
}

.sheet-body .section-header {
  margin-top: 20px;
}

.group-destructive {
  margin-top: 28px;
}

/* ---------- Tab bar ---------- */

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -0.5px 0 var(--separator);
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: rgba(153, 153, 153, 1);
  font-size: 10px;
  font-weight: 500;
}

.tabbar svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.tabbar .i-f {
  display: none;
}

.tabbar button.is-active {
  color: var(--tint);
}

.tabbar button.is-active .i-o {
  display: none;
}

.tabbar button.is-active .i-f {
  display: inline;
}

.tabbar button:active svg {
  transform: scale(0.9);
}

.tabbar svg {
  transition: transform 0.15s;
}

/* ---------- About ---------- */

.about {
  margin: 28px 0 0;
  color: var(--label-2);
  font-size: 13px;
  text-align: center;
}

/* ---------- Privacy page ---------- */

.privacy-page {
  overflow: auto;
  -webkit-user-select: text;
  user-select: text;
}

.privacy-shell {
  max-width: 640px;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 8px)
    max(20px, env(safe-area-inset-right))
    calc(var(--safe-bottom) + 40px)
    max(20px, env(safe-area-inset-left));
}

.privacy-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  margin-left: -8px;
  color: var(--tint);
  font-size: 17px;
  text-decoration: none;
}

.privacy-back svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.4;
}

.privacy-shell h1 {
  margin: 8px 0 4px;
  font-size: 34px;
  line-height: 41px;
}

.privacy-updated {
  margin: 0 0 20px;
  color: var(--label-2);
  font-size: 15px;
}

.privacy-section {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
}

.privacy-section h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
}

.privacy-section p {
  margin: 0;
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.chips-wrap {
  flex-wrap: wrap;
  overflow: visible;
}

/* ---------- Task history ---------- */

.tab-tasks .navbar-action {
  color: #FFFFFF;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.history-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: var(--r-card);
  background: var(--card);
}

.history-stat strong {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.history-stat span {
  color: var(--label-2);
  font-size: 12px;
  line-height: 15px;
}

.day-marks {
  position: absolute;
  left: 50%;
  bottom: 3px;
  display: flex;
  gap: 3px;
  transform: translateX(-50%);
  pointer-events: none;
}

.day-mark {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.2px var(--label-3);
}

.day-mark.is-done {
  background: var(--green);
  box-shadow: none;
}

.day-mark.is-missed {
  box-shadow: inset 0 0 0 1.2px var(--orange-text);
}

.history-row {
  --sep-inset: 52px;
  align-items: center;
}

.history-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  border: 1.5px solid var(--label-3);
  border-radius: 50%;
  color: #FFFFFF;
}

.history-mark.is-done {
  border-color: var(--green);
  background: var(--green);
}

.history-mark.is-missed {
  border-color: var(--orange-text);
}

.history-mark svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.history-row .row-text {
  min-width: 0;
  flex: 1;
}

.history-row .row-title {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- Wide screens (iPhone Duo unfolded) ----------
   From 600pt wide, each tab splits into two columns. The left column holds
   the main control and stays in view; the right holds the details. */

@media (min-width: 600px) {
  .split > .pane > :first-child {
    margin-top: 0;
  }

  #tab-insights .split {
    margin-top: 16px;
  }

  .app {
    max-width: 1100px;
  }

  .split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .split > .pane-a {
    position: sticky;
    top: calc(var(--safe-top) + 52px);
  }

  .ring-wrap {
    width: min(100%, 290px);
  }

  /* Tasks: the list scrolls, History stays beside it. */
  .tab-tasks .split > .pane-a {
    position: static;
  }

  .tab-tasks .split > .pane-b {
    position: sticky;
    top: calc(var(--safe-top) + 52px);
  }

  #taskHistoryButton {
    display: none;
  }

  .task-dock {
    right: auto;
    left: max(16px, env(safe-area-inset-left));
    width: calc((100% - 48px) / 2);
  }

  .history-panel {
    padding: 14px 12px 12px;
    border-radius: calc(var(--r-card) + 12px);
    background: var(--bg);
    color: var(--label);
    box-shadow: inset 0 0 0 1px var(--t-card-edge);
  }

  .history-title {
    margin: 0 4px 12px;
    font-size: 22px;
    font-weight: 700;
  }

  .history-panel .history-stats {
    gap: 6px;
  }

  .history-panel .history-stat {
    padding: 10px;
  }

  .history-panel .history-stat strong {
    font-size: 20px;
  }

  .history-panel .calendar-card {
    padding: 8px 4px 6px;
  }

  .history-panel .day {
    height: 40px;
  }

  .history-panel .day-num {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  /* Settings is one list; keep it at a readable width. */
  #tab-settings .scroll {
    padding-left: max(16px, calc((100% - 560px) / 2));
    padding-right: max(16px, calc((100% - 560px) / 2));
  }
}

/* ---------- Web app: install card and steps ---------- */

.install-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 8px 12px 12px;
  border-radius: var(--r-card);
  background: var(--card);
}

.install-card img {
  flex: 0 0 auto;
  border-radius: 10px;
}

.install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.install-text strong {
  font-size: 15px;
  font-weight: 600;
}

.install-text span {
  color: var(--label-2);
  font-size: 13px;
}

.install-go {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 15px;
  background: var(--tint);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
}

.install-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--label-3);
}

.install-close svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.install-go:active,
.install-close:active {
  opacity: 0.6;
}

.step-number {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 12px;
  border-radius: 50%;
  background: var(--tint-soft);
  color: var(--tint);
  font-size: 14px;
  font-weight: 600;
}

.install-steps .row {
  --sep-inset: 54px;
}
