/* KIABO Steep Design System — reference foundation */
:root {
  color-scheme: light;
  --ds-bg: #f4f5f2;
  --ds-surface: #ffffff;
  --ds-surface-subtle: #eef0ec;
  --ds-surface-elevated: #ffffff;
  --ds-border: #dde1db;
  --ds-border-strong: #c8cec6;
  --ds-text: #202722;
  --ds-text-secondary: #4f5b53;
  --ds-text-muted: #6c776f;
  --ds-primary: #a44f33;
  --ds-primary-hover: #884029;
  --ds-primary-soft: #f4e3da;
  --ds-apricot: #f6e7dc;
  --ds-sky: #e4eef1;
  --ds-success: #237a52;
  --ds-success-soft: #e2f1e8;
  --ds-warning: #966515;
  --ds-warning-soft: #f7edd5;
  --ds-danger: #b33a3a;
  --ds-danger-soft: #f8e3e1;
  --ds-info: #356e85;
  --ds-info-soft: #e2eef3;
  --ds-focus: rgba(164, 79, 51, 0.24);
  --ds-font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-font-display: Georgia, "Times New Roman", serif;
  --ds-font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ds-radius-sm: 8px;
  --ds-radius-md: 12px;
  --ds-radius-lg: 24px;
  --ds-radius-full: 999px;
  --ds-shadow-popover: 0 8px 24px rgba(32, 39, 34, 0.12);
  --ds-shadow-dialog: 0 24px 64px rgba(32, 39, 34, 0.2);
  --ds-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ds-sidebar-width: 240px;
  --ds-sidebar-collapsed: 72px;
  --ds-topbar-height: 64px;
  --ds-content-max: 1440px;
  --ds-z-dropdown: 30;
  --ds-z-sticky: 40;
  --ds-z-backdrop: 50;
  --ds-z-modal: 60;
  --ds-z-toast: 70;
  --ds-z-tooltip: 80;
}

.dark {
  color-scheme: dark;
  --ds-bg: #111512;
  --ds-surface: #181d19;
  --ds-surface-subtle: #202621;
  --ds-surface-elevated: #252c26;
  --ds-border: #303832;
  --ds-border-strong: #465047;
  --ds-text: #f4f6f2;
  --ds-text-secondary: #bec6bf;
  --ds-text-muted: #929d94;
  --ds-primary: #dd805e;
  --ds-primary-hover: #e89575;
  --ds-primary-soft: #3a2821;
  --ds-apricot: #392a23;
  --ds-sky: #1d2c31;
  --ds-success: #6bc49a;
  --ds-success-soft: #183226;
  --ds-warning: #e0b45e;
  --ds-warning-soft: #342b18;
  --ds-danger: #ec8681;
  --ds-danger-soft: #3a2020;
  --ds-info: #75b5cb;
  --ds-info-soft: #1b3037;
  --ds-focus: rgba(221, 128, 94, 0.28);
  --ds-shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.28);
  --ds-shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.42);
}

.ds-scope,
.ds-scope button,
.ds-scope input,
.ds-scope select,
.ds-scope textarea {
  font-family: var(--ds-font-ui);
}

