.ambient-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(color-mix(in srgb,var(--accent) 7%,transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb,var(--accent) 7%,transparent) 1px, transparent 1px); background-size: 4rem 4rem; mask-image: linear-gradient(to bottom, black, transparent 76%); }
.ambient-grain { position: absolute; inset: 0; opacity: .12; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E"); mix-blend-mode: multiply; pointer-events: none; }
.orbit { position: absolute; inset: 0; border-radius: 50%; }
.orbit-middle { inset: 17%; border: 1px solid rgba(255,255,255,.22); transform: rotate(34deg); }
.orbit-inner { inset: 34%; border: 1px solid rgba(255,255,255,.18); transform: rotate(-18deg); }
.orbit i { position: absolute; width: .55rem; height: .55rem; border-radius: 50%; background: white; box-shadow: 0 0 1rem rgba(255,255,255,.9); }
.orbit-outer i { left: 10%; top: 24%; }
.orbit-middle i { right: 2%; top: 40%; background: color-mix(in srgb,var(--accent-2) 70%,white); }
.orbit-inner i { left: 18%; bottom: 8%; background: color-mix(in srgb,var(--accent) 24%,white); }
.orbit-core { position: absolute; inset: 42%; border-radius: 50%; background: rgba(255,255,255,.16); box-shadow: 0 0 3rem rgba(255,255,255,.38); }
.orbit-core b { position: absolute; inset: 34%; border-radius: 50%; background: white; box-shadow: 0 0 1.4rem white; }
html[data-motion="on"] .orbit-outer { animation: orbit-spin 24s linear infinite; }
html[data-motion="on"] .orbit-middle { animation: orbit-spin-reverse 15s linear infinite; }
html[data-motion="on"] .orbit-inner { animation: orbit-spin 10s linear infinite; }
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes orbit-spin-reverse { to { transform: rotate(-360deg); } }

.weather-card { position: relative; overflow: hidden; }
.weather-card::after { content: ""; position: absolute; width: 10rem; height: 10rem; right: -3rem; top: -4rem; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 32%, transparent), transparent 68%); pointer-events: none; }
.weather-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.weather-age { color: var(--muted); font-size: .75rem; }
.weather-main { display: flex; align-items: center; gap: .8rem; }
.weather-main > div:first-of-type { min-width: 0; }
.weather-orb { flex: 0 0 auto; width: 3.5rem; height: 3.5rem; display: grid; place-items: center; border-radius: 50%; color: var(--accent); font-size: 2rem; background: linear-gradient(145deg, color-mix(in srgb, var(--accent-2) 22%, white), white); box-shadow: 0 12px 25px color-mix(in srgb, var(--accent) 13%, transparent); }
.weather-condition { margin: 0; font-size: 1.15rem; font-weight: 800; }
.weather-detail { margin: .3rem 0 0; color: var(--muted); font-size: .75rem; }
.weather-temp { margin-left: auto; text-align: right; }
.weather-temp strong { display: block; font-size: 3rem; font-weight: 300; line-height: 1; letter-spacing: -.08em; }
.weather-temp span { display: block; margin-top: .3rem; color: var(--muted); font-size: .75rem; }
.weather-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.weather-metrics span { display: grid; gap: .15rem; }
.weather-metrics small { color: var(--muted); font-size: .75rem; }
.weather-metrics strong { font-size: .86rem; }

