:root {
    color-scheme: light;
    --ink: #172b24;
    --muted: #66766e;
    --line: #e2ebe5;
    --surface: #ffffff;
    --canvas: #f4f8f5;
    --green: #16734a;
    --green-dark: #105b3a;
    --green-soft: #e6f4eb;
    --shadow: 0 12px 32px rgba(23, 43, 36, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

a {
    color: var(--green);
}

a:hover {
    color: var(--green-dark);
}

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    width: 100%;
    border-bottom: 1px solid rgba(226, 235, 229, 0.9);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
}

.staff-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem max(1.25rem, calc((100% - 1200px) / 2));
    color: #17432e;
    background: var(--green-soft);
    font-size: 0.875rem;
}

.site-nav {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: min(100% - 2.5rem, 1200px);
    margin: 0 auto;
}

.site-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

.site-brand img {
    display: block;
    width: auto;
    height: 48px;
}

.site-nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.site-nav-links > a,
.site-nav-links .nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0.55rem 0.9rem;
    border: 0;
    border-radius: 999px;
    color: #42554b;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.site-nav-links > a:hover,
.site-nav-links .nav-link:hover,
.site-nav-links > a.active {
    color: var(--green-dark);
    background: var(--green-soft);
}

.site-nav-links form {
    margin: 0;
}

.library-page {
    min-height: 100vh;
    background: var(--canvas);
}

.library-hero {
    border-bottom: 1px solid rgba(226, 235, 229, 0.8);
}

.library-section {
    background: var(--canvas);
}

.library-section.popular-section {
    background: #edf5ef;
}

.my-books-header {
    padding: clamp(1.5rem, 4vw, 3rem) 0 0.5rem;
}

.my-books-tabs {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    align-items: end;
    gap: clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--line);
}

.my-books-tab {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.65rem 0.1rem;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 0.925rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 160ms ease, border-color 160ms ease;
}

.my-books-tab:hover,
.my-books-tab.is-active {
    color: var(--green-dark);
}

.my-books-tab.is-active {
    border-bottom-color: var(--green);
}

.my-books-tab-count {
    color: #84938b;
    font-size: 0.8rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.my-books-tab.is-active .my-books-tab-count {
    color: var(--green);
}

.my-books-tab:focus-visible {
    outline: 2px solid rgba(22, 115, 74, 0.45);
    outline-offset: -2px;
}

.my-books-physical-cover {
    width: 100%;
    height: clamp(190px, 24vw, 280px);
    object-fit: cover;
    object-position: top;
}

.my-books-digital-cover {
    width: 100%;
    height: clamp(170px, 20vw, 240px);
    object-fit: contain;
    background: #f1f5f2;
}

.my-books-borrow-history-cover {
    width: 100%;
    height: 210px;
    object-fit: cover;
    object-position: top;
}

.my-books-read-history-cover {
    flex: 0 0 64px;
    width: 64px;
    height: 84px;
    object-fit: contain;
    background: #f1f5f2;
}

.my-books-read-history-cover + div,
.my-books-borrow-history-body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.my-books-tabs a:focus-visible {
    outline-offset: 3px;
}

.section-title {
    letter-spacing: -0.035em;
}

.book-card {
    border-color: var(--line);
    box-shadow: 0 8px 22px rgba(23, 43, 36, 0.06);
}

.book-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--green);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.book-detail-link span {
    font-size: 1rem;
    transition: transform 160ms ease;
}

.book-link:hover .book-detail-link span {
    transform: translateX(3px);
}

.book-link:focus-visible,
.site-nav a:focus-visible,
.site-nav button:focus-visible {
    outline: 3px solid rgba(22, 115, 74, 0.45);
    outline-offset: 3px;
}

