:root {
    --bg-color: #202c3b;
    --card-bg: linear-gradient(150deg, rgba(39, 52, 70, 0.96), rgba(50, 64, 84, 0.94));
    --header-bg: rgba(8, 14, 24, 0.96);
    --bg-gradient:
        radial-gradient(1200px 700px at -10% -10%, rgba(31, 169, 255, 0.1), transparent 58%),
        radial-gradient(1000px 650px at 110% 110%, rgba(120, 154, 196, 0.08), transparent 62%),
        linear-gradient(160deg, #202c3b 0%, #28364a 50%, #2d3c52 100%);
    --text-primary: #eef5ff;
    --text-secondary: #cad7e6;
    --accent: #22a9ff;
    --accent-glow: rgba(34, 169, 255, 0.3);
    --accent-hover: #0f97ec;
    --border: rgba(135, 154, 181, 0.26);
    --success: #238636;
    --danger: #f85149;
    --warning: #d29922;
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme='light'],
body.light-mode {
    --bg-color: #e8edf4;
    --card-bg: linear-gradient(150deg, rgba(240, 244, 250, 0.98), rgba(230, 237, 246, 0.96));
    --header-bg: rgba(229, 236, 245, 0.96);
    --bg-gradient:
        radial-gradient(1100px 680px at -8% -10%, rgba(97, 162, 221, 0.14), transparent 62%),
        radial-gradient(920px 620px at 108% 108%, rgba(160, 184, 211, 0.16), transparent 65%),
        linear-gradient(160deg, #e8edf4 0%, #e1e8f1 48%, #dbe3ed 100%);
    --text-primary: #1d2733;
    --text-secondary: #334556;
    --accent: #0a84d6;
    --accent-glow: rgba(10, 132, 214, 0.25);
    --accent-hover: #086eaf;
    --border: rgba(111, 132, 155, 0.35);
    --success: #1d8f3a;
    --danger: #c83d3d;
    --warning: #bf7a00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: block !important;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 2.4rem;
}

.container.login-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

html:has(body.login-page),
body.login-page {
    background:
        radial-gradient(520px 240px at 50% 40%, rgba(57, 177, 255, 0.24), transparent 70%),
        radial-gradient(1300px 700px at 0% 0%, rgba(56, 112, 178, 0.25), transparent 68%),
        radial-gradient(1100px 680px at 100% 100%, rgba(44, 89, 148, 0.22), transparent 72%),
        linear-gradient(160deg, #122540 0%, #1d3557 52%, #203b5f 100%) !important;
    min-height: 100vh;
    overflow: hidden;
}

html:has(body.app-page),
body.app-page {
    background:
        radial-gradient(1200px 700px at -10% -10%, rgba(44, 173, 255, 0.14), transparent 60%),
        radial-gradient(1000px 650px at 110% 110%, rgba(154, 184, 216, 0.12), transparent 65%),
        linear-gradient(165deg, var(--page-bg) 0%, var(--page-bg-2) 100%) !important;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-header {
    background: linear-gradient(180deg, rgba(8, 14, 24, 0.98), rgba(10, 18, 30, 0.97));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 40px;
    transition: var(--transition);
}

.header-logo:hover {
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-container {
    background: linear-gradient(180deg, rgba(11, 20, 33, 0.98), rgba(12, 22, 36, 0.96));
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.14);
    padding: 0.5rem 2rem;
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: #c2d0df;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: #f6fbff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    border-bottom: 2px solid var(--accent);
    border-radius: 8px 8px 0 0;
}

.main-footer {
    width: 100%;
    padding: 28px 0 22px;
    text-align: center;
    background: linear-gradient(180deg, rgba(9, 16, 27, 0.98), rgba(8, 14, 23, 1));
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.38);
}

.main-footer p {
    margin: 0 0 6px;
    font-family: Arial, Helvetica, sans-serif;
    font-style: italic;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    color: rgba(232, 238, 244, 0.85);
}

.top-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.top-actions .user-id {
    color: #e8eef4;
    font-weight: 500;
}

.user-settings-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* User Settings Dropdown */
.user-settings-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 2600;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: #d2dbe6;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.icon-gear {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.5s ease;
}

.icon-bell {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.btn-icon:hover .settings-gear {
    transform: rotate(90deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 3200;
    display: none;
    padding: 0.5rem 0;
    animation: dropdownAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-menu.show {
    display: block;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

.notif-head-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-danger-soft {
    border-color: rgba(248, 81, 73, 0.35);
    color: #ffb4ae;
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: start;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item.unread {
    border-left: 3px solid var(--accent);
}

.notif-item p {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.notif-item small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.notif-actions {
    display: flex;
    gap: 0.25rem;
}

.notif-action {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-radius: 6px;
    min-width: 28px;
    padding: 0 0.45rem;
    height: 26px;
    cursor: pointer;
    line-height: 1;
}

.notif-action:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.notif-delete:hover {
    color: #ffb4ae;
    border-color: rgba(248, 81, 73, 0.45);
}

.notif-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.9rem;
}

@keyframes dropdownAppear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

button.dropdown-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.4rem 0;
}

.logout-item {
    color: var(--danger);
}

.logout-item:hover {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
}

h1,
h2,
h3 {
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    transition: var(--transition);
}

.hidden {
    display: none !important;
}

.form-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    margin-bottom: 2rem;
}

/* Corporate shell reusable across sections */
.corp-shell {
    background: linear-gradient(145deg, rgba(49, 60, 77, 0.96), rgba(65, 76, 94, 0.92));
    border: 1px solid rgba(117, 133, 156, 0.25);
    border-radius: 12px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    color: #eef5ff;
}

.corp-shell h2 {
    color: #f4f8ff;
    font-weight: 700;
}

.corp-header {
    border: none;
    background: transparent;
    margin-bottom: 2rem;
    padding: 0;
}

.corp-subtitle {
    margin-top: 0.35rem;
    color: #c5d4e6;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.corp-shell label {
    color: #dce8f7;
    font-weight: 700;
}

body.light-mode .corp-shell h2,
html[data-theme='light'] .corp-shell h2 {
    color: #ffffff;
}

body.light-mode .corp-subtitle,
html[data-theme='light'] .corp-subtitle {
    color: #d6e2f0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.6rem;
    color: #d2deed;
    font-size: 0.92rem;
    font-weight: 600;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background: #eceff3;
    border: 1px solid #d6dce4;
    border-radius: 8px;
    color: #1c2530;
    font-family: inherit;
    font-size: 0.98rem;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #8cb7da;
    box-shadow: 0 0 0 3px rgba(25, 167, 255, 0.18);
    background: #f4f7fb;
}

button,
.btn-primary,
.btn-secondary,
.btn-sm,
.btn-delete {
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 8px 18px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px var(--accent-glow);
}

.btn-secondary {
    background: #eceff3;
    border: 1px solid rgba(180, 196, 214, 0.7);
    color: #111;
}

.btn-secondary:hover {
    background: #fff;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background: #eceff3;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

body.light-mode label,
html[data-theme='light'] label {
    color: #3e5164;
}

body.light-mode .corp-shell label,
html[data-theme='light'] .corp-shell label {
    color: #e7f0fc;
    font-weight: 700;
}

.btn-delete {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.segmented-control {
    display: flex;
    background: rgba(17, 28, 44, 0.55);
    border: 1px solid rgba(140, 164, 192, 0.3);
    border-radius: 8px;
    padding: 2px;
}

.segmented-control input {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.segmented-control input:checked+label {
    background: rgba(255, 255, 255, 0.14);
    color: #f7fbff;
}

.status-box,
.warning-box,
.info-box {
    --status-border: rgba(198, 155, 40, 0.88);
    --status-text: #f6d672;
    --status-bg: rgba(43, 37, 18, 0.88);
    background: linear-gradient(135deg, var(--status-bg), rgba(14, 20, 30, 0.94));
    color: var(--status-text);
    padding: 1.15rem 1.35rem;
    border-radius: 12px;
    border: 2px solid var(--status-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 24px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
}

.info-box {
    font-weight: 500;
}

.status-box.is-success {
    --status-border: rgba(35, 134, 54, 0.9);
    --status-text: #67d78a;
    --status-bg: rgba(26, 39, 28, 0.9);
}

.status-box.is-warning,
.warning-box {
    --status-border: rgba(198, 155, 40, 0.9);
    --status-text: #f6d672;
    --status-bg: rgba(43, 37, 18, 0.9);
}

.status-box.is-neutral {
    --status-border: rgba(108, 117, 125, 0.85);
    --status-text: #e6ebf2;
    --status-bg: rgba(43, 47, 54, 0.9);
}

.status-box a {
    color: inherit;
    text-decoration: underline;
    font-weight: 700;
}

.delete-adicional-panel {
    display: grid;
    gap: 1.2rem;
}

.delete-adicional-head h3 {
    margin: 0;
}

.delete-lookup-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.delete-result-card {
    display: grid;
    gap: 0.85rem;
}

.delete-result-title {
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 700;
}

.delete-result-grid {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.45rem 1rem;
    align-items: baseline;
}

.delete-result-grid span {
    color: var(--text-secondary);
    font-weight: 600;
}

.delete-result-grid strong {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.delete-adicional-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-danger-action {
    background: linear-gradient(135deg, #d23b3b, var(--danger));
    box-shadow: 0 12px 24px rgba(248, 81, 73, 0.22);
}

.btn-danger-action:hover:not(:disabled) {
    background: linear-gradient(135deg, #bf3030, #e34a42);
}

.btn-danger-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

.extra-offer-list {
    margin-top: 0.85rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.extra-offer-list div {
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.07);
}

.extra-offer-list div + div {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
}

.warning-box {
    border-radius: 12px;
}

@media (max-width: 640px) {
    .delete-lookup-row {
        grid-template-columns: 1fr;
    }

    .delete-adicional-actions {
        justify-content: stretch;
    }

    .delete-adicional-actions .btn-primary {
        width: 100%;
    }
}

.user-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.user-table th {
    background: rgba(255, 255, 255, 0.04);
    padding: 1rem;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.user-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(150, 170, 194, 0.26);
    transition: var(--transition);
}

.user-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.3);
}

.badge-secondary {
    background: rgba(110, 118, 129, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(110, 118, 129, 0.3);
}

.status-pending {
    background: rgba(210, 153, 34, 0.15);
    color: #f2c15f;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.status-processing {
    background: rgba(34, 169, 255, 0.15);
    color: #79cfff;
    border: 1px solid rgba(34, 169, 255, 0.3);
}

.status-completed {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.3);
}

.status-failed {
    background: rgba(248, 81, 73, 0.15);
    color: #ff9b95;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.compact-scheduled-content {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 1rem;
}

.compact-scheduled-content h3 {
    margin: 0 0 .75rem;
}

.compact-scheduled-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem .8rem;
}

.compact-scheduled-content .form-group {
    margin-bottom: .65rem;
}

.compact-scheduled-content label {
    margin-bottom: .25rem;
    font-size: .82rem;
}

.compact-scheduled-content input,
.compact-scheduled-content select,
.compact-scheduled-content textarea {
    min-height: 36px;
    padding: .45rem .65rem;
}

.compact-scheduled-content textarea {
    min-height: 76px;
}

.compact-scheduled-actions {
    position: sticky;
    bottom: -1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding-top: .75rem;
    margin-top: .5rem;
}

.scheduled-user-filters {
    width: min(760px, 100%);
}

@media (max-width: 700px) {
    .compact-scheduled-grid {
        grid-template-columns: 1fr;
    }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-content {
    background: linear-gradient(165deg, rgba(35, 47, 64, 0.98), rgba(30, 42, 59, 0.98));
    padding: 2.5rem;
    border-radius: 14px;
    width: 90%;
    max-width: 610px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: modalAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-message-modal {
    z-index: 7000;
}

.app-message-content {
    max-width: 480px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    border-top: 4px solid var(--accent);
}

.app-message-content.is-success {
    border-top-color: var(--success);
}

.app-message-content.is-error {
    border-top-color: var(--danger);
}

.app-message-content.is-warning,
.app-message-content.is-confirm {
    border-top-color: var(--warning);
}

.app-message-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.45rem;
    font-weight: 800;
    color: #f8fbff;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    box-shadow: 0 12px 24px rgba(34, 169, 255, 0.25);
}

.app-message-content.is-success .app-message-icon {
    background: linear-gradient(135deg, #31b85b, var(--success));
    box-shadow: 0 12px 24px rgba(35, 134, 54, 0.28);
}

.app-message-content.is-error .app-message-icon {
    background: linear-gradient(135deg, #ff6b64, var(--danger));
    box-shadow: 0 12px 24px rgba(248, 81, 73, 0.28);
}

.app-message-content.is-warning .app-message-icon,
.app-message-content.is-confirm .app-message-icon {
    background: linear-gradient(135deg, #f0b84a, var(--warning));
    box-shadow: 0 12px 24px rgba(210, 153, 34, 0.28);
}

.app-message-copy h3 {
    margin: 0 0 0.45rem;
    font-size: 1.35rem;
}

.app-message-copy p {
    margin: 0;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.app-message-actions {
    margin-top: 0.6rem;
    justify-content: center;
    width: 100%;
}

.confirm-delay {
    width: 100%;
    height: 8px;
    margin: 1rem 0 0.15rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.confirm-delay-bar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--warning), var(--accent));
    transform-origin: left center;
}

.confirm-delay.is-running .confirm-delay-bar {
    animation-name: confirmDelayDrain;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes confirmDelayDrain {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 560px) {
    .app-message-content {
        padding: 1.6rem;
    }

    .app-message-actions {
        width: 100%;
    }
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem;
    position: relative;
}

.modern-login {
    width: 100vw;
    margin-left: 0;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    gap: 1.35rem;
    background: transparent;
}

.modern-login::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.3;
    background-image:
        linear-gradient(120deg, transparent 32%, rgba(141, 205, 255, 0.12) 50%, transparent 66%),
        radial-gradient(circle at 22% 36%, rgba(139, 202, 255, 0.46) 2px, transparent 4px),
        radial-gradient(circle at 74% 52%, rgba(119, 191, 255, 0.42) 2px, transparent 5px),
        radial-gradient(circle at 61% 23%, rgba(152, 212, 255, 0.34) 2px, transparent 4px);
}

.login-hero-logo {
    position: relative;
    z-index: 1;
}

.login-logo {
    width: 100%;
    max-width: 340px;
    display: block;
    margin: 0 auto;
}

.login-glass {
    position: relative;
    z-index: 1;
    width: min(94vw, 560px);
    padding: 2.2rem;
    border-radius: 14px;
    border: 1px solid rgba(157, 205, 248, 0.34);
    background: linear-gradient(170deg, rgba(46, 86, 132, 0.24), rgba(24, 51, 82, 0.34));
    backdrop-filter: blur(8px);
    box-shadow: 0 0 0 1px rgba(165, 211, 250, 0.12) inset, 0 18px 40px rgba(5, 20, 41, 0.42);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    position: relative;
}

.login-field .field-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    opacity: 0.85;
}

.login-field .field-icon svg {
    width: 100%;
    height: 100%;
    fill: #d6e7f9;
}

.login-field input {
    width: 100%;
    height: 58px;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(167, 205, 239, 0.46) !important;
    color: #eff7ff !important;
    font-size: 1.12rem !important;
    padding-left: 3.1rem !important;
}

.login-field input::placeholder {
    color: #d9eaff !important;
    opacity: 0.92;
}

.login-field input:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(120, 198, 255, 0.82) !important;
    box-shadow: 0 0 0 3px rgba(58, 169, 255, 0.28) !important;
}

.login-submit {
    height: 60px;
    width: 100%;
    margin-top: 0.2rem;
    border-radius: 11px !important;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    background: linear-gradient(180deg, #347dff, #1d5ac8) !important;
    box-shadow: 0 12px 24px rgba(28, 96, 210, 0.32), 0 0 18px rgba(53, 136, 255, 0.25) inset !important;
}

.flash-messages {
    position: fixed;
    top: 5.8rem;
    right: 1.5rem;
    z-index: 6500;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    width: min(400px, calc(100vw - 2rem));
    pointer-events: none;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
    border: 1px solid transparent;
    animation: slideIn 0.3s ease-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    pointer-events: auto;
}

.close-alert {
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0.7;
    transition: var(--transition);
}

.close-alert:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: #1a271c;
    color: #3fb950;
    border-color: #238636;
}

.alert-danger {
    background: #271a1a;
    color: #f85149;
    border-color: #f85149;
}

.alert-info {
    background: #1a2227;
    color: #58a6ff;
    border-color: #388bfd;
}

@media (max-width: 768px) {
    .flash-messages {
        top: 4.8rem;
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
    }

    .container {
        padding: 1rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .main-header {
        padding: 1rem;
    }

    .top-actions {
        font-size: 0.8rem;
    }

    .login-card {
        padding: 2rem;
    }
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    user-select: none;
}

.collapsible-header h3 {
    margin: 0;
}

.toggle-icon {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    transition: var(--transition);
    margin-left: 0.5rem;
}

.form-card.collapsed .toggle-icon {
    transform: rotate(-45deg);
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.form-card.collapsed .collapsible-content {
    max-height: 0;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* FreshChat Visual Template */
.chat-window {
    width: 100%;
    height: 600px;
    background: linear-gradient(155deg, #091321, #0b1727);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.28), 0 12px 26px rgba(0, 0, 0, 0.2);
}

.chat-window::-webkit-scrollbar {
    width: 6px;
}

.chat-window::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 3px;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message-wrapper.cliente {
    align-self: flex-start;
}

.message-wrapper.agente,
.message-wrapper.bot {
    align-self: flex-end;
}

.message-bubble {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-wrapper.cliente .message-bubble {
    background: #0088cc;
    /* Celeste/Azul Fresh */
    color: #ffffff;
    border-bottom-left-radius: 4px;
}

.message-wrapper.agente .message-bubble,
.message-wrapper.bot .message-bubble {
    background: #238636;
    /* Verde Fresh */
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

.message-wrapper.agente .message-meta,
.message-wrapper.bot .message-meta {
    text-align: right;
}

.message-event {
    align-self: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 90%;
    margin: 0.5rem 0;
    font-style: italic;
}

.message-event strong {
    color: var(--text-primary);
}

body.light-mode .chat-window .message-meta,
html[data-theme='light'] .chat-window .message-meta {
    color: #8ea4bc;
}

body.light-mode .chat-window .message-event,
html[data-theme='light'] .chat-window .message-event {
    color: #b5c7db;
    border-color: rgba(126, 150, 177, 0.45);
    background: rgba(95, 118, 143, 0.18);
}

body.light-mode .chat-window .message-event strong,
html[data-theme='light'] .chat-window .message-event strong {
    color: #d5e3f2;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.4s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Image Previews */
.preview-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.preview-img:hover {
    transform: scale(1.01);
}

.preview-img-sm {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    border: 1px solid #eee;
    cursor: zoom-in;
}

/* ===== Global Corporate Redesign (v2) ===== */
html[data-theme='dark'],
body:not(.light-mode) {
    --page-bg: #1c2634;
    --page-bg-2: #233249;
    --panel-bg: linear-gradient(145deg, rgba(36, 49, 68, 0.96), rgba(48, 63, 84, 0.94));
    --panel-border: rgba(148, 171, 202, 0.24);
    --muted-label: #d5e4f4;
    --field-bg: #f2f5fa;
    --field-text: #1f2b3a;
}

html[data-theme='light'],
body.light-mode {
    --page-bg: #e6edf5;
    --page-bg-2: #d8e2ee;
    --panel-bg: linear-gradient(145deg, rgba(237, 243, 250, 0.97), rgba(225, 234, 245, 0.96));
    --panel-border: rgba(131, 154, 183, 0.35);
    --muted-label: #2f4359;
    --field-bg: #ffffff;
    --field-text: #1f2b3a;
}

body {
    background-image:
        radial-gradient(1200px 700px at -10% -10%, rgba(44, 173, 255, 0.14), transparent 60%),
        radial-gradient(1000px 650px at 110% 110%, rgba(154, 184, 216, 0.12), transparent 65%),
        linear-gradient(165deg, var(--page-bg) 0%, var(--page-bg-2) 100%);
}

.main-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 30px rgba(2, 9, 20, 0.38);
}

.nav-container {
    gap: 0.9rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.nav-link {
    border: 1px solid transparent;
    letter-spacing: 0.02em;
}

.nav-link:hover,
.nav-link.active {
    border-color: rgba(255, 255, 255, 0.18);
}

.form-card,
.corp-shell,
.ret-shell {
    background: var(--panel-bg) !important;
    border: 1px solid var(--panel-border) !important;
    border-radius: 14px !important;
    box-shadow: 0 24px 40px rgba(4, 12, 24, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

h2 {
    font-weight: 700;
}

label,
.ret-shell label,
.corp-shell label {
    color: var(--muted-label) !important;
    font-size: 0.93rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    background: var(--field-bg) !important;
    color: var(--field-text) !important;
    border: 1px solid rgba(176, 194, 214, 0.75) !important;
    border-radius: 10px !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #63b6f1 !important;
    box-shadow: 0 0 0 3px rgba(52, 169, 245, 0.22) !important;
    background: #ffffff !important;
}

.btn-primary {
    border-radius: 11px !important;
    background: linear-gradient(135deg, #17a1f4, #0d86db) !important;
    box-shadow: 0 10px 22px rgba(13, 134, 219, 0.35) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #22adff, #1091ea) !important;
}

.btn-secondary,
.btn-sm {
    border-radius: 10px !important;
    background: linear-gradient(180deg, #f8fbff, #e8eef5) !important;
    color: #1e2a39 !important;
    border: 1px solid rgba(182, 198, 216, 0.85) !important;
}

.info-box {
    border-radius: 12px !important;
}

.warning-box {
    border-radius: 12px !important;
}

.user-table {
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    overflow: hidden;
}

.user-table th {
    background: rgba(255, 255, 255, 0.08) !important;
    font-weight: 700;
}

body.light-mode .user-table,
html[data-theme='light'] .user-table {
    background: #f7fbff;
    border-color: rgba(129, 153, 179, 0.45);
}

body.light-mode .user-table th,
html[data-theme='light'] .user-table th {
    background: #e4edf7 !important;
    color: #24364a !important;
    border-bottom-color: rgba(129, 153, 179, 0.45);
}

body.light-mode .user-table td,
html[data-theme='light'] .user-table td {
    background: #edf4fb;
    color: #26384c !important;
    border-bottom-color: rgba(167, 186, 207, 0.62);
}

body.light-mode .user-table tr:nth-child(even) td,
html[data-theme='light'] .user-table tr:nth-child(even) td {
    background: #e6eef8;
}

body.light-mode .user-table tr:hover td,
html[data-theme='light'] .user-table tr:hover td {
    background: #dce9f6;
}

body.light-mode .segmented-control,
html[data-theme='light'] .segmented-control {
    background: #d4dee9;
    border-color: rgba(110, 132, 156, 0.55);
}

body.light-mode .segmented-control label,
html[data-theme='light'] .segmented-control label {
    color: #26384c !important;
}

body.light-mode .segmented-control input:checked + label,
html[data-theme='light'] .segmented-control input:checked + label {
    background: #f6fbff;
    color: #132236 !important;
    box-shadow: 0 1px 8px rgba(77, 101, 128, 0.22);
}

body.light-mode .badge,
html[data-theme='light'] .badge {
    color: #24364a;
}

body.light-mode .status-completed,
html[data-theme='light'] .status-completed {
    background: #d8f3df;
    color: #177232 !important;
    border-color: #7ccf91;
}

.modal-content {
    border-radius: 16px !important;
    border: 1px solid var(--panel-border) !important;
}

.chat-window {
    border-radius: 16px !important;
}

/* ===== New App Layout ===== */
.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    position: relative;
    top: 0;
}

body.app-page .app-shell {
    margin-top: 0 !important;
}

body>.app-shell {
    margin-top: 0 !important;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.4rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(180deg, rgba(7, 12, 22, 0.98), rgba(10, 17, 29, 0.96));
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 20;
}

.sidebar-brand {
    display: block;
    padding: 0.25rem 0.4rem 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-brand .header-logo {
    height: 42px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    overflow-y: auto;
    padding-right: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 169, 255, 0.55) rgba(255, 255, 255, 0.06);
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(34, 169, 255, 0.78), rgba(12, 118, 191, 0.72));
    border: 2px solid rgba(7, 12, 22, 0.98);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(65, 188, 255, 0.92), rgba(22, 143, 224, 0.86));
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.sidebar-section-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.78rem 0.05rem;
    border: 0;
    background: transparent;
    color: rgba(202, 215, 230, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
}

.sidebar-section-title::after {
    content: "+";
    color: rgba(34, 169, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1;
}

.sidebar-section.is-open .sidebar-section-title::after {
    content: "-";
}

.sidebar-section:not(.is-open) .side-link {
    display: none;
}

.side-link {
    display: block;
    padding: 0.56rem 0.78rem;
    border-radius: 9px;
    color: #c8d7e9;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
    transition: var(--transition);
}

.side-link:hover {
    color: #f4f9ff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

.side-link.active {
    color: #ffffff;
    background: linear-gradient(140deg, rgba(23, 160, 241, 0.24), rgba(12, 118, 191, 0.2));
    border-color: rgba(52, 176, 251, 0.45);
    box-shadow: 0 10px 20px rgba(7, 95, 154, 0.25);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-keep-visible {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    color: rgba(202, 215, 230, 0.84);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.sidebar-keep-visible input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.sidebar-logout {
    display: inline-flex;
    padding: 0.55rem 0.8rem;
    border-radius: 9px;
    text-decoration: none;
    color: #f7b4b4;
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid rgba(248, 81, 73, 0.28);
}

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

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(9, 16, 27, 0.9), rgba(12, 21, 34, 0.78));
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 2500;
    overflow: visible;
}

body.light-mode .modal-content label,
html[data-theme='light'] .modal-content label {
    color: #dbe9f8 !important;
    font-weight: 700 !important;
}

.modal-content .form-group>label {
    color: #e4effd !important;
    font-weight: 700 !important;
}

.app-topbar-title h1 {
    margin: 0;
    font-size: 1.12rem;
    color: #f0f7ff;
}

.app-topbar-title p {
    margin: 0.08rem 0 0;
    color: #a9bfd8;
    font-size: 0.82rem;
}

.app-content.container {
    max-width: 100%;
    padding: 1.4rem 1.6rem 2rem;
}

.app-footer.main-footer {
    margin-top: auto;
}

.app-shell .top-actions .user-id {
    font-weight: 600;
    color: #dbe7f4;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.34rem 0.65rem;
}

body.light-mode .app-sidebar,
html[data-theme='light'] .app-sidebar {
    background: linear-gradient(180deg, rgba(27, 39, 55, 0.98), rgba(34, 48, 66, 0.96));
}

body.light-mode .sidebar-nav,
html[data-theme='light'] .sidebar-nav {
    scrollbar-color: rgba(34, 169, 255, 0.62) rgba(255, 255, 255, 0.08);
}

body.light-mode .sidebar-nav::-webkit-scrollbar-track,
html[data-theme='light'] .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
}

body.light-mode .sidebar-nav::-webkit-scrollbar-thumb,
html[data-theme='light'] .sidebar-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(34, 169, 255, 0.82), rgba(10, 132, 214, 0.76));
    border-color: rgba(27, 39, 55, 0.98);
}

body.light-mode .form-card h1,
body.light-mode .form-card h2,
body.light-mode .form-card h3,
html[data-theme='light'] .form-card h1,
html[data-theme='light'] .form-card h2,
html[data-theme='light'] .form-card h3 {
    color: #1f3044 !important;
}

body.light-mode .corp-subtitle,
body.light-mode .ret-subtitle,
html[data-theme='light'] .corp-subtitle,
html[data-theme='light'] .ret-subtitle {
    color: #455d77 !important;
    font-weight: 600;
}

body.light-mode .app-topbar-title h1,
html[data-theme='light'] .app-topbar-title h1 {
    color: #f4f8ff;
}

body.light-mode .app-topbar-title p,
html[data-theme='light'] .app-topbar-title p {
    color: #d2e0ef;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .sidebar-brand .header-logo {
        height: 30px;
    }

    .side-link {
        font-size: 0.78rem;
        padding: 0.48rem 0.38rem;
        text-align: center;
    }

    .sidebar-section-title {
        padding: 0 0.2rem;
        font-size: 0.56rem;
        letter-spacing: 0.04em;
        text-align: center;
    }

    .sidebar-section-title::after {
        font-size: 0.72rem;
    }

    .sidebar-keep-visible {
        align-items: flex-start;
        font-size: 0.68rem;
        gap: 0.3rem;
    }

    .sidebar-logout {
        font-size: 0.75rem;
        padding: 0.5rem 0.55rem;
    }

    .app-topbar-title p {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
    }

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

    .app-content.container {
        padding: 1rem;
    }
}

/* ===== Feedback Widget ===== */
.feedback-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 3500;
}

.feedback-fab {
    position: relative;
    width: 56px;
    min-width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(129, 229, 255, 0.4);
    background: linear-gradient(135deg, #00a9e0 0%, #2f7bff 56%, #3d6fff 100%);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 14px 30px rgba(14, 56, 120, 0.42);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.feedback-fab:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 18px 34px rgba(14, 56, 120, 0.52);
}

.feedback-fab:active {
    transform: translateY(0);
}

.feedback-fab-icon {
    font-size: 1.45rem;
    line-height: 1;
}

.feedback-fab-badge {
    position: absolute;
    top: -7px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff6262, #ea3f4f);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0 5px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 8px 16px rgba(230, 66, 79, 0.35);
}

.feedback-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(380px, calc(100vw - 28px));
    height: min(530px, calc(100vh - 110px));
    border: 1px solid rgba(132, 196, 239, 0.25);
    border-radius: 18px;
    background: radial-gradient(120% 110% at 0% 0%, rgba(20, 101, 182, 0.28), rgba(12, 22, 36, 0) 45%),
                linear-gradient(160deg, rgba(20, 32, 48, 0.98), rgba(10, 22, 39, 0.98));
    box-shadow: 0 28px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.feedback-widget.open .feedback-fab {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.86);
}

.feedback-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    border-bottom: 1px solid rgba(164, 190, 218, 0.17);
    color: #edf5ff;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
}

.feedback-close {
    border: 0;
    background: transparent;
    color: #d4e7f7;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    transition: background-color .16s ease, color .16s ease;
}

.feedback-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.feedback-messages {
    flex: 1;
    overflow: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0));
}

.feedback-msg {
    border: 1px solid rgba(158, 188, 220, 0.2);
    border-radius: 12px;
    padding: 9px 11px;
    max-width: 90%;
    line-height: 1.35;
    color: #eaf4ff;
}

.feedback-msg.mine {
    align-self: flex-end;
    background: linear-gradient(145deg, rgba(57, 167, 255, 0.34), rgba(34, 134, 225, 0.18));
    border-color: rgba(106, 196, 255, 0.55);
    box-shadow: 0 8px 14px rgba(8, 89, 165, 0.2);
}

.feedback-msg.other {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(168, 195, 224, 0.22);
}

.feedback-msg small {
    display: block;
    margin-top: 5px;
    color: #bed2e6;
    font-size: 0.7rem;
}

.feedback-compose {
    border-top: 1px solid rgba(164, 190, 218, 0.16);
    padding: 10px 11px 11px;
    display: grid;
    gap: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.feedback-compose textarea {
    min-height: 78px;
    border-radius: 12px;
    border: 1px solid rgba(176, 200, 225, 0.32);
    background: rgba(16, 29, 44, 0.92);
    color: #e8f2fb;
    padding: .72rem .8rem;
    resize: vertical;
}

.feedback-compose textarea::placeholder {
    color: rgba(188, 209, 232, 0.72);
}

.feedback-compose textarea:focus {
    outline: none;
    border-color: rgba(101, 191, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(65, 172, 248, 0.2);
}

.feedback-compose .btn-primary {
    border-radius: 12px;
    min-height: 42px;
    font-weight: 700;
}

body.light-mode .feedback-panel,
html[data-theme='light'] .feedback-panel {
    border-color: rgba(43, 102, 163, 0.24);
    background: radial-gradient(120% 110% at 0% 0%, rgba(80, 163, 234, 0.2), rgba(255, 255, 255, 0) 42%),
                linear-gradient(170deg, rgba(248, 252, 255, 0.99), rgba(233, 243, 252, 0.99));
    box-shadow: 0 24px 42px rgba(24, 65, 112, 0.2);
}

body.light-mode .feedback-panel-head,
html[data-theme='light'] .feedback-panel-head {
    color: #123152;
    border-bottom-color: rgba(46, 111, 177, 0.2);
}

body.light-mode .feedback-close,
html[data-theme='light'] .feedback-close {
    color: #1c446d;
}

body.light-mode .feedback-close:hover,
html[data-theme='light'] .feedback-close:hover {
    background: rgba(40, 105, 171, 0.1);
}

body.light-mode .feedback-messages,
html[data-theme='light'] .feedback-messages {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(238, 247, 255, 0.4));
}

body.light-mode .feedback-msg,
html[data-theme='light'] .feedback-msg {
    color: #122a44;
}

body.light-mode .feedback-msg.mine,
html[data-theme='light'] .feedback-msg.mine {
    background: linear-gradient(145deg, rgba(100, 189, 255, 0.32), rgba(76, 142, 224, 0.2));
    border-color: rgba(63, 143, 216, 0.56);
}

body.light-mode .feedback-msg.other,
html[data-theme='light'] .feedback-msg.other {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(65, 123, 183, 0.25);
}

body.light-mode .feedback-msg small,
html[data-theme='light'] .feedback-msg small {
    color: #2e5277;
}

body.light-mode .feedback-compose,
html[data-theme='light'] .feedback-compose {
    border-top-color: rgba(46, 111, 177, 0.2);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(244, 249, 255, 0.94));
}

body.light-mode .feedback-compose textarea,
html[data-theme='light'] .feedback-compose textarea {
    border-color: rgba(66, 130, 194, 0.36);
    background: #ffffff;
    color: #10273f;
}

body.light-mode .feedback-compose textarea::placeholder,
html[data-theme='light'] .feedback-compose textarea::placeholder {
    color: rgba(39, 79, 120, 0.52);
}

body.light-mode .feedback-compose textarea:focus,
html[data-theme='light'] .feedback-compose textarea:focus {
    border-color: rgba(36, 128, 212, 0.78);
    box-shadow: 0 0 0 3px rgba(37, 127, 205, 0.16);
}

/* ===== Feedback Admin ===== */
.feedback-admin-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 14px;
}

.feedback-admin-list,
.feedback-admin-thread {
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(12, 24, 39, 0.45);
    padding: 10px;
}

.feedback-admin-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.feedback-admin-conversations {
    display: grid;
    gap: 8px;
    max-height: 520px;
    overflow: auto;
}

.feedback-admin-item {
    border: 1px solid rgba(152, 178, 206, 0.3);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
}

.feedback-admin-item.active {
    border-color: rgba(67, 191, 255, 0.7);
    box-shadow: 0 0 0 2px rgba(36, 167, 244, 0.25) inset;
}

.feedback-admin-item-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.feedback-admin-unread {
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0 6px;
}

.feedback-admin-thread-header {
    border-bottom: 1px solid rgba(152, 178, 206, 0.25);
    padding: 6px 2px 10px;
    margin-bottom: 10px;
    color: #edf6ff;
    font-weight: 700;
}

.feedback-admin-messages {
    min-height: 380px;
    max-height: 520px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

.feedback-admin-compose {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

@media (max-width: 980px) {
    .feedback-admin-grid {
        grid-template-columns: 1fr;
    }

    .feedback-widget {
        right: 12px;
        bottom: 12px;
    }

    .feedback-panel {
        width: min(370px, calc(100vw - 18px));
        height: min(520px, calc(100vh - 92px));
    }

    .feedback-fab {
        width: 54px;
        min-width: 54px;
        height: 54px;
    }
}
