/* LearningX Alert — styles follow DESIGN.md ("책갈피" direction). */

:root {
  /* Brand (school themes may override only these) */
  --brand: #2c4380;
  --brand-strong: #223566;
  --brand-soft: #e5eaf5;

  /* Neutrals */
  --ink: #1b2233;
  --muted: #5f6778;
  --mist: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --line: #dadfe8;

  /* Status (fixed across themes) */
  --urgent: #e2a93b;
  --urgent-soft: #fbf1da;
  --lake: #276c66;
  --lake-soft: #e3f1ef;
  --clay: #b8483a;
  --clay-soft: #f8e6e2;

  /* Type */
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --fs-meta: 0.8rem;
  --fs-small: 0.875rem;
  --fs-body: 1rem;
  --fs-h3: 1.0625rem;
  --fs-h2: 1.25rem;
  --fs-h1: 1.9375rem;

  /* Radius */
  --r-sheet: 24px;
  --r-block: 16px;
  --r-control: 12px;
  --r-pill: 999px;
  --r-tag: 999px 999px 999px 4px;

  /* Shadow */
  --shadow-sheet: 0 1px 2px rgb(27 34 51 / 5%), 0 12px 32px -16px rgb(27 34 51 / 18%);
  --shadow-float: 0 8px 24px -8px rgb(27 34 51 / 22%);

  --page: min(100% - 48px, 72rem);
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html {
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--mist);
  line-height: 1.6;
}

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

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 8px;
  font-size: var(--fs-h1);
  font-weight: 700;
}

h2 {
  margin-bottom: 16px;
  font-size: var(--fs-h2);
  font-weight: 700;
}

h3 {
  font-size: var(--fs-h3);
}

code {
  border-radius: 6px;
  background: var(--surface-2);
  padding: 1px 6px;
  font-size: var(--fs-meta);
}

time,
.schedule-time,
.destination-summary dd,
.history-list a {
  font-variant-numeric: tabular-nums;
}

*:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Header & nav ---------- */

.site-header {
  width: var(--page);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 12px;
}

.wordmark {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: block;
}

.security-note,
.account-menu {
  color: var(--muted);
  font-size: var(--fs-small);
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-menu form {
  margin: 0;
}

.site-nav {
  width: var(--page);
  margin: 0 auto 8px;
  display: flex;
  gap: 4px;
}

.site-nav a {
  border-radius: var(--r-pill);
  color: var(--muted);
  padding: 8px 16px;
  font-size: var(--fs-small);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.site-nav a:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 55%);
}

.site-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(27 34 51 / 8%);
}

/* ---------- Page sheet ---------- */

/* Floating toasts: pinned to the top of the viewport so they never push the
   page down or collide with the bottom save bar. */
.message-stack {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 60;
  width: min(100% - 32px, 28rem);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  border-radius: var(--r-block);
  background: var(--surface);
  box-shadow: var(--shadow-float), inset 4px 0 0 var(--brand);
  color: var(--ink);
  padding: 12px 10px 12px 18px;
  font-size: var(--fs-small);
  pointer-events: auto;
  animation: toast-in 220ms ease both;
  transition: opacity 180ms ease, transform 180ms ease;
}

.message > p {
  flex: 1;
  margin: 2px 0 0;
  line-height: 1.5;
}

.message-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.message-close:hover,
.message-close:focus-visible {
  background: var(--mist);
  color: var(--ink);
}

.message-error {
  background: var(--clay-soft);
  box-shadow: var(--shadow-float), inset 4px 0 0 var(--clay);
}

.message-warning {
  background: var(--urgent-soft);
  box-shadow: var(--shadow-float), inset 4px 0 0 var(--urgent);
}

.message.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message {
    animation: none;
    transition: none;
  }
}

.page-frame {
  width: var(--page);
  min-height: calc(100vh - 140px);
  margin: 16px auto 48px;
  border-radius: var(--r-sheet);
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  padding-bottom: 8px;
  overflow: clip;
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 40px 40px 24px;
}

.page-heading p {
  max-width: 40em;
  margin: 0;
  color: var(--muted);
}

.page-heading form {
  margin: 0;
}

.breadcrumb {
  margin: 0;
  padding: 24px 40px 0;
  color: var(--muted);
  font-size: var(--fs-small);
}

