.auth-page,
.accounts-page {
    padding: 2.5rem 0 3.5rem;
}

.auth-shell,
.accounts-shell {
    background: #f4f5f8;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1rem;
}

.auth-shell h1 {
    font-size: 2.1rem;
    margin-bottom: 1rem;
}

.auth-alert {
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid #d2d8e3;
    background: #f8fbff;
    color: #1b2f4a;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
}

.auth-alert.error {
    border-color: #f0b5b5;
    background: #fff2f2;
    color: #7f1d1d;
}

.auth-alert.success {
    border-color: #b9dfc0;
    background: #eefaf1;
    color: #14532d;
}

.auth-mobile-tabs {
    display: none;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.auth-mobile-tabs button {
    border: 1px solid #cfd8e6;
    background: #fff;
    color: #1a2332;
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
}

.auth-mobile-tabs button.active {
    background: #1a2332;
    color: #fff;
    border-color: #1a2332;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 640px;
    border-radius: 10px;
    overflow: hidden;
}

.auth-card {
    padding: 3.1rem 3rem 2.2rem;
}

.auth-card h2 {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
    font-family: var(--font-sans);
}

.auth-card p {
    margin-bottom: 1.6rem;
    color: var(--color-text-muted);
}

.auth-card-login {
    background: #fff;
}

.auth-card-signup {
    color: #fff;
    background: linear-gradient(135deg, #1a2332 0%, #2d3e54 46%, #3b5e86 100%);
}

.auth-card-signup h2,
.auth-card-signup p,
.auth-card-signup label,
.auth-card-signup .terms-check,
.auth-card-signup .terms-check a,
.auth-card-signup .show-pass {
    color: #fff;
}

.auth-card-signup input,
.auth-card-signup select {
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.95);
    color: #1a2332;
}

.auth-form {
    display: grid;
    gap: 0.8rem;
}

.auth-form label {
    font-size: 0.95rem;
    font-weight: 600;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.field-row a {
    font-size: 0.87rem;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 4.2rem;
}

.show-pass {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0.5rem;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.show-pass:hover {
    background: rgba(26, 35, 50, 0.07);
}

.terms-check {
    font-size: 0.9rem;
    color: #fff;
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
}

.terms-check input {
    width: auto;
    margin-top: 0.25rem;
}

.auth-cta {
    margin-top: 0.4rem;
    width: 100%;
    padding: 0.95rem 1rem;
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 700;
}

.verify-state {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    padding-top: 1rem;
}

.verify-state p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.7rem;
}

.auth-reset-box {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem;
}

.auth-reset-box h3 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    margin-bottom: 0.65rem;
}

.accounts-tabs-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--color-border);
    background: #fff;
    border-radius: 10px;
    padding: 0 0.75rem;
    margin-bottom: 1rem;
}

.accounts-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.35rem 0;
}

.accounts-tabs button {
    border: 0;
    background: transparent;
    color: #4f5f77;
    padding: 0.8rem 0.95rem;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
}

.accounts-tabs button:hover:not(.active) {
    color: #1a2332;
}

.accounts-tabs button.active {
    color: #1a2332;
    border-bottom-color: #1a2332;
}

.avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid #cfd8e6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1a2332;
    background: #f5f7fa;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.avatar-btn:hover {
    background: #e8edf6;
    border-color: #b0bdd0;
}

/* ── Avatar dropdown menu ───────────────────────────────────────────────────── */

.avatar-menu-wrap {
    position: relative;
}

.avatar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: #fff;
    border: 1px solid #d5dde8;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    z-index: 200;
    overflow: hidden;
    animation: dropdownFadeIn 0.12s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.avatar-dropdown-user {
    padding: 12px 14px 10px;
}

.avatar-dropdown-email {
    font-size: 0.82rem;
    color: #536177;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.avatar-dropdown-divider {
    border: 0;
    border-top: 1px solid #edf1f6;
    margin: 0;
}

.avatar-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 9px 14px;
    font-size: 0.9rem;
    color: #1a2332;
    cursor: pointer;
    transition: background 0.1s;
    font-weight: 500;
}

.avatar-dropdown-item:hover {
    background: #f4f7fb;
}

.avatar-dropdown-item--danger {
    color: #9a2a0e;
}

.avatar-dropdown-item--danger:hover {
    background: #fff2f2;
    color: #7f1d1d;
}

.accounts-top-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.accounts-panel {
    display: none;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.2rem;
}

