/*
 * account.css — shared styling for the authenticated account pages.
 *
 * Loaded alongside app.css, which owns the :root design tokens. Every
 * class here is namespaced ac- so nothing collides with the dashboard's
 * own components. Mobile-first, single column, max 640px so it reads well
 * on a phone and stays centred on a desktop.
 */

/*
 * Every ac- class below sets its own `display`, and a class beats the
 * browser's built-in `[hidden] { display: none }`. Without this line a page
 * that hides a row or a spinner with `el.hidden = true` gets no effect at all
 * — that is how a loading spinner ended up sitting under a loaded form, and
 * how the SMS row showed up on a build with no SMS gateway.
 */
[hidden] {
    display: none !important;
}

.ac-page {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--night);
    border-left: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
    position: relative;
    padding-bottom: 3rem;
}

/* ---- Top bar ---------------------------------------------------------- */

.ac-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 3.5rem;
    padding: 0 0.75rem;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hairline);
}

.ac-back {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 1px solid var(--hairline);
    background: var(--rail);
    color: var(--porcelain);
    font-size: 1.25rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.ac-back:hover {
    background: var(--rail-high);
    border-color: var(--sodium-deep);
}

.ac-bar__title {
    flex: 1;
    min-width: 0;
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--porcelain);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-bar__action {
    flex: none;
    background: none;
    border: none;
    color: var(--sodium);
    font-family: var(--body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
}

.ac-bar__action:disabled {
    color: var(--graphite-dim);
    cursor: default;
}

/* ---- Body ------------------------------------------------------------- */

.ac-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.ac-section-label {
    font-family: var(--body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--graphite-dim);
    margin: 0.85rem 0 0.5rem 0.15rem;
}

.ac-card {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.ac-card--flush {
    padding: 0;
    overflow: hidden;
}

/* ---- Inline alert / toast -------------------------------------------- */

.ac-alert {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    transition: max-height 0.25s var(--ease), opacity 0.25s var(--ease),
        padding 0.25s var(--ease), margin-top 0.25s var(--ease);
    padding: 0 0.9rem;
}

.ac-alert.is-show {
    max-height: 6rem;
    opacity: 1;
    padding: 0.7rem 0.9rem;
    margin-top: 0.75rem;
}

.ac-alert.is-success {
    background: color-mix(in srgb, #46d17f 18%, var(--panel));
    color: #8ff0b6;
    border: 1px solid color-mix(in srgb, #46d17f 40%, transparent);
}

.ac-alert.is-error {
    background: color-mix(in srgb, var(--filament) 16%, var(--panel));
    color: var(--sodium-pale);
    border: 1px solid color-mix(in srgb, var(--filament) 45%, transparent);
}

/* ---- Form fields ------------------------------------------------------ */

.ac-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.ac-field:last-child {
    margin-bottom: 0;
}

.ac-label {
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--porcelain);
}

.ac-opt {
    color: var(--graphite-dim);
    font-weight: 400;
    font-size: 0.78rem;
}

.ac-input,
textarea.ac-input {
    width: 100%;
    background: var(--rail);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    color: var(--porcelain);
    font-family: var(--body);
    font-size: 1rem;
    padding: 0.7rem 0.85rem;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

textarea.ac-input {
    resize: vertical;
    min-height: 4.5rem;
}

.ac-input::placeholder {
    color: var(--graphite-dim);
}

.ac-input:focus {
    outline: none;
    border-color: var(--sodium);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sodium) 22%, transparent);
}

.ac-input:disabled {
    color: var(--graphite);
    background: color-mix(in srgb, var(--rail) 60%, var(--night));
}

.ac-hint {
    font-size: 0.78rem;
    color: var(--graphite);
    line-height: 1.4;
}

/* ---- Buttons ---------------------------------------------------------- */

.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--body);
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius);
    padding: 0.75rem 1.1rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s var(--ease), background 0.15s var(--ease),
        border-color 0.15s var(--ease), opacity 0.15s var(--ease);
}

.ac-btn:active {
    transform: translateY(1px);
}

.ac-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

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

.ac-btn--primary {
    background: var(--sodium);
    color: var(--night);
}

.ac-btn--primary:hover:not(:disabled) {
    background: var(--sodium-pale);
}

.ac-btn--ghost {
    background: transparent;
    border-color: var(--hairline);
    color: var(--porcelain);
}

.ac-btn--ghost:hover:not(:disabled) {
    border-color: var(--sodium-deep);
    background: var(--rail);
}

.ac-btn--danger {
    background: transparent;
    border-color: color-mix(in srgb, var(--filament) 55%, transparent);
    color: var(--filament);
}

.ac-btn--danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--filament) 14%, transparent);
}

/* ---- List rows (menu style) ------------------------------------------ */

.ac-list {
    display: flex;
    flex-direction: column;
}

.ac-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--hairline);
    color: var(--porcelain);
    text-decoration: none;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    font-family: var(--body);
    font-size: 0.95rem;
    cursor: pointer;
}

