:root {
    --bg: #f6f2ea;
    --bg-soft: #fbf8f2;
    --bg-elev-1: #ffffff;
    --bg-elev-2: #f3ede2;
    --bg-elev-3: #ece5d8;
    --text: #24211c;
    --text-soft: rgba(36, 33, 28, 0.82);
    --text-muted: rgba(36, 33, 28, 0.62);
    --line: rgba(138, 105, 62, 0.18);
    --brand: #b98d57;
    --brand-soft: #d3b886;
    --primary-color: #b98d57;
    --primary-dark: #7e5d2f;
    --secondary-color: #171716;
    --ok: #3f8f6f;
    --warn: #c68a1d;
    --danger: #c75b5b;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    --transition: 180ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, rgba(185, 141, 87, 0.10), transparent 24%),
        linear-gradient(180deg, #f8f5ef, #f2eee7 52%, #eee9df);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, sans-serif;
    line-height: 1.55;
    color-scheme: light;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background: radial-gradient(circle at top left, rgba(185, 141, 87, 0.06), transparent 30%);
}

.app-sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 240, 0.96));
    border-right: 1px solid var(--line);
    padding: 1.1rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.4rem, 2vw, 1.8rem);
    letter-spacing: 0.06em;
    color: #1f1b17;
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(185, 141, 87, 0.12), rgba(255, 255, 255, 0.55));
    border: 1px solid rgba(185, 141, 87, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.app-user {
    margin: 1rem 0 0.7rem;
    padding: 0.9rem 0.8rem;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 242, 236, 0.92));
    border: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.9rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.app-user strong {
    color: #1f1b17;
    font-size: 0.95rem;
}

.app-nav-group {
    margin-top: 1.2rem;
}

.app-nav-title {
    margin: 0.4rem 0.5rem 0.55rem;
    color: var(--brand);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    font-weight: 700;
}

.app-nav-link {
    display: block;
    text-decoration: none;
    color: var(--text-soft);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.72rem 0.8rem;
    transition: var(--transition);
    margin-bottom: 0.18rem;
    font-weight: 500;
}

.app-nav-link:hover,
.app-nav-link:focus-visible {
    color: #1f1b17;
    border-color: rgba(185, 141, 87, 0.24);
    background: rgba(185, 141, 87, 0.08);
    outline: none;
    transform: translateX(2px);
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(255, 255, 255, 0.28);
}

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

.app-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-width: 0;
}

.app-nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(138, 105, 62, 0.26);
    background: rgba(255, 255, 255, 0.88);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    flex: 0 0 auto;
}

.app-nav-toggle span {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: #2a241d;
    transition: transform 160ms ease, opacity 160ms ease;
}

.app-nav-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.app-nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.app-nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.app-sidebar-overlay {
    display: none;
}

.app-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1f1b17;
}

.app-top-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-content {
    padding: 1.15rem;
}

.surface {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 240, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card,
.table-responsive,
.alert,
.dropdown-menu,
.modal-content {
    border-radius: var(--radius) !important;
    border: 1px solid var(--line) !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 246, 241, 0.96)) !important;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.card-header {
    border-bottom: 1px solid var(--line) !important;
    background: rgba(250, 247, 241, 0.9) !important;
}

.text-muted,
small,
.form-text {
    color: var(--text-muted) !important;
}

.table {
    color: var(--text);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: rgba(138, 105, 62, 0.12);
    padding: 0.8rem 0.85rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(185, 141, 87, 0.06);
}

.form-control,
.form-select,
.form-check-input,
textarea,
input {
    border-radius: 12px !important;
    border: 1px solid rgba(36, 33, 28, 0.12) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    color: #1f1b17 !important;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
textarea:focus,
input:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 0.2rem rgba(185, 141, 87, 0.16) !important;
}

