:root {
    --bg: #f0f4f9;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-deep: #1d4ed8;
    --danger: #dc2626;
    --warning: #f59e0b;
    --success: #16a34a;
    --shadow-sm: 0 12px 30px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 28px 60px rgba(37, 99, 235, 0.12);
    --radius-card: 20px;
    --radius-ui: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Plus Jakarta Sans", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 22rem),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.1), transparent 26rem),
        var(--bg);
    color: var(--text);
}

[v-cloak] {
    display: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
}

.login-layout {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 80px);
}

.login-card,
.panel,
.topbar,
.stat-card,
.modal-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
}

.eyebrow,
.stat-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.login-card h1,
.login-card h2,
.panel-heading h2,
.brand-title-row h1,
.modal-head h3 {
    margin: 0;
    line-height: 1.1;
}

.login-scene {
    position: relative;
    width: min(100%, 620px);
    padding: 28px;
}

.login-grid {
    position: absolute;
    inset: 10px;
    border-radius: 32px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.58)),
        linear-gradient(rgba(37, 99, 235, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.07) 1px, transparent 1px);
    background-size: auto, auto 22px, 22px auto;
    border: 1px solid rgba(255, 255, 255, 0.74);
    box-shadow: 0 40px 90px rgba(37, 99, 235, 0.12);
    opacity: 0.88;
}

.login-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(8px);
    animation: login-float 12s ease-in-out infinite;
    opacity: 0.9;
}

.login-orb-a {
    top: -10px;
    right: 26px;
    width: 110px;
    height: 110px;
    background: rgba(37, 99, 235, 0.26);
}

.login-orb-b {
    bottom: 34px;
    left: -4px;
    width: 160px;
    height: 160px;
    background: rgba(22, 163, 74, 0.15);
    animation-delay: -4s;
}

.login-orb-c {
    top: 50%;
    right: -18px;
    width: 72px;
    height: 72px;
    background: rgba(59, 130, 246, 0.2);
    animation-delay: -7s;
}

.login-orb-d {
    top: 28px;
    left: 40px;
    width: 22px;
    height: 22px;
    background: rgba(37, 99, 235, 0.42);
    box-shadow: 0 0 0 16px rgba(37, 99, 235, 0.07);
    animation-duration: 9s;
}

.login-card {
    padding: 32px;
}

.login-card-solo {
    position: relative;
    overflow: hidden;
    padding: 36px;
    backdrop-filter: blur(18px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88)),
        var(--surface);
    box-shadow: 0 28px 72px rgba(15, 23, 42, 0.14);
}

.login-card-solo::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 32%),
        radial-gradient(circle at bottom left, rgba(22, 163, 74, 0.08), transparent 28%);
    pointer-events: none;
}

.login-card-head p,
.panel-heading p,
.brand-copy p,
.modal-head p,
.modal-note,
.usage-meta span,
.usage-meta strong,
.empty-state p,
.panel-error,
.stat-card p {
    color: var(--muted);
}

.login-card-head p {
    margin: 12px 0 0;
}

.login-card-head {
    position: relative;
    z-index: 1;
}

.login-card-head h1 {
    margin-top: 0;
    font-size: clamp(1.55rem, 3.1vw, 2.15rem);
}

.login-form {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

.recaptcha-note {
    margin: -2px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.remember-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 600;
    user-select: none;
}

.remember-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

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

.field span {
    font-size: 0.92rem;
    font-weight: 600;
}

.field input,
.search-input,
.password-input-wrap,
.email-input-wrap {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-ui);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, width 0.25s ease, transform 0.2s ease;
}

.field input,
.password-input-wrap input,
.email-input-wrap input,
.search-input {
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    color: var(--text);
    outline: none;
}

.field input:focus,
.password-input-wrap:focus-within,
.email-input-wrap:focus-within,
.search-input:focus {
    border-color: rgba(37, 99, 235, 0.52);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.password-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.password-input-wrap input {
    border: 0;
    box-shadow: none;
    padding-right: 8px;
}

.password-toggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border: 0;
    border-left: 1px solid #e8edf5;
    background: #fff;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.18s ease, background 0.18s ease;
}

