/* ============================================================
   Carbon Design System — self-contained stylesheet
   Faithful recreation of IBM Carbon v11 tokens & components
   for the khadijah POS (deployable, no build step).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ---------- Tokens: White theme (default) ---------- */
:root {
  /* Neutrals */
  --cds-black-100: #161616;
  --cds-white: #ffffff;
  --cds-gray-10: #f4f4f4;
  --cds-gray-20: #e0e0e0;
  --cds-gray-30: #c6c6c6;
  --cds-gray-40: #a8a8a8;
  --cds-gray-50: #8d8d8d;
  --cds-gray-60: #6f6f6f;
  --cds-gray-70: #525252;
  --cds-gray-80: #393939;
  --cds-gray-90: #262626;
  --cds-gray-100: #161616;

  /* Blue (interactive) */
  --cds-blue-40: #78a9ff;
  --cds-blue-50: #4589ff;
  --cds-blue-60: #115e59;
  --cds-blue-70: #0e4f4a;
  --cds-blue-80: #0b3d39;

  /* Support */
  --cds-support-error: #da1e28;
  --cds-support-success: #24a148;
  --cds-support-warning: #f1c21b;
  --cds-support-info: #0043ce;
  --cds-support-error-inverse: #fa4d56;
  --cds-support-success-inverse: #42be65;

  /* Semantic — White theme */
  --cds-background: #ffffff;
  --cds-layer-01: #f4f4f4;
  --cds-layer-02: #ffffff;
  --cds-layer-03: #f4f4f4;
  --cds-layer-hover-01: #e8e8e8;
  --cds-layer-hover-02: #e8e8e8;
  --cds-layer-selected-01: #e0e0e0;
  --cds-layer-accent-01: #e0e0e0;
  --cds-field-01: #f4f4f4;
  --cds-field-02: #ffffff;
  --cds-field-hover: #e8e8e8;
  --cds-border-subtle-00: #e0e0e0;
  --cds-border-subtle-01: #e0e0e0;
  --cds-border-strong-01: #8d8d8d;
  --cds-border-interactive: #115e59;
  --cds-text-primary: #161616;
  --cds-text-secondary: #525252;
  --cds-text-placeholder: #a8a8a8;
  --cds-text-helper: #6f6f6f;
  --cds-text-on-color: #ffffff;
  --cds-text-error: #da1e28;
  --cds-icon-primary: #161616;
  --cds-icon-secondary: #525252;
  --cds-link-primary: #115e59;
  --cds-link-primary-hover: #0e4f4a;

  --cds-interactive: #115e59;
  --cds-button-primary: #115e59;
  --cds-button-primary-hover: #0e4f4a;
  --cds-button-primary-active: #0b3d39;
  --cds-button-secondary: #393939;
  --cds-button-secondary-hover: #474747;
  --cds-button-secondary-active: #6f6f6f;
  --cds-button-danger: #da1e28;
  --cds-button-danger-hover: #b81921;
  --cds-button-danger-active: #750e13;
  --cds-focus: #f97316;
  --cds-focus-inset: #ffffff;
  --cds-accent: #f97316;
  --cds-accent-hover: #ea6a0d;

  --cds-overlay: rgba(22,22,22,0.5);
  --cds-toggle-off: #8d8d8d;

  /* Notification tints */
  --cds-notif-error-bg: #fff1f1;
  --cds-notif-success-bg: #defbe6;
  --cds-notif-warning-bg: #fdf6dd;
  --cds-notif-info-bg: #edf5ff;

  /* Spacing scale */
  --cds-spacing-01: 2px;
  --cds-spacing-02: 4px;
  --cds-spacing-03: 8px;
  --cds-spacing-04: 12px;
  --cds-spacing-05: 16px;
  --cds-spacing-06: 24px;
  --cds-spacing-07: 32px;
  --cds-spacing-08: 40px;
  --cds-spacing-09: 48px;
  --cds-spacing-10: 64px;
  --cds-spacing-11: 80px;
  --cds-spacing-12: 96px;

  /* Elevation */
  --cds-shadow-overlay: 0 2px 6px rgba(0,0,0,0.2);
  --cds-shadow-md: 0 4px 16px rgba(0,0,0,0.2);

  /* Motion */
  --cds-ease-productive: cubic-bezier(0.2,0,0.38,0.9);
  --cds-ease-entrance: cubic-bezier(0,0,0.38,0.9);
  --cds-ease-exit: cubic-bezier(0.2,0,1,0.9);
  --cds-dur-fast: 110ms;
  --cds-dur-moderate: 150ms;
  --cds-dur-slow: 240ms;

  --cds-duo-01: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  --cds-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
}

