/* ============================================================
   KMC Workstation v2 — components.css
   15 Common Components (BEM)
   Requires: design-system-v3.css (tokens), base.css
   ============================================================ */

/* ========================
   1. Button (.btn)
   ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-md);
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: var(--touch-min);
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:focus-visible { box-shadow: var(--ring-brand); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn--primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn--secondary {
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--line-light);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--line);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-secondary);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
}

.btn--danger {
  background: var(--status-danger);
  color: #fff;
  border-color: var(--status-danger);
}
.btn--danger:hover:not(:disabled) {
  background: #B91C1C;
  border-color: #B91C1C;
}

.btn--outline {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn--outline:hover:not(:disabled) {
  background: var(--brand-50);
}

.btn--sm {
  padding: var(--sp-1) var(--sp-2_5);
  font-size: var(--text-xs);
  min-height: 28px;
}

.btn--lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-base);
  min-height: 44px;
}

.btn--full { width: 100%; }

.btn--icon-only {
  padding: var(--sp-2);
  min-width: var(--touch-min);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}


/* ========================
   2. Input (.input)
   ======================== */
.input {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  min-height: var(--touch-min);
}

.input::placeholder { color: var(--input-placeholder); }
.input:hover:not(:disabled) { border-color: var(--slate-400); }
.input:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-ring);
}
.input:disabled {
  background: var(--input-disabled-bg);
  cursor: not-allowed;
  opacity: 0.7;
}
.input--error {
  border-color: var(--status-danger);
}
.input--error:focus {
  box-shadow: var(--ring-danger);
}

.input--sm {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--text-xs);
  min-height: 28px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.input-group__label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-secondary);
}

.input-group__error {
  font-size: var(--text-2xs);
  color: var(--status-danger);
}


/* ========================
   3. Select (.select)
   ======================== */
.select {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-8) var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--input-text);
  background: var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right var(--sp-2) center;
  background-size: 16px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  appearance: none;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.select:hover:not(:disabled) { border-color: var(--slate-400); }
.select:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-ring);
}
.select:disabled {
  background-color: var(--input-disabled-bg);
  cursor: not-allowed;
  opacity: 0.7;
}

.select--sm {
  padding: var(--sp-1) var(--sp-7) var(--sp-1) var(--sp-2);
  font-size: var(--text-xs);
  min-height: 28px;
}


/* ========================
   4. Textarea (.textarea)
   ======================== */
.textarea {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  resize: vertical;
  min-height: 80px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.textarea::placeholder { color: var(--input-placeholder); }
.textarea:hover:not(:disabled) { border-color: var(--slate-400); }
.textarea:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-ring);
}
.textarea--auto-grow {
  resize: none;
  overflow: hidden;
}


/* ========================
   5. DataTable (.dt)
   ======================== */
.table-wrap {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dt { width: 100%; border-collapse: collapse; }

.dt__head {
  background: var(--table-header-bg, var(--surface-high));
}

.dt__th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-light);
  user-select: none;
}

.dt__th--number { text-align: right; }
.dt__th--center { text-align: center; }
.dt__th--check { width: 40px; text-align: center; }

.dt__th--sortable {
  cursor: pointer;
  transition: color 150ms ease;
}
.dt__th--sortable:hover { color: var(--ink); }

.dt__sort-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-left: var(--sp-1);
  opacity: 0.4;
}

.dt__th--sorted-asc .dt__sort-icon,
.dt__th--sorted-desc .dt__sort-icon {
  opacity: 1;
  color: var(--brand);
}

.dt__row {
  border-bottom: 1px solid var(--surface);
  transition: background 150ms ease;
  cursor: pointer;
}

.dt__row:hover { background: var(--slate-50); }
.dt__row--selected { background: var(--brand-50); }

.dt__td {
  padding: 14px var(--sp-4);
  font-size: var(--text-sm);
  color: var(--ink);
  vertical-align: middle;
  line-height: 1.4;
}

.dt__td--number { text-align: right; font-variant-numeric: tabular-nums; }
.dt__td--center { text-align: center; }
.dt__td--muted { color: var(--ink-secondary); }

.dt__link {
  color: var(--brand);
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease;
}
.dt__link:hover { color: var(--brand-hover); text-decoration: underline; }

.dt__check,
.dt__check-all {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.dt__progress {
  width: 100%;
  max-width: 120px;
  height: 6px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.dt__progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-pill);
  transition: width 300ms ease;
}

.dt__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line-light);
}