.ac-row:last-child {
    border-bottom: none;
}

.ac-row--link:hover {
    background: var(--rail);
}

.ac-row__icon {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: var(--radius);
    background: var(--rail-high);
}

.ac-row__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ac-row__label {
    font-weight: 600;
}

.ac-row__sub {
    font-size: 0.8rem;
    color: var(--graphite);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-row__value {
    flex: none;
    color: var(--graphite);
    font-size: 0.88rem;
}

.ac-row__chevron {
    flex: none;
    color: var(--graphite-dim);
    font-size: 1.1rem;
}

/* ---- Status pills ----------------------------------------------------- */

.ac-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--data);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.ac-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

.ac-pill--off {
    color: var(--filament);
    background: color-mix(in srgb, var(--filament) 14%, transparent);
    border-color: color-mix(in srgb, var(--filament) 40%, transparent);
}

.ac-pill--on {
    color: #57d98a;
    background: color-mix(in srgb, #46d17f 14%, transparent);
    border-color: color-mix(in srgb, #46d17f 40%, transparent);
}

.ac-pill--reported {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}

.ac-pill--progress {
    color: var(--coast);
    background: color-mix(in srgb, var(--coast) 14%, transparent);
    border-color: color-mix(in srgb, var(--coast) 40%, transparent);
}

.ac-pill--resolved {
    color: var(--graphite);
    background: color-mix(in srgb, var(--graphite) 14%, transparent);
    border-color: color-mix(in srgb, var(--graphite) 35%, transparent);
}

/* ---- Toggle switch ---------------------------------------------------- */

.ac-switch {
    flex: none;
    position: relative;
    display: inline-block;
    width: 2.9rem;
    height: 1.6rem;
    cursor: pointer;
}

.ac-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ac-switch__track {
    position: absolute;
    inset: 0;
    background: var(--rail-high);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.ac-switch__track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.2rem;
    transform: translateY(-50%);
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: var(--porcelain);
    transition: transform 0.18s var(--ease);
}

.ac-switch input:checked + .ac-switch__track {
    background: var(--sodium);
    border-color: var(--sodium);
}

.ac-switch input:checked + .ac-switch__track::after {
    transform: translate(1.3rem, -50%);
    background: var(--night);
}

/* ---- Avatar picker ---------------------------------------------------- */

.ac-ava-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
    gap: 0.85rem;
}

.ac-ava {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--hairline);
    background: var(--rail);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s var(--ease), transform 0.1s var(--ease);
    position: relative;
}

.ac-ava:hover {
    transform: translateY(-2px);
}

.ac-ava img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ac-ava__letter {
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--sodium);
}

.ac-ava.is-selected {
    border-color: var(--sodium);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sodium) 30%, transparent);
}

.ac-ava.is-selected::after {
    content: "\2713";
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: var(--sodium);
    color: var(--night);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--panel);
}

/* ---- Big status card (my-zone / notifications) ----------------------- */

.ac-status {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.15rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--hairline);
    background: var(--panel);
}

.ac-status--off {
    background: color-mix(in srgb, var(--filament) 10%, var(--panel));
    border-color: color-mix(in srgb, var(--filament) 35%, transparent);
}

.ac-status--on {
    background: color-mix(in srgb, #46d17f 9%, var(--panel));
    border-color: color-mix(in srgb, #46d17f 30%, transparent);
}

.ac-status__message {
    font-family: var(--body);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--porcelain);
    line-height: 1.4;
}

.ac-status__meta {
    font-family: var(--data);
    font-size: 0.8rem;
    color: var(--graphite);
}

.ac-progress {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--rail-high);
    overflow: hidden;
}

.ac-progress__fill {
    height: 100%;
    background: var(--coast);
    border-radius: 999px;
    transition: width 0.4s var(--ease);
}

/* ---- Empty / loading states ------------------------------------------ */

.ac-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
    padding: 3rem 1.5rem;
    color: var(--graphite);
}

.ac-state__icon {
    font-size: 2.4rem;
    opacity: 0.7;
}

.ac-state__title {
    font-family: var(--display);
    font-size: 1.1rem;
    color: var(--porcelain);
}

.ac-state__text {
    font-size: 0.9rem;
    max-width: 24rem;
    line-height: 1.5;
}

.ac-spinner {
    width: 1.6rem;
    height: 1.6rem;
    border: 2px solid var(--hairline);
    border-top-color: var(--sodium);
    border-radius: 50%;
    animation: ac-spin 0.7s linear infinite;
}

@keyframes ac-spin {
    to {
        transform: rotate(360deg);
    }
}

.ac-meta {
    font-family: var(--data);
    font-size: 0.78rem;
    color: var(--graphite-dim);
}

@media (prefers-reduced-motion: reduce) {
    .ac-spinner {
        animation-duration: 2s;
    }
    .ac-btn:active {
        transform: none;
    }
}