.password-toggle:hover {
    color: var(--accent);
    background: #f8fbff;
}

.password-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.inline-error,
.panel-error {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.18);
    color: var(--danger);
    font-size: 0.95rem;
}

.btn-primary,
.btn-outline,
.btn-ghost,
.btn-danger,
.btn-cancel,
.sort-btn,
.count-badge,
.domain-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-ui);
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn-primary,
.btn-outline,
.btn-ghost,
.btn-danger,
.btn-cancel,
.sort-btn {
    min-height: 44px;
    padding: 0 16px;
    border: 1.5px solid transparent;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #fff;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost,
.btn-cancel {
    background: #f8fafc;
    border-color: #e9eef5;
    color: var(--text);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.18);
    color: var(--danger);
}

.btn-primary:hover,
.btn-outline:hover,
.btn-ghost:hover,
.btn-danger:hover,
.btn-cancel:hover,
.sort-btn:hover {
    transform: translateY(-1px);
}

.btn-primary:disabled,
.btn-outline:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.btn-cancel:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.dashboard-layout {
    display: grid;
    gap: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
}

.brand-lockup,
.brand-title-row,
.topbar-actions,
.panel-header,
.panel-header-right,
.usage-meta,
.actions,
.modal-info-bar,
.modal-actions,
.pw-reveal {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup {
    gap: 16px;
}

.brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(22, 163, 74, 0.16));
    border: 1px solid rgba(37, 99, 235, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
}

.brand-logo.brand-logo-image {
    overflow: hidden;
    background: #fff;
}

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

.brand-copy h1 {
    font-size: 1.35rem;
}

.brand-copy p {
    margin: 6px 0 0;
}

.domain-pill,
.count-badge {
    min-height: 38px;
    padding: 0 14px;
    background: #f8fbff;
    border: 1.5px solid var(--border);
}

.count-badge.limit {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--danger);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.82), rgba(22, 163, 74, 0.62));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card strong {
    display: block;
    margin-top: 16px;
    font-size: 1.8rem;
}

.stat-card p {
    margin: 12px 0 0;
}

.stat-card.is-success strong {
    color: var(--success);
}

.stat-card.is-warning strong {
    color: var(--warning);
}

.stat-card.is-danger strong {
    color: var(--danger);
}

.panel {
    padding: 24px;
}

.panel-header {
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-heading p {
    margin: 8px 0 0;
}

.panel-header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    width: 220px;
    background: #fff;
}

.search-input:focus {
    width: 280px;
}

.sort-btn {
    background: #fff;
    border-color: var(--border);
    color: var(--muted);
}

.sort-btn.active {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.22);
    color: var(--accent);
}

.btn-icon {
    width: 46px;
    min-width: 46px;
    padding: 0;
}

.logout-btn {
    min-width: 132px;
}

.logout-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.refresh-icon {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--accent);
}

.refresh-icon.spinning {
    animation: refresh-spin 0.85s linear infinite;
}

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

.mailbox-table {
    width: 100%;
    border-collapse: collapse;
}

.mailbox-table th,
.mailbox-table td {
    padding: 18px 14px;
    border-top: 1px solid #edf2f7;
    vertical-align: middle;
}

.mailbox-table th {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

th:last-child,
td:last-child {
    text-align: right;
}

.email-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}

.email-cell code,
.pw-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.usage-cell {
    display: grid;
    gap: 10px;
}

.quota-bar-bg {
    width: min(280px, 100%);
    height: 12px;
    border-radius: 999px;
    background: #e6eefc;
    overflow: hidden;
}

