/* =============================================================
   EDH DeckApp — Carbon Design System, Gray 100 Theme
   ============================================================= */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --cds-background:             #161616;
  --cds-background-hover:       rgba(141, 141, 141, 0.12);
  --cds-background-active:      rgba(141, 141, 141, 0.50);
  --cds-background-selected:    rgba(141, 141, 141, 0.24);
  --cds-background-inverse:     #f4f4f4;

  /* Layers */
  --cds-layer-01:               #262626;
  --cds-layer-02:               #393939;
  --cds-layer-03:               #525252;
  --cds-layer-hover-01:         #333333;
  --cds-layer-hover-02:         #474747;
  --cds-layer-selected-01:      #393939;
  --cds-layer-selected-02:      #525252;

  /* Fields */
  --cds-field-01:               #262626;
  --cds-field-02:               #393939;
  --cds-field-hover-01:         #333333;
  --cds-field-hover-02:         #474747;

  /* Borders */
  --cds-border-subtle-00:       #262626;
  --cds-border-subtle-01:       #393939;
  --cds-border-subtle-02:       #525252;
  --cds-border-strong-01:       #6f6f6f;
  --cds-border-interactive:     #4589ff;
  --cds-border-inverse:         #f4f4f4;
  --cds-border-disabled:        #525252;

  /* Text */
  --cds-text-primary:           #f4f4f4;
  --cds-text-secondary:         #c6c6c6;
  --cds-text-placeholder:       #6f6f6f;
  --cds-text-helper:            #8d8d8d;
  --cds-text-error:             #ff8389;
  --cds-text-inverse:           #161616;
  --cds-text-on-color:          #ffffff;
  --cds-text-disabled:          #525252;

  /* Links */
  --cds-link-primary:           #78a9ff;
  --cds-link-secondary:         #a6c8ff;

  /* Icons */
  --cds-icon-primary:           #f4f4f4;
  --cds-icon-secondary:         #c6c6c6;
  --cds-icon-disabled:          #525252;

  /* Status */
  --cds-support-error:          #ff8389;
  --cds-support-success:        #42be65;
  --cds-support-warning:        #f1c21b;
  --cds-support-info:           #4589ff;

  /* Interactive */
  --cds-interactive:            #4589ff;
  --cds-focus:                  #ffffff;
  --cds-focus-inset:            #161616;
  --cds-overlay:                rgba(0, 0, 0, 0.65);
  --cds-shadow:                 rgba(0, 0, 0, 0.80);

  /* Buttons */
  --cds-button-primary:         #0f62fe;
  --cds-button-primary-hover:   #0050e6;
  --cds-button-primary-active:  #002d9c;
  --cds-button-secondary:       #393939;
  --cds-button-secondary-hover: #474747;
  --cds-button-secondary-active:#6f6f6f;
  --cds-button-danger:          #da1e28;
  --cds-button-danger-hover:    #ba1b23;
  --cds-button-danger-active:   #750e13;
  --cds-button-disabled:        #525252;

  /* Spacing */
  --spacing-01: 0.125rem;   /*  2px */
  --spacing-02: 0.25rem;    /*  4px */
  --spacing-03: 0.5rem;     /*  8px */
  --spacing-04: 0.75rem;    /* 12px */
  --spacing-05: 1rem;       /* 16px */
  --spacing-06: 1.5rem;     /* 24px */
  --spacing-07: 2rem;       /* 32px */
  --spacing-08: 2.5rem;     /* 40px */
  --spacing-09: 3rem;       /* 48px */
  --spacing-10: 4rem;       /* 64px */
  --spacing-11: 5rem;       /* 80px */

  /* Typography */
  --font-sans: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', Courier, monospace;

  /* Motion */
  --motion-fast:     110ms;
  --motion-moderate: 150ms;
  --motion-easing:   cubic-bezier(0.2, 0, 0.38, 0.9);
  --motion-entrance: cubic-bezier(0, 0, 0.38, 0.9);
}