/* ---------- Gray 100 (dark) theme ---------- */
[data-carbon-theme="g100"] {
  --cds-background: #161616;
  --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-field-01: #262626;
  --cds-field-02: #393939;
  --cds-field-hover: #333333;
  --cds-border-subtle-00: #393939;
  --cds-border-subtle-01: #393939;
  --cds-border-strong-01: #6f6f6f;
  --cds-text-primary: #f4f4f4;
  --cds-text-secondary: #c6c6c6;
  --cds-text-placeholder: #6f6f6f;
  --cds-text-helper: #a8a8a8;
  --cds-icon-primary: #f4f4f4;
  --cds-icon-secondary: #c6c6c6;
  --cds-link-primary: #2dd4bf;
  --cds-link-primary-hover: #5eead4;
  --cds-button-primary: #115e59;
  --cds-button-secondary: #6f6f6f;
  --cds-button-secondary-hover: #606060;
  --cds-notif-error-bg: #262626;
  --cds-notif-success-bg: #262626;
  --cds-notif-warning-bg: #262626;
  --cds-notif-info-bg: #262626;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--cds-duo-01);
  font-size: 14px;
  line-height: 1.4;
  color: var(--cds-text-primary);
  background: var(--cds-background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--cds-link-primary); text-decoration: none; }
a:hover { color: var(--cds-link-primary-hover); text-decoration: underline; }
button { font-family: inherit; }
::selection { background: rgba(17,94,89,0.2); }

/* ---------- Type scale ---------- */
.cds-label-01 { font-size: 12px; line-height: 16px; letter-spacing: .32px; font-weight: 400; }
.cds-helper-01 { font-size: 12px; line-height: 16px; letter-spacing: .32px; color: var(--cds-text-helper); }
.cds-body-compact-01 { font-size: 14px; line-height: 18px; letter-spacing: .16px; }
.cds-body-01 { font-size: 14px; line-height: 20px; letter-spacing: .16px; }
.cds-body-02 { font-size: 16px; line-height: 24px; }
.cds-heading-compact-01 { font-size: 14px; line-height: 18px; font-weight: 600; letter-spacing: .16px; }
.cds-heading-01 { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .16px; }
.cds-heading-02 { font-size: 16px; line-height: 22px; font-weight: 600; }
.cds-heading-03 { font-size: 20px; line-height: 28px; font-weight: 400; }
.cds-heading-04 { font-size: 28px; line-height: 36px; font-weight: 400; }
.cds-heading-05 { font-size: 32px; line-height: 40px; font-weight: 400; }
.cds-heading-06 { font-size: 42px; line-height: 50px; font-weight: 300; }
.cds-heading-07 { font-size: 54px; line-height: 64px; font-weight: 300; }
.cds-mono { font-family: var(--cds-mono); }

