* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    color: #e9f7ff;
    background:
      radial-gradient(circle at 18% 15%, rgba(255, 0, 179, 0.16), transparent 28%),
      radial-gradient(circle at 82% 18%, rgba(0, 255, 255, 0.12), transparent 28%),
      radial-gradient(circle at 50% 82%, rgba(90, 0, 255, 0.18), transparent 30%),
      linear-gradient(180deg, #050814 0%, #090d1c 100%);
    background-attachment: fixed;
    color-scheme: dark;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
      linear-gradient(rgba(0,255,255,0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,255,255,0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), rgba(0,0,0,0.18));
}

:root {
    --primary: #19f5ff;
    --primary-hover: #64f8ff;
    --secondary: #161f35;
    --secondary-hover: #242f4d;
    --muted-color: #8ea3c5;
    --background-color: transparent;
    --color: #e9f7ff;
    --card-background-color: rgba(8, 13, 31, 0.82);
    --form-element-background-color: rgba(7, 14, 32, 0.85);
    --form-element-border-color: rgba(25, 245, 255, 0.22);
    --form-element-color: #ebf7ff;
    --form-element-placeholder-color: #6b7ea2;
    --form-element-spacing-vertical: 0.75rem;
    --form-element-spacing-horizontal: 1rem;
    --spacing: 1rem;
    --block-spacing-vertical: 1rem;
    --block-spacing-horizontal: 1rem;
    --border-radius: 18px;
}