.quota-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.quota-bar-fill.warn {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.quota-bar-fill.danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.usage-meta {
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.usage-meta strong {
    color: var(--text);
}

.actions {
    justify-content: flex-end;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 260px;
    text-align: center;
    padding: 24px;
}

.empty-icon {
    font-size: 2rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(14px);
    z-index: 50;
}

.modal-card {
    width: min(560px, 100%);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 24px;
    animation: modal-slide-up 0.22s ease;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-close {
    width: 42px;
    min-width: 42px;
    padding: 0;
    flex: 0 0 42px;
}

.modal-info-bar {
    flex-wrap: wrap;
    margin: 18px 0 22px;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid #e7eef8;
    color: var(--muted);
}

.email-input-wrap {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.email-input-wrap input {
    border: 0;
    box-shadow: none;
}

.email-suffix {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-left: 1.5px solid var(--border);
    background: #f8fafc;
    color: var(--muted);
    white-space: nowrap;
}

.modal-note {
    margin: 14px 0 0;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 24px;
}

.pw-reveal {
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #dbe8ff;
}

.pw-text {
    word-break: break-all;
    font-size: 1rem;
}

.copy-btn {
    border: 1.5px solid rgba(37, 99, 235, 0.16);
    border-radius: var(--radius-ui);
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent);
    font: inherit;
    font-weight: 700;
    padding: 10px 14px;
}

.copy-btn.copied {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.25);
    color: var(--success);
}

.swal2-popup {
    border-radius: 24px !important;
    border: 1.5px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: "Plus Jakarta Sans", sans-serif !important;
}

.swal2-title,
.swal2-html-container,
.swal2-footer {
    color: var(--text) !important;
}

.swal2-html-container {
    margin-top: 0.5rem !important;
}

.swal2-confirm,
.swal2-cancel {
    border-radius: var(--radius-ui) !important;
    font-weight: 700 !important;
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes login-float {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(0, -14px, 0) scale(1.05);
    }
}

@keyframes refresh-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .page-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 24px;
    }

    .topbar,
    .panel-header,
    .brand-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions,
    .panel-header-right,
    .modal-actions,
    .actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar-actions .logout-btn {
        width: auto;
        min-width: 0;
    }

    .search-input,
    .search-input:focus {
        width: 100%;
    }

    .quota-bar-bg {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .panel-header-right {
        gap: 10px;
    }

    .table-wrap {
        overflow: visible;
    }

    .mailbox-table,
    .mailbox-table tbody,
    .mailbox-table tr,
    .mailbox-table td {
        display: block;
        width: 100%;
    }

    .mailbox-table thead {
        display: none;
    }

    .mailbox-table tr {
        margin-bottom: 16px;
        border: 1px solid #edf2f7;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
        overflow: hidden;
    }

    .mailbox-table td {
        padding: 14px 16px;
        border-top: 1px solid #edf2f7;
        text-align: left !important;
    }

    .mailbox-table td:first-child {
        border-top: 0;
    }

    .mailbox-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 10px;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .email-cell {
        align-items: flex-start;
        gap: 10px;
    }

    .email-cell code {
        display: block;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .usage-cell {
        gap: 12px;
    }

    .usage-meta {
        gap: 6px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .actions .btn-outline,
    .actions .btn-danger {
        width: 100%;
    }

    .modal-overlay {
        padding: 12px;
        place-items: end center;
    }

    .modal-card {
        width: 100%;
        max-height: calc(100dvh - 24px);
        border-radius: 22px;
    }

    .modal-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .email-input-wrap {
        flex-direction: column;
    }

    .email-suffix {
        border-left: 0;
        border-top: 1.5px solid var(--border);
        justify-content: flex-start;
        padding: 12px 14px;
    }

    .modal-actions > * {
        flex: 1 1 auto;
    }

    .swal2-popup {
        width: calc(100% - 24px) !important;
        padding: 1.25rem !important;
    }

    .swal2-actions {
        width: 100% !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .swal2-confirm,
    .swal2-cancel {
        width: 100% !important;
        margin: 0 !important;
    }
}

@media (max-width: 560px) {
    .login-card,
    .panel,
    .modal-card,
    .topbar,
    .stat-card {
        padding: 20px;
    }

    .panel-header-right > * {
        width: 100%;
    }

    .panel-actions {
        width: 100%;
    }

    .panel-actions > * {
        flex: 1 1 auto;
    }

    .pw-reveal {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-btn,
    .btn-primary,
    .btn-outline,
    .btn-ghost,
    .btn-danger,
    .btn-cancel,
    .sort-btn {
        width: 100%;
    }

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