.focus-orbit { position: absolute; right: -1.1rem; bottom: -1.8rem; width: 8rem; height: 8rem; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.focus-orbit::before, .focus-orbit::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.focus-orbit::before { inset: 1.1rem; }
.focus-orbit::after { inset: 2.45rem; background: rgba(255,255,255,.1); box-shadow: 0 0 2.2rem rgba(255,255,255,.2); }
.focus-orbit i { position: absolute; top: 1.1rem; left: 1.25rem; width: .6rem; height: .6rem; border-radius: 50%; background: white; box-shadow: 0 0 1.1rem white; }
.focus-card[data-mode="current"] .live-pill { background: rgba(255,255,255,.16); }

.week-day { position: relative; min-height: 7.7rem; overflow: hidden; }
.week-day::before { content: ""; position: absolute; inset: auto .8rem 0; height: 3px; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 24%, transparent); transform: scaleX(0); transition: transform .25s; }
.week-day:hover::before, .week-day.today::before { transform: scaleX(1); }
.week-day-name { display: block; color: var(--muted); font-size: .75rem; font-weight: 750; }
.week-day > strong { display: block; margin: .55rem 0 .75rem; font-size: 2rem; font-weight: 350; line-height: 1; letter-spacing: -.07em; }
.week-day-bottom { display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.week-day-bottom i { font-style: normal; font-size: 1.1rem; }
.week-day-bottom small { overflow: hidden; color: var(--muted); font-size: .75rem; white-space: nowrap; text-overflow: ellipsis; }
.week-day.selected { background: linear-gradient(145deg,var(--accent-deep),var(--accent)); box-shadow: 0 12px 28px color-mix(in srgb,var(--accent) 18%,transparent); }
.week-day.selected .week-day-name, .week-day.selected .week-day-bottom small { color: rgba(255,255,255,.78); }
.week-day:disabled { cursor: not-allowed; opacity: .4; }
.adjustment-mark { position: absolute; right: .55rem; top: .5rem; width: 1.25rem; height: 1.25rem; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: white; font-size: .75rem; font-weight: 900; }
.day-progress { padding: .4rem .7rem; border-radius: 99px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 700; }

.event-actions { display: flex; align-items: flex-start; gap: .3rem; }
.event-status, .task-status-button { border: 0; border-radius: 99px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); font-size: .75rem; font-weight: 750; white-space: nowrap; }
.event-status { padding: .25rem .45rem; }
.task-status-button { align-self: center; padding: .4rem .6rem; }
.timeline-event.completed { opacity: .58; }
.timeline-event.completed .event-title { text-decoration: line-through; }
.task-status { display: inline-block; margin-top: .45rem; padding: .2rem .45rem; border-radius: 99px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: .75rem; }
.task-status.pending-sync { color: #76570d; background: #fff3c5; }
.task-status.failed-sync { color: #b9324c; background: #ffe4e9; }
.task-urgent { margin: .45rem 0 0; padding: .4rem .65rem; border-left: 3px solid #b9324c; border-radius: 4px; color: #8f263d; background: #fff0f2; font-size: .82rem; line-height: 1.45; }
.task-slot { display: inline-flex; align-items: center; width: fit-content; margin-top: .45rem; padding: .22rem .52rem; border: 1px solid var(--board-rule); border-radius: 99px; color: var(--accent-deep); background: var(--board-wash); font-size: .73rem; font-weight: 750; }
.task-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; min-width: 0; margin-top: .65rem; }
.task-actions .progress-control { margin-top: 0; }
.task-action-button { min-height: 34px; padding: .38rem .68rem; border: 1px solid var(--board-rule); border-radius: 10px; color: var(--accent-deep); background: color-mix(in srgb, var(--accent) 6%, white); font-size: .75rem; font-weight: 750; cursor: pointer; }
.task-action-button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 42%, transparent); background: color-mix(in srgb, var(--accent) 11%, white); }
.task-action-button:disabled { opacity: .5; cursor: not-allowed; }
.progress-control:has(.progress-unknown) { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .65rem; width: auto; color: var(--muted); }
.progress-unknown, .progress-summary, .event-progress { color: var(--muted); font-size: .76rem; font-weight: 700; }
.progress-entry { display: flex; align-items: center; gap: .45rem; width: 100%; }
.progress-entry[hidden] { display: none; }
.progress-entry input { width: 6rem; min-height: 34px; padding: .35rem .5rem; border: 1px solid var(--board-rule); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.86); font: inherit; font-size: .8rem; }
.event-progress { align-self: center; white-space: nowrap; }
.progress-control { display: grid; grid-template-columns: minmax(0, 1fr) 2.8rem; align-items: center; gap: .65rem; width: min(100%, 25rem); margin-top: .65rem; color: var(--accent); font-size: .72rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.progress-control input { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.progress-control input:disabled { cursor: default; opacity: .62; }
.progress-control output { text-align: right; }
.progress-control.compact { grid-template-columns: minmax(3.8rem, 6.5rem) 2.45rem; width: min(9.6rem, 42vw); margin-top: 0; gap: .35rem; }
.event-actions { max-width: 48%; }
.task-check, .event-check { position: relative; }
.task-check:hover::after, .event-check:hover::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.is-completing { opacity: .58; transform: scale(.99); }
.completed-panel[open] .summary-end svg { transform: rotate(180deg); }

.hour-card { min-height: 9.7rem; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.hour-time { align-self: flex-start; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.hour-symbol { color: var(--accent); font-size: 1.75rem; }
.hour-card > strong { font-size: 1.35rem; font-weight: 500; }
.hour-card > small { color: var(--muted); font-size: .75rem; }
.hour-card.current { background: linear-gradient(145deg,var(--accent-deep),var(--accent)); box-shadow: 0 12px 25px color-mix(in srgb,var(--accent) 16%,transparent); }
.hour-card.current .hour-time, .hour-card.current small { color: rgba(255,255,255,.8); }
.hour-card.current .hour-symbol { color: white; }
.is-refreshing svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 500px) {
  .weather-temp strong { font-size: 2.5rem; }
  .weather-metrics { margin-top: .9rem; }
  .task-status-button { align-self: flex-start; }
  .week-context { flex-direction: column; align-items: flex-end; gap: .35rem; }
}

/* Small screens prioritize the selected day, its actionable items, then occupied time. */
@media (max-width: 760px) {
  .topbar { padding: 7px 12px; }
  .topbar-inner { gap: 7px; }
  .date-nav { gap: 5px; justify-content: space-between; }
  .date-nav .icon-button, .date-nav .quiet-button { min-width: 38px; height: 38px; }
  .date-field { flex: 1; min-width: 0; height: 38px; }
  .date-field input { width: 100%; min-width: 0; font-size: .9rem; }
  #today-button:disabled { display: none; }
  .top-actions .icon-button { min-width: 36px; height: 36px; }

  #app-view .workspace { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
  #app-view .day-stage { display: contents; }
  #app-view #dashboard-grid:not([hidden]) { display: flex; flex-direction: column; gap: 10px; order: 4; }
  #app-view .workspace > *,
  #app-view .day-stage > * { margin-top: 0; }
  .day-identity { order: 1; }
  .focus-card { order: 2; }
  .notice-area { order: 3; }
  .task-column { order: 1; gap: 10px; }
  .timeline-panel { order: 2; }
  .weather-card { order: 5; }
  .week-panel { order: 6; }
  .hourly-panel { order: 7; }
  .data-footer { order: 8; }
  #content-loading { order: 4; }

  .day-identity { min-height: 0; padding: 12px 16px; border-radius: 16px; }
  .day-index, .day-copy .eyebrow { display: none; }
  .day-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
  .day-copy h1 { margin: 0; font-size: 1.05rem; white-space: nowrap; }
  .meta-row { gap: 5px; }
  .meta-chip { padding: 4px 7px; font-size: .68rem; }

  .focus-card { min-height: 0; padding: 15px 17px 19px; border-radius: 18px; }
  .focus-card .section-kicker { font-size: .61rem; }
  .focus-time { margin: 10px 0 3px; font-size: 1.35rem; }
  .focus-body h2 { font-size: 1.1rem; }
  .focus-meta { margin: 5px 0 0; font-size: .73rem; }
  .focus-orbit { display: none; }
  .focus-track { left: 17px; right: 17px; bottom: 8px; height: 2px; }

  .notice-area { gap: 6px; margin: 0; }
  .notice { padding: 9px 11px; font-size: .76rem; line-height: 1.4; }
  .notice-dot { flex: 0 0 6px; width: 6px; height: 6px; }

  .task-panel { padding: 15px 16px; }
  .task-panel .section-kicker { display: none; }
  .task-panel .panel-header h2 { margin: 0; font-size: 1.05rem; }
  .task-panel .task-list { margin-top: 9px; }
  .task-item { padding: 10px; border-radius: 12px; }
  .task-actions { align-items: flex-start; gap: .45rem; }
  .task-actions .progress-control { flex-basis: 100%; max-width: 100%; }
  .progress-control:has(.progress-unknown) { flex-basis: 100%; }
  .progress-entry { flex-wrap: wrap; }
  .task-action-button { min-height: 38px; }
  .task-check { width: 24px; height: 24px; }
  .task-column[data-empty="true"] { display: none; }
  .task-column[data-has-pending="true"] .task-panel[data-empty="true"],
  .task-column[data-has-day-file="false"] .task-panel[data-empty="true"],
  .completed-panel[data-empty="true"] { display: none; }
  .completed-panel { padding: 0; }
  .completed-panel summary { padding: 14px 16px; }

  .timeline-panel { padding: 15px 16px; }
  .timeline-panel .panel-header h2 { margin: 0; font-size: 1.05rem; }
  .timeline-panel .section-kicker { display: none; }
  .timeline-panel .panel-summary { font-size: .72rem; }
  .timeline-panel[data-empty="true"] .timeline { display: none; }
  .timeline-panel:not([data-empty="true"]) .timeline { max-height: min(55vh, 440px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

  .weather-card { min-height: 0; padding: 15px 16px; border-radius: 18px; gap: 10px; }
  .weather-header .section-kicker { font-size: .62rem; }
  .weather-main { gap: 9px; }
  .weather-orb { width: 2.15rem; height: 2.15rem; font-size: 1.2rem; }
  .weather-condition { font-size: 1rem; }
  .weather-detail, .weather-temp span { font-size: .69rem; }
  .weather-temp strong { font-size: 2rem; }
  .weather-metrics { margin-top: 0; padding-top: 8px; }

  .week-panel { padding: 14px 16px; }
  .week-header { align-items: center; }
  .week-header .section-kicker { display: none; }
  .week-header h2 { margin: 0; font-size: 1.05rem; }
  .week-context { gap: 3px; font-size: .65rem; }
  .day-progress { padding: 2px 5px; }
  .week-ribbon { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; overflow: visible; }
  .week-day { min-width: 0; min-height: 56px; padding: 6px 3px; border-radius: 10px; text-align: center; }
  .week-day-name { font-size: .63rem; }
  .week-day > strong { margin: 5px 0 0; font-size: 1.16rem; }
  .week-day-bottom { display: none; }
  .adjustment-mark { top: 2px; right: 2px; width: 12px; height: 12px; font-size: .5rem; }

  .hourly-panel { padding: 15px 16px; }
  .hourly-panel .panel-header h2 { font-size: 1.05rem; }
  .hourly-panel .section-kicker { display: none; }
  .hourly-weather { margin-top: 0; }
  .hour-card { min-height: 115px; flex-basis: 95px; padding: 10px; }
  .data-footer { padding-top: 4px; }
}