a { color: #84f9ff; }
a:hover { color: #fff; }
form { margin: 0; }
small, .muted-text { color: #90a0c8; }
pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
button, [role=button], input, textarea, select, summary { border-radius: 14px; }
button.primary, .primary {
    background: linear-gradient(135deg, #19f5ff, #7a5cff);
    border: none;
    color: #09111f;
    font-weight: 800;
}
button.secondary, .secondary {
    background: rgba(15, 22, 42, 0.78);
    color: #d8ebff;
    border: 1px solid rgba(25,245,255,0.22);
}
.outline { border: 1px solid rgba(25,245,255,0.25) !important; }
.glow-btn { box-shadow: 0 0 0 1px rgba(25,245,255,0.18), 0 0 32px rgba(25,245,255,0.18); }
.full-width { width: 100%; justify-content: center; }

.glass-card, .glass-subpanel {
    background: rgba(8, 14, 31, 0.74);
    border: 1px solid rgba(76, 112, 255, 0.18);
    box-shadow: 0 22px 80px rgba(4, 10, 26, 0.55), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(18px);
    border-radius: 24px;
}
.glass-subpanel { padding: 18px; }
.eyebrow {
    margin: 0 0 8px;
    color: #79f4ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.lead, .subcopy { color: #c6d5f2; font-size: 1.02rem; }

.cyber-topnav {
    display: grid;
    grid-template-columns: auto minmax(320px, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 18px;
    background: rgba(5, 9, 22, 0.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(25,245,255,0.14);
}
.brand-link {
    display: inline-flex !important;
    align-items: center;
    gap: 12px;
    padding: 0 !important;
    color: #eaf8ff;
    text-decoration: none;
    min-width: 0;
}
.brand-link img {
    border-radius: 14px;
    box-shadow: 0 0 25px rgba(25,245,255,0.18);
}
.version { font-size: 0.78rem; color: #8ea3c5; }
.mail-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.mail-launcher input {
    margin: 0 !important;
    min-width: 0;
    width: 100%;
}
.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}
.action-link {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    justify-content: center;
    white-space: nowrap;
}
.emphasis-link {
    background: rgba(255, 72, 172, 0.14);
    border: 1px solid rgba(255, 72, 172, 0.28);
    color: #ffd4ec !important;
}
.topnav .icon { display: none; }

main.container.main-stage {
    max-width: min(1380px, calc(100vw - 40px));
    padding: 26px 0 48px;
}

.hero-shell, .dashboard-shell, .detail-shell { display: grid; gap: 22px; }
.hero-card, .dashboard-header, .detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 24px;
    padding: 28px;
}
.hero-visual, .guide-side { position: relative; display: grid; place-items: center; }
.hero-visual img { width: min(260px, 100%); filter: drop-shadow(0 0 24px rgba(25,245,255,0.28)); }
.scan-ring {
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 1px solid rgba(25,245,255,0.3);
    box-shadow: 0 0 30px rgba(25,245,255,0.18), inset 0 0 40px rgba(122,92,255,0.18);
}
.hero-actions-wrap, .tool-chip-row, .mail-actions, .mail-badges, .code-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hero-tip-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.hero-tip-bar span, .pill, .step-tag, .recent-pill, .pill-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(13, 22, 49, 0.75);
    border: 1px solid rgba(25,245,255,0.18);
    color: #d7ecff;
    text-decoration: none;
}
.guide-grid, .hero-subgrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.guide-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guide-card {
    padding: 20px;
    border-radius: 20px;
    background: rgba(9, 15, 35, 0.78);
    border: 1px solid rgba(25,245,255,0.12);
}
.guide-card h3 { margin-top: 12px; margin-bottom: 8px; }
.action-card { grid-column: span 1; }
.quick-panel, .empty-state, .code-panel, .meta-panel, .body-panel, .attachment-panel, .raw-panel, .stat-card, .mail-card, .cyber-details, .auth-panel {
    padding: 22px;
}
.quick-start-list {
    margin: 0;
    padding-left: 18px;
    color: #d7e5ff;
    line-height: 1.85;
}
.recent-board {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
    margin-top: 16px;
}
.recent-emails, .recent-email-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.helper-card {
    border-radius: 18px;
    padding: 16px;
    background: rgba(10, 16, 34, 0.75);
    border: 1px solid rgba(25,245,255,0.12);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
}
.dashboard-sidebar {
    display: grid;
    gap: 16px;
    align-self: start;
    position: sticky;
    top: 92px;
}
.sidebar-block {
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-actions, .tool-chip-column {
    display: grid;
    gap: 10px;
}
.tool-chip-column a, .sidebar-actions a, .sidebar-actions button {
    justify-content: flex-start;
}
.dashboard-content {
    display: grid;
    gap: 18px;
    min-width: 0;
}
.insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.insight-card h3 {
    margin: 6px 0 10px;
    font-size: 1.05rem;
}
.code-quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0 12px;
}
.preview-body {
    color: #c7d7f4;
    line-height: 1.75;
    min-height: 72px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.stat-label {
    display: block;
    color: #85a0cb;
    font-size: 0.86rem;
    margin-bottom: 10px;
}
.stat-card strong { font-size: 1.18rem; color: #fff; }
.helper-inline { margin-top: 12px; }

.mail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.mail-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.mail-card h3 {
    margin: 6px 0 10px;
    font-size: 1.05rem;
    line-height: 1.4;
}
.mail-meta {
    display: grid;
    gap: 8px;
    color: #b8cae9;
    margin-bottom: 14px;
}
.code-badge {
    border: 1px solid rgba(255,72,172,0.35);
    background: linear-gradient(135deg, rgba(255,0,170,0.12), rgba(122,92,255,0.16));
    color: #ffb2de;
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 700;
}
.code-badge.huge {
    font-size: 1.4rem;
    padding: 14px 18px;
    cursor: pointer;
}
.time-pill { color: #9bc9ff; }
.empty-state { text-align: center; }
.empty-icon {
    font-size: 2.4rem;
    margin-bottom: 10px;
    color: #19f5ff;
}

.detail-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
}
.secondary-grid { grid-template-columns: 1fr 1fr; }
.meta-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}
.meta-list li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(13,20,43,0.7);
}
.mail-body-box {
    margin-top: 14px;
    max-height: 560px;
    overflow: auto;
    padding: 18px;
    border-radius: 18px;
    background: rgba(6, 10, 25, 0.88);
    border: 1px solid rgba(25,245,255,0.12);
}
.attachment-list {
    display: grid;
    gap: 10px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(11,18,39,0.72);
    text-decoration: none;
}
.cyber-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #dff7ff;
}
.modal-card { background: rgba(7, 10, 23, 0.96) !important; }
.indicator-pill {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99;
    display: none;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(7, 13, 30, 0.88);
    border: 1px solid rgba(25,245,255,0.22);
}
body .htmx-request.htmx-indicator,
body .htmx-request .htmx-indicator {
    display: inline-flex;
}

.password-page { overflow: hidden; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}
.auth-panel {
    width: min(980px, calc(100vw - 32px));
    display: grid;
    gap: 24px;
    padding: 28px;
}
.auth-brand {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    align-items: center;
}
.auth-brand img {
    width: 180px;
    max-width: 100%;
    filter: drop-shadow(0 0 30px rgba(25,245,255,0.22));
}
.auth-form { display: grid; gap: 14px; }
.password-row {
    display: grid;
    grid-template-columns: 1fr 56px;
    gap: 10px;
}
.alert {
    border-radius: 16px;
    padding: 12px 14px;
}
.alert.info {
    background: rgba(25,245,255,0.08);
    border: 1px solid rgba(25,245,255,0.18);
}
.alert.danger {
    background: rgba(255,52,112,0.1);
    border: 1px solid rgba(255,52,112,0.26);
    color: #ffd4e2;
}

@media (max-width: 1100px) {
    .cyber-topnav {
        grid-template-columns: 1fr;
    }
    .top-actions { justify-content: flex-start; flex-wrap: wrap; }
    .hero-card, .dashboard-header, .detail-head, .auth-brand, .detail-grid, .secondary-grid, .guide-grid, .hero-subgrid, .stat-grid, .mail-grid, .dashboard-layout, .recent-board {
        grid-template-columns: 1fr;
    }
    .mail-launcher {
        flex-direction: column;
        align-items: stretch;
    }
    .mail-launcher button { width: 100%; }
    .dashboard-sidebar { position: static; }
}

@media (max-width: 775px) {
    .topnav .icon {
        display: block;
        justify-self: end;
    }
    .topnav.responsive {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    .topnav.responsive .brand-link,
    .topnav.responsive .mail-launcher,
    .topnav.responsive .top-actions {
        display: flex;
        width: 100%;
    }
    .topnav:not(.responsive) .mail-launcher,
    .topnav:not(.responsive) .top-actions {
        display: none;
    }
    .hero-card, .dashboard-header, .detail-head, .auth-panel {
        padding: 20px;
    }
}
