/* Opt-in styles. Wrap a consumer surface in .ds-root. */
.ds-root { color-scheme: light; font-family: var(--ds-font-sans); font-size: var(--ds-type-base); line-height: var(--ds-leading-normal); color: var(--ds-text); font-synthesis: none; }
.ds-root *, .ds-root *::before, .ds-root *::after { box-sizing: border-box; }
.ds-root [hidden] { display: none !important; }
.ds-root :is(button,input,select,textarea) { font: inherit; color: inherit; }
.ds-root :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 3px; }
.ds-root :is(button,a) { touch-action: manipulation; }
.ds-root button { cursor: pointer; }
.ds-root button:disabled { cursor: default; }
.ds-root h1,.ds-root h2,.ds-root h3,.ds-root p { margin-top: 0; }
.ds-root h1 { font-size: var(--ds-type-2xl); line-height: var(--ds-leading-tight); letter-spacing: -.5px; font-weight: var(--ds-weight-semibold); }
.ds-root h2 { font-size: var(--ds-type-lg); font-weight: var(--ds-weight-semibold); }
.ds-root h3 { font-size: var(--ds-type-md); font-weight: var(--ds-weight-semibold); }
.ds-root a { color: var(--ds-accent); text-underline-offset: 3px; }
.ds-muted { color: var(--ds-muted); }
.ds-meta { font-size: var(--ds-type-xs); color: var(--ds-muted); }
.ds-mono { font-family: var(--ds-font-mono); font-size: var(--ds-type-xs); }
.ds-numeric { font-variant-numeric: tabular-nums; text-align: right; }
.ds-icon { width: var(--ds-icon-size); height: var(--ds-icon-size); flex-shrink: 0; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: var(--ds-icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.ds-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ds-shell { background: var(--ds-bg); min-height: 100dvh; }
.ds-header { height: var(--ds-header-height); padding: 0 var(--ds-page-gutter); background: var(--ds-header); color: white; display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4); position: sticky; top: 0; z-index: var(--ds-z-sticky); }
.ds-header :is(a,button):focus-visible { outline-color: #7fd6dc; }
.ds-page { max-width: var(--ds-page-max); padding: var(--ds-space-6) var(--ds-page-gutter); margin: 0 auto; min-width: 0; }
.ds-panel { background: var(--ds-surface); border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-lg); }
.ds-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ds-space-3); padding: var(--ds-space-4); border-bottom: 1px solid var(--ds-line); }
.ds-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); min-height: var(--ds-control-height); padding: 0 var(--ds-space-3); border: 1px solid var(--ds-control-border); background: var(--ds-surface); border-radius: var(--ds-radius-md); font-size: var(--ds-type-sm); font-weight: var(--ds-weight-semibold); white-space: nowrap; text-decoration: none; }
.ds-button:hover { background: var(--ds-surface-subtle); }
.ds-button[data-variant="primary"] { background: var(--ds-accent); border-color: var(--ds-accent); color: white; }
.ds-button[data-variant="primary"]:hover { background: var(--ds-accent-hover); }
.ds-button[data-variant="danger"] { color: var(--ds-danger); border-color: var(--ds-danger); }
.ds-button[data-variant="ghost"] { border-color: transparent; background: transparent; color: var(--ds-muted); }
.ds-button[data-variant="ghost"]:hover { background: var(--ds-disabled-bg); color: var(--ds-text); }
.ds-button:is(:disabled,[aria-disabled="true"]) { background: var(--ds-disabled-bg); border-color: var(--ds-line); color: var(--ds-disabled-text); }
.ds-button[aria-busy="true"] { cursor: progress; }
.ds-icon-button { width: var(--ds-control-height); padding: 0; }
.ds-field { display: flex; flex-direction: column; gap: var(--ds-space-2); min-width: 0; font-size: var(--ds-type-sm); font-weight: var(--ds-weight-medium); }
.ds-input, .ds-select { min-height: var(--ds-control-height); border: 1px solid var(--ds-control-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); padding: 6px 10px; min-width: 0; font-weight: var(--ds-weight-normal); }
.ds-input::placeholder { color: var(--ds-muted); }
.ds-input:disabled,.ds-select:disabled { background: var(--ds-disabled-bg); color: var(--ds-disabled-text); }
.ds-input[aria-invalid="true"] { border: 2px solid var(--ds-danger); }
.ds-search { display: flex; align-items: center; gap: var(--ds-space-2); min-height: var(--ds-control-height); border: 1px solid var(--ds-control-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); padding: 0 var(--ds-space-2) 0 var(--ds-space-3); color: var(--ds-muted); }
.ds-search:focus-within { outline: 3px solid var(--ds-focus); outline-offset: 3px; }
.ds-search input { background: transparent; border: 0; outline: 0 !important; min-width: 0; width: 100%; padding: 7px 0; font-size: var(--ds-type-sm); }
.ds-search .ds-button { min-height: 26px; width: 26px; padding: 0; }
.ds-tabs { display: flex; gap: var(--ds-space-5); padding: 0 var(--ds-space-4); border-bottom: 1px solid var(--ds-line); overflow-x: auto; }
.ds-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 13px 2px 11px; color: var(--ds-muted); font-size: var(--ds-type-sm); font-weight: var(--ds-weight-medium); white-space: nowrap; }
.ds-tab[aria-selected="true"] { color: var(--ds-accent); border-bottom-color: var(--ds-accent); font-weight: var(--ds-weight-semibold); }
.ds-tab:focus-visible { outline-offset: -4px !important; }
.ds-segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--ds-disabled-bg); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); }
.ds-segmented button { border: 0; background: transparent; color: var(--ds-muted); border-radius: var(--ds-radius-sm); padding: 5px 10px; font-size: var(--ds-type-xs); font-weight: var(--ds-weight-medium); min-height: 26px; }
.ds-segmented button[aria-pressed="true"] { color: var(--ds-text); background: var(--ds-surface); box-shadow: 0 1px 3px #00000012; }
.ds-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: var(--ds-radius-pill); font-size: var(--ds-type-xs); font-weight: var(--ds-weight-medium); white-space: nowrap; background: var(--ds-disabled-bg); color: var(--ds-muted); }
.ds-badge[data-tone="accent"] { color: var(--ds-accent); background: var(--ds-selected); }
.ds-badge[data-tone="success"] { color: var(--ds-success); background: var(--ds-success-bg); }
.ds-badge[data-tone="warning"] { color: var(--ds-warning); background: var(--ds-warning-bg); }
.ds-badge[data-tone="danger"] { color: var(--ds-danger); background: var(--ds-danger-bg); }
.ds-badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.ds-table-scroll { overflow: auto; }
.ds-table { border-collapse: collapse; width: 100%; text-align: left; font-size: var(--ds-type-sm); }
.ds-table th { position: relative; background: var(--ds-surface-subtle); color: var(--ds-muted); font-size: var(--ds-type-xs); font-weight: var(--ds-weight-semibold); padding: 10px 16px; border-bottom: 1px solid var(--ds-line); }
.ds-table td { height: var(--ds-row-height); padding: 8px 16px; border-bottom: 1px solid var(--ds-line); vertical-align: middle; }
.ds-table tbody tr:last-child td { border-bottom: 0; }
.ds-table tbody tr:hover { background: var(--ds-surface-subtle); }
.ds-table tbody tr[data-selected="true"] { background: var(--ds-selected); }
.ds-table tbody tr[data-selected="true"] td:first-child { box-shadow: inset 3px 0 var(--ds-accent); }
.ds-table [type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ds-accent); cursor: pointer; }
.ds-table[data-density="comfortable"] { --ds-row-height: 68px; }
.ds-sort { display: inline-flex; gap: var(--ds-space-2); padding: 0; background: none; border: 0; font-size: inherit; font-weight: inherit; }
.ds-sort .ds-icon { width: 13px; height: 13px; }
.ds-dialog { padding: 0; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); width: min(440px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); color: var(--ds-text); background: var(--ds-surface); box-shadow: var(--ds-shadow-dialog); }
.ds-dialog::backdrop { background: #18232f55; }
.ds-dialog-head { padding: var(--ds-space-5) var(--ds-space-6); display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-4); border-bottom: 1px solid var(--ds-line); }
.ds-dialog-head h2 { margin: 2px 0 4px; }
.ds-dialog-body { padding: var(--ds-space-6); }
.ds-dialog-actions { padding: var(--ds-space-4) var(--ds-space-6); display: flex; justify-content: flex-end; gap: var(--ds-space-2); border-top: 1px solid var(--ds-line); }
.ds-tray { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(var(--ds-tray-width),100vw); max-width: 100vw; border-radius: 0; border: 0; border-left: 1px solid var(--ds-line); }
.ds-state { min-height: 300px; padding: var(--ds-space-10) var(--ds-space-6); display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.ds-state h3 { margin: 16px 0 6px; }
.ds-state p { color: var(--ds-muted); max-width: 340px; margin-bottom: 16px; }
.ds-state-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--ds-radius-lg); background: var(--ds-disabled-bg); color: var(--ds-muted); }
.ds-state[data-tone="danger"] .ds-state-icon { background: var(--ds-danger-bg); color: var(--ds-danger); }
.ds-spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ds-spin .8s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ds-spinner { animation: none; border-right-color: currentColor; } }
@media (forced-colors: active) { .ds-tab[aria-selected="true"],.ds-table tr[data-selected="true"] { outline: 2px solid Highlight; } .ds-badge { border: 1px solid CanvasText; } .ds-segmented button[aria-pressed="true"] { outline: 1px solid Highlight; } }
