:root {
    --bg: #f3efe7;
    --bg-strong: #e7dfd1;
    --surface: rgba(255, 252, 247, 0.84);
    --surface-strong: #fffaf2;
    --surface-dark: #17211e;
    --surface-dark-soft: rgba(23, 33, 30, 0.88);
    --text: #1d2725;
    --muted: #6f766e;
    --line: rgba(29, 39, 37, 0.08);
    --primary: #17624f;
    --primary-strong: #0f4d3f;
    --accent: #c7852f;
    --danger: #a3473d;
    --success: #1f7a56;
    --shadow-lg: 0 28px 80px rgba(31, 39, 37, 0.12);
    --shadow-md: 0 20px 40px rgba(31, 39, 37, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --transition: 220ms ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(199, 133, 47, 0.14), transparent 24%),
        radial-gradient(circle at right 20%, rgba(23, 98, 79, 0.14), transparent 20%),
        linear-gradient(160deg, #f6f0e5 0%, #f3efe7 46%, #ece6da 100%);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: #17211e;
    font-weight: 800;
    letter-spacing: -0.03em;
}

h1, h2 {
    font-family: 'Fraunces', serif;
}

p, span, label, td, th, small, .form-control, .form-select, .btn {
    font-family: 'Manrope', sans-serif;
}

.ambient {
    position: fixed;
    inset: auto;
    width: 28rem;
    height: 28rem;
    border-radius: 999px;
    filter: blur(70px);
    pointer-events: none;
    opacity: 0.5;
    z-index: 0;
}

.ambient-one {
    top: -8rem;
    right: -6rem;
    background: rgba(199, 133, 47, 0.26);
}

.ambient-two {
    bottom: -10rem;
    left: -8rem;
    background: rgba(23, 98, 79, 0.18);
}

.app-shell,
.auth-shell {
    position: relative;
    z-index: 1;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    gap: 1.5rem;
    padding: 1.25rem;
}

.app-sidebar {
    width: 300px;
    flex: 0 0 300px;
    background: linear-gradient(180deg, rgba(23, 33, 30, 0.96), rgba(15, 24, 22, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-lg);
    border-radius: 30px;
    overflow: hidden;
}

.sidebar-inner {
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    color: inherit;
    text-decoration: none;
}

.brand-lockup strong {
    display: block;
    color: #fff8f0;
    font-size: 1rem;
}

.brand-lockup small {
    display: block;
    color: rgba(255, 248, 240, 0.68);
    font-size: 0.78rem;
}

.brand-mark {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 12px 24px rgba(0,0,0,0.18);
}

.sidebar-label,
.topbar-kicker,
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 800;
    color: rgba(255, 248, 240, 0.54);
}

.sidebar-section {
    display: grid;
    gap: 0.85rem;
}

.app-nav {
    gap: 0.42rem;
}

.app-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    color: rgba(255, 248, 240, 0.75);
    transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(199, 133, 47, 0.22), rgba(23, 98, 79, 0.28));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
    transform: translateX(4px);
}

.nav-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
    transition: transform var(--transition), background var(--transition);
}

.app-nav .nav-link.active .nav-dot,
.app-nav .nav-link:hover .nav-dot {
    background: linear-gradient(135deg, #ffd39b, #f0a245);
    transform: scale(1.15);
}

.sidebar-promo {
    margin-top: auto;
    padding: 1.1rem;
    border-radius: 1.4rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255, 248, 240, 0.74);
}

.sidebar-promo strong {
    display: block;
    margin: 0.45rem 0;
    color: #fff8f0;
}

.sidebar-promo p {
    margin: 0;
    line-height: 1.55;
    font-size: 0.92rem;
}

.app-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 26px;
    background: rgba(255, 251, 245, 0.62);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

.topbar-kicker {
    color: var(--muted);
}

.topbar-title {
    margin: 0.18rem 0 0;
    font-size: clamp(1.7rem, 2vw, 2.35rem);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.content-shell {
    min-width: 0;
}

.content-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.56);
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    padding: 1.5rem;
}

.page-transition {
    animation: pageReveal 520ms cubic-bezier(.2,.8,.2,1);
}