/* ---------- UI Shell header ---------- */
.cds-header {
  display: flex;
  align-items: center;
  height: 48px;
  background: var(--cds-gray-100);
  color: #f4f4f4;
  border-bottom: 1px solid #393939;
  position: relative;
  z-index: 8000;
}
.cds-header__name {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px;
  height: 100%;
  font-size: 14px; letter-spacing: .1px;
  color: #f4f4f4;
}
.cds-header__name b { font-weight: 600; }
.cds-header__name span { font-weight: 400; color: #c6c6c6; }
.cds-header__divider { width: 1px; height: 24px; background: #393939; }
.cds-header__nav { display: flex; align-items: stretch; height: 100%; }
.cds-header__menu-item {
  display: flex; align-items: center;
  padding: 0 16px; height: 100%;
  font-size: 14px; color: #c6c6c6;
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: background var(--cds-dur-fast), color var(--cds-dur-fast);
}
.cds-header__menu-item:hover { background: #2c2c2c; color: #f4f4f4; }
.cds-header__menu-item.active { color: #f4f4f4; border-bottom-color: var(--cds-accent); background: #262626; }
.cds-header__actions { margin-left: auto; display: flex; align-items: stretch; height: 100%; }
.cds-header__action {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: #f4f4f4;
  transition: background var(--cds-dur-fast);
}
.cds-header__action:hover { background: #2c2c2c; }
.cds-header__action svg { fill: #f4f4f4; }
.cds-header__global {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 100%;
  color: #c6c6c6; font-size: 13px;
}

/* ---------- Buttons ---------- */
.cds-btn {
  --_bg: var(--cds-button-primary);
  --_bg-hover: var(--cds-button-primary-hover);
  --_bg-active: var(--cds-button-primary-active);
  --_fg: var(--cds-text-on-color);
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: 32px;
  min-height: 48px;
  padding: 12px 16px 12px 16px;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--_bg);
  color: var(--_fg);
  font-size: 14px; line-height: 18px; letter-spacing: .16px; font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background var(--cds-dur-fast) var(--cds-ease-productive),
              box-shadow var(--cds-dur-fast);
  position: relative;
}
.cds-btn:hover { background: var(--_bg-hover); }
.cds-btn:active { background: var(--_bg-active); }
.cds-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--cds-focus-inset), inset 0 0 0 2px var(--cds-focus); }
.cds-btn svg { flex-shrink: 0; fill: currentColor; }
.cds-btn:disabled { background: var(--cds-gray-30); color: var(--cds-gray-50); cursor: not-allowed; border-color: transparent; }
.cds-btn--icon-only { gap: 0; padding: 12px; justify-content: center; }
.cds-btn--sm { min-height: 32px; padding: 6px 12px; gap: 16px; }
.cds-btn--md { min-height: 40px; padding: 8px 14px; gap: 24px; }
.cds-btn--xl { min-height: 64px; padding: 16px; }
.cds-btn--full { display: flex; width: 100%; }
.cds-btn--secondary { --_bg: var(--cds-button-secondary); --_bg-hover: var(--cds-button-secondary-hover); --_bg-active: var(--cds-button-secondary-active); }
.cds-btn--tertiary {
  background: transparent; color: var(--cds-button-primary);
  border-color: var(--cds-button-primary);
}
.cds-btn--tertiary:hover { background: var(--cds-button-primary); color: #fff; }
.cds-btn--tertiary:active { background: var(--cds-button-primary-active); border-color: var(--cds-button-primary-active); }
.cds-btn--ghost { background: transparent; color: var(--cds-link-primary); }
.cds-btn--ghost:hover { background: var(--cds-layer-hover-01); color: var(--cds-link-primary); }
.cds-btn--ghost:active { background: var(--cds-layer-selected-01); }
.cds-btn--danger { --_bg: var(--cds-button-danger); --_bg-hover: var(--cds-button-danger-hover); --_bg-active: var(--cds-button-danger-active); }
.cds-btn--danger-ghost { background: transparent; color: var(--cds-button-danger); }
.cds-btn--danger-ghost:hover { background: var(--cds-button-danger); color: #fff; }

/* ---------- Form fields ---------- */
.cds-form-item { display: flex; flex-direction: column; margin-bottom: 24px; }
.cds-form-item--compact { margin-bottom: 16px; }
.cds-label {
  font-size: 12px; line-height: 16px; letter-spacing: .32px;
  color: var(--cds-text-secondary);
  margin-bottom: 6px;
}
.cds-helper { font-size: 12px; line-height: 16px; color: var(--cds-text-helper); margin-top: 4px; }
.cds-error-msg { font-size: 12px; line-height: 16px; color: var(--cds-text-error); margin-top: 4px; }

.cds-text-input, .cds-select, .cds-textarea {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  background: var(--cds-field-01);
  border: none;
  border-bottom: 1px solid var(--cds-border-strong-01);
  color: var(--cds-text-primary);
  font-family: var(--cds-duo-01);
  font-size: 14px; letter-spacing: .16px;
  outline: none;
  transition: background var(--cds-dur-fast), border-color var(--cds-dur-fast);
  border-radius: 0;
}
.cds-text-input::placeholder, .cds-textarea::placeholder { color: var(--cds-text-placeholder); }
.cds-text-input:hover, .cds-select:hover, .cds-textarea:hover { background: var(--cds-field-hover); }
.cds-text-input:focus, .cds-select:focus, .cds-textarea:focus {
  outline: 2px solid var(--cds-focus); outline-offset: -2px;
}
.cds-text-input:disabled { color: var(--cds-text-placeholder); border-bottom-color: transparent; cursor: not-allowed; }
.cds-text-input--invalid, .cds-select--invalid { outline: 2px solid var(--cds-support-error); outline-offset: -2px; }
.cds-textarea { height: auto; min-height: 64px; padding: 11px 16px; resize: vertical; line-height: 18px; }
.cds-input--lg { height: 48px; }
.cds-input--sm { height: 32px; }
.cds-select {
  appearance: none;
  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='%23161616' d='M8 11L3 6l.7-.7L8 9.6l4.3-4.3.7.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Input with unit prefix */
.cds-input-affix { position: relative; display: flex; align-items: stretch; }
.cds-input-affix__prefix {
  display: flex; align-items: center; padding: 0 0 0 16px;
  background: var(--cds-field-01);
  border-bottom: 1px solid var(--cds-border-strong-01);
  color: var(--cds-text-secondary); font-size: 14px;
}
.cds-input-affix__prefix + .cds-text-input { padding-left: 8px; }

/* Number input with steppers */
.cds-number { position: relative; display: flex; }
.cds-number input {
  flex: 1; -moz-appearance: textfield;
}
.cds-number input::-webkit-outer-spin-button,
.cds-number input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cds-number__steppers { display: flex; }
.cds-number__step {
  width: 40px; height: 40px; border: none; cursor: pointer;
  background: var(--cds-field-01);
  border-bottom: 1px solid var(--cds-border-strong-01);
  border-left: 1px solid var(--cds-border-subtle-01);
  color: var(--cds-icon-primary);
  display: flex; align-items: center; justify-content: center;
}
.cds-number__step:hover { background: var(--cds-field-hover); }

/* Checkbox */
.cds-checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.cds-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.cds-checkbox__box {
  width: 16px; height: 16px; border: 1px solid var(--cds-icon-primary);
  border-radius: 0; flex-shrink: 0; position: relative; transition: .1s;
}
.cds-checkbox input:checked + .cds-checkbox__box { background: var(--cds-icon-primary); }
.cds-checkbox input:checked + .cds-checkbox__box::after {
  content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}

/* Toggle */
.cds-toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.cds-toggle input { position: absolute; opacity: 0; }
.cds-toggle__track {
  width: 48px; height: 24px; border-radius: 12px; background: var(--cds-toggle-off);
  position: relative; transition: background var(--cds-dur-fast);
}
.cds-toggle__track::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform var(--cds-dur-fast);
}
.cds-toggle input:checked + .cds-toggle__track { background: var(--cds-support-success); }
.cds-toggle input:checked + .cds-toggle__track::after { transform: translateX(24px); }
.cds-toggle__label { font-size: 14px; }

/* ---------- Tags ---------- */
.cds-tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px; border-radius: 12px;
  font-size: 12px; line-height: 1; letter-spacing: .16px;
  background: var(--cds-gray-20); color: var(--cds-gray-100);
  white-space: nowrap;
}
.cds-tag--sm { height: 18px; font-size: 11px; }
.cds-tag--blue { background: #d0e2ff; color: #002d9c; }
.cds-tag--green { background: #a7f0ba; color: #044317; }
.cds-tag--red { background: #ffd7d9; color: #750e13; }
.cds-tag--warn { background: #fddc69; color: #684e00; }
.cds-tag--purple { background: #e8daff; color: #491d8b; }
.cds-tag--teal { background: #9ef0f0; color: #005d5d; }
.cds-tag--gray { background: var(--cds-gray-20); color: var(--cds-gray-100); }
.cds-tag--cool { background: #dde1e6; color: #343a3f; }
.cds-tag--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--cds-border-strong-01); }

/* ---------- Tile ---------- */
.cds-tile {
  background: var(--cds-layer-01);
  padding: 16px;
  border: 1px solid transparent;
  position: relative;
}
.cds-tile--clickable { cursor: pointer; transition: background var(--cds-dur-fast); }
.cds-tile--clickable:hover { background: var(--cds-layer-hover-01); }
.cds-tile--selected { outline: 1px solid var(--cds-border-interactive); outline-offset: -1px; }
.cds-tile--white { background: var(--cds-white); border: 1px solid var(--cds-border-subtle-01); }

/* ---------- Data table ---------- */
.cds-table-container { background: var(--cds-layer-01); }
.cds-table-header { padding: 16px; }
.cds-table-header h3 { font-size: 20px; line-height: 28px; font-weight: 400; }
.cds-table-header p { font-size: 14px; color: var(--cds-text-secondary); margin-top: 2px; }
.cds-table-wrap { overflow-x: auto; }
.cds-table { width: 100%; border-collapse: collapse; background: var(--cds-layer-01); }
.cds-table th {
  text-align: left; height: 48px; padding: 0 16px;
  background: var(--cds-layer-accent-01);
  color: var(--cds-text-primary);
  font-size: 14px; font-weight: 600; letter-spacing: .16px;
  white-space: nowrap; border: none;
}
.cds-table td {
  height: 48px; padding: 0 16px;
  border-top: 1px solid var(--cds-border-subtle-01);
  color: var(--cds-text-secondary);
  font-size: 14px; vertical-align: middle;
}
.cds-table tbody tr { background: var(--cds-layer-01); transition: background var(--cds-dur-fast); }
.cds-table tbody tr:hover { background: var(--cds-layer-hover-01); }
.cds-table td strong, .cds-table td b { color: var(--cds-text-primary); font-weight: 600; }
.cds-table--tall td, .cds-table--tall th { height: 64px; }
.cds-table--zebra tbody tr:nth-child(even) { background: var(--cds-layer-02); }

/* ---------- Tabs ---------- */
.cds-tabs { display: flex; border-bottom: 1px solid var(--cds-border-subtle-01); overflow-x: auto; }
.cds-tab {
  padding: 0 16px; height: 48px; min-width: 96px;
  background: none; border: none; cursor: pointer;
  color: var(--cds-text-secondary); font-size: 14px; text-align: left;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color var(--cds-dur-fast), border-color var(--cds-dur-fast);
}
.cds-tab:hover { color: var(--cds-text-primary); border-bottom-color: var(--cds-border-strong-01); }
.cds-tab.active { color: var(--cds-text-primary); font-weight: 600; border-bottom-color: var(--cds-accent); }

/* Content switcher */
.cds-switcher { display: inline-flex; border: 1px solid var(--cds-gray-100); }
[data-carbon-theme="g100"] .cds-switcher { border-color: var(--cds-gray-50); }
.cds-switcher__btn {
  padding: 0 16px; height: 40px; border: none; cursor: pointer;
  background: transparent; color: var(--cds-text-primary); font-size: 14px;
  border-right: 1px solid var(--cds-gray-100);
}
.cds-switcher__btn:last-child { border-right: none; }
.cds-switcher__btn.active { background: var(--cds-gray-100); color: #fff; }
[data-carbon-theme="g100"] .cds-switcher__btn { border-color: var(--cds-gray-50); }

/* ---------- Breadcrumb ---------- */
.cds-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cds-breadcrumb a { color: var(--cds-link-primary); }
.cds-breadcrumb__sep { color: var(--cds-text-secondary); }
.cds-breadcrumb__current { color: var(--cds-text-secondary); }

/* ---------- Notifications ---------- */
.cds-notification {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; min-height: 48px;
  border-left: 3px solid;
  margin-bottom: 12px;
}
.cds-notification__icon { flex-shrink: 0; margin-top: 2px; }
.cds-notification__body { flex: 1; font-size: 14px; }
.cds-notification__body b { font-weight: 600; }
.cds-notification--error { background: var(--cds-notif-error-bg); border-color: var(--cds-support-error); }
.cds-notification--error .cds-notification__icon svg { fill: var(--cds-support-error); }
.cds-notification--success { background: var(--cds-notif-success-bg); border-color: var(--cds-support-success); }
.cds-notification--success .cds-notification__icon svg { fill: var(--cds-support-success); }
.cds-notification--warning { background: var(--cds-notif-warning-bg); border-color: var(--cds-support-warning); }
.cds-notification--warning .cds-notification__icon svg { fill: #b28600; }
.cds-notification--info { background: var(--cds-notif-info-bg); border-color: var(--cds-support-info); }
.cds-notification--info .cds-notification__icon svg { fill: var(--cds-support-info); }

/* Toast */
.cds-toast-region {
  position: fixed; top: 56px; right: 16px; z-index: 9000;
  display: flex; flex-direction: column; gap: 8px; width: 320px;
}
.cds-toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-left: 3px solid;
  background: var(--cds-gray-100); color: #f4f4f4;
  box-shadow: var(--cds-shadow-md);
  animation: cds-toast-in var(--cds-dur-slow) var(--cds-ease-entrance);
}
@keyframes cds-toast-in { from { opacity: 0; transform: translateX(16px); } }
.cds-toast--success { border-color: var(--cds-support-success-inverse); }
.cds-toast--error { border-color: var(--cds-support-error-inverse); }
.cds-toast--info { border-color: var(--cds-blue-50); }
.cds-toast--warning { border-color: var(--cds-support-warning); }
.cds-toast__title { font-weight: 600; font-size: 14px; }
.cds-toast__sub { font-size: 13px; color: #c6c6c6; margin-top: 2px; }
.cds-toast__icon { flex-shrink: 0; margin-top: 1px; }

/* ---------- Modal ---------- */
.cds-modal-overlay {
  position: fixed; inset: 0; background: var(--cds-overlay);
  display: none; align-items: center; justify-content: center; z-index: 9500;
  padding: 16px;
}
.cds-modal-overlay.open { display: flex; }
.cds-modal {
  background: var(--cds-layer-01); width: 100%; max-width: 480px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--cds-shadow-md);
  animation: cds-modal-in var(--cds-dur-slow) var(--cds-ease-entrance);
}
@keyframes cds-modal-in { from { opacity: 0; transform: scale(.98); } }
.cds-modal--lg { max-width: 640px; }
.cds-modal--sm { max-width: 384px; }
.cds-modal__header { padding: 16px; position: relative; }
.cds-modal__label { font-size: 12px; color: var(--cds-text-secondary); margin-bottom: 4px; }
.cds-modal__title { font-size: 20px; line-height: 28px; font-weight: 400; padding-right: 40px; }
.cds-modal__close {
  position: absolute; top: 0; right: 0; width: 48px; height: 48px;
  background: none; border: none; cursor: pointer; color: var(--cds-icon-primary);
  display: flex; align-items: center; justify-content: center;
}
.cds-modal__close:hover { background: var(--cds-layer-hover-01); }
.cds-modal__body { padding: 0 16px 16px; overflow-y: auto; flex: 1; font-size: 14px; color: var(--cds-text-secondary); }
.cds-modal__footer { display: flex; margin-top: auto; }
.cds-modal__footer .cds-btn { flex: 1; min-height: 64px; }

/* ---------- Progress / loading ---------- */
.cds-progress-bar { height: 8px; background: var(--cds-layer-accent-01); overflow: hidden; }
.cds-progress-bar__fill { height: 100%; background: var(--cds-interactive); transition: width var(--cds-dur-slow); }
.cds-loading {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--cds-layer-accent-01); border-top-color: var(--cds-interactive);
  animation: cds-spin 0.7s linear infinite;
}
.cds-loading--sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes cds-spin { to { transform: rotate(360deg); } }
.cds-skeleton { background: var(--cds-layer-accent-01); position: relative; overflow: hidden; }
.cds-skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: cds-shimmer 1.2s infinite;
}
@keyframes cds-shimmer { to { transform: translateX(100%); } }

/* ---------- Side nav ---------- */
.cds-sidenav {
  width: 256px; background: var(--cds-layer-01);
  border-right: 1px solid var(--cds-border-subtle-01);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.cds-sidenav__item {
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 16px;
  color: var(--cds-text-secondary); font-size: 14px;
  background: none; border: none; cursor: pointer; text-align: left; width: 100%;
  border-left: 3px solid transparent;
  transition: background var(--cds-dur-fast);
}
.cds-sidenav__item:hover { background: var(--cds-layer-hover-01); color: var(--cds-text-primary); }
.cds-sidenav__item.active { background: var(--cds-layer-selected-01); color: var(--cds-text-primary); font-weight: 600; border-left-color: var(--cds-accent); }
.cds-sidenav__item svg { fill: currentColor; flex-shrink: 0; }
.cds-sidenav__heading { padding: 16px 16px 8px; font-size: 12px; color: var(--cds-text-helper); letter-spacing: .32px; }

/* ---------- Utilities ---------- */
.cds-stack-01 > * + * { margin-top: 4px; }
.cds-stack-03 > * + * { margin-top: 8px; }
.cds-stack-05 > * + * { margin-top: 16px; }
.cds-stack-06 > * + * { margin-top: 24px; }
.cds-flex { display: flex; }
.cds-flex-col { display: flex; flex-direction: column; }
.cds-items-center { align-items: center; }
.cds-justify-between { justify-content: space-between; }
.cds-gap-02 { gap: 4px; }
.cds-gap-03 { gap: 8px; }
.cds-gap-04 { gap: 12px; }
.cds-gap-05 { gap: 16px; }
.cds-grow { flex: 1; }
.cds-text-secondary { color: var(--cds-text-secondary); }
.cds-text-helper { color: var(--cds-text-helper); }
.cds-text-error { color: var(--cds-text-error); }
.cds-text-success { color: var(--cds-support-success); }
.cds-text-right { text-align: right; }
.cds-mono { font-family: var(--cds-mono); }
.cds-hidden { display: none !important; }
.cds-divider { height: 1px; background: var(--cds-border-subtle-01); border: none; }
.cds-empty { text-align: center; padding: 48px 24px; color: var(--cds-text-helper); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cds-gray-30); }
[data-carbon-theme="g100"] ::-webkit-scrollbar-thumb { background: var(--cds-gray-60); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Mobile / touch responsiveness ---------- */
@media (max-width: 672px) {
  .cds-modal { max-width: 100% !important; max-height: 94vh; }
  .cds-modal__footer { flex-direction: column; }
  .cds-modal__footer .cds-btn { width: 100%; }
  .cds-toast-region { left: 8px; right: 8px; width: auto; }
  .cds-btn { min-height: 44px; }
  .cds-table th, .cds-table td { padding: 0 10px; font-size: 13px; }
  .cds-header__name { font-size: 13px; padding: 0 10px; }
  .cds-header__global { padding: 0 8px; font-size: 12px; }
}
@media (hover: none) {
  .cds-btn, .cds-sidenav__item, .cds-tab, .chip { -webkit-tap-highlight-color: transparent; }
}