@media (max-width: 767.98px) {
    .search-book-card {
        display: block;
        min-height: 0;
    }

    .row.row-cols-1 > .col:has(.search-book-card) {
        width: 50%;
        padding-right: 6px;
        padding-left: 6px;
    }

    .search-book-card {
        overflow: hidden;
    }

    .search-book-card .card-img-top {
        width: 100%;
        height: 180px;
        object-fit: cover;
    }

    .search-book-card .card-body {
        min-width: 0;
        padding: 0.65rem;
        text-align: left !important;
    }

    .search-book-card .card-text {
        height: 38px;
        margin-bottom: 0.5rem !important;
        overflow: hidden;
        font-size: 0.8rem !important;
        line-height: 1.3;
    }

    .search-book-card .card-body > span:last-child {
        display: block;
        overflow: hidden;
        font-size: 0.7rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .search-book-card .badge {
        font-size: 0.65rem;
    }

    .search-book-card .book-detail-link {
        display: inline-flex;
        margin-top: 0.55rem;
        font-size: 0.7rem;
    }
}

.guest-page {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 15% 10%, rgba(51, 152, 95, 0.12), transparent 36%),
        radial-gradient(ellipse at 90% 85%, rgba(22, 115, 74, 0.1), transparent 34%),
        var(--canvas);
}

.auth-card {
    width: min(100%, 520px);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: left;
}

.auth-brand {
    display: inline-block;
    margin-bottom: 0.4rem;
    color: var(--green-dark);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    text-decoration: none;
}

.auth-heading {
    margin: 0 0 1.4rem;
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 700;
}

.auth-card form {
    padding: 0 !important;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    background: var(--canvas);
}

.admin-sidebar {
    display: flex;
    width: 260px;
    flex: 0 0 260px;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    color: #e7f1eb;
    background: #143c2c;
}

.admin-brand {
    display: block;
    padding: 0.25rem 0.8rem 1rem;
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.admin-brand small {
    display: block;
    margin-top: 0.15rem;
    color: #a9c9b6;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.admin-nav {
    display: grid;
    gap: 0.3rem;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-height: 46px;
    padding: 0.7rem 0.85rem;
    border-radius: 0.7rem;
    color: #d1e2d7;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
}

.admin-nav a.active {
    box-shadow: inset 3px 0 #76d69b;
}

.admin-main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.admin-topbar {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.admin-topbar-title {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 650;
}

.admin-user form {
    margin: 0;
}

.admin-content {
    width: min(100%, 1480px);
    flex: 1;
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
}

.admin-page-heading {
    margin: 0 0 1.4rem;
    color: var(--ink);
    font-size: clamp(1.4rem, 2vw, 1.8rem);
    font-weight: 750;
    letter-spacing: -0.04em;
}

.admin-footer {
    padding: 1.2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: var(--surface);
    font-size: 0.85rem;
    text-align: center;
}

.admin-footer a {
    font-weight: 650;
    text-decoration: none;
}

.card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    background: var(--surface);
    box-shadow: 0 6px 22px rgba(23, 43, 36, 0.045);
}

.card-header {
    border-bottom-color: var(--line);
    background: #fbfdfb;
}

.text-primary {
    color: var(--green) !important;
}

.text-success {
    color: #21804d !important;
}

.bg-primary {
    background-color: var(--green) !important;
}

.border-primary {
    border-color: var(--green) !important;
}

.border-left-primary,
.border-left-success,
.border-left-warning,
.border-left-info {
    border-left: 4px solid var(--green) !important;
}

.border-left-success {
    border-left-color: #21804d !important;
}

.border-left-warning {
    border-left-color: #e5ad32 !important;
}

.border-left-info {
    border-left-color: #3687a7 !important;
}

.text-xs {
    font-size: 0.72rem;
}

.font-weight-bold {
    font-weight: 700;
}

.text-gray-800 {
    color: #263c31;
}

.text-gray-300 {
    color: #a7b8ad;
}

.card-body {
    padding: 1.35rem;
}

.table-responsive {
    border-radius: 0.65rem;
}

.table {
    --bs-table-color: #33463c;
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.85rem 0.9rem;
    border-bottom-color: var(--line);
    vertical-align: middle;
}

.table thead th {
    color: #52645a;
    background: #f4f8f5;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr:last-child > * {
    border-bottom-width: 0;
}

.form-label {
    margin-bottom: 0.45rem;
    color: #34483d;
    font-size: 0.9rem;
    font-weight: 650;
}

.form-control,
.form-select {
    min-height: 44px;
    border-color: #d5e1d9;
    border-radius: 0.65rem;
    color: var(--ink);
    background-color: #ffffff;
    box-shadow: none;
}

textarea.form-control {
    min-height: 140px;
}

.form-control:focus,
.form-select:focus {
    border-color: #4aa673;
    box-shadow: 0 0 0 0.22rem rgba(22, 115, 74, 0.13);
}

.btn {
    min-height: 40px;
    border-radius: 0.65rem;
    font-weight: 650;
}

.btn-primary {
    border-color: var(--green);
    color: #ffffff;
    background: var(--green);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--green-dark);
    color: #ffffff;
    background: var(--green-dark);
}