.dt__count {
  font-size: var(--text-xs);
  color: var(--ink-secondary);
}

.dt__pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.dt__page-btn {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  transition: background 150ms ease, color 150ms ease;
}
.dt__page-btn:hover { background: var(--surface); color: var(--ink); }
.dt__page-btn--active {
  background: var(--brand);
  color: #fff;
}
.dt__page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Bulk action bar */
.dt__bulk {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--brand-50);
  border-bottom: 1px solid var(--brand-100);
}

.dt__bulk-count {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--brand);
}


/* ========================
   6. Card (.card)
   ======================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: var(--sp-6);
  transition: box-shadow 200ms ease;
}

.card:hover { box-shadow: var(--card-shadow-hover); }

.card--kpi {
  position: relative;
  overflow: hidden;
}

.card--kpi .card__icon {
  position: absolute;
  bottom: var(--sp-3);
  right: var(--sp-4);
  width: 48px;
  height: 48px;
  opacity: 0.08;
  color: var(--brand);
}

.card--kpi .card__icon svg {
  width: 48px;
  height: 48px;
}

.card__eyebrow {
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.card__value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.card__delta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-2xs);
  font-weight: 600;
  margin-top: var(--sp-1);
}

.card__delta--up { color: var(--status-ok); }
.card__delta--down { color: var(--status-danger); }

.card__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}

.card__desc {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.6;
}


/* ========================
   7. Badge/Tag (.badge)
   ======================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px 10px;
  font-size: var(--text-2xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1;
}

.badge--success {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}
.badge--danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}
.badge--warning {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}
.badge--info {
  background: var(--status-info-bg);
  color: var(--status-info);
}
.badge--neutral {
  background: var(--surface);
  color: var(--ink-secondary);
}

.badge--grade-a { background: #ECFDF5; color: #047857; }
.badge--grade-b { background: #EFF6FF; color: #2563EB; }
.badge--grade-c { background: #FFFBEB; color: #D97706; }
.badge--grade-d { background: #FEF2F2; color: #DC2626; }

.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: currentColor;
}


/* ========================
   8. Modal (.modal)
   ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--sp-8);
}

.modal {
  background: var(--surface-raised);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal--sm { max-width: 400px; }
.modal--md { max-width: 560px; }
.modal--lg { max-width: 720px; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line-light);
  flex-shrink: 0;
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
}

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

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-light);
  flex-shrink: 0;
}


/* ========================
   9. SlideOver (.slide-over)
   ======================== */
.slide-over-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: var(--z-drawer);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.slide-over-backdrop--open {
  opacity: 1;
  pointer-events: auto;
}

.slide-over {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background: var(--surface-raised);
  border-left: 1px solid var(--line-light);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  z-index: var(--z-drawer);
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-over--open { transform: translateX(0); }
.slide-over--360 { width: 360px; }
.slide-over--480 { width: 480px; }
.slide-over--540 { width: 540px; }

.slide-over__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line-light);
  flex-shrink: 0;
}

.slide-over__eyebrow {
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.slide-over__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  margin-top: var(--sp-1);
}

.slide-over__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: background 150ms ease, color 150ms ease;
  flex-shrink: 0;
}
.slide-over__close:hover {
  background: var(--surface);
  color: var(--ink);
}

.slide-over__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
}

.slide-over__footer {
  flex-shrink: 0;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-light);
}


/* ========================
   10. Toast/Alert (.toast)
   ======================== */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--brand);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-in 300ms ease forwards;
}

.toast--success { border-left-color: var(--status-ok); }
.toast--error   { border-left-color: var(--status-danger); }
.toast--warning { border-left-color: var(--status-warn); }
.toast--info    { border-left-color: var(--status-info); }

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast__icon svg { width: 20px; height: 20px; }

.toast--success .toast__icon { color: var(--status-ok); }
.toast--error   .toast__icon { color: var(--status-danger); }
.toast--warning .toast__icon { color: var(--status-warn); }
.toast--info    .toast__icon { color: var(--status-info); }

.toast__content { flex: 1; }

.toast__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.toast__message {
  font-size: var(--text-xs);
  color: var(--ink-secondary);
  margin-top: 2px;
}

.toast__close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: background 150ms ease;
}
.toast__close:hover { background: var(--surface); }

.toast--exiting { animation: toast-out 300ms ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}


/* ========================
   11. Tabs (.tabs)
   ======================== */
