:root {
  color-scheme: light;
  --bg: #fcfbf9;
  --bg-sidebar: #f7f4ef;
  --surface: #ffffff;
  --surface-2: #f8f6f2;
  --surface-3: #f1ede7;
  --border: #ece6de;
  --border-strong: #ddd4c8;
  --text: #2a2623;
  --text-muted: #7f756c;
  --accent: #de5c3c;
  --accent-soft: #fbe8e2;
  --accent-strong: #b9472b;
  --success: #4d7a56;
  --success-soft: #edf4ee;
  --danger: #ae5c4d;
  --shadow: 0 10px 24px rgba(33, 28, 24, 0.06);
  --shadow-soft: 0 4px 12px rgba(33, 28, 24, 0.04);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
}

html[data-theme="dark"],
body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141312;
  --bg-sidebar: #181715;
  --surface: #1d1b18;
  --surface-2: #211f1b;
  --surface-3: #292621;
  --border: #302c27;
  --border-strong: #3f3931;
  --text: #f6f2ed;
  --text-muted: #b2a79a;
  --accent: #ef7758;
  --accent-soft: #352119;
  --accent-strong: #ff9a7d;
  --success: #85b38f;
  --success-soft: #1f2a21;
  --danger: #df8b7c;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background-color 180ms ease, color 180ms ease;
}

body.is-modal-open {
  overflow: hidden;
}

body.is-modal-open .main {
  overflow: hidden;
}

body[data-app-ready="false"] .app-shell {
  visibility: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button,
input,
select {
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 2px;
}

.app-backdrop {
  display: none;
}

.app-shell {
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
  overflow: hidden;
}

body.is-sidebar-collapsed .app-shell {
  grid-template-columns: 92px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow: hidden;
  position: sticky;
}

.sidebar__toggle {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 42px;
  height: 88px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: color-mix(in srgb, var(--border-strong) 70%, var(--text) 30%);
  text-align: center;
  transform: translateY(-50%);
  transition: color 140ms ease;
  z-index: 5;
}

.sidebar__toggle:hover {
  color: var(--text);
}

.sidebar__toggle-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: transform 180ms ease;
  transform: translateX(-1px);
}

.sidebar__toggle-icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.is-sidebar-collapsed .sidebar__toggle {
  right: -6px;
}

body.is-sidebar-collapsed .sidebar__toggle-icon {
  transform: rotate(180deg);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.sidebar__logo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent-soft) 85%, white);
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 700;
}

.sidebar__brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar__brand-copy strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar__brand-copy span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-profile {
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: left;
}

.sidebar-profile:hover {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
}

