:root {
    --bg: #f6f8fb;
    --text: #1e293b;
    --muted: #64748b;
    --line: #d9e1ea;
    --panel: #ffffff;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --warning: #b54708;
    --info: #175cd3;
    --good: #067647;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a:hover {
    text-decoration: underline;
}

.site-header {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
}

.brand {
    color: var(--text);
    font-weight: 800;
}

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

.site-header span {
    color: var(--muted);
}

.container {
    margin: 0 auto;
    max-width: 1120px;
    padding: 28px;
}

.toolbar,
.detail-head {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

h1,
h2 {
    line-height: 1.15;
    margin: 0 0 8px;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 18px;
}

p {
    margin: 0 0 12px;
}

.toolbar p,
.detail-head p,
.bug-row p {
    color: var(--muted);
}

.button {
    align-items: center;
    background: #eef4f7;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    min-height: 42px;
    padding: 9px 14px;
}

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

.button.danger {
    background: #fef3f2;
    border-color: #fecdca;
    color: var(--danger);
}

.button:hover {
    text-decoration: none;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.filters a {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    font-weight: 700;
    padding: 9px 12px;
}

.filters a.active {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.filters span {
    color: var(--muted);
    margin-left: 6px;
}

.bug-list {
    display: grid;
    gap: 12px;
}

.bug-row,
.bug-detail,
.comment,
.empty,
.install-box,
.auth-card,
.panel-form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.bug-row {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 18px;
}

.row-meta {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.badge,
.severity {
    border-radius: 999px;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    padding: 3px 9px;
}

.badge.open {
    background: #fff4ed;
    color: var(--warning);
}

.badge.in_progress {
    background: #eff8ff;
    color: var(--info);
}

.badge.fixed,
.badge.closed {
    background: #ecfdf3;
    color: var(--good);
}

.severity.low {
    background: #f2f4f7;
}

.severity.medium {
    background: #fffaeb;
    color: var(--warning);
}

.severity.high,
.severity.critical {
    background: #fef3f2;
    color: var(--danger);
}

.row-stats {
    color: var(--muted);
    display: grid;
    min-width: 110px;
    place-content: center end;
    text-align: right;
}

.panel-form {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.panel-form.wide {
    max-width: 820px;
}

label {
    color: var(--text);
    display: grid;
    font-weight: 750;
    gap: 6px;
}

input,
select,
textarea {
    border: 1px solid #b8c4d1;
    border-radius: 7px;
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.notice {
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.notice.error {
    background: #fef3f2;
    color: var(--danger);
}

.notice.success {
    background: #ecfdf3;
    color: var(--good);
}

.auth-card,
.install-box {
    margin: 48px auto;
    max-width: 560px;
    padding: 24px;
}

.install-box {
    max-width: 720px;
}

.install-page {
    padding: 20px;
}

.auth-link {
    color: var(--muted);
    margin-top: 18px;
    text-align: center;
}

.bug-detail {
    padding: 22px;
}

.detail-grid {
    display: grid;
    gap: 18px;
}

.status-form {
    align-items: end;
    display: flex;
    gap: 10px;
    min-width: 260px;
}

.delete-form {
    display: flex;
    justify-content: flex-end;
    margin: -6px 0 18px;
}

.image-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    margin: 20px 0;
}

.image-grid a {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.image-grid img {
    aspect-ratio: 4 / 3;
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.comments {
    display: grid;
    gap: 12px;
}

.comment,
.empty {
    padding: 16px;
}

.comment span {
    color: var(--muted);
    margin-left: 8px;
}

@media (max-width: 720px) {
    .site-header,
    .toolbar,
    .detail-head,
    .bug-row,
    .status-form {
        align-items: stretch;
        flex-direction: column;
    }

    .delete-form {
        justify-content: stretch;
    }

    .site-header {
        gap: 10px;
        padding: 14px 18px;
    }

    .site-header nav {
        flex-wrap: wrap;
    }

    .container {
        padding: 18px;
    }

    h1 {
        font-size: 26px;
    }

    .row-stats {
        place-content: start;
        text-align: left;
    }
}