.btn {
    border-radius: 999px;
    padding: 0.56rem 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.btn-primary,
.btn-dark {
    border-color: rgba(185, 141, 87, 0.65) !important;
    background: linear-gradient(135deg, var(--brand), var(--brand-soft)) !important;
    color: #1a120c !important;
    box-shadow: 0 12px 24px rgba(185, 141, 87, 0.16);
}

.btn-outline-secondary,
.btn-secondary {
    border-color: rgba(36, 33, 28, 0.12) !important;
    background: rgba(255, 255, 255, 0.82) !important;
    color: var(--text) !important;
}

.btn-outline-primary {
    border-color: rgba(185, 141, 87, 0.5) !important;
    color: var(--brand) !important;
    background: rgba(185, 141, 87, 0.06) !important;
}

.btn-outline-primary:hover {
    color: #1f1b17 !important;
    background: rgba(185, 141, 87, 0.12) !important;
}

.badge {
    border-radius: 999px;
    padding: 0.4rem 0.62rem;
}

.alert-success {
    border-color: rgba(63, 143, 111, 0.35) !important;
    background: rgba(63, 143, 111, 0.10) !important;
}

.alert-danger,
.alert-error {
    border-color: rgba(199, 91, 91, 0.35) !important;
    background: rgba(199, 91, 91, 0.10) !important;
}

.alert-warning {
    border-color: rgba(198, 138, 29, 0.35) !important;
    background: rgba(198, 138, 29, 0.10) !important;
}

.alert-info {
    border-color: rgba(185, 141, 87, 0.35) !important;
    background: rgba(185, 141, 87, 0.10) !important;
}

.section-eyebrow {
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.notification-template-card {
    overflow: hidden;
}

.notification-template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 58px;
    background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(244, 239, 231, 0.94)) !important;
}

.notification-template-header-email {
    border-top: 3px solid #4cc9f0;
}

.notification-template-header-sms {
    border-top: 3px solid #ffb020;
}

.notification-template-header-whatsapp {
    border-top: 3px solid #2ecc71;
}

.template-channel,
.template-type {
    border-radius: 999px;
    padding: 0.34rem 0.62rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.template-channel {
    color: #111;
    background: #f5f5f5;
}

.template-type {
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(36, 33, 28, 0.12);
}

.template-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.template-subject {
    color: #1f1b17;
    font-weight: 700;
}

.template-preview {
    max-height: 180px;
    overflow-y: auto;
    padding: 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(185, 141, 87, 0.22);
    background: #fbf8f2;
    color: #2a241d;
    font-family: "Segoe UI", Roboto, sans-serif;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
    scrollbar-color: rgba(185,141,87,0.7) #f1ebdf;
    scrollbar-width: thin;
}

.notification-template-footer {
    border-top: 1px solid var(--line) !important;
    background: rgba(250, 247, 241, 0.9) !important;
}

.template-variable {
    min-height: 76px;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
}

.template-variable code {
    color: var(--brand);
}

.bg-light {
    background: rgba(250, 247, 241, 0.9) !important;
    color: var(--text) !important;
}

.page-fade {
    animation: pageFade 360ms ease both;
}

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

.public-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: radial-gradient(circle at top, rgba(185, 141, 87, 0.08), transparent 20%), linear-gradient(180deg, #f7f2e9, #eee9de);
}

.public-nav {
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
}

.public-nav .inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0.8rem clamp(0.85rem, 2vw, 1.2rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    position: relative;
}

.public-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.public-nav .btn {
    min-height: 42px;
}

.public-nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}

.public-nav-toggle span {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 160ms ease, opacity 160ms ease;
}

.public-nav-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.public-nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.public-nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.public-main {
    max-width: 1160px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

.public-footer {
    border-top: 1px solid var(--line);
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    body.menu-open {
        overflow: hidden;
    }

    .public-nav-toggle {
        display: inline-flex;
    }

    .public-nav-actions {
        position: absolute;
        top: calc(100% + 0.55rem);
        right: clamp(0.85rem, 2vw, 1.2rem);
        left: clamp(0.85rem, 2vw, 1.2rem);
        display: grid;
        gap: 0.55rem;
        padding: 0.8rem;
        border-radius: 14px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 20px 36px rgba(0, 0, 0, 0.16);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-6px);
        transition: opacity 180ms ease, transform 180ms ease;
        z-index: 35;
    }

    .public-nav-actions.is-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .public-nav-actions .btn {
        width: 100%;
        min-height: 46px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .public-main {
        padding: 0.9rem;
    }
}

@media (max-width: 480px) {
    .public-main {
        padding: 0.8rem;
    }

    .public-footer {
        font-size: 0.86rem;
    }
}

@media (max-width: 992px) {
    body.app-nav-open {
        overflow: hidden;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 320px);
        height: 100dvh;
        border-right: 1px solid var(--line);
        border-bottom: none;
        z-index: 60;
        transform: translateX(-104%);
        transition: transform 220ms ease;
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
    }

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

    .app-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        border: 0;
        background: rgba(10, 10, 10, 0.22);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
        z-index: 50;
    }

    body.app-nav-open .app-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .app-nav-toggle {
        display: inline-flex;
    }

    .app-topbar {
        height: auto;
        padding: 0.72rem 0.9rem;
        flex-wrap: wrap;
    }

    .app-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-top-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.2rem;
    }

    .app-top-actions .btn {
        min-height: 42px;
    }

    .app-content {
        padding: 0.9rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.68rem 0.62rem;
        font-size: 0.9rem;
    }

    .luxury-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .luxury-tab-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .luxury-tab-group .btn {
        width: 100%;
        min-height: 42px;
    }
}

