/*!
 * E-Office Design System Foundation
 * Spec: docs/superpowers/specs/2026-05-25-design-system-foundation.md
 * Scope: body.eo-ds opt-in
 */

/* === 1. TOKENS ============================================================= */
:root {
  /* Brand: Mandiri navy + gold */
  --eo-primary:        #003D7A;
  --eo-primary-700:    #002a55;
  --eo-primary-900:    #001F4D;
  --eo-primary-50:     #E8F0F8;
  --eo-primary-100:    #D1E5F5;
  --eo-accent:         #FFAB00;
  --eo-accent-600:     #E69500;
  --eo-accent-50:      #fff7e0;

  /* Semantic */
  --eo-success:        #10b981;
  --eo-success-700:    #047857;
  --eo-success-50:     #ecfdf5;
  --eo-warning:        #d97706;
  --eo-warning-700:    #9a3412;
  --eo-warning-50:     #fff7ed;
  --eo-warning-200:    #fde68a;
  --eo-warning-900:    #5c3b08;
  --eo-danger:         #dc2626;
  --eo-danger-700:     #991b1b;
  --eo-danger-50:      #fef2f2;
  --eo-info:           #0891b2;
  --eo-info-700:       #0e7490;
  --eo-info-50:        #ecfeff;
  --eo-info-200:       #b8dff5;
  --eo-info-900:       #073359;

  /* Neutral (slate) */
  --eo-text:           #0f172a;
  --eo-text-muted:     #6b7280;
  --eo-text-soft:      #9ca3af;
  --eo-border:         #e5e7eb;
  --eo-border-soft:    #f1f5f9;
  --eo-bg:             #f6f8fb;
  --eo-surface:        #ffffff;
  --eo-surface-alt:    #f9fafb;

  /* Typography */
  --eo-font-serif: Georgia, 'Times New Roman', 'Liberation Serif', serif;
  --eo-font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                   'Helvetica Neue', Arial, sans-serif;
  --eo-font-mono:  ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --eo-fs-xs:   11px;
  --eo-fs-sm:   12px;
  --eo-fs-base: 13.5px;
  --eo-fs-md:   15px;
  --eo-fs-lg:   17px;
  --eo-fs-xl:   20px;
  --eo-fs-2xl:  24px;
  --eo-fs-3xl:  28px;

  --eo-lh-tight:   1.3;
  --eo-lh-base:    1.55;
  --eo-lh-relaxed: 1.7;

  /* Spacing */
  --eo-space-1: 4px;  --eo-space-2: 8px;  --eo-space-3: 12px;
  --eo-space-4: 16px; --eo-space-5: 20px; --eo-space-6: 24px;
  --eo-space-8: 32px; --eo-space-10: 40px; --eo-space-12: 48px;

  /* Radius */
  --eo-radius-sm:   4px;
  --eo-radius-md:   6px;
  --eo-radius-lg:   10px;
  --eo-radius-pill: 999px;

  /* Shadow */
  --eo-shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.05);
  --eo-shadow-md:    0 2px 6px rgba(15, 23, 42, 0.08);
  --eo-shadow-lg:    0 8px 24px rgba(0, 31, 77, 0.18);
  --eo-shadow-focus: 0 0 0 3px rgba(0, 61, 122, 0.18);

  /* Motion */
  --eo-ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --eo-dur-fast: 120ms;
  --eo-dur-base: 180ms;
  --eo-dur-slow: 280ms;
}

/* === 2. RESET + BASE ======================================================= */
body.eo-ds {
  background: var(--eo-bg);
  color: var(--eo-text);
  font-family: var(--eo-font-sans);
  font-size: var(--eo-fs-base);
  line-height: var(--eo-lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.eo-ds *,
body.eo-ds *::before,
body.eo-ds *::after { box-sizing: border-box; }

body.eo-ds h1, body.eo-ds h2, body.eo-ds h3 {
  font-family: var(--eo-font-serif);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--eo-text);
  margin: 0 0 var(--eo-space-3) 0;
}
body.eo-ds h4, body.eo-ds h5, body.eo-ds h6 {
  font-family: var(--eo-font-sans);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--eo-text);
  margin: 0 0 var(--eo-space-2) 0;
}
body.eo-ds h1 { font-size: var(--eo-fs-3xl); line-height: var(--eo-lh-tight); }
body.eo-ds h2 { font-size: var(--eo-fs-2xl); line-height: var(--eo-lh-tight); }
body.eo-ds h3 { font-size: var(--eo-fs-xl);  line-height: var(--eo-lh-tight); }
body.eo-ds h4 { font-size: var(--eo-fs-lg);  line-height: var(--eo-lh-base); }
body.eo-ds h5 { font-size: var(--eo-fs-md);  line-height: var(--eo-lh-base); }
body.eo-ds h6 { font-size: var(--eo-fs-base); line-height: var(--eo-lh-base); text-transform: uppercase; letter-spacing: 0.06em; color: var(--eo-text-muted); }

