/* Yella Dayline: product UI layer
   One font family, one action color, one 4pt spacing system. */

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f2f5fa;
  --surface-selected: #edf3ff;
  --text: #121722;
  --muted: #5f6b7c;
  --muted-strong: #445064;
  --line: #dce3ec;
  --line-strong: #c5cfdd;
  --accent: #2857e8;
  --accent-hover: #1e49cc;
  --accent-weak: #edf3ff;
  --warning: #d94f27;
  --warning-weak: #fff0eb;
  --danger: #b42318;
  --success: #19735a;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  --radius-control: 8px;
  --radius-surface: 12px;

  --z-sticky: 20;
  --z-nav: 30;
  --z-popover: 40;
  --z-backdrop: 50;
  --z-drawer: 60;

  --ui-font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --display-font: var(--ui-font);
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.overlay-open {
  overflow: hidden;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: #ffffff;
  padding: var(--space-xs) var(--space-md);
  box-shadow: none;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  transition: background-color 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), color 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

button:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.secondary,
button.ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

button.secondary:hover:not(:disabled),
button.ghost:hover:not(:disabled) {
  border-color: #aeb9c9;
  background: var(--surface-soft);
  color: var(--text);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="radio"]:focus-visible {
  outline: 3px solid rgba(40, 87, 232, 0.24);
  outline-offset: 2px;
}

input,
textarea,
select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-sm) var(--space-sm);
  font-size: 14px;
}

input::placeholder,
textarea::placeholder {
  color: #687487;
  opacity: 1;
}

textarea {
  min-height: 88px;
  line-height: 1.55;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

/* Authentication */

.login-view {
  background: var(--bg);
  padding: var(--space-xl);
}

.login-shell {
  width: min(960px, 100%);
  min-height: 580px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(30, 47, 82, 0.1);
}

.login-brand-panel {
  background: #163f99;
  color: #ffffff;
  padding: var(--space-2xl);
}

.login-brand-panel h1 {
  max-width: 12ch;
  margin: auto 0 var(--space-lg);
  font-family: var(--ui-font);
  font-size: 52px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

.login-brand-panel p {
  max-width: 36ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
}

.login-wordmark,
.login-mobile-wordmark {
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.login-panel {
  width: min(392px, calc(100% - var(--space-3xl)));
  border: 0;
  padding: var(--space-xl) 0;
  box-shadow: none;
}

.login-title {
  font-size: 30px;
  letter-spacing: -0.025em;
}

/* App shell */

.app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: var(--space-xl) var(--space-md) var(--space-md);
  backdrop-filter: none;
}

.brand-block {
  padding: 0 var(--space-sm);
}

.agent-name,
.mobile-wordmark {
  margin: 0;
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
}

.tagline {
  margin: var(--space-sm) 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 550;
}

.side-nav {
  display: grid;
  gap: var(--space-2xs);
  margin-top: var(--space-2xl);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted-strong);
  padding: var(--space-sm);
  box-shadow: none;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.nav-item svg {
  width: 21px;
  height: 21px;
}

.nav-item:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.active {
  border-color: #d7e2ff;
  background: var(--surface-selected);
  color: var(--accent);
  font-weight: 680;
}

.sidebar-user {
  margin-top: auto;
}

.user-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  padding: var(--space-xs);
  text-align: left;
}

.user-card:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-soft);
  color: var(--text);
}

.user-avatar,
.mobile-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.current-user,
.user-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.user-copy small {
  margin-top: var(--space-2xs);
  color: var(--muted);
  font-size: 12px;
}

.logout-button {
  width: 100%;
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: var(--space-xs) var(--space-sm);
  font-size: 12px;
  text-align: left;
}

.logout-button:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.workspace {
  min-width: 0;
  padding: var(--space-xl) clamp(var(--space-lg), 3vw, var(--space-2xl)) var(--space-2xl);
}

