:root {
    --ink: #101828;
    --muted: #667085;
    --subtle: #98a2b3;
    --line: #e4e7ec;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --soft: #f2f4f7;
    --accent: #6c5ce7;
    --accent-deep: #4f3ecf;
    --accent-soft: #f0edff;
    --success: #12b76a;
    --danger: #d92d20;
    --danger-soft: #fff1f0;
    --shadow: 0 24px 60px rgba(16, 24, 40, 0.11);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --page: min(1160px, calc(100% - 32px));
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(108, 92, 231, 0.08), transparent 30%),
        linear-gradient(180deg, #fbfcff 0%, #f8f9fc 100%);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 440px;
    height: 440px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.19;
    pointer-events: none;
}

.ambient-one {
    top: 80px;
    left: -220px;
    background: #8b7cf6;
}

.ambient-two {
    top: 440px;
    right: -250px;
    background: #5ad7c7;
}

.site-header {
    width: var(--page);
    margin: 0 auto;
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, var(--accent), var(--accent-deep));
    box-shadow: 0 10px 24px rgba(108, 92, 231, 0.28);
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
}

.brand-name {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.header-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.header-nav a:hover {
    color: var(--accent);
}

.header-nav .admin-link {
    padding: 9px 13px;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.page-shell {
    width: var(--page);
    margin: 0 auto;
    padding: 42px 0 72px;
}

.hero {
    max-width: 760px;
    margin: 36px auto 44px;
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    color: #344054;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
    font-size: 13px;
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(18, 183, 106, 0.1);
}

.hero h1 {
    margin: 24px 0 18px;
    font-size: clamp(45px, 7vw, 76px);
    line-height: 0.98;
    letter-spacing: -0.065em;
}

.hero h1 span {
    color: var(--accent);
}

.hero p {
    max-width: 610px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.mailbox-card,
.inbox-card {
    background: var(--surface);
    border: 1px solid rgba(228, 231, 236, 0.9);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.mailbox-card {
    padding: 30px;
    border-radius: var(--radius-xl);
}

.card-topline,
.inbox-header,
.inbox-title-row,
.mailbox-actions,
.dialog-header,
.sender-card,
.confirm-actions {
    display: flex;
    align-items: center;
}

.card-topline,
.inbox-header {
    justify-content: space-between;
    gap: 20px;
}

.section-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.card-topline h2,
.inbox-header h2 {
    margin: 0;
    letter-spacing: -0.035em;
}

.card-topline h2 {
    font-size: clamp(20px, 3vw, 27px);
}

.expiry-pill {
    min-width: 102px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: right;
    background: rgba(255, 255, 255, 0.72);
}

.expiry-pill span {
    display: block;
    color: var(--subtle);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.expiry-pill strong {
    font-size: 13px;
}

.address-box {
    margin-top: 24px;
    padding: 14px 14px 14px 20px;
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: #f8f7ff;
    border: 1px solid #d9d3ff;
    border-radius: 18px;
}

.address-status {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: clamp(16px, 3vw, 22px);
    font-weight: 750;
    letter-spacing: -0.025em;
}

.address-status > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-ring {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 7px rgba(18, 183, 106, 0.1);
}

.icon-button,
.button {
    border: 0;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.icon-button:hover,
.button:hover {
    transform: translateY(-1px);
}

.icon-button:disabled,
.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.icon-button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
}

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

.icon-button.primary,
.button.primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 10px 22px rgba(108, 92, 231, 0.22);
}

.icon-button.primary {
    padding: 0 17px;
}

.icon-button.primary:hover,
.button.primary:hover {
    background: var(--accent-deep);
}

.icon-button.plain {
    color: var(--muted);
    background: transparent;
}

.icon-button.danger-ghost {
    color: var(--danger);
    background: var(--danger-soft);
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
}

.button.secondary {
    color: #344054;
    background: #fff;
    border: 1px solid var(--line);
}

.button.secondary:hover {
    border-color: #c7cbd2;
    background: #fcfcfd;
}

.button.danger-ghost {
    color: var(--danger);
    background: transparent;
    border: 1px solid transparent;
}

.button.danger-ghost:hover {
    background: var(--danger-soft);
    border-color: #fecdca;
}

.button.danger {
    color: #fff;
    background: var(--danger);
}

.button.compact {
    min-height: 40px;
}

.mailbox-actions {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.custom-address-panel {
    margin-top: 18px;
    padding: 18px;
    display: flex;
    align-items: end;
    gap: 12px;
    background: var(--soft);
    border-radius: 16px;
}

.field-group {
    display: grid;
    gap: 7px;
}

.field-group.grow {
    flex: 1;
}

.field-group label {
    color: #475467;
    font-size: 12px;
    font-weight: 700;
}

.field-group input,
.field-group select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 11px;
    outline: none;
}

.field-group input:focus,
.field-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.inbox-card {
    margin-top: 24px;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.inbox-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--line);
}

.inbox-title-row {
    gap: 10px;
}

.inbox-title-row h2 {
    font-size: 25px;
}

.count-badge {
    min-width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    padding: 0 7px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.inbox-header p {
    margin: 6px 0 0;
    color: var(--subtle);
    font-size: 13px;
}

.inbox-content {
    min-height: 330px;
}

.inbox-empty {
    min-height: 330px;
    padding: 48px 24px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.empty-illustration {
    width: 100px;
    height: 82px;
    display: grid;
    place-items: center;
    color: #b7adff;
    background: linear-gradient(145deg, #faf9ff, #efedff);
    border-radius: 26px;
    transform: rotate(-2deg);
}

.empty-illustration svg {
    width: 74px;
    height: 62px;
    stroke-width: 2.2;
}

.inbox-empty h3 {
    margin: 23px 0 8px;
    font-size: 21px;
    letter-spacing: -0.025em;
}

.inbox-empty p {
    max-width: 450px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.waiting-line {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}

.waiting-line span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

.message-list {
    display: grid;
}

.message-row {
    width: 100%;
    padding: 18px 26px;
    display: grid;
    grid-template-columns: 44px minmax(130px, 0.8fr) minmax(220px, 1.8fr) auto;
    align-items: center;
    gap: 14px;
    color: inherit;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    text-align: left;
}

.message-row:last-child {
    border-bottom: 0;
}

.message-row:hover {
    background: #fafaff;
}

.message-avatar,
.sender-avatar {
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 800;
}

.message-avatar {
    width: 42px;
    height: 42px;
}

.message-from,
.message-preview {
    min-width: 0;
}

.message-from strong,
.message-preview strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-from strong {
    font-size: 14px;
}

.message-from span,
.message-preview span,
.message-time {
    color: var(--subtle);
    font-size: 12px;
}

.message-preview strong {
    font-size: 14px;
    margin-bottom: 5px;
}

.message-preview span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time {
    text-align: right;
}

.message-row.unseen .message-preview strong,
.message-row.unseen .message-from strong {
    color: #2d1eb0;
}

.loading-list {
    padding: 12px 24px;
}

.skeleton-row {
    height: 72px;
    margin: 10px 0;
    border-radius: 14px;
    background: linear-gradient(90deg, #f2f4f7 25%, #fafafa 50%, #f2f4f7 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

.features {
    margin-top: 52px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.features article {
    padding: 25px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.feature-number {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.features h3 {
    margin: 34px 0 8px;
    font-size: 18px;
}

.features p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.site-footer {
    width: var(--page);
    margin: 0 auto;
    padding: 28px 0 38px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--subtle);
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.site-footer p {
    margin: 0;
}

.site-footer div {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.site-footer a {
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent);
}

dialog {
    border: 0;
}

dialog::backdrop {
    background: rgba(16, 24, 40, 0.52);
    backdrop-filter: blur(5px);
}

.message-dialog {
    width: min(900px, calc(100% - 24px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(16, 24, 40, 0.28);
}

.dialog-shell {
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.dialog-header {
    padding: 18px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.dialog-heading {
    min-width: 0;
    flex: 1;
}

.dialog-heading span {
    display: block;
    color: var(--subtle);
    font-size: 11px;
    margin-bottom: 3px;
}

.dialog-heading h2 {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
}

.sender-card {
    margin: 18px 20px 0;
    padding: 13px;
    gap: 12px;
    background: var(--soft);
    border-radius: 14px;
}

.sender-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.sender-card div:last-child {
    min-width: 0;
}

.sender-card strong,
.sender-card span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sender-card strong {
    font-size: 14px;
}

.sender-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.otp-panel,
.attachments-panel {
    margin: 14px 20px 0;
    padding: 14px;
    border-radius: 14px;
}

.otp-panel {
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.attachments-panel {
    background: #f9fafb;
    border: 1px solid var(--line);
}

.otp-panel p,
.attachments-panel p {
    margin: 0 0 10px;
    color: #475467;
    font-size: 12px;
    font-weight: 700;
}

.otp-panel > div,
.attachments-panel > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.otp-code {
    padding: 8px 11px;
    color: #067647;
    background: #fff;
    border: 1px solid #6ce9a6;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 850;
    letter-spacing: 0.12em;
}

.attachment-link {
    padding: 8px 11px;
    color: #344054;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.message-frame {
    width: calc(100% - 40px);
    min-height: 390px;
    margin: 18px 20px 22px;
    flex: 1 1 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.confirm-dialog {
    width: min(420px, calc(100% - 28px));
    padding: 0;
    border-radius: 22px;
}

.confirm-shell {
    padding: 28px;
    text-align: center;
}

.confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    color: var(--danger);
    background: var(--danger-soft);
    border-radius: 16px;
}

.confirm-icon svg {
    width: 24px;
    height: 24px;
}

.confirm-shell h2 {
    margin: 18px 0 8px;
    font-size: 21px;
}

.confirm-shell p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.confirm-actions {
    margin-top: 24px;
    justify-content: center;
    gap: 10px;
}

.confirm-actions .button {
    min-width: 120px;
}

.toast-region {
    position: fixed;
    z-index: 100;
    right: 20px;
    bottom: 20px;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 240px;
    max-width: 380px;
    padding: 13px 15px;
    color: #fff;
    background: #101828;
    border-radius: 12px;
    box-shadow: 0 14px 35px rgba(16, 24, 40, 0.25);
    font-size: 13px;
    animation: toast-in 0.25s ease;
}

.toast.error {
    background: #b42318;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
}

.legal-page,
.maintenance-page,
.admin-page,
.install-page {
    background: #f8f9fc;
}

.legal-shell {
    width: min(760px, calc(100% - 32px));
    margin: 50px auto 90px;
    padding: 42px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.back-link {
    display: inline-block;
    margin-bottom: 34px;
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.legal-shell h1 {
    margin: 0;
    font-size: clamp(36px, 6vw, 54px);
    letter-spacing: -0.055em;
}

.legal-updated {
    margin: 10px 0 42px;
    color: var(--subtle);
    font-size: 13px;
}

.legal-shell h2 {
    margin: 32px 0 10px;
    font-size: 19px;
}

.legal-shell p {
    color: var(--muted);
    line-height: 1.75;
}

.maintenance-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.maintenance-card {
    max-width: 480px;
    padding: 48px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.maintenance-card .brand-mark {
    margin: 0 auto;
}

.maintenance-card h1 {
    margin: 24px 0 10px;
}

.maintenance-card p {
    color: var(--muted);
}

@media (max-width: 760px) {
    :root {
        --page: min(100% - 20px, 1160px);
    }

    .header-nav a:not(.admin-link) {
        display: none;
    }

    .page-shell {
        padding-top: 20px;
    }

    .hero {
        margin: 28px auto 32px;
    }

    .hero h1 {
        font-size: 48px;
    }

    .hero p {
        font-size: 16px;
    }

    .mailbox-card {
        padding: 20px;
        border-radius: 22px;
    }

    .card-topline {
        align-items: flex-start;
    }

    .card-topline h2 {
        max-width: 240px;
    }

    .address-box {
        align-items: stretch;
        flex-direction: column;
    }

    .address-status {
        min-height: 46px;
    }

    .icon-button.primary {
        width: 100%;
    }

    .mailbox-actions .button {
        flex: 1;
        min-width: 130px;
    }

    .custom-address-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .create-custom-button {
        width: 100%;
    }

    .inbox-header {
        padding: 20px;
    }

    .message-row {
        padding: 16px 18px;
        grid-template-columns: 40px 1fr auto;
    }

    .message-preview {
        grid-column: 2 / 4;
    }

    .message-time {
        grid-column: 3;
        grid-row: 1;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .features h3 {
        margin-top: 22px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .legal-shell {
        margin-top: 28px;
        padding: 28px 22px;
        border-radius: 22px;
    }
}

@media (max-width: 430px) {
    .hero h1 {
        font-size: 41px;
    }

    .expiry-pill {
        display: none !important;
    }

    .inbox-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .inbox-header .button {
        width: 100%;
    }

    .dialog-header {
        padding: 14px 12px;
    }

    .sender-card,
    .otp-panel,
    .attachments-panel {
        margin-left: 12px;
        margin-right: 12px;
    }

    .message-frame {
        width: calc(100% - 24px);
        margin-left: 12px;
        margin-right: 12px;
    }
}
