/* Amora — component styles. Uses only tokens from tokens.css. Prefix: am- */
:root { --am-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus-ring); --am-t: var(--duration-instant) var(--ease-standard); }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 24px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: border-box; }
.am-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.am-icon { flex: none; display: block; }
.am-spinner { flex: none; animation: am-spin .8s linear infinite; }
@keyframes am-spin { to { transform: rotate(360deg); } }
:where(.am-btn, .am-iconbtn, .am-link, .am-tab, .am-nav__item, .am-li, .am-card--interactive, .am-pages__num, .am-menu__item, .am-cal__day, .am-switch__track, .am-th-sort, .am-toast__action, .am-search__clear, .am-control__btn):focus-visible { outline: none; box-shadow: var(--am-ring); }

/* ---------- Button ---------- */
.am-btn { --h: var(--control-md); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--h); min-width: var(--touch-target); padding: 0 var(--space-5); border-radius: var(--radius-md); border: 1px solid transparent; font: inherit; font-size: 15px; line-height: 20px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color var(--am-t), border-color var(--am-t), color var(--am-t), transform var(--am-t); -webkit-tap-highlight-color: transparent; }
.am-btn:active:not(:disabled) { transform: scale(.98); }
.am-btn--sm { --h: var(--control-sm); padding: 0 var(--space-3); font-size: 14px; border-radius: var(--radius-sm); }
.am-btn--lg { --h: var(--control-lg); padding: 0 var(--space-6); font-size: 16px; }
.am-btn--full { width: 100%; }
.am-btn--primary { background: var(--accent); color: var(--on-accent); }
.am-btn--primary:hover { background: var(--accent-hover); }
.am-btn--primary:active { background: var(--accent-pressed); }
.am-btn--secondary { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.am-btn--secondary:hover { background: var(--bg-muted); }
.am-btn--secondary:active { background: var(--border); }
.am-btn--ghost { background: transparent; color: var(--accent-text); padding-left: var(--space-3); padding-right: var(--space-3); }
.am-btn--ghost:hover { background: var(--accent-subtle); }
.am-btn--ghost:active { background: var(--accent-subtle-hover); }
.am-btn--danger { background: var(--error-solid); color: var(--on-error); }
.am-btn--danger:hover { filter: brightness(.92); }
.am-btn:disabled { background: var(--bg-muted); color: var(--text-disabled); border-color: transparent; cursor: not-allowed; }
.am-btn--ghost:disabled { background: transparent; }
.am-btn.is-loading { cursor: progress; }

/* ---------- Icon Button ---------- */
.am-iconbtn { display: inline-grid; place-items: center; width: var(--touch-target); height: var(--touch-target); padding: 0; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; transition: background-color var(--am-t), color var(--am-t); }
.am-iconbtn:hover { background: var(--bg-muted); color: var(--text); }
.am-iconbtn:active { background: var(--border); }
.am-iconbtn--secondary { border-color: var(--border-strong); color: var(--text); }
.am-iconbtn--sm { width: var(--control-sm); height: var(--control-sm); }
.am-iconbtn:disabled { color: var(--text-disabled); background: transparent; cursor: not-allowed; }
.am-iconbtn[aria-expanded="true"] { background: var(--bg-muted); color: var(--text); }

/* ---------- Link ---------- */
.am-link { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 2px; cursor: pointer; }
.am-link:hover { text-decoration-thickness: 2px; color: var(--accent-hover); }
.am-link--standalone { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 600; text-decoration: none; min-height: var(--touch-target); }
.am-link--standalone:hover { text-decoration: underline; }
.am-link--quiet { color: var(--text-secondary); text-decoration: none; }
.am-link--quiet:hover { color: var(--text); text-decoration: underline; }

/* ---------- Field ---------- */
.am-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.am-label { font-size: 15px; line-height: 20px; font-weight: 500; color: var(--text); }
.am-optional { font-weight: 400; color: var(--text-secondary); }
.am-field__foot { display: flex; justify-content: space-between; gap: var(--space-3); }
.am-msg { display: flex; align-items: flex-start; gap: var(--space-1); margin: 0; font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.am-msg .am-icon { margin-top: 1px; }
.am-msg--error { color: var(--error-text); font-weight: 500; }
.am-msg--success { color: var(--success-text); }
.am-counter { font-size: 13px; line-height: 18px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-disabled .am-label { color: var(--text-disabled); }

.am-control { position: relative; display: flex; align-items: center; gap: var(--space-2); height: var(--control-md); padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg); color: var(--text-secondary); transition: border-color var(--am-t), box-shadow var(--am-t); }
.am-control--sm { height: var(--control-sm); border-radius: var(--radius-sm); }
.am-control--lg { height: var(--control-lg); }
.am-control:hover { border-color: var(--text-secondary); }
.am-control:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring); }
.am-control.is-error { border-color: var(--error-solid); box-shadow: 0 0 0 1px var(--error-solid); }
.am-control.is-success { border-color: var(--success-solid); }
.am-control.is-disabled { background: var(--bg-muted); border-color: var(--border); color: var(--text-disabled); }
.am-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); padding: 0; }
.am-input::placeholder { color: var(--text-tertiary); }
.am-input::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
[data-theme="dark"] .am-input::-webkit-calendar-picker-indicator { filter: invert(1); }
.am-input:disabled { color: var(--text-disabled); cursor: not-allowed; }
.am-control__ok { color: var(--success-text); }
.am-control--select { padding: 0; }
.am-control--select select { appearance: none; -webkit-appearance: none; padding: 0 calc(var(--space-3) + 28px) 0 var(--space-3); cursor: pointer; }
.am-control__chev { position: absolute; right: var(--space-3); pointer-events: none; }
.am-control__btn { display: grid; place-items: center; width: 36px; height: 36px; margin-right: -6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); cursor: pointer; }
.am-control__btn:hover { background: var(--bg-muted); color: var(--text); }
.am-textarea { width: 100%; min-height: 104px; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg); font: inherit; font-size: 16px; line-height: 24px; color: var(--text); resize: vertical; transition: border-color var(--am-t); }
.am-textarea::placeholder { color: var(--text-tertiary); }
.am-textarea:hover { border-color: var(--text-secondary); }
.am-textarea:focus { outline: 0; border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring); }
.am-textarea.is-error { border-color: var(--error-solid); box-shadow: 0 0 0 1px var(--error-solid); }
.am-textarea:disabled { background: var(--bg-muted); border-color: var(--border); color: var(--text-disabled); }

