/* ==========================================================================
   Components — shared by marketing site, cloud console and CMS
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: .9375rem;
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-base), transform var(--dur-base) var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn .icon { width: 18px; height: 18px; }
.btn-sm { --btn-h: 34px; padding: 0 12px; font-size: .875rem; border-radius: var(--radius-sm); }
.btn-lg { --btn-h: 52px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 16px -6px rgba(42, 75, 224, .55); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { border-color: var(--color-text-muted); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #A61F17; }
.btn-danger-ghost { background: transparent; color: var(--color-error); }
.btn-danger-ghost:hover { background: var(--color-error-soft); }
.btn-light { background: #fff; color: var(--night-bg); }
.btn-light:hover { background: #E8ECF8; }
.btn-outline-light { background: rgba(255, 255, 255, .04); color: var(--night-text); border-color: var(--night-border-strong); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .1); }

.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; pointer-events: none; }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--color-border-strong); border-top-color: var(--color-primary); }

.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-sm); color: var(--color-text-secondary); display: inline-grid; place-items: center; }
.btn-icon:hover { background: var(--color-surface-sunken); color: var(--color-text); }
@media (pointer: coarse) { .btn-icon { width: 44px; min-height: 44px; } }

.link { color: var(--color-primary); font-weight: var(--fw-semibold); display: inline-flex; align-items: center; gap: 6px; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
.night .link { color: var(--night-primary); }

/* ---- Badges & chips ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-full); font-size: .75rem; font-weight: var(--fw-medium); white-space: nowrap; background: var(--color-surface-sunken); color: var(--color-text-secondary); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-error { background: var(--color-error-soft); color: var(--color-error); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-neutral { background: var(--color-surface-sunken); color: var(--color-text-secondary); }
.badge-outline { background: transparent; border: 1px solid var(--color-border-strong); }
.night .badge { background: rgba(255, 255, 255, .06); color: var(--night-text-muted); border: 1px solid var(--night-border); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: var(--radius-full); border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text-secondary); font-size: .9rem; font-weight: var(--fw-medium); white-space: nowrap; transition: all var(--dur-fast); }
.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--color-text); border-color: var(--color-text); color: #fff; }
.chip-count { font-size: .75rem; opacity: .7; }
.chip-rail { display: flex; gap: var(--space-xs); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; scrollbar-width: none; }
.chip-rail::-webkit-scrollbar { display: none; }
.chip-rail > * { scroll-snap-align: start; }

.kbd { font-family: var(--font-mono); font-size: .75rem; padding: 2px 6px; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--color-surface); color: var(--color-text-secondary); }

/* ---- Status indicator ---- */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: var(--fw-medium); color: var(--color-text-secondary); white-space: nowrap; }
.status-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-muted); flex: none; }
.status-success .status-dot { background: #12B76A; }
.status-success .status-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: rgba(18, 183, 106, .35); animation: pulse 2.4s var(--ease-out) infinite; }
.status-warning .status-dot { background: #F79009; }
.status-warning .status-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid rgba(247, 144, 9, .5); border-top-color: transparent; animation: spin 1s linear infinite; }
.status-error .status-dot { background: #F04438; }
.status-info .status-dot { background: #2E90FA; }
.status-primary .status-dot { background: var(--color-primary); }
.status-neutral .status-dot { background: #98A2B3; }

/* ---- Forms ---- */
.field { display: grid; gap: 6px; }
.field-label { font-size: .875rem; font-weight: var(--fw-semibold); color: var(--color-text); display: flex; align-items: center; gap: 6px; }
.field-label .req { color: var(--color-error); }
.field-hint { font-size: .8125rem; color: var(--color-text-muted); line-height: 1.6; }
.field-error { font-size: .8125rem; color: var(--color-error); font-weight: var(--fw-medium); display: flex; gap: 6px; align-items: center; }
.field-error:empty { display: none; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--dur-fast), box-shadow var(--dur-base);
}
.input::placeholder, .textarea::placeholder { color: #98A2B3; }
.input:hover, .select:hover, .textarea:hover { border-color: #AEB6CA; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--shadow-focus); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--color-surface-sunken); color: var(--color-text-muted); cursor: not-allowed; }
.input[readonly] { background: var(--color-surface-sunken); border-style: dashed; }
.textarea { min-height: 120px; resize: vertical; }
.textarea-code { font-family: var(--font-mono); font-size: .875rem; direction: ltr; text-align: left; }
.select { appearance: none; padding-inline-end: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea, .input[aria-invalid="true"] { border-color: var(--color-error); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px rgba(200, 40, 30, .2); }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: .9rem; border-radius: var(--radius-sm); }

.input-group { position: relative; display: flex; align-items: stretch; }
.input-group .input { flex: 1; }
.input-icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; width: 18px; height: 18px; }
.input-group .input-icon + .input { padding-inline-start: 40px; }
.input-affix { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--color-border-strong); background: var(--color-surface-sunken); color: var(--color-text-muted); font-family: var(--font-mono); font-size: .875rem; white-space: nowrap; }
.input-group .input-affix:last-child { border-inline-start: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .input:has(+ .input-affix) { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-action { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }

.check, .radio { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .9375rem; line-height: 1.5; }
.check input, .radio input { appearance: none; flex: none; width: 20px; height: 20px; margin-top: 2px; border: 1.5px solid var(--color-border-strong); background: var(--color-surface); display: grid; place-items: center; cursor: pointer; transition: all var(--dur-fast); }
.check input { border-radius: 6px; }
.radio input { border-radius: 50%; }
.check input::after { content: ""; width: 11px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur-fast) var(--ease-out); }
.radio input::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform var(--dur-fast) var(--ease-out); }
.check input:checked, .radio input:checked { background: var(--color-primary); border-color: var(--color-primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.radio input:checked::after { transform: scale(1); }
.check input:focus-visible, .radio input:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9375rem; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: var(--radius-full); background: var(--color-border-strong); position: relative; cursor: pointer; transition: background var(--dur-base); flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out); }
.switch input:checked { background: var(--color-primary); }
.switch input:checked::after { transform: translateX(-16px); }
.switch input:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

.form-grid { display: grid; gap: var(--space-md) var(--space-lg); }
@media (min-width: 768px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
.fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-lg); background: var(--color-surface); }
.fieldset legend { font-weight: var(--fw-semibold); padding-inline: 8px; margin-inline-start: -8px; }

/* ---- Segmented control ---- */
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--radius-md); background: var(--color-surface-sunken); border: 1px solid var(--color-border); }
.segmented button { min-height: 36px; padding: 0 14px; border-radius: 9px; font-size: .9rem; font-weight: var(--fw-medium); color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 6px; transition: all var(--dur-fast); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.night .segmented { background: rgba(255, 255, 255, .05); border-color: var(--night-border); }
.night .segmented button { color: var(--night-text-muted); }
.night .segmented button[aria-pressed="true"], .night .segmented button[aria-selected="true"] { background: var(--night-surface-2); color: var(--night-text); box-shadow: none; }

/* ---- Cards ---- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.card-pad { padding: clamp(18px, 2.5vw, 28px); }
.card-interactive { transition: border-color var(--dur-base), box-shadow var(--dur-base), transform var(--dur-base) var(--ease-out); }
.card-interactive:hover { border-color: rgba(42, 75, 224, .35); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.card-title { font-size: 1rem; font-weight: var(--fw-semibold); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: var(--space-xs); }
.card-night { background: var(--night-surface); border-color: var(--night-border); color: var(--night-text); }

.icon-tile { width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary); flex: none; }
.icon-tile.is-accent { background: var(--color-accent-soft); color: var(--color-accent); }
.icon-tile.is-teal { background: var(--color-teal-soft); color: var(--color-teal); }
.icon-tile.is-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.icon-tile.is-error { background: var(--color-error-soft); color: var(--color-error); }
.night .icon-tile { background: rgba(143, 166, 255, .1); color: var(--night-primary); border: 1px solid rgba(143, 166, 255, .18); }

/* ---- Tables ---- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: .9rem; }
.table th { position: sticky; top: 0; text-align: start; font-size: .8125rem; font-weight: var(--fw-semibold); color: var(--color-text-muted); background: #FAFBFD; padding: 12px 16px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: #FAFBFE; }
.table-compact td { padding-block: 10px; }
.table .cell-actions { text-align: end; white-space: nowrap; }
.table .cell-title { font-weight: var(--fw-semibold); color: var(--color-text); }
.table .cell-sub { display: block; font-size: .8125rem; color: var(--color-text-muted); font-weight: var(--fw-regular); }
.table th[aria-sort] button { display: inline-flex; gap: 4px; align-items: center; color: inherit; font-weight: inherit; }
@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
  .table-stack td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--color-text-muted); font-size: .8125rem; }
  .table-stack td.cell-primary { display: block; padding-bottom: 8px; }
  .table-stack td.cell-actions { justify-content: flex-start; padding-top: 10px; }
}

/* ---- Alerts ---- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid; font-size: .9375rem; line-height: 1.7; }
.alert .icon { margin-top: 3px; flex: none; }
.alert-title { font-weight: var(--fw-semibold); color: var(--color-text); }
.alert-body { flex: 1; min-width: 0; }
.alert-info { background: var(--color-info-soft); border-color: #BBDAF3; color: #0A4F87; }
.alert-success { background: var(--color-success-soft); border-color: #B7E3CB; color: #065C35; }
.alert-warning { background: var(--color-warning-soft); border-color: #F5D5A8; color: #8A3F07; }
.alert-error { background: var(--color-error-soft); border-color: #F4C1BC; color: #A0201A; }

/* ---- Modal (native dialog) ---- */
.modal { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; margin: auto; color: var(--color-text); overflow: visible; }
.modal::backdrop { background: rgba(6, 10, 28, .55); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in var(--dur-base) var(--ease-out); }
.modal[open]::backdrop { animation: fade-in var(--dur-base) var(--ease-out); }
.modal.is-closing { animation: modal-out 140ms var(--ease-in) forwards; }
.modal-panel { background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.modal-lg { max-width: min(860px, calc(100vw - 32px)); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-title { font-size: 1.15rem; font-weight: var(--fw-bold); }
.modal-body { padding: 16px 24px; overflow-y: auto; color: var(--color-text-secondary); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--color-border); background: #FBFCFE; }
.modal-confirm .modal-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--color-error-soft); color: var(--color-error); margin-bottom: 12px; }
@media (max-width: 479px) {
  .modal { margin: auto 0 0; max-width: 100vw; }
  .modal-panel { border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* ---- Dropdown ---- */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: var(--z-dropdown); min-width: 200px; max-width: calc(100vw - 32px); padding: 6px; background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); display: none; transform-origin: top left; }
.dropdown.is-open .dropdown-menu { display: block; animation: dropdown-in var(--dur-base) var(--ease-out); }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dropdown-menu.align-start { inset-inline-end: auto; inset-inline-start: 0; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--color-text); text-align: start; }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--color-surface-sunken); outline: none; }
.dropdown-item .icon { color: var(--color-text-muted); width: 18px; height: 18px; }
.dropdown-item.is-danger { color: var(--color-error); }
.dropdown-item.is-danger .icon { color: currentColor; }
.dropdown-sep { height: 1px; background: var(--color-border); margin: 6px 0; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; font-size: .9375rem; font-weight: var(--fw-medium); color: var(--color-text-muted); white-space: nowrap; transition: color var(--dur-fast); }
.tab:hover { color: var(--color-text); }
.tab::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-primary); transform: scaleX(0); transition: transform var(--dur-base) var(--ease-out); }
.tab[aria-selected="true"], .tab.is-active { color: var(--color-text); }
.tab[aria-selected="true"]::after, .tab.is-active::after { transform: scaleX(1); }
.tab .badge { height: 20px; padding: 0 7px; }
.tab-panel { padding-top: var(--space-lg); }
.tab-panel[hidden] { display: none; }
.tab-panel.is-entering { animation: fade-up var(--dur-slow) var(--ease-out); }

