/* ============================================================================
   Ruimtemeesters Holding — component library (brand-agnostic, token-driven).
   Every value resolves from a CSS variable defined in a brand's tokens.css,
   so the same stylesheet themes both Ruimtemeesters and Prophys, light + dark.
   Import order:  <brand>/tokens.css  THEN  components.css   (or use theme.css)
   ============================================================================ */

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 0.5em;
  color: var(--foreground);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: var(--border-w-1) solid var(--border); margin: var(--space-6) 0; }
code, kbd, pre, samp { font-family: var(--font-mono); }

:focus-visible {
  outline: var(--focus-ring-width) solid var(--ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* ---------- Text styles -------------------------------------------------- */
.text-display { font-family: var(--font-heading); font-size: var(--text-7xl); font-weight: var(--weight-bold); line-height: var(--leading-none); letter-spacing: var(--tracking-tighter); }
.text-h1 { font-family: var(--font-heading); font-size: var(--text-4xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); }
.text-h2 { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); }
.text-h3 { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.text-h4 { font-family: var(--font-heading); font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.text-body-lg { font-size: var(--text-lg); line-height: var(--leading-relaxed); }
.text-body { font-size: var(--text-base); line-height: var(--leading-normal); }
.text-body-sm { font-size: var(--text-sm); line-height: var(--leading-normal); }
.text-caption { font-size: var(--text-xs); line-height: var(--leading-normal); color: var(--muted-foreground); }
.text-overline { font-family: var(--font-heading); font-size: var(--text-xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: var(--tracking-widest); }
.text-mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }

/* ---------- Layout helpers ---------------------------------------------- */
.container { width: 100%; max-width: var(--container-xl); margin-inline: auto; padding-inline: var(--space-6); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.divider-text { display: flex; align-items: center; gap: var(--space-3); color: var(--muted-foreground); font-size: var(--text-sm); }
.divider-text::before, .divider-text::after { content: ''; flex: 1; border-top: var(--border-w-1) solid var(--border); }

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  --_bg: var(--secondary); --_fg: var(--secondary-foreground); --_bg-hover: var(--secondary-hover);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-height); padding: 0 var(--space-4);
  font-family: var(--font-heading); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide); line-height: 1; white-space: nowrap;
  border: var(--border-w-1) solid transparent; border-radius: var(--radius);
  background: var(--_bg); color: var(--_fg); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}
.btn:hover { background: var(--_bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: var(--opacity-disabled); cursor: not-allowed; transform: none; }
.btn-primary { --_bg: var(--primary); --_fg: var(--primary-foreground); --_bg-hover: var(--primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }
.btn-accent { --_bg: var(--accent); --_fg: var(--accent-foreground); --_bg-hover: var(--accent-hover); }
.btn-secondary { --_bg: var(--secondary); --_fg: var(--secondary-foreground); --_bg-hover: var(--secondary-hover); }
.btn-destructive { --_bg: var(--destructive); --_fg: var(--destructive-foreground); --_bg-hover: color-mix(in srgb, var(--destructive) 88%, #000); }
.btn-success { --_bg: var(--success); --_fg: var(--success-foreground); --_bg-hover: color-mix(in srgb, var(--success) 88%, #000); }
.btn-outline { background: transparent; color: var(--foreground); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-link { background: transparent; color: var(--primary); height: auto; padding: 0; }
.btn-link:hover { background: transparent; text-decoration: underline; }
.btn-sm { height: var(--control-height-sm); padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { height: var(--control-height-lg); padding: 0 var(--space-6); font-size: var(--text-base); }
.btn-icon { width: var(--control-height); padding: 0; }
.btn-icon.btn-sm { width: var(--control-height-sm); }
.btn-block { display: flex; width: 100%; }
.btn-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn-loading::after {
  content: ''; position: absolute; width: 1em; height: 1em; border-radius: var(--radius-full);
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: var(--_fg);
  animation: ds-spin 0.6s linear infinite;
}
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; border-left-width: 0; }
.btn-group .btn:first-child { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); border-left-width: var(--border-w-1); }
.btn-group .btn:last-child { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }

/* ---------- Badges, tags, chips ----------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-0-5) var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  line-height: 1.4; border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground);
}
.badge-primary { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.badge-accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge-success { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in srgb, var(--destructive) 16%, transparent); color: var(--destructive); }
.badge-solid { background: var(--primary); color: var(--primary-foreground); }
.badge-dot::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: var(--radius-full); background: currentColor; }
.tag {
  display: inline-flex; align-items: center; gap: var(--space-1-5); padding: var(--space-1) var(--space-2-5);
  font-size: var(--text-xs); border-radius: var(--radius-sm); background: var(--secondary); color: var(--secondary-foreground);
}
.tag button { background: none; border: 0; color: inherit; cursor: pointer; opacity: 0.6; font-size: 1em; line-height: 1; padding: 0; }
.tag button:hover { opacity: 1; }

/* ---------- Navbar ------------------------------------------------------- */
.navbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: color-mix(in srgb, var(--background) 86%, transparent);
  backdrop-filter: saturate(140%) blur(var(--blur-md));
  border-bottom: var(--border-w-1) solid var(--border);
}
.navbar-inner { display: flex; align-items: center; gap: var(--space-6); height: var(--navbar-height); max-width: var(--container-xl); margin: 0 auto; padding: 0 var(--space-6); }
.navbar-brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-lg); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--foreground); }
.navbar-brand .dot { width: 0.85rem; height: 0.85rem; border-radius: var(--radius-sm); background: var(--primary); }
.navbar-links { display: flex; align-items: center; gap: var(--space-1); }
.nav-link { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted-foreground); transition: color var(--duration-fast), background var(--duration-fast); }
.nav-link:hover { color: var(--foreground); background: var(--muted); text-decoration: none; }
.nav-link.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.navbar-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }

/* ---------- Sidebar (vertical nav) -------------------------------------- */
.sidebar { width: var(--sidebar-width); background: var(--surface); border-right: var(--border-w-1) solid var(--border); padding: var(--space-4); }
.sidebar-group + .sidebar-group { margin-top: var(--space-5); }
.sidebar-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted-foreground); font-weight: var(--weight-semibold); padding: var(--space-2) var(--space-3); }
.sidebar-link { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--foreground); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.sidebar-link:hover { background: var(--muted); text-decoration: none; }
.sidebar-link.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }

