* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --app-bg: #ffffff;
    --app-sidebar: #f5f5f5;
    --app-accent: #2b2b2b;
    --app-text: #242424;
    --app-muted: #616161;
    --app-border: #e0e0e0;
    --app-selected: #efefef;
    --app-hover: #f5f5f5;
    --ok: #16a34a;
    --warn: #ca8a04;
    --danger: #dc2626;
}

html.dark {
    --app-bg: #141414;
    --app-sidebar: #1c1c1c;
    --app-accent: #484848;
    --app-text: #e8e8e8;
    --app-muted: #9a9a9a;
    --app-border: #2e2e2e;
    --app-selected: #262626;
    --app-hover: #1f1f1f;
    --ok: #4ade80;
    --warn: #facc15;
    --danger: #f87171;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #f3f4f6;
    color: var(--app-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

html.dark body {
    background: #101010;
}

a {
    color: inherit;
    text-decoration: none;
}

main {
    flex: 1;
    padding-top: 48px;
}

/* ===== Top nav ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: var(--app-bg);
    border-bottom: 1px solid var(--app-border);
}

.logo {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.logo span {
    color: var(--app-muted);
    font-weight: 600;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--app-muted);
    font-size: 0.9rem;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--app-text);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--app-muted);
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
    color: var(--app-text);
    background: var(--app-hover);
}

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

html:not(.dark) .icon-sun { display: block; }
html:not(.dark) .icon-moon { display: none; }
html.dark .icon-sun { display: none; }
html.dark .icon-moon { display: block; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--app-accent);
    color: #fff;
}

html.dark .btn-primary {
    color: #141414;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border-color: var(--app-border);
    color: var(--app-text);
}

.btn-outline:hover {
    background: var(--app-hover);
    border-color: var(--app-text);
}

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

.btn-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ===== Hero ===== */
.hero {
    border-bottom: 1px solid var(--app-border);
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(91, 140, 255, 0.10), transparent 60%),
        radial-gradient(800px 400px at -10% 110%, rgba(143, 107, 255, 0.08), transparent 60%),
        var(--app-bg);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 130px 24px;
    align-items: center;
}

.hero-copy {
    max-width: 560px;
}

.badge {
    display: inline-block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--app-muted);
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    padding: 6px 14px;
    margin-bottom: 24px;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 20px;
    color: var(--app-text);
}

.grad {
    background: linear-gradient(90deg, #3b5bdb, #7048e8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

html.dark .grad {
    background: linear-gradient(90deg, #748ffc, #b197fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    color: var(--app-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.hero-sub strong {
    color: var(--app-text);
}

.hero-btns {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-tags span {
    font-size: 0.85rem;
    color: var(--app-muted);
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    padding: 8px 14px;
}

/* Mini mail preview */
.hero-visual {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
}

.mini-mail {
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    box-shadow: 0 24px 60px rgba(30, 30, 60, 0.12);
}

.mini-window {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-sidebar);
}

.mini-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--app-border);
}

.mini-dot:nth-child(1) { background: #ff5f57; }
.mini-dot:nth-child(2) { background: #febc2e; }
.mini-dot:nth-child(3) { background: #28c840; }

.mini-url {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--app-muted);
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    padding: 3px 12px;
}

.mini-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg);
}

.mini-item {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--app-border);
}

.mini-item:last-of-type {
    border-bottom: none;
}