.sidebar-profile__icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sidebar-profile__icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.sidebar-profile__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-profile__name,
.sidebar-profile__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile__name {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar-profile__email {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar__item {
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.sidebar__item-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.sidebar__item-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sidebar__item-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.sidebar__item-label {
  min-width: 0;
}

.sidebar__item-short {
  display: none;
  font-size: 14px;
  font-weight: 700;
}

.sidebar__item:hover {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
}

.sidebar__item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar__item-count {
  min-width: 20px;
  color: inherit;
  font-size: 14px;
  text-align: right;
}

body.is-sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

body.is-sidebar-collapsed .sidebar__item {
  justify-content: center;
  padding: 0;
}

body.is-sidebar-collapsed .sidebar-profile {
  justify-content: center;
  padding: 0;
}

body.is-sidebar-collapsed .sidebar-profile__copy {
  display: none;
}

body.is-sidebar-collapsed .sidebar__item-main {
  width: 100%;
  justify-content: center;
  gap: 0;
}

body.is-sidebar-collapsed .sidebar__item-label,
body.is-sidebar-collapsed .sidebar__item-count {
  display: none;
}

body.is-sidebar-collapsed .sidebar__item-icon {
  width: 26px;
  height: 26px;
}

body.is-sidebar-collapsed .sidebar__item-icon svg {
  width: 26px;
  height: 26px;
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.sidebar__utility-row {
  display: flex;
  gap: var(--space-2);
  width: 100%;
}

.settings-trigger,
.theme-toggle {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 54px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle {
  font-size: 0;
}

.settings-trigger:hover,
.theme-toggle:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.settings-trigger svg,
.theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.theme-toggle::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.theme-toggle[aria-pressed="true"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 20v2'/%3E%3Cpath d='m4.93 4.93 1.41 1.41'/%3E%3Cpath d='m17.66 17.66 1.41 1.41'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='M20 12h2'/%3E%3Cpath d='m6.34 17.66-1.41 1.41'/%3E%3Cpath d='m19.07 4.93-1.41 1.41'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 20v2'/%3E%3Cpath d='m4.93 4.93 1.41 1.41'/%3E%3Cpath d='m17.66 17.66 1.41 1.41'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='M20 12h2'/%3E%3Cpath d='m6.34 17.66-1.41 1.41'/%3E%3Cpath d='m19.07 4.93-1.41 1.41'/%3E%3C/svg%3E") center / contain no-repeat;
}

.theme-toggle__icon--sun {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__icon--moon {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__icon--sun {
  display: block;
}

.theme-toggle .theme-toggle__icon {
  display: none;
}

.panel__header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.today-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.today-sort-wrap__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.today-sort-wrap__select,
.today-nav__search {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.today-nav__controls--goals {
  gap: 12px;
  align-items: flex-end;
}

.goals-header__title {
  width: 100%;
}

.goals-control-bar {
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: var(--space-2);
  background: var(--surface);
}

.goals-control-bar .today-nav__search-wrap {
  flex: 1 1 280px;
  min-width: 0;
}

.goals-control-bar .today-nav__search {
  width: 100%;
}

.goals-control-bar .today-nav__filter-wrap {
  flex: 0 1 220px;
}

.today-nav__search-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-nav__search {
  width: 220px;
}

.todo-group__header-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.todo-group__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.subject-order-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.subject-order-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.subject-order-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.todo-priority-chip,
.todo-amount-chip {
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.todo-priority-chip {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  background: var(--accent-soft);
}

.todo-amount-chip {
  color: var(--text-muted);
  background: var(--surface-2);
}

.goal-search-results {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.goal-search-row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.goal-search-row__main {
  min-width: 0;
}

.goal-search-row__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.goal-search-row__meta {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.goal-search-row__open {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.goal-search-row__open:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.goal-search-empty {
  padding: 22px 0;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weekday-chip {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}

.weekday-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.weekday-chip:has(input:checked) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  background: var(--accent-soft);
}

.form__fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.form__field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form__input--color {
  padding: 4px;
  min-height: 46px;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-section__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-section__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.settings-section__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-subject-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.settings-subject-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-subject-row__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-subject-row__swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.settings-subject-row__name {
  font-size: 14px;
  font-weight: 600;
}

.settings-subject-row__meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.settings-subject-row__actions {
  display: inline-flex;
  gap: 8px;
}

.settings-form__actions {
  display: flex;
  gap: 10px;
}

.settings-form__cancel {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
}

.settings-system-badge {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.todo-delete-confirm {
  flex-wrap: wrap;
}

.modal__dialog--settings {
  width: min(560px, 100%);
}

.theme-toggle:active,
.sidebar__item:active,
.mini-action:active,
.fab__button:active,
.fab__menu-item:active,
.goal-card__action:active,
.form__submit:active {
  transform: scale(0.98);
}

.main {
  min-width: 0;
  height: 100dvh;
  padding: 38px 40px 56px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.screen {
  display: none;
}

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

body.is-calendar-tab .main {
  overflow-y: hidden;
  padding: 24px 24px 24px;
}

body.is-weekly-tab .main {
  overflow-y: hidden;
  padding: 24px 24px 24px;
}

body.is-calendar-tab .screen[data-screen="calendar"].is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

body.is-weekly-tab .screen[data-screen="weekly"].is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding-bottom: 0;
}

body.is-calendar-tab .screen[data-screen="calendar"] .screen__header {
  margin-bottom: 16px;
}

body.is-weekly-tab .screen[data-screen="weekly"] .screen__header {
  margin-bottom: 16px;
}

.screen__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
}

.screen__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.screen__title,
.panel__title {
  margin: 0;
  color: var(--text);
}

.screen__title {
  font-size: clamp(28px, 2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

[data-screen="today"] .screen__title {
  font-size: 26px;
}

.screen__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.today-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}

.today-nav__copy {
  min-width: 0;
  flex: 1 1 auto;
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
}

.today-nav__controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg-sidebar) 12%);
  box-shadow: none;
}

.today-nav__controls--filter {
  padding: 4px;
}

.today-nav__cluster {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 14px;
  background: var(--surface-2);
}

.today-nav__button,
.today-nav__today {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 650;
}

.today-nav__button {
  width: 44px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

[data-screen="today"] .today-nav__controls,
[data-screen="calendar"] .today-nav__controls {
  align-self: flex-start;
  margin-top: -3px;
  padding: 2px;
  border-radius: 14px;
}

[data-screen="today"] .today-nav__cluster,
[data-screen="calendar"] .today-nav__cluster {
  padding: 1px;
  border-radius: 11px;
}

[data-screen="today"] .today-nav__button {
  width: 30px;
  min-height: 28px;
  border-radius: 9px;
  font-size: 17px;
}

[data-screen="calendar"] .today-nav__button {
  width: 32px;
  min-height: 30px;
  border-radius: 10px;
  font-size: 18px;
}

[data-screen="today"] .today-nav__today,
[data-screen="calendar"] .today-nav__today {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 10px;
}

.today-nav__today {
  padding: 0 16px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.today-nav__today:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.today-nav__filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px 0 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.today-nav__filter-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted);
  white-space: nowrap;
}

.today-nav__filter {
  min-width: 112px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  padding-right: 18px;
}

.today-nav__filter:focus {
  outline: none;
}

.today-nav__button:hover,
.today-nav__today:hover {
  color: var(--text);
  background: var(--surface-2);
}

.today-nav__button:hover {
  color: var(--accent-strong);
  background: var(--surface);
}

.today-nav__button:active,
.today-nav__today:active {
  transform: translateY(1px) scale(0.98);
}

.panel__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 56px;
}

.panel {
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.panel__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.panel__badge,
.badge,
.subject-chip {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.panel__badge {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  min-height: auto;
}

.todo-groups {
  display: flex;
  flex-direction: column;
}

.todo-group {
  --subject-accent: var(--accent);
  --subject-soft: var(--accent-soft);
  --subject-ink: color-mix(in srgb, var(--subject-accent) 72%, var(--text) 28%);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.todo-group + .todo-group {
  margin-top: 26px;
}

.todo-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.todo-group__title {
  margin: 0;
  color: var(--subject-ink);
  font-size: 14px;
  font-weight: 700;
}

.todo-group__count {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.todo-list {
  display: flex;
  flex-direction: column;
}

.todo-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  row-gap: 0;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
}

.todo-row.is-menu-open {
  row-gap: 10px;
}

.todo-row:last-child {
  border-bottom: 0;
}

.todo-row:hover .todo-title {
  color: var(--accent-strong);
}

.todo-row.is-done .todo-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.todo-row.is-postponed .todo-title,
.todo-row.is-excluded .todo-title {
  color: var(--text-muted);
}

.todo-row.is-postponed {
  background: color-mix(in srgb, var(--subject-soft) 38%, transparent);
  border-radius: var(--radius-sm);
  padding-left: 8px;
  padding-right: 8px;
  margin-top: 4px;
}

.todo-row.is-excluded .todo-title {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border-strong);
}

.todo-row.is-done .todo-checkbox,
.todo-row.is-postponed .todo-checkbox,
.todo-row.is-excluded .todo-checkbox {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border) 70%);
  background: var(--success-soft);
}

.todo-row.is-postponed .todo-checkbox,
.todo-row.is-excluded .todo-checkbox {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.todo-row.is-done .todo-checkbox::after {
  opacity: 1;
  transform: scale(1);
}

.todo-checkbox {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  display: grid;
  place-items: center;
}

.todo-checkbox::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.todo-checkbox::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--success);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 180ms ease, transform 180ms ease;
}

.todo-row.is-postponed .todo-checkbox::after,
.todo-row.is-excluded .todo-checkbox::after {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 1;
  transform: scale(1);
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.todo-status-chip {
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.todo-status-chip[data-status="todo"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  background: var(--accent-soft);
}

.todo-status-chip[data-status="done"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 24%, var(--border) 76%);
  background: var(--success-soft);
}

.todo-link-chip {
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--subject-accent) 16%, var(--border) 84%);
  background: color-mix(in srgb, var(--subject-soft) 78%, white 22%);
  color: var(--subject-ink);
}

.todo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(2px);
  transition:
    opacity 140ms ease-out,
    visibility 140ms ease-out,
    transform 140ms ease-out;
}

.todo-row:hover .todo-actions,
.todo-row:focus-within .todo-actions,
.todo-actions.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.todo-actions .mini-action {
  font-size: 13px;
}

.todo-actions .mini-action.is-active {
  color: var(--accent);
  font-weight: 700;
}

.todo-actions .mini-action:disabled {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: not-allowed;
}

.todo-title {
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

.mini-action {
  min-height: 40px;
  min-width: 40px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 6px;
}

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

.todo-more {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.todo-more__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-1px);
  pointer-events: none;
}

.todo-more:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-2);
}

.todo-delete-confirm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.todo-delete-confirm__yes,
.goal-card__action--danger {
  color: var(--danger);
}

.todo-delete-confirm__yes:hover,
.goal-card__action--danger:hover {
  color: color-mix(in srgb, var(--danger) 76%, var(--text) 24%);
}

.empty-state {
  padding: 18px 0;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.empty-state__message {
  margin: 0;
}

.empty-state__action {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface) 36%);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 650;
}

.empty-state__action:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border) 58%);
  background: color-mix(in srgb, var(--accent-soft) 78%, var(--surface) 22%);
}

.goal-summary-list {
  display: flex;
  flex-direction: column;
}

.goal-summary-row,
.goal-card {
  --subject-accent: var(--accent);
  --subject-soft: var(--accent-soft);
  --subject-ink: color-mix(in srgb, var(--subject-accent) 72%, var(--text) 28%);
}

.goal-summary-row {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.goal-summary-row:first-child {
  padding-top: 0;
}

.goal-summary-row__top,
.goal-card__top {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 16px;
}

.goal-summary-row__main {
  min-width: 0;
  flex: 1 1 auto;
}

.goal-summary-row__title,
.goal-card__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.goal-summary-row__meta,
.goal-card__meta {
  margin-top: 8px;
  display: grid;
  gap: 6px;
  color: var(--text-muted);
}

.goal-summary-row__meta {
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.goal-summary-row__meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.goal-summary-row__meta-label,
.goal-card__meta-label {
  color: var(--text-muted);
}

.goal-summary-row__due {
  flex: 0 0 auto;
  min-width: 76px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.goal-summary-row__headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px;
}

.goal-summary-row__dot {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.goal-summary-row__inline-meta {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.badge,
.subject-chip {
  border: 1px solid color-mix(in srgb, var(--subject-accent) 16%, var(--border) 84%);
  background: color-mix(in srgb, var(--subject-soft) 78%, white 22%);
  color: var(--subject-ink);
}

.calendar-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  overflow: hidden;
}

.calendar-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 48px repeat(var(--calendar-day-rows, 5), minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--border);
}

.calendar-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 12px;
  border: 0;
  background: color-mix(in srgb, var(--surface) 97%, var(--bg-sidebar) 3%);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 12px;
  min-height: 0;
  overflow: hidden;
  text-align: left;
  border: 0;
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.calendar-day:hover {
  background: color-mix(in srgb, var(--surface-2) 92%, white 8%);
}

.calendar-day:active {
  background: var(--surface-3);
  transform: scale(0.98);
}

.calendar-day.is-muted {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--surface) 22%);
}

.calendar-day__number {
  position: relative;
  z-index: 0;
  align-self: flex-start;
  width: fit-content;
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.calendar-day__number.is-today {
  color: var(--accent-strong);
  isolation: isolate;
  padding-left: 10px;
}

.calendar-day__number.is-today::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 80%, white 20%);
  transform: translateY(-50%);
  z-index: -1;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.day-event {
  --subject-accent: var(--accent);
  min-width: 0;
  padding-left: 8px;
  border-left: 3px solid var(--subject-accent);
  border-radius: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.day-event__label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-more,
.day-note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-muted);
}

