:root {
    --phinma-green: #0b7a3b;
    --brand-green: #196F38;
    --brand-blue: #202C61;
    --phinma-green-dark: #075c2d;
    --phinma-gold: #f1b51c;
    --ink: #17211b;
    --muted: #617066;
    --line: #dfe7e2;
    --panel-bg: #ffffff;
    --page-bg: #f4f7f5;
}

body {
    background: var(--page-bg);
    color: var(--ink);
    font-size: .95rem;
}

a {
    color: var(--phinma-green);
}

a:hover {
    color: var(--phinma-green-dark);
}

.app-navbar {
    box-shadow: 0 1px 0 rgba(23, 33, 27, .04);
    z-index: 1030;
}

.navbar-brand {
    color: var(--phinma-green) !important;
    font-weight: 700;
    letter-spacing: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    background: var(--phinma-green);
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
}

.app-navbar .nav-link {
    border-radius: 6px;
    color: #314139;
    font-weight: 600;
    padding-left: .85rem;
    padding-right: .85rem;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    background: #edf7f1;
    color: var(--phinma-green-dark);
}

.dropdown-menu {
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(23, 33, 27, .12);
}

.dropdown-item {
    border-radius: 6px;
    margin: 2px .35rem;
    width: auto;
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--phinma-green);
    color: #fff;
}

.user-menu .btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    max-width: 260px;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #edf7f1;
    color: var(--phinma-green-dark);
    font-weight: 700;
}

.user-label {
    display: grid;
    min-width: 0;
    line-height: 1.15;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    color: var(--muted);
    font-size: .75rem;
}

.app-main {
    max-width: 1520px;
}

.panel,
.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-bg);
    box-shadow: 0 10px 26px rgba(23, 33, 27, .05);
}

.metric {
    padding: 1rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

a.metric:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(23, 33, 27, .08);
}

.metric-value {
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 700;
    color: var(--ink);
}

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

.form-control,
.form-select,
.btn {
    border-radius: 6px;
}

.btn-success {
    --bs-btn-bg: var(--phinma-green);
    --bs-btn-border-color: var(--phinma-green);
    --bs-btn-hover-bg: var(--phinma-green-dark);
    --bs-btn-hover-border-color: var(--phinma-green-dark);
}

.btn-outline-secondary {
    --bs-btn-color: #425249;
    --bs-btn-border-color: #cbd7d0;
    --bs-btn-hover-bg: #eef3f0;
    --bs-btn-hover-border-color: #b8c7bf;
    --bs-btn-hover-color: var(--ink);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(11, 122, 59, .5);
    box-shadow: 0 0 0 .2rem rgba(11, 122, 59, .12);
}

.table {
    --bs-table-color: var(--ink);
    --bs-table-hover-bg: #f7faf8;
}

.table thead th {
    background: #f8fbf9;
    color: #435349;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.table > :not(caption) > * > * {
    padding: .9rem 1rem;
    border-bottom-color: #e8eee9;
}

.table tbody tr:last-child > * {
    border-bottom-width: 0;
}

.badge {
    border-radius: 6px;
    font-weight: 650;
}

.ticket-description {
    white-space: pre-wrap;
}

.resolution-note {
    overflow: hidden;
    border: 1px solid rgba(25, 111, 56, .22);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(25, 111, 56, .055), #fff 54%);
}

.resolution-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .95rem 1rem;
    border-top: 4px solid transparent;
    border-bottom: 1px solid rgba(32, 44, 97, .1);
    border-image: linear-gradient(90deg, var(--brand-green), var(--brand-blue)) 1;
    background: #fbfdfc;
}

.resolution-note-eyebrow {
    color: var(--brand-blue);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02rem;
    text-transform: uppercase;
}

.resolution-note-body {
    padding: 1rem;
    color: #26342c;
    line-height: 1.55;
}

.ticket-scroll-area {
    max-height: 360px;
    overflow-y: auto;
    padding-right: .5rem;
    scrollbar-width: thin;
}

.ticket-scroll-area::-webkit-scrollbar {
    width: .45rem;
}

.ticket-scroll-area::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c3d3ca;
}

.ticket-timeline-scroll {
    max-height: 320px;
}

.ticket-conversation-scroll {
    max-height: 460px;
}

.attachment-row .min-w-0 {
    min-width: 0;
}

.attachment-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.45rem;
    height: 2.45rem;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #edf7f1;
    color: var(--brand-blue);
    font-size: .72rem;
    font-weight: 800;
}

.attachment-preview-image {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    margin: 0 auto;
    object-fit: contain;
}

.admin-page-count {
    display: inline-grid;
    min-width: 112px;
    padding: .65rem .85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: right;
}

.admin-page-count-value {
    color: var(--brand-blue);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
}

.admin-page-count-label {
    color: var(--muted);
    font-size: .76rem;
}

.admin-create-panel,
.admin-manage-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(23, 33, 27, .05);
    overflow: hidden;
}

.admin-create-header {
    padding: 1rem;
    border-bottom: 1px solid #e8eee9;
    border-top: 4px solid transparent;
    border-image: linear-gradient(90deg, var(--brand-green), var(--brand-blue)) 1;
    background: #fbfdfc;
}

.admin-create-body {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.admin-eyebrow {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04rem;
    text-transform: uppercase;
}

.admin-inline-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 2rem;
}

.admin-manage-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    color: #fff;
    background: linear-gradient(90deg, var(--brand-green), var(--brand-blue));
}

.admin-edit-table thead th {
    background: #f5f8f7;
}

.admin-edit-table .form-control-sm {
    max-width: 420px;
}

.admin-count-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: .25rem .55rem;
    border: 1px solid #d8e0ea;
    border-radius: 999px;
    color: var(--brand-blue);
    background: #eef2f7;
    font-size: .8rem;
    font-weight: 800;
}

.delete-confirm-modal .modal-header {
    color: #fff;
    background: linear-gradient(90deg, var(--brand-green), var(--brand-blue));
}

.admin-manage-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1rem;
    border-top: 1px solid #e8eee9;
    background: #fbfdfc;
}

.alert {
    border-radius: 8px;
    border-width: 1px;
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding-top: .75rem;
    }

    .app-navbar .nav-link {
        padding: .75rem .85rem;
    }

    .dropdown-menu {
        border: 0;
        box-shadow: none;
        padding-top: 0;
    }

    .user-menu .btn {
        max-width: none;
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: .92rem;
    }

    .metric-value {
        font-size: 1.55rem;
    }

    .panel.p-4,
    .panel .p-4 {
        padding: 1rem !important;
    }

    .table > :not(caption) > * > * {
        padding: .8rem .75rem;
    }
}