/* ── Reset + Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--cds-background);
  color: var(--cds-text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.25rem;
  min-height: 100vh;
}

a { color: var(--cds-link-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--font-sans); }

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cds-layer-01);
  border-bottom: 1px solid var(--cds-border-subtle-01);
  height: 3rem;
}

.app-header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1584px;
  margin: 0 auto;
  padding: 0 var(--spacing-05);
  gap: var(--spacing-05);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-03);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 var(--spacing-02);
  height: 100%;
  transition: background var(--motion-fast) var(--motion-easing);
}

.app-header__brand:hover { background: var(--cds-background-hover); }

.app-header__brand:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: -2px;
}

.app-header__logo {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--cds-interactive);
  flex-shrink: 0;
}

.app-header__title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cds-text-primary);
}

.app-header__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-02);
  color: var(--cds-text-secondary);
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}

.app-header__breadcrumb-sep {
  color: var(--cds-text-helper);
  flex-shrink: 0;
}

.app-header__breadcrumb-current {
  color: var(--cds-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-03);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Content Area ───────────────────────────────────────────── */
.app-content {
  max-width: 1584px;
  margin: 0 auto;
  padding: var(--spacing-07) var(--spacing-05);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-02);
  padding: 0 var(--spacing-05);
  height: 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-easing);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  flex-shrink: 0;
}

.btn:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--cds-button-primary);
  color: var(--cds-text-on-color);
}
.btn--primary:hover  { background: var(--cds-button-primary-hover); }
.btn--primary:active { background: var(--cds-button-primary-active); }

.btn--secondary {
  background: var(--cds-button-secondary);
  color: var(--cds-text-primary);
  border-color: var(--cds-border-strong-01);
}
.btn--secondary:hover  { background: var(--cds-button-secondary-hover); }
.btn--secondary:active { background: var(--cds-button-secondary-active); }

.btn--ghost {
  background: transparent;
  color: var(--cds-text-primary);
}
.btn--ghost:hover { background: var(--cds-background-hover); }

.btn--danger {
  background: var(--cds-button-danger);
  color: var(--cds-text-on-color);
}
.btn--danger:hover  { background: var(--cds-button-danger-hover); }
.btn--danger:active { background: var(--cds-button-danger-active); }

.btn--sm {
  height: 2rem;
  padding: 0 var(--spacing-04);
  font-size: 0.75rem;
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-02);
  margin-bottom: var(--spacing-06);
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cds-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-label--required::after {
  content: ' *';
  color: var(--cds-support-error);
}

.form-input,
.form-textarea,
.form-select {
  background: var(--cds-field-01);
  color: var(--cds-text-primary);
  border: none;
  border-bottom: 1px solid var(--cds-border-strong-01);
  padding: 0 var(--spacing-04);
  height: 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  transition: border-color var(--motion-fast) var(--motion-easing),
              background var(--motion-fast) var(--motion-easing);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--cds-text-placeholder); }

.form-input:hover,
.form-textarea:hover,
.form-select:hover { background: var(--cds-field-hover-01); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-bottom: 2px solid var(--cds-border-interactive);
  outline: none;
}

.form-textarea {
  height: auto;
  min-height: 6rem;
  padding: var(--spacing-03) var(--spacing-04);
  resize: vertical;
  line-height: 1.5rem;
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23c6c6c6' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-select option {
  background: var(--cds-layer-02);
  color: var(--cds-text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-05);
}

/* ── Color Picker ───────────────────────────────────────────── */
.color-picker {
  display: flex;
  gap: var(--spacing-03);
  flex-wrap: wrap;
}

.color-pip-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  transition: opacity var(--motion-fast) var(--motion-easing),
              border-color var(--motion-fast) var(--motion-easing);
  opacity: 0.35;
  user-select: none;
}

.color-pip-toggle:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 2px;
}

.color-pip-toggle.selected {
  opacity: 1;
  border-color: var(--cds-focus);
}