.day-more {
  font-weight: 600;
}

.goal-board {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.goal-subject-group {
  display: flex;
  flex-direction: column;
}

.goal-subject-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.goal-subject-group__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--subject-ink);
}

.goal-subject-group__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.goal-subject-group__list {
  display: flex;
  flex-direction: column;
}

.goal-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
}

.goal-subject-group__list .goal-card:last-child {
  border-bottom: 0;
}

.goal-card__main {
  min-width: 0;
}

.goal-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.goal-card__meta {
  grid-template-columns: repeat(2, minmax(120px, max-content));
  gap: 16px;
  font-size: 13px;
}

.goal-card__meta-item {
  line-height: 1.55;
}

.goal-card__action {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0 0;
}

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

.goal-card__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 20;
}

.fab__menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 200ms;
}

.fab.is-open .fab__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.fab__menu-panel {
  min-width: 180px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: none;
}

.fab__menu-item {
  min-height: 44px;
  width: 100%;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
}

.fab__menu-item + .fab__menu-item {
  border-top: 1px solid var(--border);
}

.fab.is-open .fab__menu-item {
  opacity: 1;
  transform: translateY(0);
}

.fab.is-open .fab__menu-item:nth-child(1) {
  transition-delay: 24ms;
}

.fab.is-open .fab__menu-item:nth-child(2) {
  transition-delay: 48ms;
}