.dashboard-grid,
.profile-panel {
  width: min(1400px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: var(--space-xl);
}

.primary-column {
  min-width: 0;
}

.mobile-header,
.mobile-nav,
.mobile-progress-summary {
  display: none;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 72px;
  margin-bottom: var(--space-xl);
  scroll-margin-top: var(--space-lg);
}

.page-heading > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.page-heading h1 {
  order: 2;
  margin: 0;
  font-family: var(--ui-font);
  font-size: 44px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1;
}

.page-heading p {
  order: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.new-plan-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}

.new-plan-button svg {
  width: 18px;
  height: 18px;
}

/* Today capacity */

.today-priority {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.capacity-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 0 var(--space-lg);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--line);
}

.section-heading h2,
.agenda-heading h2,
.queue-heading h3,
.rail-card h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

#agendaSummary {
  min-height: 0;
  margin: var(--space-2xs) 0 0;
  color: var(--muted);
  font-size: 12px;
}

.capacity-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-lg);
  margin: var(--space-lg) 0 var(--space-md);
  border: 0;
  padding: 0;
}

.capacity-label {
  margin-bottom: var(--space-xs);
  color: var(--muted);
  font-size: 13px;
}

.capacity-value {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  color: var(--text);
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  font-weight: 690;
  letter-spacing: -0.035em;
  line-height: 1;
}

.capacity-value small {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.capacity-stat.remaining .capacity-value {
  color: var(--accent);
}

.capacity-meter-track {
  display: flex;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf1;
}

.capacity-meter-segment {
  display: block;
  min-width: 0;
}

.capacity-meter-segment.retained {
  background: var(--accent);
}

.capacity-meter-segment.slack {
  flex: 1;
  background: transparent;
}

.capacity-meter-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xs);
  color: var(--muted);
  font-size: 12px;
}

.capacity-overflow-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--warning);
  font-weight: 650;
  text-align: right;
}

.capacity-overflow-note::before {
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}

/* Task run */

.agenda-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-bottom: var(--space-sm);
}

.agenda-heading span,
.queue-heading span {
  color: var(--muted);
  font-size: 12px;
}

.agenda-list {
  display: grid;
  gap: 0;
}

.retained-list {
  border-top: 0;
}

.todo {
  position: relative;
  display: grid;
  grid-template-columns: 48px 44px minmax(0, 1fr) auto;
  grid-template-areas: "sequence check main time";
  align-items: start;
  gap: var(--space-sm);
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: var(--space-md) 0;
  transition: background-color 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.todo:hover {
  background: rgba(255, 255, 255, 0.58);
}

.todo.is-next {
  grid-template-columns: 48px 44px minmax(0, 1fr) auto 124px;
  grid-template-areas: "sequence check main time focus";
  align-items: center;
  border: 1px solid #a9bfff;
  border-radius: var(--radius-surface);
  background: var(--surface);
  padding: var(--space-md);
}

.todo.is-next:hover {
  border-color: #7f9ef7;
  background: var(--surface);
  transform: translateY(-1px);
}

.todo.focus-running {
  border-color: var(--accent);
  background: var(--surface-selected);
}

.todo.done {
  opacity: 0.64;
}

.todo.done .todo-action {
  text-decoration: line-through;
}

.todo-sequence {
  position: relative;
  grid-area: sequence;
  min-height: 44px;
  color: var(--accent);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  line-height: 44px;
  text-align: center;
}

.todo-sequence::after {
  position: absolute;
  top: 36px;
  bottom: -28px;
  left: 50%;
  width: 1px;
  background: #b9c9f7;
  content: "";
}

.todo:last-of-type .todo-sequence::after {
  display: none;
}

.todo.scoped-todo {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "check main time";
}

.todo-check {
  grid-area: check;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  cursor: pointer;
}

.todo-check input[type="checkbox"],
.todo input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-check-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.todo-main {
  grid-area: main;
  align-self: center;
  min-width: 0;
}

.todo-action {
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.45;
  text-wrap: pretty;
}

.todo-sub {
  margin-top: var(--space-2xs);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.todo-time {
  grid-area: time;
  align-self: center;
  padding: 0;
  color: var(--muted-strong);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.focus-button {
  grid-area: focus;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-width: 124px;
  white-space: nowrap;
}

.focus-button .play-symbol {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-sm);
}

.deferred-shell {
  margin-top: var(--space-lg);
}

.deferred-toggle {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-sm) var(--space-md);
  box-shadow: none;
  text-align: left;
}

.deferred-toggle:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.deferred-toggle svg {
  width: 17px;
  height: 17px;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.deferred-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.deferred-toggle span {
  font-size: 14px;
  font-weight: 650;
}

.deferred-toggle small {
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
}

.deferred-list {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.deferred-list[hidden] {
  display: none;
}

.todo.deferred {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main time";
  padding: var(--space-md) var(--space-sm);
}

/* Composer */

.bottom-chat {
  position: sticky;
  left: auto;
  bottom: var(--space-md);
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  width: 100%;
  margin-top: var(--space-xl);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-surface);
  background: rgba(255, 255, 255, 0.96);
  padding: var(--space-xs);
  box-shadow: 0 4px 8px rgba(30, 47, 82, 0.08);
  transform: none;
  backdrop-filter: blur(12px);
}

.bottom-chat-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 var(--space-sm);
  font-size: 14px;
  font-weight: 520;
  text-align: left;
}

.bottom-chat-button:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-soft);
  color: var(--text);
}

