.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 52px;
    padding: 0 var(--sp-5);
    border-radius: var(--r-md);
    font-size: var(--step-0);
    font-weight: 600;
    transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease),
        opacity var(--dur-2) var(--ease);
    -webkit-user-select: none;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.985);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn--primary,
.btn--accent {
    background: var(--ink);
    color: #fff;
}

.btn--soft {
    background: var(--surface);
    color: var(--ink);
}

.btn--ghost {
    background: var(--surface);
    color: var(--graphite);
}

.btn--danger {
    background: var(--signal-soft);
    color: var(--signal);
}

.btn--block {
    width: 100%;
}

.btn--sm {
    min-height: 40px;
    padding: 0 var(--sp-4);
    font-size: var(--step--1);
    border-radius: var(--r-sm);
}

.btn--loading {
    color: transparent;
    pointer-events: none;
}

.btn--loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: spin 620ms linear infinite;
}

.btn--soft.btn--loading::after,
.btn--ghost.btn--loading::after {
    border-color: rgba(0, 0, 0, 0.18);
    border-top-color: var(--ink);
}

.icon-btn {
    width: 36px;
    height: 36px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    color: var(--graphite);
    transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease);
}

.icon-btn:active {
    transform: scale(0.92);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn--filled {
    background: var(--ink);
    color: #fff;
}

.card {
    background: var(--surface);
    border: 0;
    border-radius: var(--r-md);
    padding: var(--sp-4);
}

.card--flat {
    background: var(--surface);
}

.card--notch {
    border-radius: var(--r-md);
}

.panel {
    background: var(--surface);
    border-radius: var(--r-md);
    overflow: hidden;
}

.panel__row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    min-height: 56px;
    position: relative;
    transition: background var(--dur-1) var(--ease);
}

.panel__row + .panel__row::before {
    content: "";
    position: absolute;
    left: var(--sp-4);
    right: 0;
    top: 0;
    height: 1px;
    background: var(--line);
}

.panel__row--tappable:active {
    background: var(--surface-strong);
}

.panel__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.panel__label strong {
    font-weight: 600;
}

.panel__hint {
    font-size: var(--step--1);
    color: var(--muted);
    line-height: 1.3;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 var(--sp-4);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: var(--step--1);
    font-weight: 500;
    color: var(--graphite);
    white-space: nowrap;
    transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease),
        color var(--dur-2) var(--ease);
}

.chip:active {
    transform: scale(0.96);
}

.chip--active {
    background: var(--ink);
    color: #fff;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-xs);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.badge--accent {
    background: var(--accent-soft);
    color: var(--accent-deep);
}

.badge--signal {
    background: var(--signal-soft);
    color: var(--signal);
}

.badge--amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.badge--neutral {
    background: var(--surface);
    color: var(--graphite);
}

.field {
    display: grid;
    gap: 6px;
}

.field__label {
    font-size: var(--step--1);
    font-weight: 500;
    color: var(--muted);
}

.field__control {
    width: 100%;
    min-height: 50px;
    padding: 13px var(--sp-4);
    border-radius: var(--r-md);
    border: 1px solid transparent;
    background: var(--surface);
    transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}

.field__control:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--paper);
}

.field__control::placeholder {
    color: var(--faint);
}

textarea.field__control {
    min-height: 96px;
    resize: vertical;
    line-height: 1.45;
}

.field__error {
    font-size: var(--step--1);
    color: var(--signal);
}

.field--invalid .field__control {
    border-color: var(--signal);
}

.switch {
    position: relative;
    flex: none;
    width: 50px;
    height: 30px;
    border-radius: var(--r-pill);
    background: var(--line-strong);
    transition: background var(--dur-2) var(--ease);
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform var(--dur-2) var(--ease-out);
}

.switch--on {
    background: var(--accent);
}

.switch--on::after {
    transform: translateX(20px);
}

.avatar {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--graphite);
    font-size: var(--step-0);
    font-weight: 600;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar--lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: var(--step-1);
}

.toasts {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: calc(var(--safe-top) + 10px);
    z-index: 60;
    width: min(calc(100% - var(--gutter) * 2), 420px);
    display: grid;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 12px var(--sp-4);
    border-radius: var(--r-md);
    background: var(--ink);
    color: #fff;
    font-size: var(--step--1);
    animation: toast-in var(--dur-3) var(--ease-out) both;
}

.toast--error {
    background: var(--signal);
}

.toast--success {
    background: var(--accent-deep);
}

.toast__dot {
    display: none;
}

.sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sheet__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    animation: fade-in var(--dur-2) var(--ease) both;
}

.sheet__body {
    position: relative;
    width: min(100%, 560px);
    max-height: 90dvh;
    overflow-y: auto;
    padding: var(--sp-4) var(--gutter) calc(var(--safe-bottom) + var(--sp-6));
    background: var(--paper);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: sheet-up var(--dur-3) var(--ease-out) both;
}

.sheet__grip {
    width: 36px;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--line-strong);
    margin: 0 auto var(--sp-4);
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--r-sm);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(255, 255, 255, 0.8) 50%,
        transparent 80%
    );
    animation: sweep 1.3s var(--ease) infinite;
}

.empty {
    display: grid;
    justify-items: center;
    gap: var(--sp-3);
    padding: var(--sp-8) var(--sp-4);
    text-align: center;
}

.empty__mark {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface);
    display: grid;
    place-items: center;
    color: var(--muted);
}

.empty__mark svg {
    width: 26px;
    height: 26px;
    stroke-width: 1.6;
}

.empty strong {
    font-size: var(--step-2);
    font-weight: 700;
}

.splash {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: var(--paper);
}

.splash__inner {
    display: grid;
    justify-items: center;
    gap: var(--sp-4);
}

.splash__glyph {
    width: 56px;
    height: 56px;
    border-radius: var(--r-md);
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: var(--step-2);
    font-weight: 700;
    animation: breathe 1.8s var(--ease) infinite;
}

.splash__bar {
    width: 110px;
    height: 2px;
    border-radius: var(--r-pill);
    background: var(--line);
    overflow: hidden;
}

.splash__bar::after {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    background: var(--ink);
    animation: slide 1.15s var(--ease) infinite;
}

.panel__row > a > svg,
.panel__row > span > svg {
    flex: none;
}

.empty svg,
.gate svg {
    flex: none;
}

.empty__mark--emoji {
    font-size: 30px;
    line-height: 1;
    background: var(--surface);
    animation: breathe 2.6s var(--ease) infinite;
}

.empty__mark--emoji svg {
    display: none;
}