.fab__menu-item:hover {
  background: var(--surface-2);
}

.fab__button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: none;
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.fab__button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.fab__button:active {
  transform: translateY(1px) scale(0.98);
}

.fab__icon {
  position: relative;
  width: 18px;
  height: 18px;
  display: block;
}

.fab__icon-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.fab__icon-line--one {
  transform: translate(-50%, -50%) rotate(0deg);
}

.fab__icon-line--two {
  transform: translate(-50%, -50%) rotate(90deg);
}

.fab.is-open .fab__icon-line--one {
  transform: translate(-50%, -50%) rotate(45deg);
}

.fab.is-open .fab__icon-line--two {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(33, 28, 24, 0.12);
  z-index: 30;
}

.modal.is-auth {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal__dialog {
  width: min(480px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
  padding: 20px;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 22px;
  line-height: 1;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form__label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.form__input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.form__textarea {
  min-height: 108px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

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

.form__input--custom-subject {
  margin-top: 2px;
}

.form__input:disabled {
  color: var(--text-muted);
  opacity: 1;
}

.form__error {
  margin: -2px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.form__submit {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-tab:hover,
.auth-tab.is-active {
  color: var(--accent);
}

.auth-tab.is-active {
  border-bottom-color: var(--accent);
}

.auth-nickname-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: stretch;
}

.auth-nickname-check__button {
  min-height: 46px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-nickname-check__button:hover {
  background: var(--surface-3);
}

.auth-nickname-check__button:disabled {
  color: var(--text-muted);
  cursor: wait;
}

.auth-nickname-check__message {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.auth-nickname-check__message.is-success {
  color: var(--success);
}

.auth-nickname-check__message.is-danger {
  color: var(--danger);
}

.auth-session {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-session__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-session__nickname {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.auth-session__email {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.auth-logout {
  width: 100%;
  min-height: 32px;
  margin-top: var(--space-5);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.auth-logout:hover {
  background: transparent;
  color: var(--text);
}

.postpone-form__summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.postpone-form__title,
.postpone-form__meta,
.postpone-form__usage {
  margin: 0;
}

.postpone-form__title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.postpone-form__meta,
.postpone-form__usage {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.postpone-form__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.postpone-form__chip {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.postpone-form__chip:hover,
.postpone-form__chip.is-active {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border) 68%);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.postpone-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  min-width: min(320px, calc(100vw - 32px));
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 200ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 50;
}

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

.toast[data-kind="danger"] {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border) 72%);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface) 90%);
  color: var(--danger);
}

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

  body.is-sidebar-collapsed .app-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .main {
    padding: 30px 30px 48px;
  }

  .sidebar__toggle {
    right: -18px;
    width: 38px;
    height: 80px;
  }

  .today-layout {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .calendar-shell {
    min-height: 0;
  }
}

@media (hover: none), (pointer: coarse) {
  .todo-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .todo-cell {
    grid-column: 2;
    grid-row: 1;
  }

  .todo-row:hover .todo-actions,
  .todo-row:focus-within .todo-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(2px);
  }

  .todo-more {
    display: inline-flex;
    width: 40px;
    height: 40px;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .todo-actions {
    display: none;
    width: 100%;
    gap: 8px;
  }

  .todo-row.is-menu-open .todo-actions,
  .todo-row .todo-actions.is-open {
    display: flex;
    grid-column: 2 / 4;
    grid-row: 2;
    justify-self: stretch;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
}

@media (min-width: 821px) {
  body.is-sidebar-collapsed .sidebar__utility-row {
    flex-direction: column;
  }

  body.is-sidebar-collapsed .settings-trigger,
  body.is-sidebar-collapsed .theme-toggle {
    min-height: 44px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  
  body.is-sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }

  .sidebar__nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar__toggle {
    top: 24px;
    right: 16px;
    width: 52px;
    min-height: 52px;
    height: auto;
    transform: none;
  }

  .sidebar__item {
    justify-content: center;
  }

  .sidebar__item-count {
    min-width: auto;
  }

  .main {
    height: 100%;
    min-height: 0;
    padding: 28px 14px 40px;
  }

  .screen__title {
    font-size: 27px;
  }

  [data-screen="today"] .screen__title {
    font-size: 25px;
  }

  .goal-card {
    grid-template-columns: 1fr;
  }

  .goal-card__actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .today-nav {
    flex-direction: column;
    align-items: stretch;
  }

  [data-screen="today"] .today-nav,
  [data-screen="calendar"] .today-nav {
    flex-direction: row;
    align-items: flex-start;
  }

  .today-nav__controls {
    align-self: flex-start;
  }

  [data-screen="today"] .today-nav__controls,
  [data-screen="calendar"] .today-nav__controls {
    margin-top: -4px;
  }

  .goals-control-bar {
    align-items: stretch;
  }

  .goals-control-bar .today-nav__search-wrap,
  .goals-control-bar .today-nav__filter-wrap {
    flex-basis: 100%;
  }

  .goals-control-bar .today-nav__filter {
    width: 100%;
  }

  .screen__title {
    font-size: 26px;
  }

  [data-screen="today"] .screen__title {
    font-size: 24px;
  }

  .todo-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    padding: 10px 0;
  }

  .todo-cell {
    grid-column: 2;
    grid-row: 1;
  }

  .todo-actions {
    grid-column: 2 / 4;
    grid-row: 2;
    justify-self: start;
    width: 100%;
    gap: 8px;
  }

  .todo-row:hover .todo-actions,
  .todo-row:focus-within .todo-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(2px);
  }

  .todo-row.is-menu-open .todo-actions,
  .todo-row .todo-actions.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .todo-more {
    display: inline-flex;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .goal-card__meta {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(96px, 1fr);
  }

  .fab {
    right: 18px;
    bottom: 18px;
  }

  .toast {
    bottom: 18px;
  }
}

/* ===== BigPlan type badge ===== */
.goal-type-badge {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.goal-type-badge[data-type="lecture"] {
  color: #6786a8;
  border-color: color-mix(in srgb, #6786a8 24%, var(--border) 76%);
  background: #eaf2fb;
}

.goal-type-badge[data-type="workbook"] {
  color: #b07a63;
  border-color: color-mix(in srgb, #b07a63 24%, var(--border) 76%);
  background: #fbefe8;
}

body[data-theme="dark"] .goal-type-badge[data-type="lecture"] {
  background: #1c2630;
}

body[data-theme="dark"] .goal-type-badge[data-type="workbook"] {
  background: #2a1f18;
}

.goal-card__chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.goal-card__progress {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-card__progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.goal-card__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--subject-accent);
  transition: width 240ms ease;
}

.goal-card__progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.goal-card__progress-caption {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.goal-card__linked {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-card__linked-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.goal-card__linked-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.goal-card__linked-empty {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Date Detail modal ===== */
.modal__dialog--wide {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
}

.date-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 2px;
}

.date-detail__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-detail__section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.date-detail__list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.date-detail__list .todo-row {
  min-height: 56px;
}

.date-detail__add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.date-detail__add-row {
  display: flex;
  gap: 8px;
}

.date-detail__add-input {
  flex: 1;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.date-detail__add-input::placeholder {
  color: var(--text-muted);
}

.date-detail__add-button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.date-detail__empty {
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* ===== Weekly review ===== */
.weekly-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 20px;
}

.weekly-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.weekly-stat {
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weekly-stat__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.weekly-stat__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.weekly-stat[data-kind="completed"] .weekly-stat__value { color: var(--success); }
.weekly-stat[data-kind="postponed"] .weekly-stat__value { color: #b07a63; }
.weekly-stat[data-kind="excluded"] .weekly-stat__value { color: var(--text-muted); }
.weekly-stat[data-kind="failed"] .weekly-stat__value { color: var(--danger); }

.weekly-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekly-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.weekly-section--flow,
.weekly-section--insights {
  height: 100%;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.weekly-section__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.weekly-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.weekly-flow__day {
  min-height: 74px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.weekly-flow__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.weekly-flow__weekday {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.weekly-flow__date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.weekly-flow__track-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.weekly-flow__bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.weekly-flow__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success);
}

.weekly-flow__meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.weekly-flow__count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.weekly-insights {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.weekly-insight {
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 0;
}

.weekly-insight__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.weekly-insight__value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.weekly-insight__subject {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--subject-accent) 16%, var(--border) 84%);
  background: color-mix(in srgb, var(--subject-soft) 78%, white 22%);
  color: var(--subject-ink);
  font-size: 12px;
  font-weight: 700;
}

.weekly-insight__count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.weekly-insight__empty {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.weekly-empty {
  padding: 24px 0;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 820px) {
  .weekly-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weekly-overview {
    grid-template-columns: 1fr;
  }

  .weekly-insights {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  .weekly-flow__day {
    grid-template-columns: 82px minmax(0, 1fr) auto;
  }
}

@media (max-width: 640px) {
  .weekly-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal__dialog--wide {
    max-height: 88vh;
  }
}
