* {
    box-sizing: border-box;
}

:root {
    --bg: #0d1117;
    --bg-soft: #111722;
    --panel: #131a24;
    --panel-strong: #171f2b;
    --line: rgba(255, 255, 255, 0.08);
    --text: #e5ebf3;
    --muted: #9ba6b5;
    --accent: #2fd07f;
    --accent-soft: rgba(47, 208, 127, 0.16);
    --danger: #ff6b6b;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(47, 208, 127, 0.10), transparent 30%),
        linear-gradient(180deg, #0b0f15 0%, #0f141d 100%);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

.shell {
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 14, 20, 0.92);
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
}

.brand-row,
.topbar-actions,
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.nav-links a,
.link-button {
    color: var(--muted);
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active,
.link-button:hover {
    color: var(--text);
}

.link-button {
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.user-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.82rem;
}

.badge.ready,
.badge.deployment {
    color: var(--accent);
    border-color: rgba(47, 208, 127, 0.3);
    background: var(--accent-soft);
}

.badge.partial,
.badge.pull_request {
    color: #f2cf72;
    border-color: rgba(242, 207, 114, 0.3);
    background: rgba(242, 207, 114, 0.14);
}

.badge.missing,
.badge.error {
    color: var(--danger);
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.14);
}

.badge.small {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.environment-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin: -0.4rem 0 1.25rem;
}

.legend-copy {
    color: var(--muted);
    font-size: 0.88rem;
}

.eyebrow {
    margin: 0 0 0.6rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.9rem, 4vw, 3rem);
    line-height: 1.08;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.lede,
.section-heading p,
.feed-row p,
.empty-state {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 1.25rem;
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1.5rem;
}

.dashboard-grid {
    grid-template-columns: 1.5fr 1fr;
    margin-top: 1.5rem;
}

.panel {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(19, 26, 36, 0.98), rgba(15, 21, 30, 0.98));
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.auth-wrap {
    display: grid;
    min-height: calc(100vh - 6rem);
    place-items: center;
}

.auth-panel {
    width: min(520px, 100%);
}

.card-header,
.kv-row,
.feed-row,
.section-heading {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.card-actions {
    margin-top: 1.25rem;
}

.kv-list,
.feed-list {
    display: grid;
    gap: 0.85rem;
}

.kv-row,
.feed-row {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.kv-row:last-child,
.feed-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.kv-row span {
    color: var(--muted);
}

.feed-meta {
    text-align: right;
    color: var(--muted);
    font-size: 0.85rem;
}

.feed-row.production,
.feed-row.staging {
    padding: 0.9rem 1rem;
    border: 1px solid transparent;
    border-radius: 14px;
}

.feed-row.production {
    border-color: rgba(255, 125, 125, 0.16);
    background: linear-gradient(90deg, rgba(255, 125, 125, 0.10), rgba(255, 255, 255, 0.01));
}

.feed-row.staging {
    border-color: rgba(167, 180, 255, 0.16);
    background: linear-gradient(90deg, rgba(167, 180, 255, 0.12), rgba(255, 255, 255, 0.01));
}

.activity-group + .activity-group {
    margin-top: 1.75rem;
}

.activity-date {
    margin-bottom: 0.85rem;
    color: #707a89;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.activity-list {
    display: grid;
}

.activity-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 1rem 1.1rem;
    border-top: 1px solid var(--line);
    border-left: 3px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.activity-row.production {
    border-left-color: rgba(255, 125, 125, 0.7);
    background: linear-gradient(90deg, rgba(255, 125, 125, 0.12), rgba(255, 255, 255, 0.01));
}

.activity-row.staging {
    border-left-color: rgba(167, 180, 255, 0.75);
    background: linear-gradient(90deg, rgba(167, 180, 255, 0.14), rgba(255, 255, 255, 0.01));
}

.activity-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.activity-copy {
    min-width: 0;
}

.activity-copy strong {
    display: block;
    margin-bottom: 0.22rem;
}

.activity-copy strong a,
.feed-row strong a,
.feed-card strong a,
.feed-mini-item strong a {
    color: var(--text);
}

.activity-copy strong a:hover,
.feed-row strong a:hover,
.feed-card strong a:hover,
.feed-mini-item strong a:hover {
    color: var(--accent);
}

.activity-copy p {
    margin-bottom: 0;
}

.activity-marker {
    width: 0.65rem;
    height: 0.65rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: var(--muted);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.activity-marker.sync {
    background: #55c6ff;
}

.activity-marker.commit {
    background: #f2cf72;
}

.activity-marker.pull_request {
    background: var(--accent);
}

.badge.production {
    color: #ff7d7d;
    border-color: rgba(255, 125, 125, 0.28);
    background: rgba(255, 125, 125, 0.14);
}

.badge.staging {
    color: #a7b4ff;
    border-color: rgba(167, 180, 255, 0.28);
    background: rgba(167, 180, 255, 0.14);
}

.compact-feed .feed-row.compact {
    padding-bottom: 0.8rem;
}

.feed-hero {
    display: grid;
    gap: 1.5rem;
}

.feed-hero-stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feed-stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.1rem 1.15rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(18, 24, 34, 0.98), rgba(12, 18, 27, 0.98));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.feed-stat-card::after {
    content: "";
    position: absolute;
    right: -2rem;
    bottom: -2rem;
    width: 7rem;
    height: 7rem;
    border-radius: 999px;
    opacity: 0.2;
    filter: blur(10px);
}

.feed-stat-card strong,
.feed-side-card strong {
    display: block;
    margin-bottom: 0.45rem;
    font-size: clamp(1.55rem, 2.5vw, 2.2rem);
    line-height: 1;
}

.feed-stat-card p,
.feed-side-card p,
.feed-mini-item p {
    margin-bottom: 0;
    color: var(--muted);
}

.feed-stat-label,
.feed-side-label {
    display: inline-flex;
    margin-bottom: 0.75rem;
    color: #d4dbe6;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.accent-green {
    border-color: rgba(47, 208, 127, 0.25);
}

.accent-green::after {
    background: rgba(47, 208, 127, 0.95);
}

.accent-blue {
    border-color: rgba(85, 198, 255, 0.25);
}

.accent-blue::after {
    background: rgba(85, 198, 255, 0.95);
}

.accent-purple {
    border-color: rgba(167, 180, 255, 0.28);
}

.accent-purple::after {
    background: rgba(167, 180, 255, 0.95);
}

.accent-amber {
    border-color: rgba(242, 207, 114, 0.3);
}

.accent-amber::after {
    background: rgba(242, 207, 114, 0.95);
}

.feed-layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
    align-items: start;
}

.feed-timeline-panel,
.feed-sidebar-panel {
    min-height: 100%;
}

.feed-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.feed-legend-chip,
.feed-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.feed-legend-chip.sync,
.feed-type-pill.sync {
    color: #8ad7ff;
    border-color: rgba(85, 198, 255, 0.24);
    background: rgba(85, 198, 255, 0.14);
}

.feed-legend-chip.commit,
.feed-type-pill.commit {
    color: #f4d789;
    border-color: rgba(242, 207, 114, 0.24);
    background: rgba(242, 207, 114, 0.12);
}

.feed-legend-chip.pull_request,
.feed-type-pill.pull_request {
    color: #83e8b1;
    border-color: rgba(47, 208, 127, 0.24);
    background: rgba(47, 208, 127, 0.12);
}

.feed-day-group + .feed-day-group {
    margin-top: 1.6rem;
}

.feed-day-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.feed-day-list,
.feed-side-stack,
.feed-mini-list,
.feed-card-main,
.feed-card-side {
    display: grid;
    gap: 0.5rem;
}

.feed-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    transition: transform 0.18s ease, background 0.18s ease;
}

.feed-card:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
}