body.eo-ds .eo-h1-anchor::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--eo-accent);
  margin-top: var(--eo-space-2);
}

body.eo-ds a { color: var(--eo-primary); text-decoration: none; }
body.eo-ds a:hover { color: var(--eo-primary-700); text-decoration: underline; }
body.eo-ds :focus-visible { outline: none; box-shadow: var(--eo-shadow-focus); }

/* === 3. UTILITIES ========================================================== */
body.eo-ds .eo-text-muted   { color: var(--eo-text-muted); }
body.eo-ds .eo-text-soft    { color: var(--eo-text-soft); }
body.eo-ds .eo-text-mono    { font-family: var(--eo-font-mono); font-size: var(--eo-fs-sm); }
body.eo-ds .eo-text-danger  { color: var(--eo-danger); }
body.eo-ds .eo-text-success { color: var(--eo-success); }
body.eo-ds .eo-text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

body.eo-ds .eo-divider {
  height: 1px; background: var(--eo-border); margin: var(--eo-space-4) 0; border: 0;
}
body.eo-ds .eo-divider-soft {
  height: 1px; background: var(--eo-border-soft); margin: var(--eo-space-3) 0; border: 0;
}

body.eo-ds .eo-gap-1 { gap: var(--eo-space-1); }
body.eo-ds .eo-gap-2 { gap: var(--eo-space-2); }
body.eo-ds .eo-gap-3 { gap: var(--eo-space-3); }
body.eo-ds .eo-gap-4 { gap: var(--eo-space-4); }
body.eo-ds .eo-gap-6 { gap: var(--eo-space-6); }

body.eo-ds .eo-pad-1 { padding: var(--eo-space-1); }
body.eo-ds .eo-pad-2 { padding: var(--eo-space-2); }
body.eo-ds .eo-pad-3 { padding: var(--eo-space-3); }
body.eo-ds .eo-pad-4 { padding: var(--eo-space-4); }
body.eo-ds .eo-pad-6 { padding: var(--eo-space-6); }

body.eo-ds .eo-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

@media print {
  body.eo-ds .eo-no-print { display: none !important; }
}

/* === 4. ATOMS ============================================================== */