.btn-success {
    border-color: #238451;
    background: #238451;
}

.btn-warning {
    border-color: #e6b94e;
}

.btn-outline-primary {
    border-color: var(--green);
    color: var(--green);
}

.btn-outline-primary:hover {
    border-color: var(--green);
    color: #ffffff;
    background: var(--green);
}

.btn-link {
    color: var(--green);
    text-decoration: none;
}

.btn-link:hover {
    color: var(--green-dark);
    text-decoration: underline;
}

.badge {
    border-radius: 999px;
    font-weight: 650;
}

.badge-success {
    color: #155b35;
    background: #d9f0e1;
}

.badge-warning {
    color: #765512;
    background: #fff0c2;
}

.badge-danger {
    color: #8a2932;
    background: #fde1e3;
}

.badge-dark {
    color: #ffffff;
    background: #40534a;
}

.badge-info {
    color: #155b70;
    background: #d9f0f6;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0;
}

.page-link {
    border-color: var(--line);
    border-radius: 0.5rem !important;
    color: var(--green);
}

.page-item.active .page-link {
    border-color: var(--green);
    background: var(--green);
}

@media (max-width: 767.98px) {
    .catalog-pagination {
        overflow: hidden;
    }

    .catalog-pagination .pagination {
        gap: 0.2rem;
    }

    .catalog-pagination .page-link {
        min-width: 2rem;
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
        text-align: center;
    }
}

.delete-confirm {
    position: relative;
    display: inline-block;
}

.delete-confirm summary {
    cursor: pointer;
    list-style: none;
}

.delete-confirm summary::-webkit-details-marker {
    display: none;
}