.bottom-chat-send {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-control);
  padding: 0;
}

/* Context rail */

.right-rail {
  display: grid;
  gap: 0;
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 0 0 0 var(--space-xl);
}

.rail-card {
  min-width: 0;
  scroll-margin-top: var(--space-lg);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: var(--space-lg) 0;
}

.rail-card:first-child {
  padding-top: var(--space-sm);
}

.rail-card:last-child {
  border-bottom: 0;
}

.progress-layout {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.progress-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--progress), #e5eaf1 0);
}

.progress-ring::before {
  position: absolute;
  width: 72px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg);
  content: "";
}

.progress-ring span {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
}

.metric {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: var(--space-xs) 0;
}

.metric:last-child {
  border-bottom: 0;
}

.metric-label {
  margin-bottom: var(--space-2xs);
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  color: var(--accent);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.metric-total .metric-value {
  color: var(--text);
}

.panel-heading {
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.panel-title {
  font-size: 18px;
  font-weight: 680;
}

.panel-count,
.section-note {
  color: var(--muted);
  font-size: 12px;
}

.plans-panel {
  padding-bottom: var(--space-lg);
}

.plan-tabs {
  display: flex;
  gap: var(--space-2xs);
  margin: 0 0 var(--space-md);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  padding: 0 0 var(--space-xs);
}

.plan-tab {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted-strong);
  padding: var(--space-xs) var(--space-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.plan-tab:hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-soft);
  color: var(--text);
}

.plan-tab.active {
  border-color: transparent;
  background: var(--accent-weak);
  color: var(--accent);
}

.plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.plan-card {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.plan-card + .plan-card {
  border-top: 1px solid var(--line);
  padding-top: var(--space-md);
}

.plan-card-main {
  border-radius: var(--radius-control);
  padding: 0;
}

.plan-title {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.plan-meta {
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  color: var(--muted);
  font-size: 12px;
}

.pill {
  min-height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 550;
}

.bar {
  height: 5px;
  margin-top: var(--space-xs);
}

.plan-card-actions {
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.plan-card-actions button,
.plan-menu summary {
  min-height: 36px;
  border-radius: var(--radius-control);
  padding: var(--space-xs) var(--space-sm);
  font-size: 12px;
}

.plan-menu-popover {
  z-index: var(--z-popover);
  width: 152px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: var(--space-xs);
  box-shadow: 0 4px 8px rgba(30, 47, 82, 0.1);
}

/* Check-in */

.checkin-card label {
  display: block;
  margin: 0 0 var(--space-xs);
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
}

.energy-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
}

.energy-option {
  min-height: 40px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
  padding: var(--space-xs);
}

.energy-option:hover:not(:disabled) {
  border-color: #9fb2ee;
  background: var(--surface-selected);
  color: var(--accent);
}

.energy-option.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.notes-label {
  margin-top: var(--space-md) !important;
}

.checkin-card textarea {
  min-height: 88px;
  font-size: 13px;
}

.preview-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  width: 100%;
  margin-top: var(--space-sm);
  color: var(--accent);
}

.profile-panel {
  display: none;
  margin-top: var(--space-xl);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  padding: var(--space-lg);
}

.profile-panel.open {
  display: block;
}

.panel-description {
  margin: var(--space-2xs) 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  gap: var(--space-md);
}

.insight-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.insight-item {
  border-color: var(--line);
  background: var(--surface);
}

/* Drawers and overlays */

.drawer-backdrop {
  z-index: var(--z-backdrop);
  background: rgba(18, 23, 34, 0.44);
  backdrop-filter: blur(2px);
}

.chat-drawer,
.plan-drawer {
  z-index: var(--z-drawer);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(18, 23, 34, 0.16);
}

.chat-drawer {
  bottom: var(--space-lg);
  width: min(680px, calc(100% - var(--space-xl)));
  max-height: min(78vh, 680px);
}

.chat-drawer.open {
  transform: translate(-50%, 0);
}

.chat-drawer-header,
.drawer-header {
  padding: var(--space-md) var(--space-lg) var(--space-sm);
}

.chat-drawer-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.chat-log {
  border-color: var(--line);
  background: var(--surface-soft);
}

/* Tablet */

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .workspace {
    padding-right: var(--space-lg);
    padding-left: var(--space-lg);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 292px;
    gap: var(--space-lg);
  }

  .right-rail {
    padding-left: var(--space-lg);
  }

  .todo.is-next {
    grid-template-columns: 40px 44px minmax(0, 1fr) auto;
    grid-template-areas:
      "sequence check main time"
      "sequence check focus focus";
  }

  .todo.scoped-todo {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "check main time";
  }

  .focus-button {
    justify-self: end;
    margin-top: var(--space-xs);
  }
}

/* Mobile web: real views, not scroll anchors */

@media (max-width: 900px) {
  body:not(.is-logged-out) {
    padding-bottom: calc(148px + env(safe-area-inset-bottom));
  }

  .app {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 0 var(--space-md) calc(148px + env(safe-area-inset-bottom));
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    margin: 0 calc(var(--space-md) * -1) var(--space-lg);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    padding: env(safe-area-inset-top) var(--space-md) 0;
    backdrop-filter: blur(12px);
  }

  .mobile-wordmark {
    font-size: 28px;
  }

  .dashboard-grid {
    display: block;
    width: 100%;
  }

  .page-heading {
    min-height: 72px;
    margin-bottom: var(--space-lg);
  }

  .page-heading h1 {
    font-size: 40px;
  }

  .right-rail {
    display: none;
    width: 100%;
    border-left: 0;
    padding: 0;
  }

  .rail-card {
    border: 0;
    padding: 0 0 var(--space-xl);
  }

  .mobile-progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    border-top: 1px solid var(--line);
    padding-top: var(--space-sm);
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-progress-summary span {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
  }

  .mobile-progress-summary strong {
    color: var(--accent);
    font-size: 15px;
  }

  .progress-card {
    display: none !important;
  }

  body[data-mobile-view="plans"] .primary-column > .page-heading,
  body[data-mobile-view="plans"] .primary-column > .today-priority,
  body[data-mobile-view="review"] .primary-column > .page-heading,
  body[data-mobile-view="review"] .primary-column > .today-priority,
  body[data-mobile-view="settings"] .primary-column > .page-heading,
  body[data-mobile-view="settings"] .primary-column > .today-priority {
    display: none;
  }

  body[data-mobile-view="plans"] .right-rail,
  body[data-mobile-view="review"] .right-rail {
    display: block;
  }

  body[data-mobile-view="plans"] .right-rail > :not(#plansSection),
  body[data-mobile-view="review"] .right-rail > :not(#reviewSection) {
    display: none;
  }

  body[data-mobile-view="settings"] .right-rail {
    display: none;
  }

  body[data-mobile-view="settings"] .profile-panel {
    display: block;
    margin-top: 0;
  }

  body:not([data-mobile-view="settings"]) .profile-panel {
    display: none;
  }

  .plans-panel .panel-title,
  .checkin-card .panel-title,
  .profile-panel .panel-title {
    font-size: 24px;
    letter-spacing: -0.025em;
  }

  .plan-tabs {
    margin-top: var(--space-lg);
  }

  .plan-tab {
    min-height: 44px;
    font-size: 14px;
  }

  .plan-title {
    font-size: 16px;
  }

  .plan-meta,
  .pill {
    font-size: 13px;
  }

  .energy-option {
    min-height: 44px;
    font-size: 14px;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-nav);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(68px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    padding: var(--space-2xs) max(var(--space-xs), env(safe-area-inset-right)) max(var(--space-2xs), env(safe-area-inset-bottom)) max(var(--space-xs), env(safe-area-inset-left));
    backdrop-filter: blur(14px);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2xs);
    min-height: 56px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--muted-strong);
    padding: var(--space-2xs);
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .mobile-nav-item:hover:not(:disabled) {
    border-color: transparent;
    background: var(--surface-soft);
    color: var(--text);
  }

  .mobile-nav-item.active {
    background: transparent;
    color: var(--accent);
  }

  .bottom-chat {
    position: fixed;
    right: var(--space-md);
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: var(--space-md);
    z-index: var(--z-sticky);
    width: auto;
    margin: 0;
  }

  .chat-drawer {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 620px) {
  .page-heading {
    align-items: flex-end;
  }

  .page-heading h1 {
    font-size: 38px;
  }

  .page-heading p {
    font-size: 13px;
  }

  .new-plan-button {
    min-height: 44px;
    padding-right: var(--space-sm);
    padding-left: var(--space-sm);
    font-size: 13px;
  }

  .capacity-card {
    padding-bottom: var(--space-md);
  }

  #agendaSummary {
    display: none;
  }

  .capacity-stats {
    gap: var(--space-sm);
    margin: var(--space-md) 0;
  }

  .capacity-label {
    margin-bottom: var(--space-2xs);
    font-size: 11px;
  }

  .capacity-value {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xs);
    font-size: 32px;
  }

  .capacity-value small {
    font-size: 11px;
  }

  .capacity-meter-labels {
    align-items: flex-start;
    font-size: 11px;
  }

  .agenda-heading {
    margin-top: var(--space-md);
  }

  .todo {
    grid-template-columns: 34px 44px minmax(0, 1fr);
    grid-template-areas:
      "sequence check main"
      "sequence check time";
    gap: var(--space-xs);
    padding: var(--space-md) 0;
  }

  .todo.is-next {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas:
      "sequence main time"
      "sequence check focus";
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .todo-sequence {
    font-size: 14px;
  }

  .todo-action {
    font-size: 15px;
  }

  .todo-sub {
    font-size: 12px;
  }

  .todo-time {
    align-self: start;
    color: var(--muted);
  }

  .todo:not(.is-next) .todo-time {
    margin-top: calc(var(--space-2xs) * -1);
  }

  .todo.scoped-todo {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "check main"
      "check time";
  }

  .todo.is-next .todo-check {
    justify-self: start;
  }

  .focus-button {
    min-width: 120px;
    margin-top: 0;
  }

  .queue-heading {
    margin-top: var(--space-lg);
  }

  .todo.deferred {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "main"
      "time";
    padding-right: 0;
    padding-left: 0;
  }

  .profile-panel {
    border: 0;
    background: transparent;
    padding: 0;
  }

  .form-grid,
  .insight-list {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .bottom-chat {
    grid-template-columns: minmax(0, 1fr) 44px;
    border-radius: var(--radius-surface);
  }

  .bottom-chat-button {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-drawer {
    width: calc(100% - var(--space-md));
    max-height: calc(100dvh - 96px);
    border-radius: var(--radius-surface) var(--radius-surface) 0 0;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .plan-drawer {
    max-height: 92dvh;
  }
}

@media (pointer: coarse) {
  button,
  .plan-menu summary,
  .todo-check {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