@media (max-width: 640px) {
    .app-topbar {
        padding: 0.62rem 0.72rem;
    }

    .app-content {
        padding: 0.72rem;
    }

    .app-top-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .app-top-actions .btn {
        width: 100%;
        padding-left: 0.6rem;
        padding-right: 0.6rem;
        font-size: 0.8rem;
    }

    .app-user {
        font-size: 0.84rem;
    }

    .app-nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .table-responsive {
        border-radius: 12px !important;
    }

    .table > :not(caption) > * > * {
        font-size: 0.84rem;
    }

    .badge {
        font-size: 0.68rem;
    }
}

.text-success { color: var(--ok) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warn) !important; }

.luxury-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0.2rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.luxury-page-header h1 {
    color: #1f1b17;
    letter-spacing: 0.02em;
}

.luxury-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 246, 241, 0.98)) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow);
}

.luxury-panel-header {
    padding: 1rem 1.2rem !important;
    background: rgba(250, 247, 241, 0.94) !important;
    border-bottom: 1px solid var(--line) !important;
}

.luxury-stat-card {
    position: relative;
    overflow: hidden;
    min-height: 150px;
    border: 1px solid var(--line) !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 241, 233, 0.96)) !important;
    box-shadow: var(--shadow);
}

.luxury-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), transparent);
}

.stat-label {
    display: block;
    color: var(--text-muted) !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.72rem;
    margin-bottom: 0.9rem;
}

.stat-value {
    color: #1f1b17;
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 700;
    line-height: 1;
}

.stat-confirmed::before { background: linear-gradient(90deg, #3f8f6f, transparent); }
.stat-declined::before { background: linear-gradient(90deg, #c75b5b, transparent); }
.stat-waiting::before { background: linear-gradient(90deg, #c68a1d, transparent); }

.summary-line {
    margin: 0;
    color: var(--text-soft);
}

.summary-line code {
    color: var(--brand);
    background: rgba(185, 141, 87, 0.08);
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
}

.luxury-pill {
    color: #1f1b17 !important;
    background: linear-gradient(135deg, var(--brand-soft), var(--brand)) !important;
    padding: 0.5rem 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.68rem;
}

.luxury-table-card {
    height: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 241, 233, 0.9));
    padding: 1rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    transition: var(--transition);
}

.table-dropzone {
    cursor: pointer;
}

.table-dropzone:hover {
    border-color: rgba(185, 141, 87, 0.4);
}

.luxury-progress {
    border-radius: 999px;
    overflow: hidden;
    background: rgba(36, 33, 28, 0.08);
}

.luxury-assignment-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.assignment-card {
    border-top: 1px solid rgba(36, 33, 28, 0.08) !important;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    color: var(--text-soft);
}

.assignment-card:last-child {
    border-bottom: 1px solid rgba(36, 33, 28, 0.04);
}

.assignment-card.border-primary {
    background: rgba(185, 141, 87, 0.06);
    border-top-color: rgba(185, 141, 87, 0.4) !important;
}

.luxury-list-table thead th {
    color: var(--brand);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(250, 247, 241, 0.9);
}

.luxury-badge {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    border-radius: 999px;
}

.luxury-badge-status {
    color: #1f1b17 !important;
    background: linear-gradient(135deg, #f0e7d6, #d8bf93) !important;
}

.luxury-badge-warning {
    color: #1a120c !important;
    background: linear-gradient(135deg, #f6d17b, #e0b95c) !important;
}

.actions-cell {
    white-space: nowrap;
}

.luxury-form-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 246, 241, 0.98)) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow);
}

.luxury-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--line);
}

.form-label {
    color: var(--text-soft);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.public-shell .form-control,
.public-shell .form-select,
.public-shell .form-check-input,
.public-shell textarea,
.public-shell input {
    background: #fff !important;
    color: #111 !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    min-height: 46px;
}

.public-shell .form-control:focus,
.public-shell .form-select:focus,
.public-shell .form-check-input:focus,
.public-shell textarea:focus,
.public-shell input:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 0.2rem rgba(185, 141, 87, 0.16) !important;
}

.public-shell .text-muted,
.public-shell small,
.public-shell .form-text {
    color: #6c757d !important;
}