/* ---------- Checkbox / Radio / Switch ---------- */
.am-check { position: relative; display: grid; grid-template-columns: 20px 1fr; column-gap: var(--space-3); align-items: start; min-height: var(--touch-target); padding: 10px 0; }
.am-check__input { position: absolute; left: 0; top: 10px; width: 20px; height: 20px; margin: 0; opacity: 0; cursor: pointer; }
.am-check__box, .am-radio__dot { grid-column: 1; grid-row: 1; width: 20px; height: 20px; margin-top: 2px; display: grid; place-items: center; border: 1.5px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--bg); color: var(--on-accent); pointer-events: none; transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); }
.am-check__box .am-icon { opacity: 0; transform: scale(.6); transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); stroke-width: 3; }
.am-check__input:hover ~ .am-check__box, .am-check__input:hover ~ .am-radio__dot { border-color: var(--accent); }
.am-check__input:checked ~ .am-check__box, .am-check__input:indeterminate ~ .am-check__box { background: var(--accent); border-color: var(--accent); }
.am-check__input:checked ~ .am-check__box .am-icon, .am-check__input:indeterminate ~ .am-check__box .am-icon { opacity: 1; transform: none; }
.am-check__input:focus-visible ~ .am-check__box, .am-check__input:focus-visible ~ .am-radio__dot { box-shadow: var(--am-ring); }
.am-radio__dot { border-radius: var(--radius-full); }
.am-radio__dot::after { content: ""; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--on-accent); transform: scale(0); transition: transform var(--duration-fast) var(--ease-standard); }
.am-check__input:checked ~ .am-radio__dot { background: var(--accent); border-color: var(--accent); }
.am-check__input:checked ~ .am-radio__dot::after { transform: scale(1); }
.am-check__label { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 2px; font-size: 16px; line-height: 24px; color: var(--text); cursor: pointer; }
.am-check__desc { font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.am-check.is-error .am-check__box { border-color: var(--error-solid); border-width: 2px; }
.am-check.is-disabled .am-check__label { color: var(--text-disabled); cursor: not-allowed; }
.am-check.is-disabled .am-check__box, .am-check.is-disabled .am-radio__dot { border-color: var(--border); background: var(--bg-muted); }
.am-check.is-disabled .am-check__input { cursor: not-allowed; }
.am-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.am-fieldset legend { padding: 0; margin-bottom: var(--space-1); }
.am-radios--inline { display: flex; flex-wrap: wrap; column-gap: var(--space-6); }
.am-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--touch-target); padding: var(--space-2) 0; }
.am-switch__text { display: flex; flex-direction: column; gap: 2px; }
.am-switch__track { position: relative; flex: none; width: 52px; height: 32px; padding: 0; border: 0; border-radius: var(--radius-full); background: var(--border-strong); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard); }
.am-switch__track:hover { background: var(--text-secondary); }
.am-switch__thumb { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: var(--radius-full); background: var(--neutral-0); color: var(--neutral-500); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform var(--duration-fast) var(--ease-standard); }
.am-switch__thumb .am-icon { stroke-width: 2.5; width: 14px; height: 14px; }
.am-switch__track[aria-checked="true"] { background: var(--accent); }
.am-switch__track[aria-checked="true"]:hover { background: var(--accent-hover); }
.am-switch__track[aria-checked="true"] .am-switch__thumb { transform: translateX(20px); color: var(--amora-700); }
.am-switch.is-disabled .am-switch__track { background: var(--bg-muted); cursor: not-allowed; }
.am-switch.is-disabled .am-check__label { color: var(--text-disabled); }

