:root {
    --bg: #eff5f2;
    --surface: #ffffff;
    --text: #032d42;
    --muted: #4f6b7a;
    --line: #c9d6dd;
    --primary: #81b441;
    --primary-dark: #6b9834;
    --danger: #c23b4f;
    --warning: #c6762a;
    --success: #1e8b52;
    --navy: #032d42;
    --navy-2: #124862;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at 15% 20%, #f7fbf8 0%, var(--bg) 45%, #e9f1ee 100%);
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a {
    color: #0f5f86;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(95deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #eaf4f8;
    padding: 0.9rem 1.4rem;
    box-shadow: 0 10px 24px rgba(3, 45, 66, 0.15);
}

.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topbar .brand-mark {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #88bd46 0%, #5f8f28 100%);
    box-shadow: 0 6px 14px rgba(97, 146, 40, 0.35);
}

.topbar .brand-mark svg {
    width: 1rem;
    height: 1rem;
}

.topbar .brand-mark circle {
    fill: none;
    stroke: #eef8ff;
    stroke-width: 1.8;
    opacity: 0.95;
}

.topbar .brand-mark path {
    fill: none;
    stroke: #e8ffd0;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar nav {
    display: flex;
    gap: 1rem;
}

.topbar nav a {
    color: #d6ebf2;
}

.auth-box {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.4rem;
}

.page-head {
    margin-bottom: 1rem;
}

.page-head.inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.muted {
    color: var(--muted);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(3, 45, 66, 0.06);
}

.metric-card h2 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.metric-card p {
    margin: 0.35rem 0 0;
    font-size: 1.9rem;
    font-weight: 700;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(3, 45, 66, 0.05);
}

.panel.narrow {
    max-width: 700px;
}

.create-card {
    position: relative;
    overflow: hidden;
    border-color: #c5d7b2;
    background: linear-gradient(180deg, #f9fcf5 0%, #ffffff 35%);
}

.create-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 5px;
    background: linear-gradient(90deg, #81b441 0%, #9ccb5e 55%, #b6df7e 100%);
}

.create-card .stack-form {
    margin-top: 0.35rem;
}

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

.detail-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
}

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

th,
td {
    text-align: left;
    padding: 0.65rem;
    border-bottom: 1px solid var(--line);
}

th {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
}

.stack-form {
    display: grid;
    gap: 0.8rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.92rem;
}

input,
textarea,
select,
button {
    font: inherit;
    border: 1px solid #b6c9d3;
    border-radius: 10px;
    padding: 0.58rem 0.68rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #76a839;
    box-shadow: 0 0 0 3px rgba(129, 180, 65, 0.2);
}

button,
.btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.62rem 1.08rem;
    line-height: 1.2;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
    box-shadow: 0 8px 18px rgba(107, 152, 52, 0.24);
}

button:hover,
.btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 11px 22px rgba(107, 152, 52, 0.30);
}

button:active,
.btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(107, 152, 52, 0.24);
}

button:focus-visible,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(129, 180, 65, 0.25), 0 10px 20px rgba(107, 152, 52, 0.24);
}

.btn.secondary {
    background: #365668;
    box-shadow: 0 8px 18px rgba(26, 62, 80, 0.22);
}


.create-btn {
    background: linear-gradient(120deg, #6d9b36 0%, #81b441 50%, #97c45d 100%);
    color: #f9fff2;
    border: 1px solid rgba(47, 87, 25, 0.2);
    border-radius: 999px;
    letter-spacing: 0.01em;
    min-height: 42px;
    padding: 0.68rem 1.26rem 0.68rem 1rem;
    gap: 0.42rem;
}

.create-btn::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.link-btn {
    background: transparent;
    color: #dbeef5;
    border: 1px solid rgba(219, 238, 245, 0.35);
    border-radius: 999px;
    padding: 0.42rem 0.78rem;
    box-shadow: none;
}

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #e5edf1;
    color: #27495c;
}

.status-new,
.status-in_progress {
    background: #dcedfb;
    color: #1f5d84;
}

.status-resolved,
.status-closed {
    background: #dbf1e1;
    color: #145f37;
}

.priority-critical {
    background: #fbe3e6;
    color: #9d2443;
}

.priority-high {
    background: #fff0df;
    color: #a34a00;
}

.priority-medium {
    background: #fef5d6;
    color: #7d5a0f;
}

.priority-low {
    background: #e5edf1;
    color: #38586a;
}

.alert {
    background: #fbe3e6;
    color: #9d2443;
    border: 1px solid #f4bec8;
    border-radius: 10px;
    padding: 0.6rem;
    margin-bottom: 0.8rem;
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.meta-list dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.meta-list dd {
    margin: 0.2rem 0 0;
}

.comment-list {
    margin-top: 1rem;
    display: grid;
    gap: 0.8rem;
}

.comment {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem;
    background: #f8fbfc;
}

.comment header {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-card {
    padding-bottom: 0.8rem;
}

.chart-card h2 {
    margin: 0;
    font-size: 1rem;
}

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

.chart-canvas-wrap {
    position: relative;
    min-height: 260px;
    margin-top: 0.2rem;
}

.chart-canvas-wrap.trend {
    min-height: 300px;
}

.chart-fallback {
    margin: 0;
    padding: 1rem;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: #f8fbfc;
}

.auth-page {
    min-height: calc(100vh - 120px);
    display: grid;
    align-items: center;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1rem;
    align-items: stretch;
}

.auth-hero,
.auth-panel {
    border-radius: 18px;
    padding: 1.4rem;
    box-shadow: 0 14px 40px rgba(3, 45, 66, 0.12);
}

.auth-hero {
    background: linear-gradient(135deg, #032d42 0%, #0e4c66 70%, #1a6684 100%);
    color: #edf8fb;
    position: relative;
    overflow: hidden;
}

.auth-hero::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -50px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(129, 180, 65, 0.45) 0%, rgba(129, 180, 65, 0) 70%);
}

.auth-hero .muted {
    color: #d2e8ef;
}

.auth-hero h1 {
    margin: 0.3rem 0 0.9rem;
    font-size: 2rem;
    line-height: 1.15;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    color: #9fd067;
    font-weight: 700;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1.1rem;
}

.hero-pills span {
    background: rgba(129, 180, 65, 0.22);
    border: 1px solid rgba(129, 180, 65, 0.5);
    color: #e7f8d6;
    border-radius: 999px;
    padding: 0.32rem 0.7rem;
    font-size: 0.82rem;
}

.auth-panel {
    background: #ffffff;
    border: 1px solid #ccdae1;
}

.auth-panel h2 {
    margin: 0;
}

.auth-switch {
    margin: 0.8rem 0 0;
    color: var(--muted);
    font-size: 0.93rem;
}

.auth-switch a {
    color: #0f5f86;
    font-weight: 600;
}

.users-table .row-edit-form {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.users-table td {
    vertical-align: top;
}

@media (max-width: 980px) {
    .metrics-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .auth-layout {
        grid-template-columns: 1fr;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .users-table .row-edit-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .meta-list {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .auth-page {
        min-height: auto;
    }

    .auth-hero h1 {
        font-size: 1.5rem;
    }
}