/* --- Button --- */
body.eo-ds .eo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--eo-space-2);
  padding: 8px 14px;
  font-family: var(--eo-font-sans);
  font-size: var(--eo-fs-base);
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--eo-radius-md);
  cursor: pointer;
  transition: background var(--eo-dur-fast) var(--eo-ease),
              border-color var(--eo-dur-fast) var(--eo-ease),
              color var(--eo-dur-fast) var(--eo-ease),
              box-shadow var(--eo-dur-fast) var(--eo-ease);
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}
body.eo-ds .eo-btn:focus-visible { box-shadow: var(--eo-shadow-focus); }
body.eo-ds .eo-btn:disabled,
body.eo-ds .eo-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variants */
body.eo-ds .eo-btn-primary {
  background: linear-gradient(180deg, var(--eo-primary) 0%, var(--eo-primary-700) 100%);
  color: #ffffff;
  border-color: var(--eo-primary-700);
}
body.eo-ds .eo-btn-primary:hover { background: var(--eo-primary-700); color: #ffffff; text-decoration: none; }

body.eo-ds .eo-btn-secondary {
  background: var(--eo-surface);
  color: var(--eo-text);
  border-color: var(--eo-border);
}
body.eo-ds .eo-btn-secondary:hover { background: var(--eo-surface-alt); border-color: var(--eo-text-soft); color: var(--eo-text); text-decoration: none; }

body.eo-ds .eo-btn-ghost {
  background: transparent;
  color: var(--eo-primary);
  border-color: transparent;
}
body.eo-ds .eo-btn-ghost:hover { background: var(--eo-primary-50); color: var(--eo-primary-700); text-decoration: none; }

body.eo-ds .eo-btn-danger {
  background: var(--eo-danger);
  color: #ffffff;
  border-color: var(--eo-danger-700);
}
body.eo-ds .eo-btn-danger:hover { background: var(--eo-danger-700); color: #ffffff; text-decoration: none; }

/* Sizes */
body.eo-ds .eo-btn-sm { padding: 5px 10px; font-size: var(--eo-fs-sm); }
body.eo-ds .eo-btn-lg { padding: 11px 18px; font-size: var(--eo-fs-md); }

/* Icon-only */
body.eo-ds .eo-btn-icon-only {
  padding: 8px;
  width: 34px;
  height: 34px;
}
body.eo-ds .eo-btn-icon-only.eo-btn-sm { width: 28px; height: 28px; padding: 6px; }
body.eo-ds .eo-btn-icon-only.eo-btn-lg { width: 40px; height: 40px; padding: 10px; }

/* Loading state */
body.eo-ds .eo-btn.is-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
body.eo-ds .eo-btn.is-loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: eo-spin 700ms linear infinite;
  color: #ffffff;
  top: 50%; left: 50%;
  margin-top: -7px; margin-left: -7px;
}
body.eo-ds .eo-btn-secondary.is-loading::after,
body.eo-ds .eo-btn-ghost.is-loading::after { color: var(--eo-primary); }

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

/* --- Input / Select / Textarea --- */
body.eo-ds .eo-input,
body.eo-ds .eo-select,
body.eo-ds .eo-textarea {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-family: var(--eo-font-sans);
  font-size: var(--eo-fs-base);
  line-height: var(--eo-lh-base);
  color: var(--eo-text);
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-md);
  transition: border-color var(--eo-dur-fast) var(--eo-ease),
              box-shadow var(--eo-dur-fast) var(--eo-ease);
}
body.eo-ds .eo-input:focus,
body.eo-ds .eo-select:focus,
body.eo-ds .eo-textarea:focus {
  outline: none;
  border-color: var(--eo-primary);
  box-shadow: var(--eo-shadow-focus);
}
body.eo-ds .eo-input:disabled,
body.eo-ds .eo-select:disabled,
body.eo-ds .eo-textarea:disabled {
  background: var(--eo-surface-alt);
  color: var(--eo-text-soft);
  cursor: not-allowed;
}
body.eo-ds .eo-input::placeholder,
body.eo-ds .eo-textarea::placeholder { color: var(--eo-text-soft); }

body.eo-ds .eo-textarea { min-height: 96px; resize: vertical; }

body.eo-ds .eo-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Prefix-icon wrapper */
body.eo-ds .eo-input-prefix {
  position: relative;
  display: block;
}
body.eo-ds .eo-input-prefix > svg,
body.eo-ds .eo-input-prefix > i[data-lucide] {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--eo-text-muted);
  pointer-events: none;
}
body.eo-ds .eo-input-prefix > .eo-input { padding-left: 34px; }

/* Error state */
body.eo-ds .eo-input.is-error,
body.eo-ds .eo-select.is-error,
body.eo-ds .eo-textarea.is-error {
  border-color: var(--eo-danger);
}
body.eo-ds .eo-input.is-error:focus,
body.eo-ds .eo-select.is-error:focus,
body.eo-ds .eo-textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}
body.eo-ds .eo-field-error {
  display: block;
  margin-top: var(--eo-space-1);
  color: var(--eo-danger);
  font-size: var(--eo-fs-sm);
}

/* --- Checkbox / Radio --- */
body.eo-ds .eo-checkbox,
body.eo-ds .eo-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--eo-space-2);
  cursor: pointer;
  user-select: none;
  font-size: var(--eo-fs-base);
  color: var(--eo-text);
}
body.eo-ds .eo-checkbox input[type="checkbox"],
body.eo-ds .eo-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--eo-border);
  background: var(--eo-surface);
  cursor: pointer;
  position: relative;
  transition: border-color var(--eo-dur-fast) var(--eo-ease),
              background var(--eo-dur-fast) var(--eo-ease);
  flex-shrink: 0;
}
body.eo-ds .eo-checkbox input[type="checkbox"] { border-radius: var(--eo-radius-sm); }
body.eo-ds .eo-radio input[type="radio"]       { border-radius: 50%; }