/* ---------- Breadcrumb / tabs / segmented / pagination / stepper -------- */
.breadcrumb { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--muted-foreground); }
.breadcrumb a { color: var(--muted-foreground); }
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb .sep { opacity: 0.5; }

.tabs { display: flex; gap: var(--space-1); border-bottom: var(--border-w-1) solid var(--border); }
.tab { padding: var(--space-3) var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted-foreground); cursor: pointer; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; }
.tab:hover { color: var(--foreground); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.segmented { display: inline-flex; padding: var(--space-0-5); background: var(--muted); border-radius: var(--radius); }
.segmented button { border: 0; background: none; cursor: pointer; padding: var(--space-1-5) var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted-foreground); border-radius: calc(var(--radius) - 2px); }
.segmented button.active { background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-xs); }

.pagination { display: inline-flex; gap: var(--space-1); }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: var(--control-height-sm); height: var(--control-height-sm); padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--foreground); border: var(--border-w-1) solid transparent; }
.pagination a:hover { background: var(--muted); text-decoration: none; }
.pagination .active { background: var(--primary); color: var(--primary-foreground); }
.pagination .disabled { opacity: var(--opacity-disabled); pointer-events: none; }

.stepper { display: flex; align-items: center; gap: var(--space-2); }
.step { display: flex; align-items: center; gap: var(--space-2); color: var(--muted-foreground); font-size: var(--text-sm); }
.step .num { width: 1.6rem; height: 1.6rem; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: var(--weight-bold); background: var(--muted); color: var(--muted-foreground); }
.step.active .num { background: var(--primary); color: var(--primary-foreground); }
.step.done .num { background: var(--success); color: var(--success-foreground); }
.step.active { color: var(--foreground); }
.stepper .bar { width: 2rem; height: 2px; background: var(--border); }

/* ---------- Cards / list-group / stat ----------------------------------- */
.card { background: var(--card); color: var(--card-foreground); border: var(--border-w-1) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: var(--space-5) var(--space-5) 0; }
.card-body { padding: var(--space-5); }
.card-footer { padding: var(--space-4) var(--space-5); border-top: var(--border-w-1) solid var(--border); display: flex; gap: var(--space-3); align-items: center; }
.card-title { font-size: var(--text-lg); margin: 0 0 var(--space-1); }
.card-subtitle { color: var(--muted-foreground); font-size: var(--text-sm); margin: 0; }
.card-media { height: 9rem; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.card-interactive { cursor: pointer; transition: box-shadow var(--duration-fast), transform var(--duration-fast), border-color var(--duration-fast); }
.card-interactive:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }

.list-group { border: var(--border-w-1) solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); }
.list-group-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: var(--border-w-1) solid var(--border); }
.list-group-item:last-child { border-bottom: 0; }
.list-group-item.clickable { cursor: pointer; }
.list-group-item.clickable:hover { background: var(--muted); }