/* ---------- Search ---------- */
.am-search { background: var(--bg-subtle); border-color: var(--border-strong); }
.am-search input::-webkit-search-cancel-button { display: none; }
.am-search__clear { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius-full); background: var(--bg-muted); color: var(--text-secondary); cursor: pointer; }
.am-search__clear:hover { color: var(--text); background: var(--border); }

/* ---------- Date ---------- */
.am-datewrap { position: relative; }
.am-datewrap .am-input { cursor: pointer; }
.am-popover { position: absolute; z-index: var(--z-dropdown); top: calc(100% + var(--space-2)); left: 0; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-3); animation: am-pop var(--duration-fast) var(--ease-enter); }
@keyframes am-pop { from { opacity: 0; transform: translateY(-4px); } }
.am-cal { width: 296px; }
.am-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.am-cal__title { font-weight: 600; font-size: 16px; text-transform: capitalize; }
.am-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.am-cal__dow { text-align: center; font-size: 13px; line-height: 28px; font-weight: 600; color: var(--text-secondary); }
.am-cal__day { height: 40px; border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; cursor: pointer; }
.am-cal__day:hover { background: var(--bg-muted); }
.am-cal__day.is-today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--border-strong); }
.am-cal__day.is-selected { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.am-cal__day:disabled { color: var(--text-disabled); text-decoration: line-through; cursor: not-allowed; background: transparent; }

/* ---------- File upload ---------- */
.am-drop { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-6) var(--space-4); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-subtle); text-align: center; cursor: pointer; transition: background-color var(--am-t), border-color var(--am-t); }
.am-drop:hover, .am-drop.is-dragging { border-color: var(--accent); background: var(--accent-subtle); }
.am-drop:focus-within { box-shadow: var(--am-ring); }
.am-drop.is-error { border-color: var(--error-solid); }
.am-drop.is-disabled { cursor: not-allowed; opacity: .6; }
.am-drop__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--space-1); border-radius: var(--radius-full); background: var(--bg); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--border); }
.am-drop__title { font-size: 16px; }
.am-drop__cta { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.am-drop__or { color: var(--text-secondary); }
.am-drop__hint { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.am-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.am-file { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); }
.am-file.is-error { border-color: var(--error-border); background: var(--error-bg); }
.am-file__icon { color: var(--text-secondary); }
.am-file__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.am-file__name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-file__meta { display: flex; align-items: center; gap: var(--space-1); font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.am-file__meta .am-icon { color: var(--success-text); }

/* ---------- Tabs ---------- */
.am-tabs { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.am-tabs--underline { box-shadow: inset 0 -1px 0 var(--border); gap: var(--space-6); }
.am-tab { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); height: var(--touch-target); padding: 0; border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: color var(--am-t); }
.am-tab__label::after { content: attr(data-text); display: block; height: 0; overflow: hidden; visibility: hidden; font-weight: 600; }
.am-tab:hover { color: var(--text); }
.am-tabs--underline .am-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transform: scaleX(0); transition: transform var(--duration-fast) var(--ease-standard); }
.am-tab.is-selected { color: var(--text); font-weight: 600; }
.am-tabs--underline .am-tab.is-selected::after { transform: none; }
.am-tab__count { min-width: 22px; padding: 0 6px; border-radius: var(--radius-full); background: var(--bg-muted); font-size: 12px; line-height: 20px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: center; }
.am-tab.is-selected .am-tab__count { background: var(--accent-subtle); color: var(--accent-text); }
.am-tabs--segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-md); background: var(--bg-muted); }
.am-tabs--segmented.am-tabs--full { display: flex; }
.am-tabs--segmented .am-tab { height: 38px; padding: 0 var(--space-4); border-radius: var(--radius-sm); justify-content: center; flex: 1; }
.am-tabs--segmented .am-tab.is-selected { background: var(--bg); box-shadow: var(--shadow-sm); }
.am-tabs--segmented .am-tab.is-selected:focus-visible { box-shadow: var(--am-ring); }