body.eo-ds .eo-checkbox input[type="checkbox"]:checked,
body.eo-ds .eo-radio input[type="radio"]:checked {
  background: var(--eo-primary);
  border-color: var(--eo-primary);
}
body.eo-ds .eo-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 4px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
body.eo-ds .eo-radio input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
}
body.eo-ds .eo-checkbox input:focus-visible,
body.eo-ds .eo-radio input:focus-visible { box-shadow: var(--eo-shadow-focus); }

/* --- Switch (pill toggle) --- */
body.eo-ds .eo-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--eo-space-2);
  cursor: pointer;
  user-select: none;
}
body.eo-ds .eo-switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 20px;
  background: var(--eo-border);
  border-radius: var(--eo-radius-pill);
  position: relative;
  cursor: pointer;
  transition: background var(--eo-dur-base) var(--eo-ease);
  margin: 0;
  flex-shrink: 0;
}
body.eo-ds .eo-switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--eo-dur-base) var(--eo-ease);
  box-shadow: var(--eo-shadow-sm);
}
body.eo-ds .eo-switch input[type="checkbox"]:checked {
  background: var(--eo-primary);
}
body.eo-ds .eo-switch input[type="checkbox"]:checked::after {
  transform: translateX(14px);
}
body.eo-ds .eo-switch input:focus-visible { box-shadow: var(--eo-shadow-focus); }

/* --- Badge / Chip --- */
body.eo-ds .eo-badge,
body.eo-ds .eo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: var(--eo-font-sans);
  font-size: var(--eo-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
  background: var(--eo-surface);
  color: var(--eo-text);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm);
  white-space: nowrap;
}
body.eo-ds .eo-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--eo-text-soft);
  flex-shrink: 0;
}

/* Status variants — dot color drives the visual */
body.eo-ds .eo-badge-draft::before     { background: var(--eo-text-soft); }
body.eo-ds .eo-badge-intake::before    { background: var(--eo-info); }
body.eo-ds .eo-badge-review::before    { background: var(--eo-warning); }
body.eo-ds .eo-badge-approved::before  { background: var(--eo-success); }
body.eo-ds .eo-badge-progress::before  { background: var(--eo-primary); }
body.eo-ds .eo-badge-completed::before { background: var(--eo-success-700); }
body.eo-ds .eo-badge-rejected::before  { background: var(--eo-danger); }
body.eo-ds .eo-badge-revision::before  { background: var(--eo-warning-700); }
body.eo-ds .eo-badge-archived::before  { background: var(--eo-text-muted); }

/* Priority variants */
body.eo-ds .eo-badge-normal::before    { background: var(--eo-text-muted); }
body.eo-ds .eo-badge-personal::before  { background: var(--eo-info); }
body.eo-ds .eo-badge-rahasia {
  background: var(--eo-warning-50);
  border-color: var(--eo-warning);
  color: var(--eo-warning-700);
}
body.eo-ds .eo-badge-rahasia::before { background: var(--eo-warning); }

/* URGENT — red-fill exception */
body.eo-ds .eo-badge-urgent {
  background: var(--eo-danger-50);
  border-color: var(--eo-danger);
  color: var(--eo-danger-700);
}
body.eo-ds .eo-badge-urgent::before { display: none; }

/* Chip = badge + dismiss button + hover lift */
body.eo-ds .eo-chip {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  padding: 4px 10px;
  font-size: var(--eo-fs-sm);
  transition: box-shadow var(--eo-dur-fast) var(--eo-ease);
}
body.eo-ds .eo-chip:hover { box-shadow: var(--eo-shadow-sm); }
body.eo-ds .eo-chip-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  margin-left: 4px;
  border: 0;
  background: transparent;
  color: var(--eo-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
body.eo-ds .eo-chip-close:hover { background: var(--eo-border); color: var(--eo-text); }

/* === 5. MOLECULES ========================================================== */

/* --- Card --- */
body.eo-ds .eo-card {
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-lg);
  box-shadow: var(--eo-shadow-sm);
  overflow: hidden;
}
body.eo-ds .eo-card-header {
  padding: var(--eo-space-4) var(--eo-space-5);
  border-bottom: 1px solid var(--eo-border);
  background: var(--eo-surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--eo-space-3);
}
body.eo-ds .eo-card-header h3,
body.eo-ds .eo-card-header h4 { margin: 0; }
body.eo-ds .eo-card-title {
  margin: 0;
  font-size: var(--eo-fs-lg);
  font-weight: 600;
  color: var(--eo-text);
  line-height: 1.3;
}
body.eo-ds .eo-card-body   { padding: var(--eo-space-5); }
body.eo-ds .eo-card-footer {
  padding: var(--eo-space-3) var(--eo-space-5);
  border-top: 1px solid var(--eo-border);
  background: var(--eo-surface-alt);
  display: flex;
  gap: var(--eo-space-2);
  justify-content: flex-end;
}