.color-pip-toggle--W { background: #f0e6d2; color: #161616; }
.color-pip-toggle--U { background: #4589ff; color: #ffffff; }
.color-pip-toggle--B { background: #393939; color: #f4f4f4; border-color: #6f6f6f; }
.color-pip-toggle--R { background: #ff8389; color: #161616; }
.color-pip-toggle--G { background: #42be65; color: #161616; }
.color-pip-toggle--C { background: #8d8d8d; color: #161616; }

.color-pip-toggle--B.selected { border-color: var(--cds-focus); }

/* ── Color Pips (Display) ───────────────────────────────────── */
.color-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.color-pip--W { background: #f0e6d2; color: #161616; }
.color-pip--U { background: #4589ff; color: #ffffff; }
.color-pip--B { background: #525252; color: #f4f4f4; border: 1px solid #6f6f6f; }
.color-pip--R { background: #ff8389; color: #161616; }
.color-pip--G { background: #42be65; color: #161616; }
.color-pip--C { background: #8d8d8d; color: #161616; }

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-05);
  margin-bottom: var(--spacing-07);
}

.dashboard-heading {
  font-size: 2rem;
  font-weight: 300;
  line-height: 2.5rem;
  color: var(--cds-text-primary);
}

.dashboard-subheading {
  font-size: 0.875rem;
  color: var(--cds-text-secondary);
  margin-top: var(--spacing-02);
  font-family: var(--font-mono);
}

/* ── Deck Grid ──────────────────────────────────────────────── */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-05);
}

/* ── Deck Card ──────────────────────────────────────────────── */
.deck-card {
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  padding: var(--spacing-06);
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-easing),
              border-color var(--motion-fast) var(--motion-easing);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-04);
  position: relative;
}

.deck-card:hover {
  background: var(--cds-layer-hover-01);
  border-color: var(--cds-border-strong-01);
}

.deck-card:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 2px;
}

.deck-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-03);
}

.deck-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cds-text-primary);
  line-height: 1.5rem;
}

.deck-card__commander {
  font-size: 0.75rem;
  color: var(--cds-text-secondary);
  font-family: var(--font-mono);
  margin-top: var(--spacing-01);
  line-height: 1.25rem;
}

.deck-card__colors {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 5rem;
}

.deck-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-03);
  border-top: 1px solid var(--cds-border-subtle-01);
  padding-top: var(--spacing-04);
}

.deck-card__stat-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cds-text-primary);
  line-height: 1.75rem;
}

.deck-card__stat-lbl {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cds-text-helper);
  margin-top: 0.1rem;
}

.deck-card__footer {
  font-size: 0.75rem;
  color: var(--cds-text-helper);
  font-family: var(--font-mono);
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-11) var(--spacing-05);
  text-align: center;
  gap: var(--spacing-05);
  border: 1px dashed var(--cds-border-subtle-01);
  background: var(--cds-layer-01);
}

.empty-state svg { color: var(--cds-text-helper); }

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--cds-text-secondary);
}

.empty-state__sub {
  font-size: 0.875rem;
  color: var(--cds-text-helper);
  max-width: 340px;
  line-height: 1.5rem;
}

/* ── Back Button ────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-02);
  color: var(--cds-link-primary);
  font-size: 0.875rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color var(--motion-fast) var(--motion-easing);
}

.back-btn:hover { color: var(--cds-text-primary); }

.back-btn:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 2px;
}

/* ── Detail Hero ────────────────────────────────────────────── */
.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-07);
  margin-bottom: var(--spacing-07);
}

.detail-hero__info { flex: 1; min-width: 0; }

.detail-hero__name {
  font-size: 2.625rem;
  font-weight: 300;
  line-height: 3.125rem;
  color: var(--cds-text-primary);
  margin-bottom: var(--spacing-02);
}

.detail-hero__commander {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--cds-text-secondary);
  margin-bottom: var(--spacing-04);
}

.detail-hero__meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-05);
  flex-wrap: wrap;
}