/* ---------- Navigation ---------- */
.am-nav__list { list-style: none; margin: 0; padding: 0; }
.am-nav--sidebar { display: flex; flex-direction: column; width: 240px; height: 100%; padding: var(--space-4) var(--space-3); background: var(--bg-subtle); border-right: 1px solid var(--border); }
.am-nav--sidebar .am-nav__list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.am-nav__header { padding: var(--space-1) var(--space-3) var(--space-5); }
.am-nav__footer { padding-top: var(--space-3); border-top: 1px solid var(--border); }
.am-nav__item { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch-target); padding: 0 var(--space-3); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 15px; font-weight: 500; text-decoration: none; transition: background-color var(--am-t), color var(--am-t); }
.am-nav__item:hover { background: var(--bg-muted); color: var(--text); }
.am-nav__item.is-current { background: var(--accent-subtle); color: var(--accent-text); font-weight: 600; }
.am-nav__icon { position: relative; display: grid; place-items: center; }
.am-nav__badge { position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full); background: var(--info-solid); color: var(--neutral-0); font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; box-shadow: 0 0 0 2px var(--bg-subtle); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .am-nav__badge { color: var(--info-900); }
.am-nav--bottom { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.am-nav--bottom .am-nav__list { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.am-nav--bottom .am-nav__item { flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: var(--space-1); border-radius: 0; font-size: 12px; line-height: 16px; background: transparent; }
.am-nav--bottom .am-nav__item:hover { background: transparent; }
.am-nav--bottom .am-nav__item.is-current { background: transparent; }
.am-nav--bottom .am-nav__item.is-current .am-nav__icon::before { content: ""; position: absolute; inset: -4px -14px; border-radius: var(--radius-full); background: var(--accent-subtle); z-index: -1; }
.am-nav--bottom .am-nav__icon { isolation: isolate; }
.am-nav--bottom .am-nav__badge { box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Breadcrumb ---------- */
.am-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 20px; }
.am-crumbs li { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--text-tertiary); }
.am-crumbs [aria-current] { color: var(--text); font-weight: 500; }
.am-crumbs__back { display: none; align-items: center; gap: var(--space-1); font-size: 15px; font-weight: 500; min-height: var(--touch-target); }

/* ---------- Pagination ---------- */
.am-pages { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.am-pages__total { font-size: 14px; color: var(--text-secondary); }
.am-pages__list { display: flex; align-items: center; gap: var(--space-1); }
.am-pages__num { min-width: 36px; height: 36px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; font-size: 15px; color: var(--text-secondary); font-variant-numeric: tabular-nums; cursor: pointer; }
.am-pages__num:hover { background: var(--bg-muted); color: var(--text); }
.am-pages__num.is-current { background: var(--accent-subtle); color: var(--accent-text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.am-pages__gap { width: 24px; text-align: center; color: var(--text-tertiary); }
.am-pages__compact { display: none; font-size: 15px; color: var(--text-secondary); font-variant-numeric: tabular-nums; padding: 0 var(--space-2); }

/* ---------- Card ---------- */
.am-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); color: inherit; text-decoration: none; }
.am-card--interactive { cursor: pointer; transition: border-color var(--am-t), background-color var(--am-t); }
.am-card--interactive:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.am-card.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.am-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.am-card__eyebrow { font-size: 13px; line-height: 18px; color: var(--text-secondary); margin-bottom: 2px; }
.am-card__title { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
.am-card__desc { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.am-card__chev { color: var(--text-tertiary); margin-top: 2px; }
.am-card__foot { display: flex; gap: var(--space-2); align-items: center; padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* ---------- Badge ---------- */
.am-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-xs); font-size: 13px; line-height: 16px; font-weight: 600; white-space: nowrap; background: var(--bg-muted); color: var(--text-secondary); }
.am-badge--accent { background: var(--accent-subtle); color: var(--accent-text); }
.am-badge--success { background: var(--success-bg); color: var(--success-text); }
.am-badge--warning { background: var(--warning-bg); color: var(--warning-text); }
.am-badge--error { background: var(--error-bg); color: var(--error-text); }
.am-badge--info { background: var(--info-bg); color: var(--info-text); }

/* ---------- Avatar ---------- */
.am-avatar { --s: 40px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: var(--radius-full); font-size: calc(var(--s) * .38); font-weight: 600; letter-spacing: .01em; user-select: none; }
.am-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.am-avatar--sm { --s: 32px; } .am-avatar--lg { --s: 56px; } .am-avatar--xl { --s: 80px; }
.am-avatar--t0 { background: var(--amora-100); color: var(--amora-800); }
.am-avatar--t1 { background: var(--info-100); color: var(--info-800); }
.am-avatar--t2 { background: var(--success-100); color: var(--success-800); }
.am-avatar--t3 { background: var(--warning-100); color: var(--warning-800); }
.am-avatar__status { position: absolute; right: 0; bottom: 0; width: 30%; height: 30%; min-width: 10px; min-height: 10px; border-radius: var(--radius-full); border: 2px solid var(--bg); }
.am-avatar__status.is-online { background: var(--success-solid); }
.am-avatar__status.is-away { background: var(--neutral-0); border-color: var(--neutral-500); }

/* ---------- List ---------- */
.am-list { list-style: none; margin: 0; padding: 0; }
.am-list__li + .am-list__li .am-li { box-shadow: inset 0 1px 0 var(--border); }
.am-list--inset { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.am-li { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 64px; padding: var(--space-3) var(--space-4); border: 0; background: transparent; font: inherit; text-align: left; color: inherit; text-decoration: none; }
.am-li--interactive { cursor: pointer; transition: background-color var(--am-t); }
.am-li--interactive:hover { background: var(--bg-subtle); }
.am-li.is-selected { background: var(--accent-subtle); }
.am-li.is-selected .am-li__title { color: var(--accent-text); }
.am-li__lead { flex: none; display: grid; place-items: center; color: var(--text-secondary); }
.am-li__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.am-li__title { display: flex; align-items: center; gap: var(--space-2); font-size: 16px; line-height: 24px; font-weight: 500; color: var(--text); }
.am-li.is-unread .am-li__title { font-weight: 700; }
.am-li__dot { flex: none; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--accent); }
.am-li__desc { font-size: 14px; line-height: 20px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-li__trail { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.am-li__meta { font-size: 13px; line-height: 18px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.am-li__chev { flex: none; color: var(--text-tertiary); }

/* ---------- Table ---------- */
.am-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.am-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 20px; }
.am-table thead th { position: sticky; top: 0; background: var(--bg-subtle); text-align: left; font-size: 13px; line-height: 16px; font-weight: 600; color: var(--text-secondary); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); white-space: nowrap; }
.am-table td, .am-table tbody th { padding: var(--space-4); border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-weight: 400; }
.am-table tbody th { font-weight: 500; }
.am-table tbody tr:last-child > * { border-bottom: 0; }
.am-table tbody tr:hover { background: var(--bg-subtle); }
.am-table tr.is-selected { background: var(--accent-subtle); }
.am-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.am-table--dense td, .am-table--dense tbody th { padding: var(--space-2) var(--space-4); }
.am-th-sort { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; border-radius: 2px; }
.am-th-sort:hover, .am-th-sort.is-on { color: var(--text); }
.am-th-sort__i { opacity: .5; transition: transform var(--duration-fast) var(--ease-standard); }
.am-th-sort.is-on .am-th-sort__i { opacity: 1; }
.am-th-sort__i.is-up { transform: rotate(180deg); }

/* ---------- Layers ---------- */
.am-layer { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--space-4); }
.am-scrim { position: absolute; inset: 0; background: var(--scrim); animation: am-fade var(--duration-base) var(--ease-enter); }
@keyframes am-fade { from { opacity: 0; } }
.am-dialog { position: relative; width: 100%; max-width: 480px; max-height: calc(100% - 32px); overflow: auto; display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-6); border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-lg); animation: am-rise var(--duration-base) var(--ease-enter); }
.am-dialog--md { max-width: 640px; }
@keyframes am-rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.am-dialog__head { display: flex; align-items: flex-start; gap: var(--space-4); }
.am-dialog__head > div { flex: 1; }
.am-dialog__icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-full); background: var(--error-bg); color: var(--error-text); }
.am-dialog__title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.am-dialog__desc { margin: var(--space-2) 0 0; color: var(--text-secondary); }
.am-dialog__close { margin: -10px -10px 0 0; }
.am-dialog__body { display: flex; flex-direction: column; gap: var(--space-4); }
.am-dialog__actions { display: flex; justify-content: flex-end; gap: var(--space-3); }
.am-sheet { position: absolute; display: flex; flex-direction: column; background: var(--surface-raised); box-shadow: var(--shadow-lg); }
.am-sheet--auto, .am-sheet--right { top: 0; right: 0; bottom: 0; width: min(480px, 100%); animation: am-slide-r var(--duration-slow) var(--ease-enter); }
.am-sheet--bottom { left: 0; right: 0; bottom: 0; max-height: 90%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; animation: am-slide-b var(--duration-slow) var(--ease-enter); }
@keyframes am-slide-r { from { transform: translateX(32px); opacity: 0; } }
@keyframes am-slide-b { from { transform: translateY(100%); } }
.am-sheet__grip { display: none; width: 40px; height: 4px; margin: var(--space-2) auto 0; border-radius: var(--radius-full); background: var(--border-strong); }
.am-sheet--bottom .am-sheet__grip { display: block; }
.am-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); }
.am-sheet__title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.am-sheet__body { flex: 1; overflow: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.am-sheet__foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); }