.stat { padding: var(--space-5); }
.stat-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted-foreground); font-weight: var(--weight-semibold); }
.stat-value { font-family: var(--font-heading); font-size: var(--text-4xl); font-weight: var(--weight-bold); line-height: 1.1; margin: var(--space-1) 0; }
.stat-delta { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--destructive); }

/* ---------- Forms -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-1-5); margin-bottom: var(--space-4); }
.label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--foreground); }
.label .req { color: var(--destructive); }
.hint { font-size: var(--text-xs); color: var(--muted-foreground); }
.input, .textarea, .select {
  width: 100%; height: var(--control-height); padding: 0 var(--space-3);
  font-family: var(--font-body); font-size: var(--text-sm); color: var(--foreground);
  background: var(--surface); border: var(--border-w-1) solid var(--input); border-radius: var(--radius);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.textarea { height: auto; min-height: 6rem; padding: var(--space-2-5) var(--space-3); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ring); box-shadow: var(--shadow-focus) color-mix(in srgb, var(--ring) 30%, transparent); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--muted); cursor: not-allowed; opacity: var(--opacity-muted); }
.input[readonly] { background: var(--muted); }
.input-sm { height: var(--control-height-sm); font-size: var(--text-xs); }
.input-lg { height: var(--control-height-lg); font-size: var(--text-base); }
.input-error { border-color: var(--destructive); }
.input-error:focus { box-shadow: var(--shadow-focus) color-mix(in srgb, var(--destructive) 30%, transparent); }
.input-success { border-color: var(--success); }
.input-group { display: flex; align-items: stretch; }
.input-group > .addon { display: inline-flex; align-items: center; padding: 0 var(--space-3); background: var(--muted); color: var(--muted-foreground); border: var(--border-w-1) solid var(--input); font-size: var(--text-sm); }
.input-group > .addon:first-child { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.input-group > .addon:last-child { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.input-group > .input { border-radius: 0; }
.input-group > .input:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > .input:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }
.check input { accent-color: var(--primary); width: 1.05rem; height: 1.05rem; }
fieldset { border: var(--border-w-1) solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
legend { font-size: var(--text-sm); font-weight: var(--weight-semibold); padding: 0 var(--space-2); }

.switch { position: relative; display: inline-block; width: 2.6rem; height: 1.5rem; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; cursor: pointer; background: var(--input); border-radius: var(--radius-full); transition: background var(--duration-fast); }
.switch .track::before { content: ''; position: absolute; height: 1.1rem; width: 1.1rem; left: 0.2rem; top: 0.2rem; background: #fff; border-radius: var(--radius-full); transition: transform var(--duration-fast); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(1.1rem); }

.range { width: 100%; accent-color: var(--primary); }

/* ---------- Alerts / banner --------------------------------------------- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border: var(--border-w-1) solid var(--border); border-left-width: 3px; border-radius: var(--radius); background: var(--card); }
.alert-title { font-weight: var(--weight-semibold); margin: 0 0 var(--space-1); font-size: var(--text-sm); }
.alert-body { margin: 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.alert-info { border-left-color: var(--info); background: color-mix(in srgb, var(--info) 8%, var(--card)); }
.alert-success { border-left-color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--card)); }
.alert-warning { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--card)); }
.alert-danger { border-left-color: var(--destructive); background: color-mix(in srgb, var(--destructive) 8%, var(--card)); }
.banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); background: var(--primary); color: var(--primary-foreground); font-size: var(--text-sm); }
.banner .btn { margin-left: auto; }

/* ---------- Toast -------------------------------------------------------- */
.toast-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.toast { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 18rem; max-width: 24rem; padding: var(--space-3) var(--space-4); background: var(--popover); color: var(--popover-foreground); border: var(--border-w-1) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.toast .accent { width: 3px; align-self: stretch; border-radius: var(--radius-full); background: var(--primary); }
.toast.success .accent { background: var(--success); }
.toast.danger .accent { background: var(--destructive); }

/* ---------- Tooltip ------------------------------------------------------ */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--foreground); color: var(--background); font-size: var(--text-xs); white-space: nowrap;
  padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); opacity: 0; pointer-events: none;
  transition: opacity var(--duration-fast); z-index: var(--z-tooltip);
}
.tooltip:hover::after, .tooltip:focus-visible::after { opacity: 1; }

/* ---------- Menu / dropdown --------------------------------------------- */
.menu { min-width: 12rem; padding: var(--space-1); background: var(--popover); color: var(--popover-foreground); border: var(--border-w-1) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left; padding: var(--space-2) var(--space-3); border: 0; background: none; border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--popover-foreground); cursor: pointer; }
.menu-item:hover { background: var(--muted); }
.menu-item.danger { color: var(--destructive); }
.menu-separator { height: 1px; background: var(--border); margin: var(--space-1) 0; }
.menu-label { padding: var(--space-1-5) var(--space-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted-foreground); }
details.dropdown { position: relative; display: inline-block; }
details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown[open] > .menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: var(--z-dropdown); }