.mini-av {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--app-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.mini-av:nth-child(1) { background: linear-gradient(135deg, #3b5bdb, #7048e8); }

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

.mini-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.mini-top span {
    color: var(--app-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.mini-s {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.mini-p {
    color: var(--app-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--app-border);
    background: var(--app-sidebar);
    font-size: 0.85rem;
}

.mini-foot a {
    font-weight: 600;
    color: var(--app-text);
    white-space: nowrap;
}

@media (min-width: 900px) {
    .hero-grid {
        grid-template-columns: 1.1fr 1fr;
        padding: 180px 24px;
    }
}

/* ===== Text helpers ===== */
.text-xs { font-size: 0.8rem; }
.text-sm { font-size: 0.875rem; }
.semibold { font-weight: 600; }
.muted { color: var(--app-muted); }

/* ===== Sections ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.sec {
    padding: 80px 0;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg);
}

.sec-alt {
    background: var(--app-sidebar);
}

.sec-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--app-muted);
    margin-bottom: 14px;
}

.sec-h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 14px;
}

.sec-h2 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

.sec-sub {
    color: var(--app-muted);
    max-width: 640px;
    line-height: 1.6;
}

.sec-head {
    margin-bottom: 56px;
}

/* Feature strip */
.strip {
    background: var(--app-sidebar);
    border-bottom: 1px solid var(--app-border);
}

.strip-grid {
    display: grid;
    grid-template-columns: 1fr;
}

.strip-cell {
    padding: 20px 24px;
    border-bottom: 1px solid var(--app-border);
}

.strip-cell:last-child {
    border-bottom: none;
}

.strip-t {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.strip-d {
    font-size: 0.8rem;
    color: var(--app-muted);
}

@media (min-width: 768px) {
    .strip-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .strip-cell {
        border-bottom: none;
        border-right: 1px solid var(--app-border);
        padding: 24px;
    }

    .strip-cell:last-child {
        border-right: none;
    }
}

/* Hairline grids */
.hairline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--app-border);
    border: 1px solid var(--app-border);
}

.cell {
    background: var(--app-bg);
    padding: 32px;
}

.cell-inner {
    border-left: 2px solid var(--app-accent);
    padding-left: 20px;
}

.cell-h {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.cell-p {
    color: var(--app-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.cell-tags {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--app-muted);
}

.p-10 {
    padding: 40px;
}

.num {
    font-size: 3rem;
    font-weight: 300;
    color: var(--app-border);
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .hairline {
        grid-template-columns: 1fr 1fr;
    }
}

/* Stats */
.stats {
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--app-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.stat-num {
    font-size: 1.875rem;
    font-weight: 300;
    margin-bottom: 4px;
}

.stat-name {
    color: var(--app-muted);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Accent block */
.accent-block {
    margin-top: 64px;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--app-accent);
    color: #fff;
}

.accent-block a {
    color: #fff;
}

.accent-col {
    padding: 40px;
}

.accent-block .cell-inner,
.accent-block .cell-h {
    border-color: rgba(255, 255, 255, 0.5);
}

.accent-col + .accent-col {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.accent-h {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 20px;
}

.accent-p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.accent-line {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 20px;
}

.accent-tag {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.steps-h {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.step-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.step-n {
    width: 24px;
    flex-shrink: 0;
    font-size: 1.25rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
}

.step-t {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.step-d {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .accent-block {
        grid-template-columns: 2fr 3fr;
    }

    .accent-col + .accent-col {
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.15);
    }
}

/* Plans */
.plans-grid .plan-cell {
    border-left: 2px solid var(--app-accent);
    padding-left: 20px;
}

.price {
    font-size: 2rem;
    font-weight: 300;
    margin: 16px 0;
}

.plan-list {
    list-style: none;
    margin-bottom: 28px;
    color: var(--app-muted);
    font-size: 0.875rem;
}

.plan-list li {
    padding: 5px 0;
    border-bottom: 1px solid var(--app-border);
}

/* FAQ */
.faq-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
}

.faq-item {
    margin-bottom: 40px;
}

.faq-h {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.faq-p {
    color: var(--app-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .faq-grid {
        grid-template-columns: 1fr 1fr;
        gap: 64px;
    }
}

/* ===== Forms (login / register) ===== */
.auth {
    max-width: 460px;
    margin: 0 auto;
    padding: 72px 24px 40px;
}

.card {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    padding: 32px;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.card > .hint {
    margin-bottom: 24px;
}

.card-done {
    text-align: center;
}

label {
    display: block;
    margin-bottom: 16px;
    color: var(--app-muted);
    font-size: 0.85rem;
}

label input {
    margin-top: 6px;
}

input {
    width: 100%;
    padding: 10px 12px;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 0;
    color: var(--app-text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

input:focus {
    border-color: var(--app-text);
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group input {
    border-right: none;
}

.input-group .suffix {
    padding: 0 14px;
    background: var(--app-sidebar);
    border: 1px solid var(--app-border);
    color: var(--app-muted);
    line-height: 42px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.plan-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.plan-option {
    display: block;
    margin: 0;
    cursor: pointer;
}

.plan-option input {
    display: none;
}

.plan-option span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    transition: all 0.15s;
}

.plan-option input:checked + span {
    border-color: var(--app-text);
    background: var(--app-selected);
}

.plan-option em {
    color: var(--app-text);
    font-style: normal;
    font-weight: 700;
}

.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-error {
    background: rgba(220, 38, 38, 0.06);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-info {
    background: rgba(37, 99, 235, 0.06);
    border-color: #2563eb;
    color: #2563eb;
}

html.dark .alert-info {
    border-color: #60a5fa;
    color: #60a5fa;
}

.hint {
    color: var(--app-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

.hint a {
    color: var(--app-text);
    font-weight: 600;
}

.hint code {
    background: var(--app-sidebar);
    border: 1px solid var(--app-border);
    padding: 2px 6px;
    font-size: 0.8rem;
}

/* ===== Cabinet /mail ===== */
.cabinet {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 24px 40px;
}

.cabinet-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 52px;
    height: 52px;
    background: var(--app-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.user-email {
    font-size: 1.1rem;
    font-weight: 700;
}

.user-role {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.cabinet-actions {
    display: flex;
    gap: 12px;
}

.greet h2 {
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 6px;
}

.greet p {
    color: var(--app-muted);
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--app-border);
    border: 1px solid var(--app-border);
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

.stat-card {
    background: var(--app-bg);
    padding: 24px;
}

.stat-icon {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 300;
    word-break: break-all;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--app-muted);
    font-size: 0.8rem;
}

.sub-card,
.inbox-card {
    margin-bottom: 32px;
    padding: 32px;
}

.sub-card-head,
.inbox-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sub-card h3,
.inbox-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chip {
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
}

.chip-ok {
    border-color: var(--ok);
    color: var(--ok);
}

.chip-warn {
    border-color: var(--warn);
    color: var(--warn);
}

.progress {
    height: 10px;
    background: var(--app-sidebar);
    border: 1px solid var(--app-border);
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: var(--app-accent);
}

.bar-ok {
    background: var(--ok);
}

.bar-warn {
    background: var(--warn);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--app-border);
    margin-bottom: 20px;
}

.msg-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--app-border);
    transition: background 0.15s;
}

.msg-item:last-child {
    border-bottom: none;
}

.msg-item:hover {
    background: var(--app-hover);
}

.msg-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--app-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

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

.msg-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.msg-time {
    color: var(--app-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.msg-subj {
    font-weight: 600;
    margin-bottom: 2px;
}

.msg-prev {
    color: var(--app-muted);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-delete {
    align-self: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-left: 12px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-bg);
    font-size: 0.95rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s;
}

.msg-delete:hover {
    background: var(--app-danger);
    border-color: var(--app-danger);
    color: #fff;
}

.empty-state {
    border: 1px dashed var(--app-border);
    padding: 32px;
    text-align: center;
    color: var(--app-muted);
    font-size: 0.9rem;
}

/* ===== Message view /message/... ===== */
.msg-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 60px;
}

.msg-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.msg-toolbar-title {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 700;
    word-break: break-word;
}

.msg-toolbar-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.msg-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    margin-bottom: 20px;
}

.msg-head .avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
}

.msg-head-main {
    min-width: 0;
}

.msg-from {
    font-size: 1.05rem;
    margin-bottom: 4px;
    word-break: break-word;
}

.msg-from .muted {
    font-size: 0.9rem;
}

.msg-meta {
    font-size: 0.85rem;
    word-break: break-word;
}

.msg-body-full {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    min-height: 200px;
}

.msg-text {
    padding: 24px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-iframe {
    width: 100%;
    border: 0;
    display: block;
    min-height: 300px;
}

.msg-gallery {
    margin-top: 20px;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    padding: 24px;
}

.msg-gallery-head h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.msg-skipped {
    margin-top: 20px;
    padding: 12px 16px;
    background: rgba(202, 138, 4, 0.08);
    border: 1px solid var(--warn);
    color: var(--warn);
    font-size: 0.85rem;
    line-height: 1.6;
}

.msg-skipped span {
    font-weight: 600;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.gallery-item {
    border: 1px solid var(--app-border);
    background: var(--app-sidebar);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 8px;
}

.gallery-open {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 8px;
    border: 0;
    background: none;
    cursor: zoom-in;
    width: 100%;
}

.gallery-open:hover img {
    transform: scale(1.03);
}

.gallery-item img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
    transition: transform 0.15s;
}

.gallery-item figcaption {
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--app-muted);
    border-top: 1px solid var(--app-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-body {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.lightbox-body img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-body figcaption {
    color: #ddd;
    font-size: 0.9rem;
    text-align: center;
    word-break: break-word;
}

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--app-border);
    background: var(--app-bg);
    padding: 48px 24px 24px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--app-border);
}

.footer-brand {
    font-weight: 700;
}

.footer-links {
    display: flex;
    gap: 24px;
    color: var(--app-muted);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--app-text);
}

.footer-bottom {
    max-width: 1200px;
    margin: 20px auto 0;
    color: var(--app-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero-grid {
        padding: 48px 20px;
    }

    .hero-title {
        font-size: 2.4rem;
    }

    .sec {
        padding: 48px 0;
    }

    .sec-h1 {
        font-size: 2rem;
    }

    .sec-h2 {
        font-size: 1.6rem;
    }

    .cell {
        padding: 24px;
    }

    .p-10 {
        padding: 24px;
    }

    .accent-col {
        padding: 24px;
    }
}