.accounts-panel.active {
    display: block;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.panel-head h1,
.panel-head h2 {
    margin-bottom: 0;
    font-size: 2rem;
    font-family: var(--font-sans);
}

.panel-head-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.plan-pill {
    background: #edf3fb;
    color: #1b3657;
    border: 1px solid #d5e0f0;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    transition: background 0.2s, color 0.2s;
    font-size: 0.86rem;
    font-weight: 700;
}

.accounts-grid {
    display: grid;
    gap: 0.9rem;
}

.accounts-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.accounts-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-info-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem;
    background: #fff;
}

.account-info-card h3 {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    margin-bottom: 0.55rem;
}

.account-info-card p,
.account-info-card li,
.account-info-card small {
    color: #536177;
}

.account-info-card hr {
    margin: 0.85rem 0;
    border: 0;
    border-top: 1px solid #e5eaf2;
}

.usage-bar {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #e8edf6;
    border: 1px solid #d5e0f0;
    margin: 0.65rem 0;
}

.usage-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #1a2332, #3b5e86);
}

.compact-list {
    list-style: none;
}

.compact-list li {
    border-bottom: 1px solid #edf1f6;
    padding: 0.55rem 0;
    font-size: 0.93rem;
    color: #32445f;
}

.compact-list li:last-child {
    border-bottom: 0;
}

.danger-zone {
    border-color: #f0d8d8;
    background: #fff8f8;
}

.danger-zone h3 {
    color: #7f1d1d;
}

.danger-actions {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.7rem;
}

.empty-state {
    text-align: center;
    background: #fbfcfe;
}

/* ── Plan billing toggle ───────────────────────────────────────────────────── */

