/* 홈 대시보드 — 들어오자마자 보이는 카드들 */

.dash {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  align-items: start;
}

.dash__card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
}

.dash__card.span-1 { grid-column: span 1; }
.dash__card.span-4 { grid-column: span 4; }

.dash__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}

.dash__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--color-ink);
  margin: 0;
}

.dash__link {
  flex: none;
  font-size: 12px;
  color: var(--color-ink);
  opacity: 0.6;
  text-decoration: none;
  white-space: nowrap;
}

.dash__link:hover { opacity: 1; text-decoration: underline; }

/* The one thing the card exists to say, set large enough to read from arm's
   length — the point of a dashboard is answering without being read. */
.dash__lede {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  flex-wrap: wrap;
  padding: var(--space-xs) 0 var(--space-xxs);
}

.dash__lede-when {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  font-weight: 500;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

.dash__lede-what {
  font-size: 13px;
  color: var(--color-ink);
  opacity: 0.75;
  min-width: 0;
}

.dash__empty {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-ink);
  opacity: 0.7;
  margin: 0;
}

/* --- rows shared by both cards --- */

.dash__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: rgba(20, 20, 20, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dash__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 7px var(--space-sm);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  min-width: 0;
}

.dash__row-when {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  min-width: 62px;
}

.dash__row-what {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash__row-tag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--color-muted);
  white-space: nowrap;
}

.dash__row.is-today .dash__row-when { color: var(--color-ink); font-weight: 600; }
.dash__row.is-unverified .dash__row-what { border-bottom: 1px dashed var(--color-border-strong); }

/* A day heading inside the calendar list. */
.dash__day {
  padding: 5px var(--space-sm);
  background: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-muted);
}

/* --- 수시 경쟁률 chips --- */

.dash__ratios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
}

.dash__ratio {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  white-space: nowrap;
}

.dash__ratio b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.dash__ratio span { color: var(--color-muted); }

/* --- calendar settings --- */

.dash__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
  align-items: center;
}

.dash-setup {
  margin-top: var(--space-xxs);
  font-size: 12px;
}

.dash-setup > summary {
  cursor: pointer;
  color: var(--color-muted);
  padding: 2px 0;
  list-style: revert;
}

.dash-setup__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) 0 0;
}

.dash-setup__how {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--color-muted);
}

.dash-setup__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
}

.dash-setup__form input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12px;
  background: var(--color-canvas);
  color: var(--color-ink);
}

.dash-feed {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px var(--space-xs);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.dash-feed__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-feed__meta { flex: 0 0 auto; color: var(--color-muted); font-size: 11px; }
.dash-feed.is-off .dash-feed__name { opacity: 0.45; text-decoration: line-through; }

.dash__error {
  margin: 0;
  font-size: 12px;
  color: var(--color-signature-coral);
}

/* The section only earns its place at the top of the page once it has
   something to say, so it stays out of the flow until the fetch lands. */
#dashboard-section[hidden] { display: none; }

@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash__card,
  .dash__card.span-1,
  .dash__card.span-4 { grid-column: span 1; }
  .dash__lede-when { font-size: 26px; }
}

/* A dashboard you have to scroll to isn't a dashboard. When this section is
   showing, the homepage's 96px section rhythm above it collapses so the first
   card is on screen as the page opens — on a phone the hero alone was pushing
   it past the fold. :has() carries the whole condition, so a browser without
   it simply keeps the site's normal spacing. */
.hero-band:has(+ #dashboard-section:not([hidden])) {
  padding-bottom: var(--space-lg);
}

#dashboard-section:not([hidden]) {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-xl);
}

@media (max-width: 900px) {
  .hero-band:has(+ #dashboard-section:not([hidden])) {
    padding-top: var(--space-xl);
  }
  .hero-band:has(+ #dashboard-section:not([hidden])) h1 {
    font-size: 30px;
    margin-bottom: var(--space-sm);
  }
  .hero-band:has(+ #dashboard-section:not([hidden])) p {
    font-size: 15px;
  }
}

/* --- featured card: picker + per-feature bodies --- */

/* The featured card's title doubles as the feature picker: it reads as the
   heading, and the chevron says it can be changed. */
.dash__picker {
  min-width: 0;
  flex: 0 1 auto;
}

.dash__picker select {
  max-width: 100%;
  margin: -4px 0 -4px -8px;
  padding: 4px 26px 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 6px center / 14px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--color-ink);
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
  /* Not field-sizing: content — Chrome sizes that without the chevron's
     padding and ellipsises the name ("진학사 점공 ..."). Sized to the longest
     option instead, which only costs some air before the chevron. */
}

.dash__picker select:hover { background-color: rgba(255, 255, 255, 0.45); border-color: rgba(20, 20, 20, 0.12); }

.dash__picker select:focus-visible {
  outline: 2px solid var(--color-info-border);
  outline-offset: 1px;
}

.dash__card.is-loading > :not(.dash__head) { opacity: 0.45; transition: opacity 0.15s; }

.dash-up { color: var(--color-signature-coral); }
.dash-down { color: var(--color-link); }

.dash__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-xs);
}

.dash__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  min-width: 0;
}

.dash__stat-label { font-size: 11px; color: var(--color-muted); }

.dash__stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 500;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

.dash__stat-sub { font-size: 12px; font-variant-numeric: tabular-nums; }

.dash__caption {
  margin: 0;
  font-size: 11px;
  color: var(--color-ink);
  opacity: 0.65;
}

.dash__spark {
  display: block;
  width: 100%;
  height: 44px;
  color: var(--color-ink);
  opacity: 0.8;
}

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