.tabs {
  display: flex;
  gap: var(--sp-6);
  border-bottom: 1px solid var(--line-light);
  margin-bottom: var(--sp-4);
}

.tabs__item {
  padding: var(--sp-2) 0;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-secondary);
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
  margin-bottom: -1px;
}

.tabs__item:hover {
  color: var(--ink);
  border-bottom-color: var(--slate-300);
}

.tabs__item--active {
  color: var(--brand);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

/* Pill tabs variant */
.tabs--pill {
  border-bottom: none;
  gap: var(--sp-1);
  background: var(--surface);
  padding: var(--sp-1);
  border-radius: var(--radius-md);
  width: fit-content;
}

.tabs--pill .tabs__item {
  border-bottom: none;
  padding: var(--sp-1_5) var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
}

.tabs--pill .tabs__item--active {
  background: var(--surface-raised);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}


/* ========================
   12. Breadcrumb (.breadcrumb)
   ======================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.breadcrumb__item {
  color: var(--ink-secondary);
  transition: color 150ms ease;
}

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

.breadcrumb__sep {
  color: var(--muted);
  font-size: var(--text-2xs);
}

.breadcrumb__item--current {
  color: var(--ink);
  font-weight: 500;
}


/* ========================
   13. Loading Skeleton (.skeleton)
   ======================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-mid) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton--line {
  height: 14px;
  width: 100%;
  margin-bottom: var(--sp-2);
}

.skeleton--line:last-child { width: 60%; }

.skeleton--card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton--table-row {
  height: 48px;
  margin-bottom: var(--sp-1);
}

.skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ========================
   14. Empty State (.empty-state)
   ======================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-8);
  text-align: center;
}

/* td에 .empty-state 직접 적용 시 colspan 깨짐 방지 */
td.empty-state {
  display: table-cell;
  padding: 3rem 1rem;
  color: var(--ink-secondary);
  font-size: var(--text-sm);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--muted);
  margin-bottom: var(--sp-4);
  opacity: 0.6;
}

.empty-state__icon svg {
  width: 48px;
  height: 48px;
}

.empty-state__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}

.empty-state__desc {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  max-width: 360px;
  margin-bottom: var(--sp-4);
}


/* ========================
   15. Dropdown/Popover (.dropdown)
   ======================== */
.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--sp-1);
  background: var(--surface-raised);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: var(--z-dropdown);
  padding: var(--sp-1);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.dropdown--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: background 150ms ease;
  width: 100%;
  text-align: left;
}

.dropdown__item:hover { background: var(--surface); }

.dropdown__item--danger { color: var(--status-danger); }
.dropdown__item--danger:hover { background: var(--status-danger-bg); }

.dropdown__item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--ink-secondary);
}

.dropdown__divider {
  height: 1px;
  background: var(--line-light);
  margin: var(--sp-1) 0;
}

/* Notification dropdown */
.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--sp-2);
  background: var(--surface-raised);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-height: 400px;
  z-index: var(--z-dropdown);
  overflow: hidden;
}

.notif-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line-light);
  font-size: var(--text-sm);
}

.notif-dropdown__list {
  overflow-y: auto;
  max-height: 340px;
}

.notif-empty {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--muted);
}


/* ========================
   Flash messages (.flash)
   ======================== */
.flash {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
}

.flash--notice {
  background: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid var(--status-info-border);
}

.flash--error {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid var(--status-danger-border);
}

.flash--success {
  background: var(--status-ok-bg);
  color: var(--status-ok);
  border: 1px solid var(--status-ok-border);
}


/* ========================
   Command Palette
   ======================== */
.cmd-palette__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.cmd-palette__content {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  z-index: var(--z-modal);
}

.cmd-palette__content input {
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-base);
  border: none;
  border-bottom: 1px solid var(--line-light);
  background: transparent;
}

.cmd-palette__content input:focus { outline: none; }

.cmd-palette__results {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--sp-1);
}

.cmd-palette__hint {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--line-light);
  font-size: var(--text-2xs);
  color: var(--muted);
}

.cmd-palette__hint kbd {
  padding: 1px 4px;
  background: var(--surface);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] .badge--grade-a { background: rgba(5, 150, 105, 0.2); color: #4ade80; }
[data-theme="dark"] .badge--grade-b { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
[data-theme="dark"] .badge--grade-c { background: rgba(217, 119, 6, 0.2); color: #fdba74; }
[data-theme="dark"] .badge--grade-d { background: rgba(220, 38, 38, 0.2); color: #fca5a5; }
