/* ====================== Token ====================== */
:root {
    color-scheme: light dark;

    --bg: #f1f4fb;
    --bg-accent: #e6ebfb;
    --surface: #ffffff;
    --surface-alt: #f7f9fd;
    --text: #12172b;
    --muted: #5c6685;
    --border: #e3e8f3;
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-soft: #eef0ff;
    --accent: #06b6d4;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #047857;
    --success-soft: #ecfdf5;

    --radius-lg: 22px;
    --radius: 16px;
    --radius-sm: 12px;

    --shadow-sm: 0 2px 10px rgba(18, 23, 43, .06);
    --shadow: 0 16px 38px rgba(18, 23, 43, .10);
    --ring: 0 0 0 4px rgba(79, 70, 229, .18);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0f1d;
        --bg-accent: #121a33;
        --surface: #151b2e;
        --surface-alt: #1b2236;
        --text: #eef2ff;
        --muted: #9aa5c4;
        --border: #262e47;
        --brand: #7c83ff;
        --brand-dark: #6a71f0;
        --brand-soft: #1f2748;
        --danger-soft: #3a1d21;
        --success-soft: #14342a;
        --success: #34d399;
        --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
        --shadow: 0 16px 38px rgba(0, 0, 0, .38);
    }
}

/* ====================== Dasar ====================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 420px, var(--bg) 100%);
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

.muted {
    color: var(--muted);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 20;
    padding: 12px 18px;
    border-radius: 0 0 var(--radius-sm) 0;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
}

/* ====================== Hero ====================== */
.hero {
    padding: 40px 0 24px;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 30px 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--brand) 0%, #6d28d9 55%, var(--accent) 130%);
    color: #fff;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 10px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    opacity: .85;
}

.hero h1 {
    font-size: clamp(1.6rem, 5.6vw, 2.4rem);
    font-weight: 700;
}

.lead {
    margin-top: 12px;
    max-width: 48ch;
    font-size: 1rem;
    color: rgba(255, 255, 255, .88);
}

.hero-stats {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px 20px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .25);
    backdrop-filter: blur(6px);
    align-self: flex-start;
}

.count {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
}

.count-label {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .9;
}

/* ====================== Layout ====================== */
.layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
    padding-bottom: 48px;
}

.panel {
    min-width: 0;
}

.card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.card-sub {
    margin-top: 6px;
    margin-bottom: 18px;
    font-size: .92rem;
    color: var(--muted);
}

/* ====================== Form ====================== */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: .9rem;
    font-weight: 600;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 13px 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

textarea {
    min-height: 132px;
    resize: vertical;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: .8;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.counter {
    margin-top: 8px;
    font-size: .82rem;
    color: var(--muted);
}

.counter.is-low {
    color: var(--danger);
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 13px 22px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand) 0%, #6d28d9 100%);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(79, 70, 229, .28);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn:disabled {
    opacity: .7;
    cursor: progress;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ====================== Notifikasi ====================== */
.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    font-size: .9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.notice ul {
    margin: 0;
    padding-left: 18px;
}

.notice-error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(220, 38, 38, .28);
}

.notice-warn {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid rgba(5, 150, 105, .3);
    border-radius: var(--radius-sm);
    transition: opacity .4s ease, transform .4s ease;
}

.flash.is-hidden {
    opacity: 0;
    transform: translateY(-6px);
}

/* ====================== Daftar pesan ====================== */
.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.badge {
    padding: 5px 12px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 999px;
    white-space: nowrap;
}

.message-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.message {
    display: flex;
    gap: 14px;
    animation: rise .35s ease both;
}

.avatar {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
}

.message-body {
    min-width: 0;
    flex: 1 1 auto;
}

.message-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
}

.message-name {
    font-weight: 700;
    word-break: break-word;
}

.message-time {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}

.message-text {
    margin-top: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
    color: var(--text);
}

.empty {
    text-align: center;
    padding: 34px 20px;
}

.empty-title {
    margin-bottom: 6px;
    font-weight: 700;
}

/* ====================== Footer ====================== */
.site-footer {
    padding: 22px 0 34px;
    font-size: .86rem;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

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

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ====================== Layar besar ====================== */
@media (min-width: 720px) {
    .wrap {
        padding: 0 24px;
    }

    .hero {
        padding: 56px 0 28px;
    }

    .hero-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 32px;
        padding: 40px 36px;
    }

    .hero-stats {
        align-self: center;
        text-align: right;
    }

    .card {
        padding: 26px;
    }
}

@media (min-width: 960px) {
    .layout {
        grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
        gap: 30px;
        align-items: start;
    }

    .layout > .panel:first-child {
        position: sticky;
        top: 24px;
    }
}