.delete-confirm .delete-confirm-panel {
    position: absolute;
    z-index: 5;
    min-width: 210px;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.delete-confirm-panel p {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.logout-confirm .delete-confirm-panel {
    right: 0;
}

.admin-topbar-start {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.8rem;
}

.admin-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    color: var(--green-dark);
    background: var(--surface);
    font-size: 1rem;
}

.admin-sidebar-backdrop {
    display: none;
}

.preview-page {
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.preview-book-layout {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(2rem, 5vw, 4.5rem) !important;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
}

.preview-book-layout > .col {
    width: auto;
    max-width: none;
    padding: 0;
}

.collection-cover {
    display: block;
    width: min(100%, 380px);
    height: min(68vh, 560px);
    margin: 0 auto;
    border: 1px solid var(--line);
    background: var(--surface);
    object-fit: contain;
}

.collection-title {
    font-size: clamp(1.8rem, 2.1vw, 2.35rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.digital-reader {
    padding-top: 7rem;
    padding-bottom: 3rem;
}

.digital-reader-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.digital-reader-info {
    min-width: 0;
    overflow-wrap: anywhere;
}

.digital-reader-frame {
    display: block;
    width: 100%;
    height: min(78vh, 1000px);
    min-height: 560px;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #ffffff;
}

.digital-reader-hint {
    margin: 0.6rem 0 0;
    color: var(--muted);
    font-size: 0.875rem;
}

@media (max-width: 767.98px) {
    .my-books-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 1rem;
    }

    .my-books-tab {
        min-width: 0;
        justify-content: space-between;
        gap: 0.35rem;
        font-size: 0.875rem;
    }

    .my-books-physical-cover {
        height: clamp(170px, 46vw, 240px);
    }

    .my-books-digital-cover {
        height: clamp(150px, 42vw, 210px);
    }

    .my-books-borrow-history-card {
        flex-direction: row;
        align-items: stretch;
    }

    .my-books-borrow-history-cover {
        flex: 0 0 88px;
        width: 88px;
        height: 120px;
        align-self: center;
        margin-left: 0.75rem;
        border-radius: 0.375rem;
    }

    .my-books-borrow-history-body {
        padding: 0.9rem;
        text-align: left;
    }

    .my-books-borrow-history-body .mt-auto {
        margin-top: 0.5rem !important;
    }

    .site-header {
        position: sticky;
    }

    .site-nav {
        width: min(100% - 1.5rem, 1200px);
        min-height: 64px;
        gap: 0.75rem;
    }

    .site-brand img {
        max-width: 52vw;
        height: 38px;
    }

    .site-nav-links {
        flex-wrap: nowrap;
        gap: 0.1rem;
    }

    .site-nav-links > a,
    .site-nav-links .nav-link {
        min-height: 38px;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    .staff-banner {
        flex-wrap: wrap;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .delete-confirm .delete-confirm-panel {
        right: 0;
        max-width: calc(100vw - 2rem);
    }

    .digital-reader {
        padding-top: 5.75rem;
        padding-bottom: 1.25rem;
    }

    .digital-reader-header {
        align-items: stretch;
    }

    .digital-reader-open {
        width: 100%;
    }

    .digital-reader-frame {
        height: max(65dvh, 480px);
        min-height: 0;
        touch-action: pan-x pan-y pinch-zoom;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .collection-cover {
        width: min(100%, 320px);
        height: min(52vh, 440px);
        object-fit: contain;
    }

    .collection-title {
        font-size: clamp(1.5rem, 7vw, 2.2rem);
    }

    .preview-page {
        padding-top: 1.5rem;
        padding-bottom: 2rem;
    }

    .preview-book-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .my-books-header {
        padding-top: 1.25rem;
    }

    .my-books-tabs {
        column-gap: 0.75rem;
    }

    .my-books-tab {
        font-size: 0.8rem;
    }

    .my-books-tab-count {
        font-size: 0.75rem;
    }

    .my-books-borrow-history-cover {
        flex-basis: 72px;
        width: 72px;
        height: 104px;
        margin-left: 0.5rem;
    }

    .my-books-borrow-history-body {
        padding: 0.75rem;
    }

    .site-nav {
        width: calc(100% - 1rem);
        gap: 0.3rem;
    }

    .site-brand img {
        max-width: 44vw;
        height: 34px;
    }

    .site-nav-links > a,
    .site-nav-links .nav-link {
        min-height: 38px;
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }

    .staff-banner {
        gap: 0.4rem;
        font-size: 0.78rem;
    }

    .digital-reader {
        padding-top: 5rem;
    }

    .digital-reader-info h1 {
        font-size: 1.25rem;
    }

    .digital-reader-frame {
        height: max(62dvh, 460px);
        min-height: 0;
    }
}

@media (max-width: 991.98px) {
    .admin-shell {
        display: block;
        min-height: 100vh;
    }

    .admin-sidebar {
        position: fixed;
        z-index: 40;
        inset: 0 auto 0 0;
        width: min(290px, calc(100vw - 3rem));
        min-height: 100vh;
        min-height: 100dvh;
        overflow-y: auto;
        padding: 1.25rem 1rem;
        box-shadow: 16px 0 36px rgba(9, 32, 22, 0.2);
        transform: translateX(-105%);
        transition: transform 220ms ease;
    }

    body.admin-menu-open {
        overflow: hidden;
    }

    body.admin-menu-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-backdrop {
        position: fixed;
        z-index: 39;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgba(12, 29, 21, 0.48);
    }

    body.admin-menu-open .admin-sidebar-backdrop {
        display: block;
    }

    .admin-menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .admin-topbar {
        position: sticky;
        z-index: 30;
        top: 0;
        min-height: 64px;
        padding: 0.65rem clamp(1rem, 3vw, 1.5rem);
    }

    .admin-user {
        min-width: 0;
        gap: 0.65rem;
        font-size: 0.9rem;
    }

    .admin-user > span {
        max-width: 32vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-content {
        width: 100%;
        padding: clamp(1rem, 3vw, 1.75rem);
    }

    .admin-content .table-responsive {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .preview-page {
        padding-top: 2rem;
        padding-bottom: 3rem;
    }

    .preview-book-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem !important;
    }
}

@media (max-width: 767.98px) {
    .admin-topbar {
        min-height: 58px;
        padding: 0.5rem 0.75rem;
    }

    .admin-topbar-start {
        gap: 0.55rem;
    }

    .admin-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .admin-topbar-title {
        max-width: 38vw;
        font-size: 0.78rem;
    }

    .admin-user {
        gap: 0.4rem;
        font-size: 0.8rem;
    }

    .admin-user > span {
        max-width: 28vw;
    }

    .admin-content {
        padding: 1rem 0.75rem;
    }

    .admin-content > .row {
        margin-right: 0;
        margin-left: 0;
    }

    .admin-page-heading {
        margin-bottom: 1rem;
    }

    .admin-content .card-body {
        padding: 0.9rem;
    }

    .admin-content .table {
        min-width: 680px;
    }

    .admin-content .table > :not(caption) > * > * {
        padding: 0.65rem;
    }

    .admin-content form.row {
        row-gap: 0.15rem;
    }

    .admin-content .form-control,
    .admin-content .form-select,
    .admin-content .btn {
        font-size: 1rem;
    }

    .admin-content form > .d-flex.justify-content-end {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .admin-content form > .d-flex.justify-content-end .btn {
        flex: 1 1 120px;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

.members-page {
    display: grid;
    gap: 1.25rem;
}

.members-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.members-page-header h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 750;
    letter-spacing: -0.045em;
}

.members-eyebrow {
    margin: 0 0 0.35rem;
    color: var(--green);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.12em;
}

.members-page-description {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.members-add-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
}

.members-panel {
    min-width: 0;
    padding: clamp(1rem, 2.4vw, 1.6rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(23, 43, 36, 0.045);
}

.members-alert {
    margin-bottom: 1.15rem;
    border: 0;
    border-radius: 0.75rem;
}

.members-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}

.members-tab {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    color: #5d6e64;
    font-size: 0.84rem;
    font-weight: 620;
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.members-tab:hover {
    color: var(--green-dark);
    background: #f5f8f6;
}

.members-tab.is-active {
    border-color: #cfe5d7;
    color: var(--green-dark);
    background: var(--green-soft);
}

.members-tab-count {
    display: inline-grid;
    min-width: 1.45rem;
    height: 1.45rem;
    place-items: center;
    padding: 0 0.3rem;
    border-radius: 999px;
    color: #617168;
    background: #edf1ee;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.members-tab.is-active .members-tab-count {
    color: #ffffff;
    background: var(--green);
}

.members-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.members-result-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
}

.members-result-label span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.members-toolbar .navbar-search {
    width: min(100%, 360px);
    margin: 0;
}

.members-toolbar .form-control {
    min-height: 40px;
    border-radius: 0.65rem 0 0 0.65rem;
    font-size: 0.84rem;
}

.members-toolbar .input-group .btn {
    min-height: 40px;
    border-radius: 0 0.65rem 0.65rem 0;
}

.members-table-wrap {
    overflow: visible;
}

.members-table {
    min-width: 790px;
    border-collapse: separate;
    border-spacing: 0;
}

.members-table thead th {
    padding: 0.7rem 0.8rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: #748178;
    background: #f8faf8;
    font-size: 0.68rem;
    letter-spacing: 0.075em;
}

.members-table thead th:first-child {
    border-left: 1px solid var(--line);
    border-radius: 0.65rem 0 0 0.65rem;
}

.members-table thead th:last-child {
    border-right: 1px solid var(--line);
    border-radius: 0 0.65rem 0.65rem 0;
}

.members-table tbody td {
    padding: 0.9rem 0.8rem;
    border-bottom: 1px solid #edf1ee;
    font-size: 0.84rem;
}

.members-table tbody tr:hover {
    background: #fbfdfb;
}

.members-name {
    color: var(--ink);
    font-weight: 700;
}

.members-username {
    padding: 0.25rem 0.45rem;
    border-radius: 0.4rem;
    color: #596b60;
    background: #f3f6f4;
    font-size: 0.78rem;
}

.members-type-pill {
    display: inline-flex;
    padding: 0.32rem 0.55rem;
    border: 1px solid #e4ebe6;
    border-radius: 999px;
    color: #53645a;
    background: #f8faf8;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.members-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #607168;
    font-size: 0.76rem;
    font-weight: 650;
    white-space: nowrap;
}

.members-status > span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #8a9990;
}

.members-status-active > span {
    background: #2b9860;
}

.members-status-pending > span {
    background: #d49a24;
}

.members-status-inactive > span {
    background: #8a9990;
}

.members-phone {
    color: #617168;
    white-space: nowrap;
}

.members-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.members-actions form {
    margin: 0;
}

.members-action {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.members-action-approve {
    border-color: #cde8d7;
    color: #16734a;
    background: #eff8f2;
}

.members-action-approve:hover {
    border-color: #add9be;
    background: #e2f3e8;
}

.members-action-disable,
.members-action-edit {
    border-color: #e6ebe7;
    color: #52645a;
    background: #ffffff;
}

.members-action-disable:hover,
.members-action-edit:hover {
    color: var(--green-dark);
    background: #f4f8f5;
}

.members-action-delete {
    color: #a34b4b;
}

.members-action-delete:hover {
    color: #863333;
    background: #fff4f3;
}

.members-delete-panel {
    right: 0;
    left: auto;
    z-index: 5;
}

.members-empty {
    display: grid;
    min-height: 190px;
    align-content: center;
    justify-items: center;
    gap: 0.45rem;
    color: var(--muted);
    text-align: center;
}

.members-empty strong {
    color: var(--ink);
    font-size: 0.95rem;
}

.members-empty-icon {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    place-items: center;
    margin-bottom: 0.35rem;
    border-radius: 0.85rem;
    color: var(--green);
    background: var(--green-soft);
}

.members-pagination {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
}

.members-pagination nav {
    margin: 0;
}

@media (max-width: 767.98px) {
    .members-page {
        gap: 0.9rem;
    }

    .members-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .members-page-description {
        max-width: 34ch;
    }

    .members-add-button {
        width: 100%;
    }

    .members-panel {
        padding: 0.9rem;
    }

    .members-tabs {
        margin: 0 -0.2rem;
        padding: 0 0.2rem 0.75rem;
    }

    .members-tab {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.78rem;
    }

    .members-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0.75rem;
    }

    .members-toolbar .navbar-search {
        width: 100%;
    }

    .members-table-wrap {
        overflow: visible !important;
    }

    .members-table {
        min-width: 0 !important;
    }

    .members-table thead {
        display: none;
    }

    .members-table,
    .members-table tbody,
    .members-table tbody tr,
    .members-table tbody td {
        display: block;
        width: 100%;
    }

    .members-table tbody tr {
        margin-bottom: 0.7rem;
        padding: 0.35rem 0.8rem;
        border: 1px solid var(--line);
        border-radius: 0.8rem;
        background: #ffffff;
    }

    .members-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .members-table tbody td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 0.75fr) minmax(0, 1.25fr);
        align-items: center;
        gap: 0.65rem;
        padding: 0.65rem 0;
        border: 0;
        border-bottom: 1px solid #edf1ee;
        overflow-wrap: anywhere;
    }

    .members-table tbody td::before {
        color: #7a8980;
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 650;
    }

    .members-table tbody td:last-child {
        display: block;
        padding: 0.65rem 0 0.2rem;
        border-bottom: 0;
    }

    .members-table tbody td:last-child::before {
        display: block;
        margin-bottom: 0.5rem;
    }

    .members-actions {
        gap: 0.3rem;
    }

    .members-empty {
        min-height: 150px;
    }

    .members-pagination {
        justify-content: center;
        overflow-x: auto;
    }
}