.detail-hero__meta-tag {
  font-size: 0.75rem;
  color: var(--cds-text-helper);
  font-family: var(--font-mono);
}

.detail-hero__description {
  margin-top: var(--spacing-05);
  font-size: 0.875rem;
  color: var(--cds-text-secondary);
  line-height: 1.5rem;
  max-width: 640px;
}

.detail-hero__actions {
  display: flex;
  gap: var(--spacing-03);
  flex-shrink: 0;
  align-items: flex-start;
  padding-top: var(--spacing-02);
}

@media (max-width: 640px) {
  .detail-hero {
    flex-direction: column;
    gap: var(--spacing-05);
  }
  .detail-hero__name { font-size: 1.75rem; line-height: 2.25rem; }
  .detail-hero__actions { width: 100%; }
}

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-bottom: var(--spacing-07);
  background: var(--cds-border-subtle-01);
  border: 1px solid var(--cds-border-subtle-01);
}

@media (max-width: 900px)  { .stats-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .stats-row { grid-template-columns: repeat(2, 1fr); } }

.stat-box {
  background: var(--cds-layer-01);
  padding: var(--spacing-06);
}

.stat-box__val {
  font-family: var(--font-mono);
  font-size: 2.625rem;
  font-weight: 300;
  line-height: 3rem;
  color: var(--cds-text-primary);
  letter-spacing: -0.02em;
}

.stat-box__val--win    { color: var(--cds-support-success); }
.stat-box__val--loss   { color: var(--cds-support-error); }
.stat-box__val--accent { color: var(--cds-interactive); }
.stat-box__val--muted  { color: var(--cds-text-secondary); }

.stat-box__lbl {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cds-text-helper);
  margin-top: var(--spacing-02);
}

/* ── Charts ─────────────────────────────────────────────────── */
.charts-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-05);
  margin-bottom: var(--spacing-07);
}

@media (max-width: 900px) { .charts-section { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  padding: var(--spacing-06);
}

.chart-card__title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cds-text-secondary);
  font-weight: 600;
  margin-bottom: var(--spacing-05);
}

.chart-card__wrap {
  position: relative;
  height: 220px;
}

/* ── Section Headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--spacing-04);
  border-bottom: 1px solid var(--cds-border-subtle-01);
  margin-bottom: var(--spacing-05);
}

.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cds-text-secondary);
}

/* ── Data Table ─────────────────────────────────────────────── */
.table-wrap {
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  margin-bottom: var(--spacing-07);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--cds-layer-02);
  color: var(--cds-text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--spacing-04) var(--spacing-05);
  text-align: left;
  border-bottom: 1px solid var(--cds-border-subtle-01);
  white-space: nowrap;
}

.data-table td {
  padding: var(--spacing-04) var(--spacing-05);
  border-bottom: 1px solid var(--cds-border-subtle-01);
  color: var(--cds-text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--cds-background-hover); }

.td-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cds-text-secondary);
  white-space: nowrap;
}

.td-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cds-text-secondary);
  white-space: nowrap;
}

.td-notes {
  color: var(--cds-text-secondary);
  font-size: 0.8125rem;
  max-width: 360px;
  line-height: 1.375rem;
}

.td-actions {
  text-align: right;
  white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--spacing-03);
  height: 1.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: 0.75rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge--win {
  background: rgba(66, 190, 101, 0.12);
  color: var(--cds-support-success);
  border: 1px solid rgba(66, 190, 101, 0.25);
}

.badge--loss {
  background: rgba(255, 131, 137, 0.10);
  color: var(--cds-support-error);
  border: 1px solid rgba(255, 131, 137, 0.20);
}

/* ── Deck Mood ──────────────────────────────────────────────── */
.deck-mood {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-05);
  padding: var(--spacing-05) var(--spacing-06);
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  margin-bottom: var(--spacing-06);
}
.deck-mood__group {
  display: flex;
  align-items: center;
  gap: var(--spacing-03);
}
.deck-mood__label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cds-text-helper);
  white-space: nowrap;
}
.deck-mood__dots { display: flex; gap: 4px; }