.ds-scope {
  --color-ink: var(--ds-text);
  --color-pure-white: var(--ds-surface);
  --color-fog: var(--ds-bg);
  --color-ash: var(--ds-text-secondary);
  --color-graphite: var(--ds-text-muted);
  --color-dove: var(--ds-border);
  --color-slate: var(--ds-border-strong);
  --color-rust: var(--ds-primary);
  --color-rust-strong: var(--ds-primary-hover);
  --color-apricot-wash: var(--ds-apricot);
  --color-sky-wash: var(--ds-sky);
  --bg: var(--ds-bg);
  --bg-elevated: var(--ds-surface);
  --bg-soft: var(--ds-surface-subtle);
  --text: var(--ds-text);
  --muted: var(--ds-text-muted);
  --border: var(--ds-border);
  --accent: var(--ds-primary);
  --accent-strong: var(--ds-primary-hover);
  --accent-soft: var(--ds-primary-soft);
  --success: var(--ds-success);
  --success-soft: var(--ds-success-soft);
  --warning: var(--ds-warning);
  --warning-soft: var(--ds-warning-soft);
  --danger: var(--ds-danger);
  --danger-soft: var(--ds-danger-soft);
  color: var(--ds-text) !important;
  background: var(--ds-bg) !important;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

.ds-scope *,
.ds-scope *::before,
.ds-scope *::after {
  box-sizing: border-box;
}

.ds-scope a {
  color: inherit;
}

.ds-scope button,
.ds-scope input,
.ds-scope select {
  font: inherit;
}

/* Compatibility bridge while legacy utility markup migrates screen by screen. */
.ds-scope .text-slate-950,
.ds-scope .text-slate-900,
.ds-scope .text-slate-800 {
  color: var(--ds-text) !important;
}

.ds-scope .text-slate-700,
.ds-scope .text-slate-600 {
  color: var(--ds-text-secondary) !important;
}

.ds-scope .text-slate-500,
.ds-scope .text-slate-400,
.ds-scope .text-slate-300 {
  color: var(--ds-text-muted) !important;
}

.ds-scope input,
.ds-scope select,
.ds-scope textarea {
  border-color: var(--ds-border) !important;
  background: var(--ds-surface) !important;
  color: var(--ds-text) !important;
}

.ds-scope button {
  cursor: pointer;
}

.ds-scope button:disabled {
  cursor: not-allowed;
}

.ds-scope :focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

.ds-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: calc(var(--ds-z-tooltip) + 1);
  transform: translateY(-140%);
  border-radius: var(--ds-radius-md);
  background: var(--ds-text);
  color: var(--ds-bg);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
  transition: transform 160ms var(--ds-ease-out);
}

.ds-skip-link:focus {
  transform: translateY(0);
}

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

.ds-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-md);
  padding: 8px 14px;
  color: var(--ds-text);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ds-ease-out);
}

.ds-button:hover {
  background: var(--ds-surface-subtle);
}

.ds-button:active:not(:disabled) {
  transform: translateY(1px);
}

.ds-button:disabled {
  opacity: 0.55;
}

.ds-button--primary {
  border-radius: var(--ds-radius-full);
  background: var(--ds-primary);
  color: #ffffff;
}

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

.ds-button--secondary {
  border-color: var(--ds-border);
  background: var(--ds-surface);
}

.ds-button--secondary:hover {
  border-color: var(--ds-border-strong);
  background: var(--ds-surface-subtle);
}

.ds-icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text-secondary);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ds-ease-out);
}

.ds-icon-button:hover {
  border-color: var(--ds-border-strong);
  background: var(--ds-surface-subtle);
  color: var(--ds-text);
}

.ds-icon-button:active {
  transform: translateY(1px);
}

.ds-icon,
.ds-button svg,
.ds-icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.ds-input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.ds-input:hover {
  border-color: var(--ds-border-strong);
}

.ds-input:focus {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px var(--ds-focus);
}

.ds-input::placeholder {
  color: var(--ds-text-muted);
  opacity: 1;
}

.ds-panel {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
}

.ds-badge,
.ds-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--ds-radius-full);
  padding: 4px 10px;
  background: var(--ds-surface-subtle);
  color: var(--ds-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.ds-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.ds-status--success { background: var(--ds-success-soft); color: var(--ds-success); }
.ds-status--warning { background: var(--ds-warning-soft); color: var(--ds-warning); }
.ds-status--danger { background: var(--ds-danger-soft); color: var(--ds-danger); }
.ds-status--info { background: var(--ds-info-soft); color: var(--ds-info); }

.ds-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-subtle);
}

.ds-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  animation: ds-shimmer 1.4s ease-in-out infinite;
}

.dark .ds-skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

@keyframes ds-shimmer {
  to { transform: translateX(100%); }
}

@media (pointer: coarse) {
  .ds-button,
  .ds-icon-button,
  .ds-input {
    min-height: 44px;
  }

  .ds-icon-button {
    width: 44px;
    flex-basis: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ds-scope *,
  .ds-scope *::before,
  .ds-scope *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
