:root {
    --navy: #0f172a;
    --navy-soft: #1e293b;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --slate: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --background: #f8fafc;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --purple: #7e22ce;
    --radius: 14px;
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--navy);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--blue-dark);
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--navy);
    color: white;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    color: white;
    display: inline-flex;
    flex-direction: column;
    letter-spacing: 0.18em;
    margin-bottom: 34px;
}

.brand span {
    font-size: 0.8rem;
}

.brand strong {
    font-size: 1.9rem;
    letter-spacing: 0.08em;
}

.brand--dark {
    color: var(--navy);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    color: #cbd5e1;
    padding: 12px 14px;
    border-radius: 10px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: white;
    background: var(--navy-soft);
}

.sidebar-footer {
    display: grid;
    gap: 6px;
    color: #cbd5e1;
}

.link-button {
    border: 0;
    background: none;
    color: white;
    padding: 8px 0;
    cursor: pointer;
}

.main-content {
    width: min(1500px, 100%);
    padding: 44px clamp(24px, 4vw, 64px);
}

.page-header,
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 26px;
}

.page-header h1,
.section-heading h2 {
    margin: 4px 0 8px;
}

.page-header p,
.section-heading p {
    margin-top: 0;
}

.eyebrow {
    color: var(--blue-dark);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin: 0;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border-radius: 10px;
    padding: 10px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
}

.primary-button {
    color: white;
    background: var(--blue);
}

.primary-button:hover {
    background: var(--blue-dark);
}

.secondary-button {
    color: var(--navy);
    background: white;
    border-color: var(--line);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 42px;
}

.stat-card,
.project-card,
.detail-card,
.form-card,
.filter-bar,
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    color: var(--slate);
    display: block;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 2rem;
}

.stat-card--danger strong {
    color: var(--danger);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 42px;
}

.project-card {
    padding: 24px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
}

.project-card__icon {
    font-size: 2rem;
}

.project-card h3 {
    margin: 0 0 8px;
}

.project-card p {
    color: var(--slate);
    margin: 0;
}

.project-meta,
.issue-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.project-meta span {
    border-radius: 99px;
    background: #eef2ff;
    color: #3730a3;
    padding: 5px 9px;
    font-size: 0.78rem;
}

.project-card__actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--slate);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.badge {
    display: inline-flex;
    border-radius: 99px;
    padding: 5px 9px;
    font-size: 0.76rem;
    font-weight: 800;
}

.badge--minor {
    background: #f1f5f9;
    color: #475569;
}

.badge--normal {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge--major {
    background: #fef3c7;
    color: #92400e;
}

.badge--urgent {
    background: #ffedd5;
    color: #c2410c;
}

.badge--blocker {
    background: #fee2e2;
    color: #b91c1c;
}

.badge--status {
    background: #ede9fe;
    color: #6d28d9;
}

.filter-bar {
    padding: 18px;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 22px;
}

.filter-bar label,
.form-grid label,
.auth-card label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: white;
    padding: 11px 12px;
    color: var(--navy);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(37, 99, 235, 0.16);
    border-color: var(--blue);
}

.form-card {
    padding: 26px;
}

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

.form-field--wide {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.checkbox-row {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox-row input {
    width: auto;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    color: var(--slate);
    margin-bottom: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.detail-card {
    padding: 24px;
}

.detail-card--wide {
    grid-column: 1 / -1;
}

.detail-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0 0;
}

.detail-list dt {
    color: var(--slate);
}

.detail-list dd {
    margin: 0;
    text-align: right;
}

.prose {
    white-space: pre-wrap;
    line-height: 1.65;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.attachment-grid a {
    display: grid;
    gap: 8px;
}

.attachment-grid img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.file-attachment {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
}

.empty-state {
    background: white;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #dbeafe, transparent 40%),
        var(--background);
}

.auth-card {
    width: min(430px, 100%);
    background: white;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px;
    display: grid;
    gap: 18px;
}

.auth-card h1,
.auth-card p {
    margin: 0;
}

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.flash {
    border-radius: 10px;
    padding: 12px 14px;
}

.flash--success {
    background: #dcfce7;
    color: #166534;
}

.flash--warning {
    background: #fef3c7;
    color: #92400e;
}

.flash--error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 1000px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 18px;
        flex-direction: row;
        align-items: center;
    }

    .brand {
        margin-bottom: 0;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        display: none;
    }

    .stat-grid,
    .project-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

    .detail-card--wide {
        grid-column: auto;
    }
}

@media (max-width: 680px) {
    .main-content {
        padding: 26px 16px;
    }

    .page-header,
    .section-heading {
        display: grid;
    }

    .stat-grid,
    .project-grid,
    .form-grid,
    .filter-bar,
    .attachment-grid {
        grid-template-columns: 1fr;
    }

    .form-field--wide {
        grid-column: auto;
    }

    .project-card__actions,
    .filter-actions,
    .form-actions {
        flex-direction: column;
    }
}