@keyframes pageReveal {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-shell {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    background: rgba(255, 250, 242, 0.7);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 36px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

.auth-panel {
    padding: clamp(1.6rem, 3vw, 3rem);
}

.auth-brand-panel {
    background: linear-gradient(160deg, rgba(23, 98, 79, 0.94), rgba(18, 34, 30, 0.94));
    color: #fff8f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.auth-brand-panel h1 {
    color: #fffaf2;
    font-size: clamp(2.4rem, 3.4vw, 4rem);
    line-height: 1.03;
    margin: 0;
}

.auth-brand-panel p {
    max-width: 34rem;
    color: rgba(255,248,240,0.74);
    font-size: 1rem;
    line-height: 1.75;
    margin: 0;
}

.auth-feature-list {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.auth-feature-card {
    padding: 1rem 1.1rem;
    border-radius: 1.2rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
}

.auth-feature-card strong,
.auth-feature-card span {
    display: block;
}

.auth-feature-card span {
    margin-top: 0.3rem;
    color: rgba(255,248,240,0.7);
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form-panel .brand-lockup strong,
.auth-form-panel .brand-lockup small {
    color: var(--text);
}

.row.justify-content-center {
    margin: 0;
}

.row.justify-content-center > [class*='col-'] {
    width: 100%;
    max-width: 28rem;
}

.form-label {
    font-weight: 700;
    color: #24312d;
    margin-bottom: 0.55rem;
}

.form-control,
.form-select,
textarea.form-control {
    min-height: 3.25rem;
    border-radius: 1rem;
    border: 1px solid rgba(29, 39, 37, 0.1);
    background: rgba(255,255,255,0.82);
    padding: 0.9rem 1rem;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.62);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

textarea.form-control {
    min-height: 7rem;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(23, 98, 79, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(23, 98, 79, 0.12);
    transform: translateY(-1px);
}

.btn {
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.82rem 1.25rem;
    border: none;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), background var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    box-shadow: 0 16px 28px rgba(23, 98, 79, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1b725c, #115444);
}

.btn-secondary {
    background: linear-gradient(135deg, #d7d0c2, #beb4a4);
    color: #1d2725;
}

.btn-danger {
    background: linear-gradient(135deg, #b45247, #8e3f36);
}

.btn-warning {
    background: linear-gradient(135deg, #e0b04c, #cd9135);
    color: #1d2725;
}

.btn-info {
    background: linear-gradient(135deg, #6fb8d8, #4690b8);
    color: #102127;
}

.btn-ghost {
    background: rgba(255,255,255,0.68);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(29, 39, 37, 0.08);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,0.42);
    --bs-table-hover-bg: rgba(23, 98, 79, 0.06);
    margin-bottom: 0;
    overflow: hidden;
}

.table thead th {
    border-bottom: 1px solid rgba(29,39,37,0.08);
    color: #33413c;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 0.9rem;
    background: rgba(248, 242, 233, 0.92);
}

.table td {
    vertical-align: middle;
    padding: 1rem 0.9rem;
    border-color: rgba(29,39,37,0.06);
}

.card {
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 1.6rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    background: rgba(255, 251, 245, 0.9);
}

.card-header {
    background: rgba(248, 242, 233, 0.9);
    border-bottom: 1px solid rgba(29,39,37,0.06);
    font-weight: 800;
    padding: 1rem 1.25rem;
}

.card-title {
    font-weight: 800;
}

.alert {
    border: none;
    border-radius: 1.1rem;
    box-shadow: var(--shadow-md);
}

.badge {
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
}

.sidebar-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.23rem;
    width: 2.8rem;
    height: 2.8rem;
    padding: 0;
    margin-right: 0.85rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.7);
}

.sidebar-toggle span {
    width: 1.1rem;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 999px;
}

canvas {
    max-width: 100%;
}

.table-responsive,
.content-card,
.card,
.auth-shell,
.app-sidebar,
.app-topbar {
    animation: fadeLift 480ms cubic-bezier(.2,.8,.2,1);
}

@keyframes fadeLift {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1199.98px) {
    .app-shell {
        gap: 1rem;
        padding: 1rem;
    }

    .app-sidebar {
        width: 280px;
        flex-basis: 280px;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
        padding: 0.75rem;
    }

    .app-sidebar {
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: min(86vw, 320px);
        z-index: 1050;
    }

    .app-main {
        width: 100%;
    }

    .app-topbar {
        padding-inline: 1rem;
    }

    .content-card {
        padding: 1.1rem;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .topbar-title {
        font-size: 1.6rem;
    }

    .topbar-actions {
        gap: 0.5rem;
    }

    .topbar-actions .btn {
        padding-inline: 1rem;
    }

    .content-card {
        border-radius: 24px;
    }

    .card,
    .app-topbar {
        border-radius: 20px;
    }

    .table thead th,
    .table td {
        padding: 0.8rem 0.7rem;
    }
}
