:root {
    --bg: #07111e;
    --bg-soft: #0f1d2d;
    --panel: rgba(15, 29, 45, 0.88);
    --panel-strong: rgba(11, 24, 39, 0.94);
    --line: rgba(148, 163, 184, 0.18);
    --text: #e8eef7;
    --muted: #9fb2c8;
    --accent: #f59e0b;
    --accent-strong: #fb923c;
    --success: #34d399;
    --danger: #f87171;
    --shadow: 0 20px 40px rgba(1, 8, 18, 0.35);
    --radius: 24px;
    --radius-sm: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    position: relative;
}

body.standalone-mode .topbar {
    padding-top: calc(1.55rem + env(safe-area-inset-top, 0));
}

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

button,
input {
    font: inherit;
}

select,
textarea {
    font: inherit;
}

.app-gradient,
.auth-gradient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(251, 146, 60, 0.25), transparent 32%),
        radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.15), transparent 28%),
        linear-gradient(180deg, #10233a 0%, #07111e 55%, #050b14 100%);
}

.app-shell,
.auth-shell {
    position: relative;
    z-index: 1;
}

.topbar,
.page,
.primary-nav,
.auth-page,
.network-banner {
    width: min(100%, 1100px);
    margin-inline: auto;
}

.topbar {
    display: grid;
    gap: 0.65rem;
    padding: 1rem 1rem 0;
}

.network-banner {
    position: sticky;
    top: 0.75rem;
    z-index: 20;
    margin-top: 0.75rem;
}

.network-banner {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(248, 113, 113, 0.22);
    background: rgba(69, 18, 18, 0.92);
    color: #fecaca;
    box-shadow: var(--shadow);
}

.topbar-brand {
    display: grid;
    gap: 0.35rem;
}

.primary-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0 1rem 0.15rem;
}

.primary-nav a,
.primary-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    background: rgba(8, 17, 29, 0.92);
    border: 1px solid var(--line);
    color: var(--muted);
    backdrop-filter: blur(18px);
}

.primary-nav form {
    display: flex;
    margin: 0;
}

.primary-nav button {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.primary-nav .is-active {
    color: #fff0ca;
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
}

.topbar-title,
.auth-title,
.hero-card h2,
.panel h3 {
    margin: 0;
    letter-spacing: -0.03em;
}

.topbar-title {
    font-size: 1.5rem;
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page {
    display: grid;
    gap: 1.25rem;
    padding: 0.5rem 1rem 2.5rem;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-card,
.hero-card,
.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 460px);
    padding: 1.5rem;
}

.hero-badge,
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(15, 29, 45, 0.75);
    color: var(--text);
}

.chip {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border-width: 1px;
    border-style: solid;
}

.chip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.45rem;
    min-height: 1.45rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.24);
    color: #fff0ca;
    font-size: 0.75rem;
    font-weight: 800;
}

.chip-accent {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
    color: #ffd698;
}

.auth-title {
    font-size: clamp(2rem, 7vw, 3rem);
    margin-bottom: 0.75rem;
}

.auth-copy,
.hero-copy,
.muted-copy,
.module-card p,
.plain-list,
.auth-footer {
    color: var(--muted);
    line-height: 1.6;
}

.stack {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.field {
    display: grid;
    gap: 0.5rem;
}

.field span,
.check-row span,
dt {
    font-size: 0.92rem;
    color: #cfdae8;
}

.field input {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(7, 17, 30, 0.85);
    color: var(--text);
}

.field input[type="file"] {
    padding: 1rem;
    min-height: 3.5rem;
}

.field select,
.field textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(7, 17, 30, 0.85);
    color: var(--text);
}

.field input:focus {
    outline: 2px solid rgba(245, 158, 11, 0.35);
    border-color: rgba(245, 158, 11, 0.35);
}

.field select:focus,
.field textarea:focus {
    outline: 2px solid rgba(245, 158, 11, 0.35);
    border-color: rgba(245, 158, 11, 0.35);
}

.check-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 16px;
    padding: 0.95rem 1.15rem;
    font-weight: 700;
    cursor: pointer;
}

.button-primary {
    color: #1b1302;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 100%);
}

.button-secondary {
    color: var(--text);
    background: rgba(15, 29, 45, 0.88);
    border: 1px solid var(--line);
}

.button-danger {
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.8);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.button-full {
    width: 100%;
    justify-content: center;
}

.button-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
    color: #fecaca;
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.25);
    color: #bbf7d0;
}

.hero-card {
    display: grid;
    gap: 1.25rem;
    padding: 1.4rem;
}

.hero-card-compact {
    gap: 1rem;
}

.hero-metrics,
.content-grid,
.details-grid,
.module-list {
    display: grid;
    gap: 1.25rem;
}