/* Status buttons */
.deck-mood__status-btns { display: flex; gap: 4px; }
.status-btn {
  padding: 2px 10px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: transparent;
  border: 1px solid var(--cds-border-subtle-01);
  color: var(--cds-text-secondary);
  cursor: pointer;
  transition: background 80ms, border-color 80ms;
}
.status-btn:hover { background: var(--cds-background-hover); }
.status-btn--active { border-color: var(--cds-border-strong-01); color: var(--cds-text-primary); }
.status-btn--active.status-btn--active   { background: var(--cds-layer-02); }
.status-btn--active.status-btn--review   { border-color: #f1c21b; color: #f1c21b; background: rgba(241,194,27,0.08); }
.status-btn--active.status-btn--dissolved{ border-color: var(--cds-text-helper); color: var(--cds-text-helper); }

/* Rating dots */
.rating-dot-btn {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--cds-border-subtle-01);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 80ms, border-color 80ms, transform 80ms;
}
.rating-dot-btn:hover { transform: scale(1.2); border-color: var(--cds-text-helper); }
.rating-dot-btn--on { background: var(--cds-interactive); border-color: var(--cds-interactive); }

/* Dashboard status badges */
.deck-status {
  display: inline-block;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 1px 6px;
  margin-left: 0.4rem;
  vertical-align: middle;
  border-radius: 2px;
}
.deck-status--review    { background: rgba(241,194,27,0.15); color: #f1c21b; border: 1px solid rgba(241,194,27,0.3); }
.deck-status--dissolved { background: rgba(141,141,141,0.1); color: var(--cds-text-helper); border: 1px solid var(--cds-border-subtle-01); }

/* Dashboard rating dots (read-only) */
.deck-card__ratings {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 0 var(--spacing-03);
}
.rating-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--cds-text-helper);
}
.rating-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--cds-border-subtle-01);
  background: transparent;
}
.rating-dot--on { background: var(--cds-interactive); border-color: var(--cds-interactive); }

/* Dissolved deck card */
.deck-card--dissolved { opacity: 0.5; }
.deck-card--dissolved:hover { opacity: 0.75; }

/* Dissolved section toggle */
.dissolved-section {
  margin-top: var(--spacing-07);
}
.dissolved-section__toggle {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cds-text-helper);
  cursor: pointer;
  padding: var(--spacing-03) 0;
  list-style: none;
  user-select: none;
}
.dissolved-section__toggle::-webkit-details-marker { display: none; }
.dissolved-section__toggle::before {
  content: '▶ ';
  font-size: 0.6rem;
}
details[open] .dissolved-section__toggle::before { content: '▼ '; }

/* ── Notes ──────────────────────────────────────────────────── */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-05);
  margin-bottom: var(--spacing-07);
}

.note-card {
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  padding: var(--spacing-06);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-03);
}

.note-card__date {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--cds-text-helper);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--cds-text-primary);
  line-height: 1.375rem;
}

.note-card__content {
  font-size: 0.8125rem;
  color: var(--cds-text-secondary);
  line-height: 1.5rem;
  white-space: pre-wrap;
  flex: 1;
}

.note-card__footer {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--spacing-03);
  border-top: 1px solid var(--cds-border-subtle-01);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--cds-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-05);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-moderate) var(--motion-easing);
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform var(--motion-moderate) var(--motion-entrance);
  box-shadow: 0 12px 40px var(--cds-shadow);
}

.modal-overlay.is-open .modal { transform: translateY(0); }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-06) var(--spacing-07);
  border-bottom: 1px solid var(--cds-border-subtle-01);
  flex-shrink: 0;
}

.modal__title {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--cds-text-primary);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  color: var(--cds-icon-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--motion-fast) var(--motion-easing),
              color var(--motion-fast) var(--motion-easing);
  flex-shrink: 0;
}