/* --- Section (page-level grouping) --- */
body.eo-ds .eo-section {
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-lg);
  margin-bottom: var(--eo-space-5);
}
body.eo-ds .eo-section-header {
  display: flex;
  align-items: center;
  gap: var(--eo-space-3);
  padding: var(--eo-space-4) var(--eo-space-5);
  border-bottom: 1px solid var(--eo-border);
}
body.eo-ds .eo-section-header h2,
body.eo-ds .eo-section-header h3 { margin: 0; flex: 1; }
body.eo-ds .eo-section-hint {
  color: var(--eo-text-muted);
  font-size: var(--eo-fs-sm);
  font-weight: 400;
}
body.eo-ds .eo-section-body { padding: 18px var(--eo-space-5); }

/* --- Action Card (clickable card with chevron) --- */
body.eo-ds .eo-action-card {
  display: flex;
  align-items: center;
  gap: var(--eo-space-4);
  padding: var(--eo-space-4);
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-lg);
  color: var(--eo-text);
  text-decoration: none;
  transition: border-color var(--eo-dur-fast) var(--eo-ease),
              box-shadow var(--eo-dur-fast) var(--eo-ease),
              transform var(--eo-dur-fast) var(--eo-ease);
  cursor: pointer;
}
body.eo-ds .eo-action-card:hover {
  border-color: var(--eo-primary);
  box-shadow: var(--eo-shadow-md);
  text-decoration: none;
  color: var(--eo-text);
}
body.eo-ds .eo-action-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--eo-radius-md);
  background: var(--eo-primary-50);
  color: var(--eo-primary);
  flex-shrink: 0;
}
body.eo-ds .eo-action-card-body { flex: 1; min-width: 0; }
body.eo-ds .eo-action-card-title {
  font-weight: 600;
  color: var(--eo-text);
  margin: 0 0 2px 0;
}
body.eo-ds .eo-action-card-desc {
  color: var(--eo-text-muted);
  font-size: var(--eo-fs-sm);
  margin: 0;
}
body.eo-ds .eo-action-card-arrow {
  color: var(--eo-text-soft);
  flex-shrink: 0;
}

/* --- Alert --- */
body.eo-ds .eo-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--eo-space-3);
  padding: var(--eo-space-3) var(--eo-space-4);
  border-radius: var(--eo-radius-md);
  border: 1px solid transparent;
  font-size: var(--eo-fs-base);
}
body.eo-ds .eo-alert-icon { flex-shrink: 0; margin-top: 2px; }
body.eo-ds .eo-alert-body { flex: 1; }
body.eo-ds .eo-alert-title { font-weight: 600; margin: 0 0 2px 0; }
body.eo-ds .eo-alert-dismiss {
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  margin-left: var(--eo-space-2);
}
body.eo-ds .eo-alert-dismiss:hover { opacity: 1; }

body.eo-ds .eo-alert-info    { background: var(--eo-info-50);    border-color: var(--eo-info);    color: var(--eo-info-700); }
body.eo-ds .eo-alert-success { background: var(--eo-success-50); border-color: var(--eo-success); color: var(--eo-success-700); }
body.eo-ds .eo-alert-warning { background: var(--eo-warning-50); border-color: var(--eo-warning); color: var(--eo-warning-700); }
body.eo-ds .eo-alert-danger  { background: var(--eo-danger-50);  border-color: var(--eo-danger);  color: var(--eo-danger-700); }

/* --- Empty State --- */
body.eo-ds .eo-empty {
  text-align: center;
  padding: var(--eo-space-10) var(--eo-space-5);
  color: var(--eo-text-muted);
}
body.eo-ds .eo-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--eo-surface-alt);
  color: var(--eo-text-soft);
  margin-bottom: var(--eo-space-3);
}
body.eo-ds .eo-empty-title {
  color: var(--eo-text);
  font-weight: 600;
  margin: 0 0 var(--eo-space-1) 0;
}
body.eo-ds .eo-empty-body {
  font-size: var(--eo-fs-sm);
  margin: 0 0 var(--eo-space-4) 0;
}