/* ---------- Dropdown ---------- */
.am-dd { position: relative; display: inline-block; }
.am-menu { position: absolute; z-index: var(--z-dropdown); top: calc(100% + var(--space-1)); left: 0; min-width: 220px; padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-raised); box-shadow: var(--shadow-md); animation: am-pop var(--duration-fast) var(--ease-enter); }
.am-dd--end .am-menu { left: auto; right: 0; }
.am-menu__item { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--touch-target); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-xs); background: transparent; font: inherit; font-size: 15px; color: var(--text); text-align: left; cursor: pointer; }
.am-menu__item .am-icon { color: var(--text-secondary); }
.am-menu__item:hover, .am-menu__item:focus-visible { background: var(--bg-muted); }
.am-menu__item.is-danger, .am-menu__item.is-danger .am-icon { color: var(--error-text); }
.am-menu__item.is-danger:hover { background: var(--error-bg); }
.am-menu__item:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.am-menu__hint { margin-left: auto; font-size: 13px; color: var(--text-tertiary); }
.am-menu__sep { height: 1px; margin: var(--space-1) 0; background: var(--border); }

/* ---------- Tooltip ---------- */
.am-tip { position: relative; display: inline-flex; }
.am-tip__bubble { position: absolute; z-index: var(--z-tooltip); left: 50%; bottom: calc(100% + 6px); max-width: 240px; width: max-content; padding: 6px 10px; border-radius: var(--radius-xs); background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 13px; line-height: 18px; font-weight: 500; pointer-events: none; opacity: 0; transform: translate(-50%, 4px); transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.am-tip__bubble--bottom { bottom: auto; top: calc(100% + 6px); transform: translate(-50%, -4px); }
.am-tip__bubble.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Alert ---------- */
.am-alert { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-5); border: 1px solid; border-radius: var(--radius-lg); }
.am-alert--info { background: var(--info-bg); border-color: var(--info-border); }
.am-alert--success { background: var(--success-bg); border-color: var(--success-border); }
.am-alert--warning { background: var(--warning-bg); border-color: var(--warning-border); }
.am-alert--error { background: var(--error-bg); border-color: var(--error-border); }
.am-alert--info .am-alert__icon { color: var(--info-text); }
.am-alert--success .am-alert__icon { color: var(--success-text); }
.am-alert--warning .am-alert__icon { color: var(--warning-text); }
.am-alert--error .am-alert__icon { color: var(--error-text); }
.am-alert__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.am-alert__title { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; color: var(--text); }
.am-alert__text { font-size: 15px; line-height: 22px; color: var(--text); }
.am-alert__action { margin-top: var(--space-2); }
.am-alert .am-iconbtn { margin: -8px -10px -8px 0; color: var(--text-secondary); }