.hero-metrics-compact {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.metric-card {
    padding: 1rem;
    background: var(--panel-strong);
    border-radius: var(--radius-sm);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.metric-card strong {
    font-size: 1.4rem;
}

.quick-actions {
    display: grid;
    gap: 1rem;
}

.quick-actions-summary {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.quick-actions-summary strong {
    font-size: 1.05rem;
}

.quick-actions-summary p {
    margin: 0;
    color: var(--muted);
}

.shortcut-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.shortcut-card {
    display: grid;
    gap: 0.45rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.16);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.shortcut-card strong {
    font-size: 1rem;
}

.shortcut-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.shortcut-card:hover,
.shortcut-card:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(22, 31, 45, 0.92);
}

.panel {
    padding: 1.25rem;
}

.panel-spacious {
    padding: 1.5rem;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.1rem;
}

.dashboard-grid {
    align-items: start;
}

.compact-stack {
    gap: 0.7rem;
}

.primary-project-pill {
    display: inline-grid;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(7, 17, 30, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.primary-project-pill span {
    color: var(--muted);
    font-size: 0.95rem;
}

.action-button-grid {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.action-button {
    display: grid;
    gap: 0.45rem;
    min-height: 8.5rem;
    padding: 1rem 1.05rem;
    border-radius: 22px;
    background: rgba(7, 17, 30, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.16);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.action-button strong {
    font-size: 1.02rem;
}

.action-button span {
    color: var(--muted);
    line-height: 1.45;
}

.action-button:hover,
.action-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(22, 31, 45, 0.92);
}

.module-card {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.upload-entry-grid {
    display: grid;
    gap: 1rem;
}

.upload-choice {
    display: grid;
    gap: 1rem;
    padding: 1.15rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.upload-choice.is-camera {
    border-color: rgba(245, 158, 11, 0.28);
    background:
        linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(7, 17, 30, 0.82));
}

.upload-choice p,
.upload-meta p {
    margin: 0;
    color: var(--muted);
}

.upload-meta {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    background: rgba(7, 17, 30, 0.45);
}

.upload-helper {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding-left: 1.15rem;
    color: var(--muted);
}

.module-card.is-live {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(6, 28, 24, 0.75);
}

.stack-list {
    display: grid;
    gap: 0.85rem;
}

.list-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.list-card.static-card {
    align-items: flex-start;
}

.list-card-main strong,
.project-card h3 {
    display: block;
    margin-bottom: 0.3rem;
}

.list-card-main p,
.project-card-copy,
.project-card-property {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.status-pill,
.muted-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid var(--line);
}

.status-pill {
    background: rgba(245, 158, 11, 0.12);
    color: #ffd698;
}

.muted-badge {
    background: rgba(15, 29, 45, 0.72);
    color: var(--muted);
}

.text-link {
    color: #ffd698;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.action-row {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.action-row.split {
    justify-content: space-between;
}

.empty-state {
    padding: 1.2rem;
    border-radius: 18px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px dashed rgba(148, 163, 184, 0.2);
}

.empty-state strong {
    display: block;
    margin-bottom: 0.4rem;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

.empty-state.compact {
    padding: 1rem;
}

.project-grid {
    display: grid;
    gap: 1rem;
}

.project-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.project-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
}

.membership-stack {
    display: grid;
    gap: 1rem;
}

.membership-card {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(7, 17, 30, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.stacked-card {
    align-items: stretch;
}

.plain-list {
    margin: 0;
    padding-left: 1.1rem;
}

.plain-list li + li {
    margin-top: 0.75rem;
}

.details-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.chat-stack {
    display: grid;
    gap: 1rem;
}

.activity-stack {
    display: grid;
    gap: 0.9rem;
}

.activity-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.activity-card.is-unread {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(32, 23, 9, 0.82);
}

.activity-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}

.activity-head span {
    color: var(--muted);
    font-size: 0.88rem;
}

.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.8rem 0;
}

.reference-card,
.attachment-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(7, 17, 30, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.chat-header-panel {
    padding-bottom: 1rem;
}

.chat-header-main {
    display: grid;
    gap: 1rem;
}

.chat-layout {
    display: grid;
    gap: 1.25rem;
}

.chat-main-column,
.chat-side-column {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.chat-thread {
    display: grid;
    gap: 0.85rem;
}

.chat-bubble {
    display: grid;
    gap: 0.9rem;
    max-width: 48rem;
    padding: 1rem;
    border-radius: 22px;
    background: rgba(7, 17, 30, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.chat-bubble.is-own {
    margin-left: auto;
    border-color: rgba(245, 158, 11, 0.35);
    background: linear-gradient(180deg, rgba(74, 44, 6, 0.72), rgba(37, 24, 7, 0.84));
}

.chat-bubble-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    color: var(--muted);
}

.chat-body {
    margin: 0;
    line-height: 1.65;
    white-space: pre-wrap;
}

.reference-card,
.attachment-card {
    display: grid;
    gap: 0.75rem;
}

.reference-card p,
.attachment-card p {
    margin: 0;
    color: var(--muted);
}

.chat-attachment-preview {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    object-fit: cover;
    max-height: 320px;
}

.chat-composer-panel {
    align-self: start;
}

dt {
    margin-bottom: 0.4rem;
}

dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.single-column {
    grid-template-columns: 1fr;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.88rem;
}

@media (min-width: 768px) {
    .topbar,
    .primary-nav,
    .page {
        padding-inline: 1.5rem;
    }

    .topbar {
        padding-top: 1.4rem;
    }

    .content-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-card {
        grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
        align-items: stretch;
    }

    .hero-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-header-main {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .chat-layout {
        grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.82fr);
        align-items: start;
    }

    .chat-side-column {
        position: sticky;
        top: 1rem;
    }

    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .upload-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