/* --- Skeleton --- */
body.eo-ds .eo-skeleton {
  display: block;
  background: linear-gradient(90deg, var(--eo-border-soft) 0%, var(--eo-border) 50%, var(--eo-border-soft) 100%);
  background-size: 200% 100%;
  border-radius: var(--eo-radius-sm);
  animation: eo-shimmer 1400ms linear infinite;
}
body.eo-ds .eo-skeleton-text   { height: 12px; width: 100%; margin: 4px 0; }
body.eo-ds .eo-skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; }
body.eo-ds .eo-skeleton-rect   { width: 100%; height: 60px; border-radius: var(--eo-radius-md); }

@keyframes eo-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Form Group --- */
body.eo-ds .eo-field {
  display: block;
  margin-bottom: var(--eo-space-4);
}
body.eo-ds .eo-field-label {
  display: block;
  font-size: var(--eo-fs-sm);
  font-weight: 600;
  color: var(--eo-text);
  margin-bottom: 6px;
}
body.eo-ds .eo-field-label .eo-required {
  color: var(--eo-danger);
  margin-left: 2px;
}
body.eo-ds .eo-field-hint {
  display: block;
  margin-top: var(--eo-space-1);
  color: var(--eo-text-muted);
  font-size: var(--eo-fs-sm);
}
body.eo-ds .eo-field.is-error .eo-input,
body.eo-ds .eo-field.is-error .eo-select,
body.eo-ds .eo-field.is-error .eo-textarea {
  border-color: var(--eo-danger);
}
body.eo-ds .eo-field.is-error .eo-field-label { color: var(--eo-danger-700); }
body.eo-ds .eo-field.is-error .eo-field-hint  { color: var(--eo-danger); }

/* === 6. ORGANISMS ========================================================== */

/* --- Table --- */
body.eo-ds .eo-table-wrap {
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-lg);
  overflow: hidden;
  box-shadow: var(--eo-shadow-sm);
}
body.eo-ds .eo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--eo-fs-base);
}
body.eo-ds .eo-table th,
body.eo-ds .eo-table td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--eo-border-soft);
}
body.eo-ds .eo-table thead th {
  background: var(--eo-surface-alt);
  color: var(--eo-text-muted);
  font-weight: 600;
  font-size: var(--eo-fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--eo-border);
  white-space: nowrap;
}
body.eo-ds .eo-table tbody tr { transition: background var(--eo-dur-fast) var(--eo-ease); }
body.eo-ds .eo-table tbody tr:hover { background: var(--eo-surface-alt); }
body.eo-ds .eo-table tbody tr:last-child td { border-bottom: 0; }

/* Sortable column header */
body.eo-ds .eo-th-sortable {
  cursor: pointer;
  user-select: none;
}
body.eo-ds .eo-th-sortable::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid var(--eo-text-soft);
  vertical-align: middle;
  opacity: 0.5;
}
body.eo-ds .eo-th-sortable.is-asc::after  { border-bottom-color: var(--eo-primary); opacity: 1; }
body.eo-ds .eo-th-sortable.is-desc::after {
  border-bottom: 0;
  border-top: 4px solid var(--eo-primary);
  opacity: 1;
}

/* Dense variant */
body.eo-ds .eo-table-dense th,
body.eo-ds .eo-table-dense td { padding: 6px 10px; font-size: var(--eo-fs-sm); }

/* Empty state row */
body.eo-ds .eo-table-empty {
  padding: var(--eo-space-8) var(--eo-space-4);
  text-align: center;
  color: var(--eo-text-muted);
}

/* --- Modal --- */
body.eo-ds .eo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1040;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--eo-space-4);
}
body.eo-ds .eo-modal-overlay.is-open { display: flex; }

