:root {
    --forest-950: #182318;
    --forest-900: #243224;
    --forest-700: #465d46;
    --sage-600: #6d806c;
    --sage-400: #9caa98;
    --mist: #b0b2a2;
    --cream: #f3f2e9;
    --paper: #ffffff;
    --ink: #263126;
    --muted: #687168;
    --line: #dfe3da;
    --danger: #a63d40;
    --warning: #a87420;
    --success: #367149;
    --shadow: 0 10px 30px rgba(36, 50, 36, .08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #eef0eb;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: #f6f7f4;
    font-family: "Open Sans", "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--forest-700);
}

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

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 270px;
    overflow-y: auto;
    color: var(--cream);
    background:
        linear-gradient(rgba(24, 35, 24, .94), rgba(36, 50, 36, .97)),
        url("../img/intro-bg.jpg") center/cover;
    box-shadow: 8px 0 35px rgba(24, 35, 24, .14);
}

.brand {
    display: block;
    padding: 28px 26px 22px;
    color: var(--cream);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand-mark {
    display: inline-grid;
    width: 48px;
    height: 48px;
    margin-right: 12px;
    place-items: center;
    color: var(--forest-900);
    background: var(--cream);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .08em;
    vertical-align: middle;
}

.brand-copy {
    display: inline-block;
    vertical-align: middle;
}

.brand-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .05em;
}

.brand-subtitle {
    display: block;
    margin-top: 2px;
    color: var(--mist);
    font-size: 12px;
}

.sidebar-nav {
    padding: 20px 14px;
}

.nav-section {
    margin: 18px 12px 8px;
    color: var(--sage-400);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 3px 0;
    padding: 11px 14px;
    color: #e9ede5;
    text-decoration: none;
    border-radius: 8px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: #fff;
    background: rgba(176, 178, 162, .19);
    transform: translateX(2px);
}

.nav-icon {
    width: 22px;
    color: var(--mist);
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 18px 26px 28px;
    color: var(--sage-400);
    font-size: 12px;
}

.main-area {
    min-height: 100vh;
    margin-left: 270px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    min-height: 72px;
    padding: 14px 30px;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-title {
    margin: 0;
    color: var(--forest-900);
    font-size: 21px;
    font-weight: 700;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
}

.role-badge,
.status-badge {
    display: inline-flex;
    padding: 4px 9px;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.role-badge {
    color: var(--forest-900);
    background: var(--cream);
}

.status-badge.is-active {
    color: #fff;
    background: var(--danger);
}

.status-badge.is-resolved {
    color: #fff;
    background: var(--success);
}

.mobile-menu-button {
    display: none;
    width: 42px;
    height: 42px;
    margin-right: 12px;
    color: var(--forest-900);
    background: var(--cream);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 30px;
}

.page-heading {
    display: flex;
    margin-bottom: 22px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.page-heading h1 {
    margin: 0;
    color: var(--forest-900);
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.15;
}

.page-heading p {
    max-width: 760px;
    margin: 7px 0 0;
    color: var(--muted);
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card {
    margin-bottom: 22px;
    padding: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.card-title {
    margin: 0 0 18px;
    color: var(--forest-900);
    font-size: 18px;
}

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

.stat-card {
    position: relative;
    min-height: 132px;
    padding: 22px;
    overflow: hidden;
    color: var(--forest-900);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-card::after {
    position: absolute;
    right: -28px;
    bottom: -38px;
    width: 110px;
    height: 110px;
    content: "";
    background: var(--cream);
    border-radius: 50%;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.stat-value {
    display: block;
    margin-top: 12px;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

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

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    color: var(--forest-700);
    background: #f8f9f6;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: #fafbf8;
}

.data-table .number {
    text-align: right;
    white-space: nowrap;
}

.data-table .table-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    min-height: 40px;
    padding: 9px 15px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--forest-900);
    background: var(--cream);
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(36, 50, 36, .12);
}

.btn-primary {
    color: #fff;
    background: var(--forest-700);
}

.btn-secondary {
    color: var(--forest-900);
    background: var(--cream);
    border-color: #dadbce;
}

.btn-danger {
    color: #fff;
    background: var(--danger);
}

.btn-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.button-link {
    padding: 0;
    color: var(--forest-700);
    background: none;
    border: 0;
    cursor: pointer;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.filter-bar {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .field {
    min-width: 190px;
    margin: 0;
}

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

.field {
    margin-bottom: 18px;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--forest-900);
    font-size: 13px;
    font-weight: 700;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.control {
    display: block;
    width: 100%;
    min-height: 43px;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfd5ca;
    border-radius: 7px;
    outline: none;
}

.control:focus {
    border-color: var(--sage-600);
    box-shadow: 0 0 0 3px rgba(109, 128, 108, .15);
}

textarea.control {
    min-height: 110px;
    resize: vertical;
}

.check-row {
    display: flex;
    min-height: 43px;
    align-items: center;
    gap: 9px;
}

.form-footer {
    display: flex;
    margin-top: 8px;
    padding-top: 18px;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
}

.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid;
    border-radius: 8px;
}

.alert-success {
    color: #245534;
    background: #edf7ef;
    border-color: #bad8c1;
}

.alert-danger {
    color: #772b2e;
    background: #fff0f0;
    border-color: #edb9bb;
}

.alert ul {
    margin: 8px 0 0;
}

.empty-state {
    padding: 44px 20px;
    color: var(--muted);
    text-align: center;
}

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

.detail-item {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.detail-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-value {
    display: block;
    margin-top: 5px;
    color: var(--ink);
    font-weight: 600;
}

.pagination {
    display: flex;
    margin-top: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}

.map {
    width: 100%;
    min-height: 620px;
    border-radius: 10px;
}

.photo-preview {
    display: block;
    width: min(680px, 100%);
    max-height: 520px;
    object-fit: contain;
    background: #eef0eb;
    border-radius: 10px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(24, 35, 24, .92), rgba(109, 128, 108, .74)),
        url("../img/intro-bg.jpg") center/cover fixed;
}

.login-card {
    width: min(460px, 100%);
    padding: 38px;
    background: rgba(255, 255, 255, .97);
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .26);
}

.login-brand {
    margin-bottom: 28px;
    text-align: center;
}

.login-brand .brand-mark {
    width: 64px;
    height: 64px;
    margin: 0 0 14px;
    color: var(--cream);
    background: var(--forest-900);
}

.login-brand h1 {
    margin: 0;
    color: var(--forest-900);
    font-size: 25px;
}

.login-brand p {
    margin: 6px 0 0;
    color: var(--muted);
}

.login-back {
    margin-top: 22px;
    text-align: center;
}

.inline-form {
    display: inline;
}

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

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 820px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-grid;
        place-items: center;
    }

    .topbar {
        padding: 12px 18px;
    }

    .topbar-title {
        font-size: 18px;
    }

    .topbar-user .user-name {
        display: none;
    }

    .content {
        padding: 22px 16px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .stat-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 28px 22px;
    }

    .filter-bar {
        display: block;
    }

    .filter-bar .field {
        margin-bottom: 12px;
    }
}

@media print {
    .sidebar,
    .topbar,
    .page-heading .actions,
    .filter-bar,
    .table-actions,
    .pagination {
        display: none !important;
    }

    .main-area {
        margin: 0;
    }

    .content {
        width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
    }
}