.breadcrumb a {
  color: var(--ink);
}

/* Blocks inside the sheet: separated by space and tint, not borders. */

.panel,
.danger-zone,
.history-panel,
.preview-section {
  margin: 0 24px 16px;
  border-radius: var(--r-block);
  background: var(--surface-2);
  padding: 28px 32px;
}

.panel h2,
.danger-zone h2,
.history-panel h2,
.preview-section h2 {
  font-size: var(--fs-h2);
}

.panel > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  cursor: pointer;
  list-style: none;
}

.panel > summary::-webkit-details-marker {
  display: none;
}

.panel > summary::after,
.term-group > summary::after {
  margin-left: auto;
  color: var(--muted);
  content: "펼치기";
  font-size: var(--fs-small);
}

.panel[open] > summary::after,
.term-group[open] > summary::after {
  content: "접기";
}

.panel > summary h2 {
  display: inline;
  margin: 0;
}

.panel[open] > summary {
  margin-bottom: 20px;
}

.danger-zone {
  background: transparent;
  border: 1px solid var(--clay-soft);
}

.danger-zone p {
  max-width: 44em;
  color: var(--muted);
}

/* ---------- Notices ---------- */

.attention-notice,
.reconnect-notice {
  margin: 0 24px 16px;
  border-radius: var(--r-block);
  background: var(--urgent-soft);
  color: var(--ink);
  padding: 16px 24px;
}

.reconnect-notice {
  background: var(--clay-soft);
}

.attention-notice p,
.reconnect-notice p {
  margin: 4px 0 0;
  color: var(--ink);
  opacity: 0.78;
}

.attention-notice a,
.reconnect-notice a {
  color: var(--ink);
  font-weight: 700;
}

.plain-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

/* ---------- Buttons ---------- */

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--r-control);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.secondary-button:hover {
  background: var(--brand-soft);
}

.panel .secondary-button,
.history-panel .secondary-button {
  background: var(--surface);
}

.danger-button {
  background: transparent;
  color: var(--clay);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--clay) 35%, transparent);
}

.danger-button:hover {
  background: var(--clay-soft);
}

.text-button {
  min-height: 32px;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
}

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

button:disabled,
button[aria-busy="true"] {
  cursor: progress;
  opacity: 0.72;
}

.full-width {
  width: 100%;
}

.fine-print {
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.6;
}

/* ---------- Forms ---------- */

.settings-form,
.course-form {
  margin: 0;
}