body.eo-ds .eo-modal {
  background: var(--eo-surface);
  border-radius: var(--eo-radius-lg);
  box-shadow: var(--eo-shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: eo-modal-in var(--eo-dur-base) var(--eo-ease);
}
body.eo-ds .eo-modal-sm { max-width: 400px; }
body.eo-ds .eo-modal-lg { max-width: 760px; }
body.eo-ds .eo-modal-xl { max-width: 980px; }

body.eo-ds .eo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--eo-space-3);
  padding: var(--eo-space-4) var(--eo-space-5);
  border-bottom: 1px solid var(--eo-border);
}
body.eo-ds .eo-modal-header h2,
body.eo-ds .eo-modal-header h3 { margin: 0; flex: 1; }
body.eo-ds .eo-modal-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--eo-text-muted);
  padding: 4px;
  border-radius: var(--eo-radius-sm);
}
body.eo-ds .eo-modal-close:hover { background: var(--eo-surface-alt); color: var(--eo-text); }
body.eo-ds .eo-modal-body {
  padding: var(--eo-space-5);
  overflow-y: auto;
  flex: 1;
}
body.eo-ds .eo-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--eo-space-2);
  padding: var(--eo-space-3) var(--eo-space-5);
  border-top: 1px solid var(--eo-border);
  background: var(--eo-surface-alt);
}

@keyframes eo-modal-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Drawer --- */
body.eo-ds .eo-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1050;
  display: none;
}
body.eo-ds .eo-drawer-overlay.is-open { display: block; }
body.eo-ds .eo-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--eo-surface);
  box-shadow: var(--eo-shadow-lg);
  display: flex;
  flex-direction: column;
  animation: eo-drawer-in var(--eo-dur-base) var(--eo-ease);
}
body.eo-ds .eo-drawer-left .eo-drawer {
  right: auto;
  left: 0;
  animation: eo-drawer-in-left var(--eo-dur-base) var(--eo-ease);
}
body.eo-ds .eo-drawer-header,
body.eo-ds .eo-drawer-footer {
  padding: var(--eo-space-4) var(--eo-space-5);
  border-bottom: 1px solid var(--eo-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
body.eo-ds .eo-drawer-footer { border-bottom: 0; border-top: 1px solid var(--eo-border); background: var(--eo-surface-alt); }
body.eo-ds .eo-drawer-body { padding: var(--eo-space-5); flex: 1; overflow-y: auto; }

@keyframes eo-drawer-in      { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes eo-drawer-in-left { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* --- Tabs --- */
body.eo-ds .eo-tabs {
  display: flex;
  gap: var(--eo-space-4);
  border-bottom: 1px solid var(--eo-border);
  margin-bottom: var(--eo-space-4);
}
body.eo-ds .eo-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--eo-space-2);
  padding: 10px 2px;
  font-size: var(--eo-fs-base);
  font-weight: 500;
  color: var(--eo-text-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--eo-dur-fast) var(--eo-ease),
              border-color var(--eo-dur-fast) var(--eo-ease);
}
body.eo-ds .eo-tab:hover { color: var(--eo-text); }
body.eo-ds .eo-tab.is-active {
  color: var(--eo-primary);
  border-bottom-color: var(--eo-primary);
  font-weight: 700;
}
body.eo-ds .eo-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: var(--eo-fs-xs);
  font-weight: 600;
  background: var(--eo-border-soft);
  color: var(--eo-text-muted);
  border-radius: var(--eo-radius-pill);
}
body.eo-ds .eo-tab.is-active .eo-tab-count { background: var(--eo-primary-50); color: var(--eo-primary); }

/* --- Breadcrumb --- */
body.eo-ds .eo-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--eo-space-1);
  font-size: var(--eo-fs-sm);
  color: var(--eo-text-muted);
  margin-bottom: var(--eo-space-3);
}
body.eo-ds .eo-breadcrumb a { color: var(--eo-text-muted); }
body.eo-ds .eo-breadcrumb a:hover { color: var(--eo-primary); }
body.eo-ds .eo-breadcrumb-sep {
  display: inline-block;
  margin: 0 4px;
  color: var(--eo-text-soft);
}
body.eo-ds .eo-breadcrumb-current { color: var(--eo-text); font-weight: 600; }

/* --- Pagination --- */
body.eo-ds .eo-pagination {
  display: inline-flex;
  align-items: center;
  gap: var(--eo-space-1);
  font-size: var(--eo-fs-sm);
}
body.eo-ds .eo-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm);
  color: var(--eo-text);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--eo-dur-fast) var(--eo-ease);
}
body.eo-ds .eo-page-btn:hover { background: var(--eo-surface-alt); text-decoration: none; color: var(--eo-text); }
body.eo-ds .eo-page-btn.is-active {
  background: var(--eo-primary);
  border-color: var(--eo-primary);
  color: #ffffff;
  font-weight: 600;
}
body.eo-ds .eo-page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
body.eo-ds .eo-page-ellipsis { padding: 0 4px; color: var(--eo-text-soft); }