.modal__close:hover {
  background: var(--cds-background-hover);
  color: var(--cds-icon-primary);
}

.modal__close:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 2px;
}

.modal__body {
  padding: var(--spacing-07);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-03);
  padding: var(--spacing-05) var(--spacing-07);
  border-top: 1px solid var(--cds-border-subtle-01);
  flex-shrink: 0;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--spacing-06);
  right: var(--spacing-06);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-03);
  pointer-events: none;
}

.toast {
  background: var(--cds-layer-02);
  border: 1px solid var(--cds-border-subtle-01);
  border-left: 3px solid var(--cds-support-success);
  padding: var(--spacing-04) var(--spacing-05);
  display: flex;
  align-items: center;
  gap: var(--spacing-03);
  font-size: 0.875rem;
  color: var(--cds-text-primary);
  min-width: 240px;
  max-width: 340px;
  pointer-events: auto;
  animation: toastIn var(--motion-moderate) var(--motion-entrance) both;
}

.toast--error   { border-left-color: var(--cds-support-error); }
.toast--warning { border-left-color: var(--cds-support-warning); }
.toast--info    { border-left-color: var(--cds-support-info); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Delete Confirm Text ────────────────────────────────────── */
.confirm-text {
  color: var(--cds-text-secondary);
  line-height: 1.625rem;
  font-size: 0.9375rem;
}

/* ── Card List ───────────────────────────────────────────────── */
.card-list-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--spacing-06);
  align-items: start;
  margin-bottom: var(--spacing-07);
}

@media (max-width: 780px) {
  .card-list-layout {
    grid-template-columns: 1fr;
  }
  .card-preview { display: none; }
}

.card-list-layout__main {
  min-width: 0;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0;
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
}

.card-list__item {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-03);
  padding: var(--spacing-02) var(--spacing-05);
  border-bottom: 1px solid var(--cds-border-subtle-00);
  transition: background var(--duration-fast) var(--ease-standard);
}

.card-list__item:hover {
  background: var(--cds-layer-hover-01);
}

.card-list__qty {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--cds-text-helper);
  min-width: 1rem;
  text-align: right;
  flex-shrink: 0;
}

.card-list__name {
  font-size: 0.8125rem;
  color: var(--cds-text-primary);
  line-height: 1.4rem;
}

.card-list__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  background: var(--cds-layer-02);
  color: var(--cds-text-secondary);
  padding: 0 var(--spacing-02);
  height: 1.125rem;
  margin-left: var(--spacing-03);
  vertical-align: middle;
}

.card-list__empty {
  display: flex;
  align-items: center;
  gap: var(--spacing-04);
  padding: var(--spacing-06) var(--spacing-05);
  color: var(--cds-text-helper);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
}

/* ── Card Preview ────────────────────────────────────────────── */
.card-preview {
  position: sticky;
  top: calc(3rem + var(--spacing-06));
  background: var(--cds-layer-01);
  border: 1px solid var(--cds-border-subtle-01);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-03);
  padding: var(--spacing-05);
  min-height: 12rem;
}

.card-preview__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-04);
  color: var(--cds-text-helper);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: center;
  padding: var(--spacing-06) 0;
  width: 100%;
  flex: 1;
}

.card-preview__img {
  width: 100%;
  display: block;
  border: 1px solid var(--cds-border-subtle-01);
  border-radius: 4.75% / 3.5%;
  opacity: 1;
  transition: opacity 80ms ease;
}

.card-preview__img.hidden {
  display: none;
  opacity: 0;
}

.card-preview__name {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--cds-text-secondary);
  text-align: center;
  min-height: 1rem;
  line-height: 1.2;
}

.card-preview__error {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cds-text-helper);
  text-align: center;
  padding: var(--spacing-06) 0;
}

.card-preview__error.hidden { display: none; }

/* ── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }

.divider {
  border: none;
  border-top: 1px solid var(--cds-border-subtle-01);
  margin: var(--spacing-07) 0;
}