/* ---------- Modal / drawer ---------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--space-4); }
.modal { width: 100%; max-width: 30rem; background: var(--popover); color: var(--popover-foreground); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); border: var(--border-w-1) solid var(--border); }
.modal-header { padding: var(--space-5) var(--space-5) 0; display: flex; align-items: start; justify-content: space-between; gap: var(--space-3); }
.modal-body { padding: var(--space-4) var(--space-5); color: var(--muted-foreground); font-size: var(--text-sm); }
.modal-footer { padding: var(--space-4) var(--space-5); display: flex; gap: var(--space-3); justify-content: flex-end; border-top: var(--border-w-1) solid var(--border); }
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-drawer); }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 22rem; max-width: 90vw; background: var(--surface); border-left: var(--border-w-1) solid var(--border); box-shadow: var(--shadow-xl); z-index: calc(var(--z-drawer) + 1); padding: var(--space-5); }

/* ---------- Accordion ---------------------------------------------------- */
.accordion { border: var(--border-w-1) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accordion details { border-bottom: var(--border-w-1) solid var(--border); }
.accordion details:last-child { border-bottom: 0; }
.accordion summary { list-style: none; cursor: pointer; padding: var(--space-3) var(--space-4); font-weight: var(--weight-medium); font-size: var(--text-sm); display: flex; justify-content: space-between; align-items: center; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: '+'; color: var(--muted-foreground); }
.accordion details[open] summary::after { content: '\2212'; }
.accordion .acc-body { padding: 0 var(--space-4) var(--space-4); font-size: var(--text-sm); color: var(--muted-foreground); }

/* ---------- Table -------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: var(--border-w-1) solid var(--border); }
.table th { font-weight: var(--weight-semibold); color: var(--muted-foreground); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.table tbody tr:hover { background: var(--muted); }
.table-striped tbody tr:nth-child(odd) { background: var(--surface-sunken); }
.table-compact th, .table-compact td { padding: var(--space-2) var(--space-3); }

/* ---------- Progress / spinner / skeleton ------------------------------- */
.progress { height: 0.6rem; background: var(--muted); border-radius: var(--radius-full); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress.indeterminate > span { width: 40%; animation: ds-indet 1.2s var(--ease-in-out) infinite; }
.spinner { width: 1.25rem; height: 1.25rem; border-radius: var(--radius-full); border: 2px solid var(--muted); border-top-color: var(--primary); animation: ds-spin 0.6s linear infinite; display: inline-block; }
.skeleton { background: var(--muted); border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--foreground) 8%, transparent), transparent); animation: ds-shimmer 1.4s infinite; }
.skeleton-text { height: 0.8rem; margin: 0.35rem 0; }

/* ---------- Avatar / kbd / code / timeline / empty ---------------------- */
.avatar { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--primary-foreground); font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { border: 2px solid var(--background); margin-left: -0.6rem; }
.avatar-group .avatar:first-child { margin-left: 0; }
kbd { display: inline-block; padding: 1px var(--space-1-5); font-size: var(--text-xs); background: var(--muted); border: var(--border-w-1) solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--radius-sm); color: var(--foreground); }
pre.code { background: var(--surface-sunken); border: var(--border-w-1) solid var(--border); border-radius: var(--radius); padding: var(--space-4); overflow: auto; font-size: var(--text-sm); color: var(--foreground); }
.timeline { position: relative; padding-left: var(--space-6); }
.timeline::before { content: ''; position: absolute; left: 0.4rem; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: var(--space-5); }
.timeline-item::before { content: ''; position: absolute; left: calc(-1 * var(--space-6) + 0.15rem); top: 0.2rem; width: 0.6rem; height: 0.6rem; border-radius: var(--radius-full); background: var(--primary); box-shadow: 0 0 0 3px var(--background); }
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--muted-foreground); }
.empty-state .icon { width: 3rem; height: 3rem; border-radius: var(--radius-full); background: var(--muted); margin: 0 auto var(--space-4); display: grid; place-items: center; }

/* ---------- Helpers ------------------------------------------------------ */
.muted-text { color: var(--muted-foreground); }
.surface { background: var(--surface); border: var(--border-w-1) solid var(--border); border-radius: var(--radius-lg); }

/* ---------- Animations --------------------------------------------------- */
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-shimmer { 100% { transform: translateX(100%); } }
@keyframes ds-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

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