/* === 7. LAYOUT ============================================================= */
body.eo-ds .eo-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 768px) {
  body.eo-ds .eo-page { padding: 0 14px; }
}

body.eo-ds .eo-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--eo-space-4);
  padding: var(--eo-space-6) 0 var(--eo-space-5);
  border-bottom: 1px solid var(--eo-border);
  margin-bottom: var(--eo-space-5);
}
body.eo-ds .eo-page-header-main { flex: 1; min-width: 0; }
body.eo-ds .eo-page-header h1 {
  margin: 0;
}
body.eo-ds .eo-page-header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--eo-space-2);
  flex-shrink: 0;
}
body.eo-ds .eo-page-header-stats {
  display: flex;
  gap: var(--eo-space-8);
  margin-top: var(--eo-space-4);
}
body.eo-ds .eo-stat-label { color: var(--eo-text-muted); font-size: var(--eo-fs-sm); }
body.eo-ds .eo-stat-value { color: var(--eo-text); font-size: var(--eo-fs-xl); font-weight: 700; margin-top: 2px; }

body.eo-ds .eo-stack    { display: flex; flex-direction: column; gap: var(--eo-space-4); }
body.eo-ds .eo-stack-sm { display: flex; flex-direction: column; gap: var(--eo-space-2); }
body.eo-ds .eo-stack-md { display: flex; flex-direction: column; gap: var(--eo-space-4); }
body.eo-ds .eo-stack-lg { display: flex; flex-direction: column; gap: var(--eo-space-6); }

body.eo-ds .eo-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--eo-space-2);
}

/* ================================================================
 * Wave 3c: Hero header atoms (promoted from letter-detail.css).
 * Shared by LetterDetail, LetterCreate, LetterIntake, LetterEdit.
 * --eo-cat-color is a per-category override set inline by the view.
 * ============================================================== */
body.eo-ds .eo-page-header.eo-detail-header {
  padding: var(--eo-space-5) var(--eo-space-5);
  gap: var(--eo-space-4);
  align-items: center;
}
body.eo-ds .eo-page-header.eo-detail-header .eo-page-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
body.eo-ds .eo-page-header.eo-detail-header .eo-h1-anchor {
  font-size: var(--eo-fs-2xl);
  margin-bottom: var(--eo-space-2);
}
body.eo-ds .eo-page-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--eo-space-2) var(--eo-space-3);
  align-items: center;
  font-size: var(--eo-fs-sm);
  color: var(--eo-text-muted);
}
body.eo-ds .eo-page-header-meta code {
  background: var(--eo-surface-alt);
  color: var(--eo-text);
  padding: 1px 6px;
  border-radius: var(--eo-radius-sm);
  font-size: var(--eo-fs-xs);
}
body.eo-ds .eo-detail-cat-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--eo-radius-lg);
  background: var(--eo-cat-color, var(--eo-primary));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}
body.eo-ds .eo-detail-cat-icon > i[data-lucide] {
  width: 32px;
  height: 32px;
}

/* Refined card frame (promoted from letter-detail.css §12.5). */
body.eo-ds .eo-card.eo-card-refined {
  background: var(--eo-surface);
  border: 1px solid var(--eo-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  margin-bottom: var(--eo-space-4);
}
body.eo-ds .eo-card-refined > .eo-card-header {
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
  border-bottom: 1px solid var(--eo-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: var(--eo-space-2);
}
body.eo-ds .eo-card-refined > .eo-card-header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--eo-text);
}
body.eo-ds .eo-card-refined > .eo-card-header > i[data-lucide],
body.eo-ds .eo-card-refined > .eo-card-header > svg {
  width: 16px;
  height: 16px;
  color: var(--eo-primary);
}
body.eo-ds .eo-card-refined > .eo-card-body {
  padding: 20px 24px;
}

@media (max-width: 768px) {
  body.eo-ds .eo-page-header.eo-detail-header {
    padding: var(--eo-space-3);
  }
  body.eo-ds .eo-detail-cat-icon {
    width: 48px;
    height: 48px;
  }
  body.eo-ds .eo-detail-cat-icon > i[data-lucide] {
    width: 24px;
    height: 24px;
  }
}