.feed-card-sync {
    border-left-color: #55c6ff;
}

.feed-card-commit {
    border-left-color: #f2cf72;
}

.feed-card-pull_request {
    border-left-color: var(--accent);
}

.feed-card-main strong,
.feed-mini-item strong {
    display: block;
    line-height: 1.35;
}

.feed-card-main p {
    margin-bottom: 0;
    color: var(--muted);
}

.feed-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.feed-card-side {
    min-width: 92px;
    text-align: right;
    color: var(--muted);
    font-size: 0.83rem;
}

.feed-card-time {
    color: var(--text);
    font-weight: 600;
}

.feed-card-sha {
    color: #8a96a7;
}

.feed-side-stack {
    gap: 1rem;
}

.feed-side-card {
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
}

.feed-mini-item + .feed-mini-item {
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.field,
.stack-md {
    display: grid;
    gap: 0.5rem;
}

.stack-md {
    gap: 0.9rem;
}

label {
    color: var(--muted);
    font-size: 0.92rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(47, 208, 127, 0.22);
    border-color: rgba(47, 208, 127, 0.5);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.checkbox input {
    width: auto;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(47, 208, 127, 0.25);
    background: linear-gradient(180deg, #2fd07f, #24b56d);
    color: #04110a;
    font-weight: 700;
    cursor: pointer;
}

.button.subtle {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-color: var(--line);
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.84rem;
}

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

.alert.success {
    color: var(--accent);
    border-color: rgba(47, 208, 127, 0.24);
    background: var(--accent-soft);
}

.alert.error {
    color: var(--danger);
    border-color: rgba(255, 107, 107, 0.24);
    background: rgba(255, 107, 107, 0.14);
}

.pagination-wrap {
    margin-top: 1.25rem;
}

.pagination-wrap nav {
    display: flex;
    justify-content: center;
}

.pagination-wrap svg {
    width: 1rem;
    height: 1rem;
}

@media (max-width: 900px) {
    .topbar,
    .brand-row,
    .topbar-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .two-up,
    .dashboard-grid,
    .feed-layout,
    .feed-hero-stats {
        grid-template-columns: 1fr;
    }

    .feed-row,
    .card-header,
    .section-heading,
    .kv-row,
    .activity-row,
    .feed-day-heading,
    .feed-card {
        flex-direction: column;
    }

    .environment-legend {
        align-items: flex-start;
    }

    .feed-meta {
        text-align: left;
    }

    .feed-card-side {
        min-width: 0;
        text-align: left;
    }
}
