:root {
    --app-bg: #f4efe6;
    --app-bg-soft: #fbf8f3;
    --app-surface: rgba(255, 252, 247, 0.92);
    --app-surface-strong: #ffffff;
    --app-border: rgba(73, 52, 32, 0.12);
    --app-border-strong: rgba(73, 52, 32, 0.18);
    --app-text: #2f2419;
    --app-muted: #756554;
    --app-accent: #0f766e;
    --app-accent-strong: #115e59;
    --app-accent-soft: rgba(15, 118, 110, 0.12);
    --app-highlight: #b45309;
    --app-shadow: 0 24px 60px rgba(58, 40, 24, 0.08);
    --app-radius-lg: 24px;
    --app-radius-md: 18px;
    --app-radius-sm: 12px;
}

html,
body {
    min-height: 100%;
}

body.app-body {
    color: var(--app-text);
    background:
        radial-gradient(circle at top left, rgba(180, 83, 9, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
        linear-gradient(180deg, #f8f4ec 0%, #f2ece2 52%, #ece3d7 100%);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.app-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 85%);
    opacity: 0.45;
}

.app-navbar {
    position: relative;
    z-index: 1000;
    margin: 16px auto 0;
    max-width: min(1360px, calc(100% - 24px));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(34, 26, 20, 0.92), rgba(43, 36, 29, 0.82));
    box-shadow: 0 16px 40px rgba(33, 24, 17, 0.16);
    backdrop-filter: blur(16px);
}

.app-navbar .navbar-brand {
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.app-navbar .nav-link,
.app-navbar .dropdown-item,
.app-navbar .btn {
    border-radius: 999px;
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.app-page {
    position: relative;
    z-index: 1;
    padding-bottom: 40px;
}

.container,
.container-fluid {
    position: relative;
    z-index: 1;
}

.card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow);
    background: var(--app-surface);
    backdrop-filter: blur(10px);
}

.card .card-header {
    border-color: var(--app-border);
    border-top-left-radius: var(--app-radius-lg) !important;
    border-top-right-radius: var(--app-radius-lg) !important;
    background: rgba(255, 255, 255, 0.74) !important;
}

.alert,
.form-control,
.form-select,
.btn,
.badge,
.dropdown-menu,
.list-group-item,
.table,
.modal-content {
    border-radius: var(--app-radius-sm);
}

.form-control,
.form-select,
.modal-content,
.dropdown-menu,
.list-group-item {
    border-color: var(--app-border);
}

.form-control,
.form-select {
    min-height: 46px;
    background-color: rgba(255, 255, 255, 0.86);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 118, 110, 0.38);
    box-shadow: 0 0 0 0.24rem rgba(15, 118, 110, 0.14);
}

.btn-primary,
.btn-dark {
    border: none;
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-strong));
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.18);
}

.btn-primary:hover,
.btn-dark:hover {
    background: linear-gradient(135deg, #0d6760, #0f4c49);
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-success {
    border-width: 1px;
}

.table thead th {
    border-bottom: 0;
    color: var(--app-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table-light,
.table > :not(caption) > * > * {
    background-color: transparent !important;
}

.table tbody tr {
    border-color: rgba(73, 52, 32, 0.08);
}

.table tbody tr:hover {
    background-color: rgba(15, 118, 110, 0.05);
}

.nav-pills .nav-link {
    border-radius: 999px;
    color: var(--app-muted);
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-strong));
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.16);
}

.badge.text-bg-secondary {
    background-color: rgba(117, 101, 84, 0.12) !important;
    color: var(--app-text) !important;
}

.app-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.app-auth::before,
.app-auth::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(6px);
}

.app-auth::before {
    width: 280px;
    height: 280px;
    background: rgba(180, 83, 9, 0.18);
    top: 8%;
    left: 7%;
}

.app-auth::after {
    width: 360px;
    height: 360px;
    background: rgba(15, 118, 110, 0.16);
    right: -60px;
    bottom: 8%;
}

.auth-shell {
    position: relative;
    z-index: 1;
}

.auth-panel {
    overflow: hidden;
    border-radius: 28px;
}

.auth-panel .card-body {
    padding: 0;
}

.auth-showcase {
    min-height: 100%;
    padding: 36px;
    color: #fff7ed;
    background: linear-gradient(155deg, #14532d 0%, #0f766e 42%, #1f2937 100%);
}

.auth-showcase h1 {
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.08;
}

.auth-showcase .auth-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.84rem;
}

.auth-form {
    padding: 36px;
    background: rgba(255, 252, 247, 0.96);
}

.auth-brand {
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: 1.5rem;
}

.auth-muted {
    color: var(--app-muted);
}

.auth-footer-note {
    padding: 14px 16px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.06);
    color: var(--app-text);
}

.page-narrow {
    max-width: 860px;
}

.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding: 26px 28px;
    border: 1px solid var(--app-border);
    border-radius: 28px;
    background:
        radial-gradient(circle at right top, rgba(15, 118, 110, 0.14), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 250, 244, 0.92));
    box-shadow: var(--app-shadow);
}

.page-hero-title {
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: clamp(1.7rem, 2vw, 2.35rem);
    line-height: 1.08;
    margin-bottom: 0.35rem;
}

.page-hero-copy {
    max-width: 720px;
    color: var(--app-muted);
    margin-bottom: 0;
}

.page-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.filter-panel {
    margin-bottom: 24px;
    padding: 20px 22px;
}

.filter-panel .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.metric-card {
    overflow: hidden;
}

.metric-card .card-body {
    position: relative;
}

.metric-card .card-body::after {
    content: "";
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--app-accent-soft);
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    position: relative;
    z-index: 1;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
}

.table-card {
    overflow: hidden;
}

.table-card .card-body {
    padding: 0;
}

.form-shell {
    padding: 22px 24px;
}

.form-shell .form-label {
    font-weight: 600;
}

.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-muted);
    margin-bottom: 14px;
}

.segmented-panel {
    padding: 10px 12px;
}

@media (max-width: 767.98px) {
    .app-page {
        padding-bottom: 28px;
    }

    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }

    .page-hero {
        padding: 20px;
        flex-direction: column;
        margin-bottom: 18px;
    }

    .page-hero-title {
        font-size: 1.5rem;
    }

    .page-hero-copy {
        max-width: none;
    }

    .page-hero-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .page-hero-actions .btn {
        flex: 1 1 auto;
    }

    .filter-panel {
        padding: 16px;
        margin-bottom: 18px;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions .btn,
    .filter-actions > a,
    .filter-actions > button {
        width: 100%;
    }

    .metric-value {
        font-size: 1.55rem;
    }

    .form-shell {
        padding: 18px 16px;
    }

    .segmented-panel {
        padding: 8px;
    }

    .segmented-panel .nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .segmented-panel .nav-link {
        white-space: nowrap;
    }

    .table-card .table,
    .table-responsive .table {
        font-size: 0.92rem;
    }

    .table-card .table th,
    .table-card .table td,
    .table-responsive .table th,
    .table-responsive .table td {
        white-space: nowrap;
    }

    .auth-form,
    .auth-showcase {
        padding: 24px;
    }
}

@media (max-width: 991.98px) {
    .app-navbar {
        border-radius: 0;
        max-width: 100%;
        margin-top: 0;
    }

    .auth-showcase {
        min-height: auto;
    }

    .page-hero {
        align-items: stretch;
    }

    .page-hero-actions {
        justify-content: flex-start;
    }
}