.billing-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.billing-toggle span { color: var(--text-muted, #6b7280); }
.billing-toggle span.active { color: var(--text, #111); font-weight: 600; }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider { background: #1a2332; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.save-badge {
    font-style: normal;
    font-size: 0.75rem;
    font-weight: 600;
    background: #edfaf2;
    color: #166534;
    border: 1px solid #b3dfc5;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    vertical-align: middle;
}

.plan-price-sub {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    margin-top: 0.1rem;
}

/* ── Plan cards ────────────────────────────────────────────────────────────── */

.plan-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem;
    background: #fff;
}

.plan-card.current {
    border-color: #1a2332;
    box-shadow: 0 0 0 2px rgba(26, 35, 50, 0.07);
}

.plan-card h3 {
    font-family: var(--font-sans);
    font-size: 1.3rem;
}

.plan-card ul {
    list-style: none;
    margin: 0.7rem 0;
}

.plan-card li {
    color: #4f5f77;
    margin-bottom: 0.35rem;
}

/* ── Status badges ─────────────────────────────────────────────────────────── */

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.status-draft  { background: #f0f2f5; color: #4f5f77; border: 1px solid #d8dfe9; }
.status-badge.status-sent   { background: #eef4ff; color: #1e4ea6; border: 1px solid #c3d6f7; }
.status-badge.status-paid   { background: #edfaf2; color: #166534; border: 1px solid #b3dfc5; }
.status-badge.status-overdue{ background: #fff4f0; color: #9a2a0e; border: 1px solid #f0c5b6; }
.status-badge.status-void    { background: #f9f9f9; color: #9aa3b0; border: 1px solid #e0e4ea; }
.status-badge.status-partial { background: #fffbea; color: #7a5a00; border: 1px solid #e8d48a; }

/* ── Invoice data table ────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.data-table th {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 2px solid #e5eaf2;
    color: #4f5f77;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 0.6rem;
    border-bottom: 1px solid #edf1f6;
    color: #1a2332;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: #f8fafc;
}

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-muted {
    color: #9aa3b0 !important;
}

.btn-muted:hover {
    color: #7f1d1d !important;
}

/* ── Stat value in summary cards ───────────────────────────────────────────── */

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--font-sans);
    margin: 0;
    color: #1a2332;
}

.stat-green { color: #166534; }
.stat-red   { color: #9a2a0e; }

/* ── accounts-grid four ─────────────────────────────────────────────────────── */

.accounts-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.9rem;
}

@media (max-width: 1024px) {
    .accounts-grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 540px) {
    .accounts-grid.four {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Recurring badge ────────────────────────────────────────────────────────── */

.recurring-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: #1e4ea6;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.btn-recurring-active {
    color: #1e4ea6 !important;
}

/* ── Plan badge (inline Pro label) ─────────────────────────────────────────── */

.plan-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #1a2332;
    color: #fff;
    vertical-align: middle;
    margin-left: 0.4rem;
    letter-spacing: 0.03em;
}

/* ── Partial payment balance note ───────────────────────────────────────────── */

.balance-note {
    font-size: 0.8rem;
    color: #536177;
    font-weight: 400;
}

/* ── Form hint ──────────────────────────────────────────────────────────────── */

.form-hint {
    font-size: 0.9rem;
    color: #536177;
    margin-bottom: 0.6rem;
}
.form-hint--error {
    color: var(--color-error, #c4423f);
    font-weight: 500;
}

/* ── clients list ───────────────────────────────────────────────────────────── */

.clients-list {
    list-style: none;
}

.client-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #edf1f6;
}

.client-item:last-child {
    border-bottom: 0;
}

.client-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.client-company,
.client-email {
    font-size: 0.88rem;
    color: #536177;
}

.client-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-danger {
    color: #9a2a0e !important;
}

.btn-danger:hover {
    color: #7f1d1d !important;
}

.admin-mini-table-wrap {
    overflow-x: auto;
}

.admin-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-mini-table th,
.admin-mini-table td {
    border-bottom: 1px solid #e8edf6;
    padding: 0.45rem 0.3rem;
    text-align: left;
}

.admin-mini-table select {
    width: 100%;
    font-size: 0.85rem;
}

/* ── Plan pill colour variants ──────────────────────────────────────────────── */

.plan-pill[data-plan="basic"] {
    background: #faf0ff;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.plan-pill[data-plan="pro"] {
    background: #1a2332;
    color: #ffffff;
    border-color: #1a2332;
}

/* ── Inline form (horizontal layout) ────────────────────────────────────────── */

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.7rem;
}

.inline-form label,
.inline-form .checkbox-label {
    flex: 0 0 auto;
}

/* ── Session/login list improvements ────────────────────────────────────────── */

.compact-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    flex-shrink: 0;
}

/* ── Password strength meter ────────────────────────────────────────────────── */

.pw-strength-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: -0.2rem;
}

.pw-strength-bar {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: #e5eaf2;
    overflow: hidden;
}

.pw-strength-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.pw-strength-label {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 4.5rem;
    text-align: right;
}

.pw-strength--weak   .pw-strength-bar span { width: 25%; background: #dc2626; }
.pw-strength--fair   .pw-strength-bar span { width: 50%; background: #f59e0b; }
.pw-strength--good   .pw-strength-bar span { width: 75%; background: #3b82f6; }
.pw-strength--strong .pw-strength-bar span { width: 100%; background: #16a34a; }

.pw-strength--weak   .pw-strength-label { color: #dc2626; }
.pw-strength--fair   .pw-strength-label { color: #d97706; }
.pw-strength--good   .pw-strength-label { color: #2563eb; }
.pw-strength--strong .pw-strength-label { color: #16a34a; }

/* On the dark signup card the bar background needs to lighten */
.auth-card-signup .pw-strength-bar {
    background: rgba(255, 255, 255, 0.25);
}

.auth-card-signup .pw-strength-label {
    color: inherit;
}

/* Password rules checklist */
.pw-rules {
    list-style: none;
    margin: -0.1rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
}

.pw-rules li {
    font-size: 0.8rem;
    color: #9aa3b0;
    padding-left: 1.1rem;
    position: relative;
    transition: color 0.2s;
}

.pw-rules li::before {
    content: '✕';
    position: absolute;
    left: 0;
    font-size: 0.7rem;
    font-weight: 700;
    color: #c0c8d4;
    transition: color 0.2s;
}

.pw-rules li.pw-rule-ok {
    color: #16a34a;
}

.pw-rules li.pw-rule-ok::before {
    content: '✓';
    color: #16a34a;
}

.auth-card-signup .pw-rules li { color: rgba(255,255,255,0.65); }
.auth-card-signup .pw-rules li::before { color: rgba(255,255,255,0.4); }
.auth-card-signup .pw-rules li.pw-rule-ok { color: #86efac; }
.auth-card-signup .pw-rules li.pw-rule-ok::before { color: #86efac; }

/* ─────────────────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .auth-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .accounts-grid.two,
    .accounts-grid.three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .auth-mobile-tabs {
        display: flex;
    }

    .auth-card {
        padding: 1.2rem;
    }

    .auth-card h2 {
        font-size: 1.8rem;
    }

    .auth-card[data-hidden="true"] {
        display: none;
    }

    .accounts-tabs-wrap {
        padding: 0 0.45rem;
    }

    .accounts-panel {
        padding: 0.85rem;
    }
}