/* ---- Accordion ---- */
.accordion { border-top: 1px solid var(--color-border); }
.accordion-item { border-bottom: 1px solid var(--color-border); }
.accordion-item summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; cursor: pointer; font-size: 1.0625rem; font-weight: var(--fw-semibold); color: var(--color-text); }
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item summary:hover { color: var(--color-primary); }
.accordion-icon { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid var(--color-border-strong); transition: transform var(--dur-base) var(--ease-out), background var(--dur-fast); }
.accordion-icon::before, .accordion-icon::after { content: ""; position: absolute; top: 50%; left: 50%; width: 11px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); transition: transform var(--dur-base) var(--ease-out); }
.accordion-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.accordion-item[open] .accordion-icon { background: var(--color-text); color: #fff; border-color: var(--color-text); }
.accordion-item[open] .accordion-icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.accordion-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.accordion-item[open] .accordion-content { grid-template-rows: 1fr; }
.accordion-content > div { overflow: hidden; }
.accordion-content .prose { padding-bottom: 22px; max-width: 72ch; font-size: 1rem; }
.night .accordion, .night .accordion-item { border-color: var(--night-border); }
.night .accordion-item summary { color: var(--night-text); }

/* ---- Tooltip ---- */
.tooltip { position: fixed; z-index: var(--z-tooltip); max-width: 260px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--night-bg); color: #fff; font-size: .8125rem; line-height: 1.55; box-shadow: var(--shadow-md); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity var(--dur-fast), transform var(--dur-base) var(--ease-out); }
.tooltip.is-visible { opacity: 1; transform: none; }

/* ---- Toast ---- */
.toast-region { position: fixed; z-index: var(--z-toast); inset-inline-start: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column-reverse; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 479px) { .toast-region { inset-inline: 16px; width: auto; } }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 12px; border-radius: var(--radius-md); background: var(--night-bg); color: var(--night-text); box-shadow: var(--shadow-lg); border: 1px solid var(--night-border); animation: toast-in var(--dur-slow) var(--ease-out); font-size: .9375rem; line-height: 1.6; }
.toast.is-leaving { animation: toast-out 180ms var(--ease-in) forwards; }
.toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.toast-icon .icon { width: 14px; height: 14px; }
.toast-success .toast-icon { background: #12B76A; color: #fff; }
.toast-error .toast-icon { background: #F04438; color: #fff; }
.toast-info .toast-icon { background: #2E90FA; color: #fff; }
.toast-body { flex: 1; }
.toast-title { font-weight: var(--fw-semibold); display: block; }
.toast-close { color: var(--night-text-muted); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; flex: none; }
.toast-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---- Breadcrumb ---- */
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; padding: 0; font-size: .875rem; color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--color-border-strong); }
.breadcrumb [aria-current="page"] { color: var(--color-text); font-weight: var(--fw-medium); }
.night .breadcrumb ol { color: var(--night-text-muted); }
.night .breadcrumb [aria-current="page"] { color: var(--night-text); }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; font-size: .875rem; color: var(--color-text-muted); flex-wrap: wrap; }
.pagination-pages { display: flex; gap: 4px; }
.pagination-pages a, .pagination-pages span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.pagination-pages a:hover { border-color: var(--color-border-strong); }
.pagination-pages [aria-current="page"] { background: var(--color-text); color: #fff; }

/* ---- Empty / error states ---- */
.empty-state { display: grid; justify-items: center; text-align: center; gap: 10px; padding: clamp(40px, 7vw, 72px) 24px; }
.empty-art { position: relative; width: 96px; height: 96px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 24px; background: var(--color-surface); border: 1px dashed var(--color-border-strong); color: var(--color-primary); isolation: isolate; }
.empty-art::before { content: ""; position: absolute; inset: -18px; z-index: -1; background-image: linear-gradient(var(--color-border) 1px, transparent 1px), linear-gradient(90deg, var(--color-border) 1px, transparent 1px); background-size: 16px 16px; -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); mask-image: radial-gradient(circle, #000 30%, transparent 70%); }
.empty-art .icon { width: 40px; height: 40px; stroke-width: 1.5; }
.empty-art.is-error { color: var(--color-error); border-color: #F4C1BC; }
.empty-title { font-size: 1.125rem; font-weight: var(--fw-bold); }
.empty-text { color: var(--color-text-secondary); max-width: 420px; }
.empty-state .btn { margin-top: 10px; }
.empty-code { font-family: var(--font-mono); font-size: .75rem; color: var(--color-text-muted); }

/* ---- Skeleton ---- */
.skeleton { position: relative; overflow: hidden; background: #ECEFF5; border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent); animation: shimmer 1.4s infinite; }
.skeleton-text { height: 12px; margin-block: 6px; }
.skeleton-title { height: 20px; width: 45%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-block { height: 120px; border-radius: var(--radius-md); }

/* ---- Avatar ---- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--gradient-brand); color: #fff; font-weight: var(--fw-bold); font-size: .875rem; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }

/* ---- Meter / progress ---- */
.meter { height: 8px; border-radius: var(--radius-full); background: var(--color-surface-sunken); overflow: hidden; }
.meter-fill { height: 100%; width: var(--value, 0%); border-radius: inherit; background: var(--color-primary); transition: width 600ms var(--ease-out); }
.meter-fill.is-accent { background: var(--color-accent); }
.meter-fill.is-teal { background: var(--color-teal); }
.meter-fill.is-warning { background: #F79009; }
.meter-fill.is-error { background: #F04438; }
.meter-label { display: flex; justify-content: space-between; gap: 8px; font-size: .8125rem; color: var(--color-text-muted); margin-bottom: 6px; }
.meter-label strong { color: var(--color-text); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--color-border-strong); border-top-color: var(--color-primary); animation: spin .7s linear infinite; display: inline-block; }

/* ---- Keyframes ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes shimmer { to { transform: translateX(-100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-16px); } }
@keyframes dash { to { stroke-dashoffset: -24; } }