.field-row {
  max-width: 40rem;
  margin-bottom: 20px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.field-row label {
  font-size: var(--fs-small);
  font-weight: 700;
}

.field-row small {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.field-row select,
.field-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 8px 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field-row select:focus,
.field-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.field-pair {
  max-width: 40rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

.field-pair .field-row {
  margin-bottom: 0;
}

.input-with-unit {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-row input.input-short {
  width: 6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.errorlist {
  margin: 0;
  color: var(--clay);
  padding-left: 18px;
  font-size: var(--fs-small);
}

.sticky-actions {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  margin: 8px 24px 16px;
  border-radius: var(--r-block);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px 12px 24px;
}

.sticky-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: var(--fs-small);
}

/* ---------- Badges ---------- */

.badge,
.type-badge {
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-block;
  padding: 2px 10px;
  font-size: var(--fs-meta);
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}

.badge-signal {
  background: var(--brand-soft);
  color: var(--brand);
}

/* D-day: the one bold element — a bookmark-tag shape. */
.badge-dday {
  min-width: 3.4rem;
  border-radius: var(--r-tag);
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.badge-dday.is-urgent {
  background: var(--urgent);
  box-shadow: none;
}

.type-badge {
  min-width: 4.5em;
  text-align: center;
}

.type-assignment {
  background: var(--brand-soft);
  color: var(--brand);
}

.type-lecture {
  background: var(--lake-soft);
  color: var(--lake);
}

.type-material {
  background: var(--urgent-soft);
  color: #7a5710;
}

/* ---------- Dashboard ---------- */

.status-rail {
  margin: 0 24px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}

.status-rail li {
  border-radius: var(--r-block);
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: var(--fs-small);
}

.status-rail a {
  color: inherit;
  text-decoration: none;
}

.status-rail a:hover {
  text-decoration: underline;
}

.status-number {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  place-items: center;
  font-size: var(--fs-meta);
  font-weight: 700;
}

.status-rail .is-complete {
  color: var(--ink);
}

.status-rail .is-complete .status-number {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.status-rail .is-current {
  background: var(--urgent-soft);
  color: var(--ink);
}

.status-rail .is-current .status-number {
  box-shadow: inset 0 0 0 2px var(--urgent);
}

.history-grid {
  margin: 0 24px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.history-grid .history-panel {
  margin: 0;
}

/* Dashboard: remaining items on the left, next/recent runs stacked on the right. */
.dashboard-layout {
  margin: 0 24px 16px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.dashboard-layout .panel,
.dashboard-side .history-panel {
  margin: 0;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

/* No remaining items: three equal cards in one row, same height. */
.dashboard-layout.is-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.dashboard-layout.is-compact .dashboard-side {
  display: contents;
}

.schedule-date {
  display: block;
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
}

.schedule-clock {
  display: block;
}

.remaining-empty {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.remaining-empty p,
.remaining-empty form {
  margin: 0;
}

.remaining-heading {
  margin-bottom: 16px;
}

.remaining-heading h2,
.remaining-heading p {
  margin: 0 0 4px;
}

.remaining-partial {
  margin: 0 0 16px;
}

.history-panel.full-panel {
  background: var(--clay-soft);
}

.schedule-time {
  margin: 0 0 4px;
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li,
.problem-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.history-list li + li {
  border-top: 1px solid var(--line);
}

.history-list a {
  color: var(--ink);
  font-weight: 700;
}

.problem-row {
  margin: 0;
}

.empty-state {
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  gap: 4px;
  padding: 18px 20px;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state.compact {
  margin: 0;
  padding: 14px 16px;
  font-size: var(--fs-small);
}

.connection-dot {
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
}

.term-meta {
  color: var(--muted);
  font-size: var(--fs-small);
}

.destination-summary {
  max-width: 40rem;
  margin: 0 0 20px;
  border-radius: var(--r-control);
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.destination-summary div {
  padding: 14px 16px;
}

.destination-summary dt {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.destination-summary dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.destination-actions,
.token-form {
  max-width: 40rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.destination-actions form,
.disconnect-form {
  margin: 0;
}

/* Button sits on the input's row; the helper text goes underneath both,
   so the button lines up with the input instead of the helper text. */
.token-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  margin-bottom: 16px;
}

.token-form .field-row {
  display: contents;
}

/* School radios (shown only when several schools are enabled). */
.school-choice {
  max-width: 40rem;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.school-choice legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.school-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.school-option {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.school-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.school-option span {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 700;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.school-option input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--surface);
}

.school-option input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.school-option input:disabled,
.school-option input:disabled + span {
  cursor: not-allowed;
}

.school-option input:disabled + span {
  background: var(--mist);
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .school-option span {
    transition: none;
  }
}

.token-form .field-row label,
.token-form .field-row small {
  grid-column: 1 / -1;
}

.token-form .field-row label {
  grid-row: 1;
}

.token-form .field-row input {
  grid-column: 1;
  grid-row: 2;
}

.token-form .primary-button {
  grid-column: 2;
  grid-row: 2;
}

.token-form .field-row small {
  grid-row: 3;
}

@media (max-width: 760px) {
  .token-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .token-form .primary-button {
    grid-column: 1;
    grid-row: 4;
    justify-self: start;
  }
}

/* ---------- Course selection ---------- */

.term-group {
  margin: 0 24px 12px;
  border-radius: var(--r-block);
  background: var(--surface-2);
  padding: 4px 20px;
}

.term-group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 16px 4px;
  cursor: pointer;
  list-style: none;
}

.term-group > summary::-webkit-details-marker {
  display: none;
}

.term-name {
  font-size: var(--fs-h3);
  font-weight: 700;
}

.course-list {
  margin: 0 0 12px;
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.course-item {
  border-radius: var(--r-control);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 12px 12px 18px;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.course-item.is-on,
.course-item:has(input:checked) {
  box-shadow: inset 3px 0 0 var(--brand);
}

.course-name {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.course-name span {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.toggle-group {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.toggle {
  min-height: 40px;
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: var(--fs-small);
  font-weight: 700;
  transition: background-color 120ms ease, color 120ms ease;
}

.toggle:hover {
  color: var(--ink);
}

.toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.toggle:has(input:checked) {
  background: var(--brand-soft);
  color: var(--brand);
}

.toggle:has(input:focus-visible) {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.toggle.is-disabled {
  cursor: not-allowed;
  font-weight: 400;
  opacity: 0.7;
}

.course-legend {
  margin: 0;
  padding: 4px 40px 0;
}

/* ---------- Preview ---------- */

.preview-layout {
  margin: 0 24px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.preview-layout .panel {
  margin: 0;
}

.day-group + .day-group {
  margin-top: 24px;
}

.day-group h3 {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-list,
.outcome-list {
  margin: 0;
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.preview-list .preview-item {
  border-radius: var(--r-control);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
}

.preview-item div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.preview-item div span {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.message-sheet {
  display: flex;
  gap: 12px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
}

.message-preview {
  min-width: 0;
  margin: 0;
  border-radius: 4px var(--r-block) var(--r-block) var(--r-block);
  background: var(--surface);
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-family: var(--font);
  font-size: var(--fs-small);
  line-height: 1.65;
}

.outcome {
  border-radius: var(--r-control);
  background: var(--surface);
  display: grid;
  /* Fixed first track: each row is its own grid, so a content-sized column
     would start the status text at a different x for every course name. */
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 16px;
  font-size: var(--fs-small);
}

.outcome > strong {
  overflow-wrap: anywhere;
}

.outcome span,
.outcome code {
  margin: 0;
}

.outcome-failed {
  background: var(--clay-soft);
}

/* Run detail (legacy markup) */

.preview-section .preview-item,
.preview-section > .outcome {
  margin-top: 8px;
}

.preview-section .preview-item {
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 12px 16px;
}

.preview-section .preview-item h3,
.preview-section .preview-item p {
  margin: 2px 0;
}

.run-meta {
  margin: 0 24px 16px;
  border-radius: var(--r-block);
  background: var(--surface-2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.run-meta div {
  padding: 16px 20px;
}

.run-meta dt {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.run-meta dd {
  margin: 4px 0 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Login & notice pages ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: 16px;
  padding: 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: var(--fs-small);
  font-weight: 700;
}

.section-index {
  display: none;
}

/* Login: headline + sign-in card on the left, a sample alert on the right. */
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  min-height: calc(100vh - 180px);
  padding: 24px;
}

.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
}

.login-main h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 3.6vw, 2.6rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.login-lead {
  max-width: 26em;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.login-card {
  width: min(100%, 24rem);
  border-radius: var(--r-block);
  background: var(--surface-2);
  padding: 24px;
}

.login-card form {
  margin: 0;
}

.google-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.google-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.google-mark {
  width: 18px;
  height: 18px;
  flex: none;
}

.login-card .fine-print {
  margin: 12px 0 0;
}

.login-after {
  max-width: 24rem;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.6;
  word-break: keep-all;
}

.login-after .guide-link {
  white-space: nowrap;
}

.login-legal {
  margin: 16px 0 0;
  font-size: var(--fs-small);
}

.login-legal a {
  color: var(--muted);
}

/* ---------- Privacy policy ---------- */
.policy-list {
  margin: 0;
  display: grid;
  gap: 4px;
}

.policy-list dt {
  margin-top: 12px;
  font-weight: 700;
  color: var(--ink);
}

.policy-list dt:first-child {
  margin-top: 0;
}

.policy-list dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-visual {
  border-radius: var(--r-block);
  background:
    radial-gradient(circle at 20% 15%, rgb(255 255 255 / 14%), transparent 45%),
    linear-gradient(160deg, var(--brand) 0%, var(--brand-strong) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 32px;
  overflow: hidden;
}

.demo-push,
.demo-message {
  width: min(100%, 22rem);
  border-radius: var(--r-block);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
}

.demo-push {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgb(255 255 255 / 92%);
  transform: translateX(-12px);
}

.demo-push p,
.demo-message p {
  margin: 0;
}

.demo-push-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: block;
}

.demo-push-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-meta);
}

.demo-push-head span,
.demo-push-body {
  color: var(--muted);
}

.demo-push-title {
  font-size: var(--fs-small);
  font-weight: 700;
}

.demo-push-body {
  font-size: var(--fs-small);
}

.demo-message {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  transform: translateX(12px);
  font-variant-numeric: tabular-nums;
}

.demo-message-meta {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.demo-message-meta strong {
  color: var(--ink);
  margin-right: 4px;
}

.demo-day {
  display: grid;
  gap: 6px;
}

.demo-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.demo-course {
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 700;
}

.demo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
}

.demo-kind {
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  padding: 1px 8px;
  font-size: var(--fs-meta);
  font-weight: 700;
}

.demo-kind-lecture {
  background: var(--lake-soft);
  color: var(--lake);
}

.demo-time {
  margin-left: auto;
  color: var(--muted);
}

.login-visual-caption {
  margin: 8px 0 0;
  color: rgb(255 255 255 / 85%);
  font-size: var(--fs-small);
  font-weight: 700;
}

@media (max-width: 760px) {
  .login-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 10px;
  }

  .login-main {
    padding: 32px 12px;
  }

  .login-visual {
    padding: 32px 16px;
  }

  .demo-push,
  .demo-message {
    transform: none;
  }
}

.notice-page {
  max-width: 44rem;
  padding: 64px 40px;
}

.notice-page p:not(.eyebrow) {
  margin-bottom: 28px;
  color: var(--muted);
}

/* ---------- Loading ---------- */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 700ms linear infinite;
}

.loading-veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(238 241 246 / 72%);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.loading-veil.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-card {
  border-radius: var(--r-block);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
}

.loading-card .spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--brand-soft);
  border-top-color: var(--brand);
}

.loading-card strong {
  display: block;
}

.loading-card span {
  color: var(--muted);
  font-size: var(--fs-small);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

  .spinner {
    animation: pulse 1.4s ease-in-out infinite;
  }
}

/* Narrow screens: keep things usable (mobile is not a design target). */
@media (max-width: 760px) {
  :root {
    --page: min(100% - 20px, 72rem);
  }

  .page-heading,
  .split,
  .field-pair,
  .preview-layout,
  .dashboard-layout,
  .dashboard-layout.is-compact,
  .history-grid,
  .status-rail,
  .destination-summary,
  .run-meta,
  .outcome {
    grid-template-columns: 1fr;
  }

  .page-heading {
    padding: 28px 20px 16px;
  }

  .panel,
  .danger-zone,
  .history-panel,
  .preview-section,
  .term-group,
  .status-rail,
  .history-grid,
  .preview-layout,
  .dashboard-layout,
  .attention-notice,
  .reconnect-notice,
  .sticky-actions {
    margin-right: 10px;
    margin-left: 10px;
  }

  .course-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-menu > span {
    display: none;
  }
}

/* ---------- Destinations (multi) + browser push ---------- */
.destination-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.destination-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--ink);
}

.destination-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.destination-row .destination-actions {
  align-items: center;
  gap: 8px;
}

.kind-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-meta);
  font-weight: 700;
  background: var(--mist);
  color: var(--muted);
}

.kind-chip.kind-discord,
.kind-chip.kind-slack {
  background: var(--lake-soft);
  color: var(--lake);
}

.kind-chip.kind-webpush {
  background: var(--brand-soft);
  color: var(--brand);
}

.push-status {
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
}

/* Buttons set their own display; keep the HTML hidden attribute authoritative. */
[hidden] {
  display: none !important;
}

/* ---------- Alarm editor (phone-alarm style) ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.alarm-editor {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.alarm-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.alarm-heading h3 {
  margin: 0;
  font-size: var(--fs-h3);
  color: var(--ink);
}

.alarm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.alarm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 16px;
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: opacity 160ms ease;
}

.alarm-row.is-off {
  opacity: 0.55;
}

.alarm-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
}

.alarm-row input.alarm-time-input {
  /* Fallback when JS is off: the native time input, themed as a control. */
  width: auto;
  min-width: 7.5rem;
  font-size: var(--fs-h3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- Time picker (replaces the native time popup) ---------- */
.time-field {
  position: relative;
  display: inline-flex;
}

.time-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.time-trigger:hover,
.time-field.is-open .time-trigger {
  border-color: var(--brand);
  background: var(--surface);
}

.time-trigger:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.time-period {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--muted);
}

.time-digits {
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.time-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.time-field.is-open .time-icon {
  color: var(--brand);
}

.time-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 15rem;
  padding: 8px;
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float), inset 0 0 0 1px var(--line);
}

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

.time-column {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  max-height: 13.5rem;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.time-column + .time-column {
  box-shadow: inset 1px 0 0 var(--mist);
}

.time-option {
  min-height: 2.5rem;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.time-option:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.time-option[aria-selected="true"] {
  background: var(--brand);
  color: var(--surface);
  font-weight: 700;
}

.time-option:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

.time-footer {
  display: flex;
  justify-content: flex-end;
  padding: 8px 4px 2px;
  margin-top: 4px;
  box-shadow: inset 0 1px 0 var(--mist);
}

.time-footer .primary-button {
  min-height: 0;
  padding: 8px 16px;
  font-size: var(--fs-small);
}

@media (prefers-reduced-motion: reduce) {
  .time-trigger {
    transition: none;
  }
}

.weekday-picker {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.day-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.day-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.day-chip span {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: 700;
  background: var(--mist);
  color: var(--muted);
  transition: background 120ms ease, color 120ms ease;
}

.day-chip input:checked + span {
  background: var(--brand);
  color: var(--surface);
}

.day-chip input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.alarm-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  width: 2.75rem;
  height: 1.625rem;
  border-radius: var(--r-pill);
  background: var(--line);
  position: relative;
  transition: background 160ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.625rem - 6px);
  height: calc(1.625rem - 6px);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(29, 42, 36, 0.25);
  transition: transform 160ms ease;
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(1.125rem);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.alarm-delete {
  color: var(--clay);
}

.alarm-delete:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.alarm-add {
  justify-self: start;
}

.alarm-errors {
  flex-basis: 100%;
  color: var(--clay);
  font-size: var(--fs-small);
}

@media (prefers-reduced-motion: reduce) {
  .alarm-row,
  .day-chip span,
  .switch-track,
  .switch-track::after {
    transition: none;
  }
}

/* ---------- Notification sub-tabs (알림 시각 | 받을 곳) ---------- */
.sub-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-width: 24rem;
  margin: 0 24px 16px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--mist);
}

.sub-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 2.75rem;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.sub-tabs a:hover {
  color: var(--ink);
}

.sub-tabs a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(27 34 51 / 8%);
}

.sub-tabs a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--fs-meta);
  font-variant-numeric: tabular-nums;
}

/* ---------- Save bar: only while there are unsaved changes ---------- */
.save-bar {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms ease, opacity 160ms ease;
}

.save-bar[data-dirty] {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* Keep the last alarm row clear of the bar while it floats. */
.settings-form:has(.save-bar[data-dirty]) {
  padding-bottom: 8px;
}

.webhook-panel .webhook-form {
  display: grid;
  gap: 16px;
}

.webhook-panel .webhook-form > .primary-button {
  justify-self: start;
}

/* ---------- Header account link ---------- */
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-pill);
  color: var(--muted);
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.account-link:hover,
.account-link[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--fs-meta);
  font-weight: 700;
}

@media (max-width: 760px) {
  .sub-tabs {
    max-width: none;
    margin: 0 10px 12px;
  }

  .account-email {
    display: none;
  }

  .account-link {
    padding: 4px;
  }

  .save-bar {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .save-bar > span {
    display: none;
  }

  .save-bar .primary-button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .save-bar,
  .sub-tabs a,
  .account-link {
    transition: none;
  }
}

/* ---------- Item exclusions ---------- */
.preview-item-text {
  flex: 1;
}

.exclude-form {
  margin: 0 0 0 auto;
  align-self: center;
}

.exclude-button {
  color: var(--muted);
  font-size: var(--fs-small);
  white-space: nowrap;
}

.exclude-button:hover {
  color: var(--clay);
}

.excluded-note {
  margin: 0 24px 16px;
  padding: 10px 16px;
  border-radius: var(--r-control);
  background: var(--mist);
  color: var(--muted);
  font-size: var(--fs-small);
}

.excluded-note strong {
  color: var(--ink);
}

.excluded-note a {
  margin-left: 8px;
  color: var(--brand);
  font-weight: 700;
}

.excluded-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.excluded-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--ink);
}

.excluded-row form {
  margin: 0 0 0 auto;
}

@media (max-width: 760px) {
  .excluded-note {
    margin: 0 10px 12px;
  }

  .excluded-row {
    flex-wrap: wrap;
  }
}

.link-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 120ms ease;
}

.link-panel > span:first-child {
  display: grid;
  gap: 4px;
}

.link-panel:hover {
  background: var(--brand-soft);
}

.link-panel:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.link-arrow {
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

/* ---------- Canvas access-key guide ---------- */
.guide-facts,
.guide-next {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 10px;
  color: var(--ink);
  line-height: 1.6;
}

.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.guide-step {
  margin: 0 24px;
  padding: 28px;
  border-radius: var(--r-block);
  background: var(--surface-2);
  color: var(--ink);
  display: grid;
  gap: 20px;
  scroll-margin-top: 16px;
}

.guide-step-text {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.guide-step-text h2 {
  margin: 4px 0 8px;
  font-size: var(--fs-h2);
  line-height: 1.35;
}

.guide-step-text p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.65;
}

.guide-step-text p strong,
.guide-callout strong {
  color: var(--ink);
}

.guide-step-number {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-tag);
  background: var(--brand);
  color: var(--surface);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.guide-callout {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--urgent-soft);
  color: var(--ink);
}

.guide-callout p {
  margin: 4px 0 0;
  color: var(--ink);
}

.guide-shot {
  margin: 0;
  display: grid;
  gap: 8px;
}

.guide-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-control);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(27 34 51 / 8%), inset 0 0 0 1px var(--line);
}

/* Phone screenshots are tall; keep them phone-sized instead of full width. */
.guide-shot-phone {
  max-width: 320px;
}

.guide-shot figcaption {
  color: var(--muted);
  font-size: var(--fs-small);
}

.guide-faq {
  margin: 0;
  display: grid;
  gap: 4px;
}

.guide-faq dt {
  margin-top: 12px;
  font-weight: 700;
  color: var(--ink);
}

.guide-faq dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.guide-link {
  color: var(--brand);
  font-weight: 700;
}

@media (max-width: 760px) {
  .guide-step {
    margin: 0 10px;
    padding: 20px 16px;
  }

  .guide-step-text {
    gap: 12px;
  }
}

/* ---------- Feedback ---------- */

.feedback-fab {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 20;
  min-height: 48px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-float);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 0 14px;
  font-weight: 700;
  font-size: var(--fs-small);
  text-decoration: none;
}

.feedback-fab:hover {
  background: var(--brand-strong);
}

.feedback-fab:focus-visible {
  outline: 3px solid var(--brand-soft);
  outline-offset: 2px;
}

.feedback-fab svg {
  width: 22px;
  height: 22px;
}

/* Stay clear of the sticky save bar on settings pages. */
body:has(.sticky-actions) .feedback-fab {
  bottom: calc(96px + env(safe-area-inset-bottom));
}

.feedback-dialog {
  width: min(100% - 32px, 30rem);
  border: 0;
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  padding: 24px;
}

.feedback-dialog::backdrop {
  background: rgb(27 34 51 / 40%);
}

.feedback-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.feedback-dialog-head h2 {
  margin: 0;
  font-size: var(--fs-h2);
}

.feedback-kinds {
  margin: 0 0 16px;
  border: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.feedback-kinds legend {
  margin-bottom: 8px;
  font-size: var(--fs-small);
  font-weight: 700;
}

.feedback-kinds label,
.feedback-context {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feedback-context {
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: var(--fs-small);
}

.field-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 10px 14px;
  font: inherit;
  resize: vertical;
}

.field-row textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-error {
  color: var(--clay);
}

@media (max-width: 760px) {
  .feedback-fab span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .feedback-fab {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
  }
}

/* Medium widths: the empty remaining card takes the first row. */
@media (min-width: 761px) and (max-width: 1100px) {
  .dashboard-layout.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout.is-compact .remaining-panel {
    grid-column: 1 / -1;
  }
}