/* ---------- Toast ---------- */
.am-toasts { position: fixed; z-index: var(--z-toast); right: var(--space-6); bottom: var(--space-6); display: flex; flex-direction: column; gap: var(--space-2); width: 380px; }
.am-toast { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-raised); box-shadow: var(--shadow-md); animation: am-rise var(--duration-base) var(--ease-enter); }
.am-toast--success .am-toast__icon { color: var(--success-text); }
.am-toast--error .am-toast__icon { color: var(--error-text); }
.am-toast--warning .am-toast__icon { color: var(--warning-text); }
.am-toast--info .am-toast__icon { color: var(--info-text); }
.am-toast__body { flex: 1; min-width: 0; }
.am-toast__title { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.am-toast__desc { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.am-toast__action { flex: none; height: 36px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.am-toast__action:hover { background: var(--accent-subtle); }

/* ---------- Progress ---------- */
.am-progress, .am-steps { display: flex; flex-direction: column; gap: var(--space-2); }
.am-progress__top { display: flex; justify-content: space-between; gap: var(--space-3); }
.am-progress__val { font-size: 14px; line-height: 20px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.am-progress__track { position: relative; height: 8px; border-radius: var(--radius-full); background: var(--bg-muted); overflow: hidden; }
.am-progress--sm .am-progress__track { height: 4px; }
.am-progress__fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--duration-base) var(--ease-standard); }
.am-progress--success .am-progress__fill { background: var(--success-solid); }
.am-progress--error .am-progress__fill { background: var(--error-solid); }
.am-progress__track.is-indeterminate .am-progress__fill { width: 35%; animation: am-indet 1.4s var(--ease-standard) infinite; }
@keyframes am-indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.am-steps__bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
.am-steps__bar li { height: 6px; border-radius: var(--radius-full); background: var(--bg-muted); }
.am-steps__bar li.is-done { background: var(--accent); }
.am-steps__bar li.is-current { background: var(--accent); opacity: .5; }

/* ---------- Skeleton ---------- */
.am-skel { display: block; background: var(--bg-muted); border-radius: var(--radius-sm); animation: am-pulse 1.6s ease-in-out infinite; }
.am-skel--text { height: 14px; margin: 5px 0; border-radius: var(--radius-xs); }
.am-skel--circle { border-radius: var(--radius-full); width: 40px; height: 40px; }
.am-skel--rect { width: 100%; height: 96px; border-radius: var(--radius-lg); }
.am-skel-lines { display: block; }
@keyframes am-pulse { 50% { opacity: .5; } }

/* ---------- Empty state ---------- */
.am-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-12) var(--space-4); max-width: 420px; margin: 0 auto; }
.am-empty__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--space-4); border-radius: var(--radius-full); background: var(--bg-muted); color: var(--text-secondary); }
.am-empty__title { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
.am-empty__desc { margin: var(--space-1) 0 0; color: var(--text-secondary); }
.am-empty__action { margin-top: var(--space-5); }


/* ---------- Motion ---------- */
.am-magnetic { display: inline-block; vertical-align: middle; transition: transform var(--duration-spring) var(--ease-spring); }
.am-magnetic--block { display: block; }
.am-magnetic.is-attracted { transition: transform var(--duration-instant) var(--ease-standard); will-change: transform; }
.am-success { position: relative; display: inline-grid; place-items: center; }
.am-success svg { display: block; overflow: visible; }
.am-success__disc { fill: var(--success-bg); stroke: var(--success-solid); stroke-width: 2; transform-origin: 24px 24px; animation: am-pop-in var(--duration-spring) var(--ease-spring-lively) both; }
.am-success__check { fill: none; stroke: var(--success-text); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: am-draw var(--duration-base) var(--ease-standard) 160ms forwards; }
.am-success.is-static .am-success__disc { animation: none; }
.am-success.is-static .am-success__check { animation: none; stroke-dashoffset: 0; }
@keyframes am-pop-in { from { transform: scale(.4); opacity: 0; } }
@keyframes am-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .am-magnetic { transform: none !important; }
  .am-success__disc { animation: none !important; }
  .am-success__check { animation: none !important; stroke-dashoffset: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .am-dialog__actions, .am-sheet__foot { flex-direction: column-reverse; }
  .am-dialog__actions .am-btn, .am-sheet__foot .am-btn { width: 100%; height: var(--control-lg); }
  .am-layer { place-items: end stretch; padding: 0; }
  .am-dialog { max-width: none; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); animation-name: am-slide-b; }
  .am-sheet--auto { top: auto; left: 0; width: auto; max-height: 90%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; animation-name: am-slide-b; }
  .am-sheet--auto .am-sheet__grip { display: block; }
  .am-toasts { left: var(--space-4); right: var(--space-4); bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }
  .am-crumbs ol { display: none; }
  .am-crumbs__back { display: inline-flex; }
  .am-pages__num, .am-pages__gap { display: none; }
  .am-pages__compact { display: inline; }
  .am-tip__bubble { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .am-spinner { animation: am-spin 1.6s linear infinite !important; }
  .am-btn:active:not(:disabled) { transform: none; }
}
