/* ==========================================================================
   MESA — App Design System
   Direction: Soft/Modern
   Font: Halcom (Adobe Typekit)
   Brand: Merkle / dentsu
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Merkle Brand */
    --merkle-blue: #0a1540;
    --merkle-orange: #ff644c;
    --merkle-red: #F23A1D;
    --merkle-yellow: #ffdc69;
    --merkle-color-primary: #41547d;
    --merkle-color-secondary: #f6f4f0;

    /* Surfaces */
    --surface: #ffffff;
    --surface-raised: #f8f9fc;
    --surface-hover: #f0f2f7;
    --border-color: #e8ecf2;

    /* Border Radius */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(10, 21, 64, 0.04);
    --shadow-md: 0 4px 16px rgba(10, 21, 64, 0.08);
    --shadow-lg: 0 8px 32px rgba(10, 21, 64, 0.12);

    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-family: 'halcom', sans-serif;
    --text-primary: #1a2340;
    --text-secondary: #5a6580;
    --text-muted: #8a95aa;

    /* Status Colors */
    --success: #22c55e;
    --success-soft: #dcfce7;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --info: #3b82f6;
    --info-soft: #dbeafe;
}

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

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

a {
    color: var(--merkle-color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--merkle-orange);
}

/* --------------------------------------------------------------------------
   Page Load Animation
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-content {
    animation: fadeInUp 0.4s ease-out;
}

/* --------------------------------------------------------------------------
   AdminLTE Sidebar Overrides
   -------------------------------------------------------------------------- */
.app-sidebar {
    background: var(--merkle-blue) !important;
    border-right: none !important;
    box-shadow: var(--shadow-lg);
}

.app-sidebar .sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar .sidebar-brand img.brand-image {
    width: 100%;
    padding: 0 10px;
    max-height: 40px;
    object-fit: contain;
}

.app-sidebar .sidebar-wrapper {
    padding: 0.75rem 0.5rem;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link {
    font-family: var(--font-family);
    color: #ffffff !important;
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 1rem;
    margin: 2px 0;
    transition: var(--transition);
    font-size: 0.9rem;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link p,
.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link i {
    color: #ffffff !important;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link.active,
.app-sidebar .sidebar-wrapper nav .sidebar-menu li.menu-selected > a.nav-link {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12) !important;
    font-weight: 500;
    box-shadow: inset 4px 0 0 0 var(--merkle-orange);
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu li.menu-selected > a.nav-link i::before {
    color: var(--merkle-orange);
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
    opacity: 0.8;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-treeview {
    padding-left: 0.5rem;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-treeview .nav-link {
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
}

/* Disabled menu item (no pending feedbacks): dimmed, blocked cursor, tooltip via title. */
.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link.nav-link-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.app-sidebar .sidebar-wrapper nav .sidebar-menu .nav-link.nav-link-disabled:hover {
    background: transparent;
}

i.nav-arrow::before {
    color: var(--merkle-orange) !important;
}

/* --------------------------------------------------------------------------
   AdminLTE Header / Topbar Overrides
   -------------------------------------------------------------------------- */
.app-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm);
}

.app-header .nav-link {
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.app-header .nav-link:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.app-header .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    overflow: hidden;
}

.app-header .dropdown-menu .dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    transition: var(--transition-fast);
}

.app-header .dropdown-menu .dropdown-item:hover {
    background: var(--surface-hover);
}

.app-header .user-menu .user-header {
    background: var(--merkle-color-primary) !important;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    padding: 1.25rem;
    color: #fff;
}

.app-header .user-menu .user-header p,
.app-header .user-menu .user-header small,
.app-header .user-menu .user-header i {
    color: #fff !important;
}

.app-header .user-menu .user-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.app-header .user-menu .user-footer .btn {
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Main Content Area
   -------------------------------------------------------------------------- */
.app-main {
    background: var(--surface-raised);
}

.app-content-header {
    padding: 1.5rem 0 0.5rem;
}

.app-content-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.app-footer {
    font-family: var(--font-family);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: visible;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Pending-review cards share the dashboard card look (public/assets/css/pages/dashboard.css):
   no hard outline, 16px radius, soft shadow, primary accent on the left edge. */
.card.pending-review-card {
    border: none;
    border-left: 4px solid var(--merkle-color-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.card.pending-review-card:hover {
    box-shadow: var(--shadow-md);
}

.card.pending-review-card > .card-header {
    background: transparent;
    border-bottom: none;
    padding: 1.5rem 1.5rem 0;
}

.card.pending-review-card > .card-body {
    padding: 0.75rem 1.5rem 1.5rem;
}

.card-header .active {
    background-color: var(--merkle-color-primary) !important;
    color: #fff !important;
    border-radius: var(--border-radius-sm);
}

.card-header .nav-link {
    color: var(--merkle-color-primary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.card-body {
    padding: 1.25rem;
}

.card[class*="card-primary"]:not(.card-outline) > .card-header {
    background-color: var(--merkle-color-primary);
    color: #fff;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card[class*="card-secondary"]:not(.card-outline) > .card-header {
    background-color: var(--merkle-color-secondary);
    color: var(--merkle-blue);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    font-family: var(--font-family);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    transition: var(--transition);
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
    color: #fff;
    box-shadow: -4px 0 0 0 var(--merkle-orange);
}

.btn-primary:hover {
    background-color: var(--merkle-blue);
    border-color: var(--merkle-blue);
    color: #fff;
    box-shadow: -4px 0 0 0 var(--merkle-orange), var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--merkle-orange);
    border-color: var(--merkle-orange);
    color: #fff;
    box-shadow: -4px 0 0 0 var(--merkle-color-primary);
}

.btn-secondary:hover {
    background-color: #e8553d;
    border-color: #e8553d;
    color: #fff;
    box-shadow: -4px 0 0 0 var(--merkle-color-primary), var(--shadow-sm);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
    color: #fff;
}

/* Refuse-feedback modal: while the reason is too short the confirm button is
   disabled. Show it in the primary (blue) tone, muted, so it reads as "not yet
   available" instead of a faded red that resembles the orange Cancel/secondary. */
.refuse-submit-btn:disabled,
.refuse-submit-btn:disabled:hover,
.refuse-submit-btn.disabled,
.refuse-submit-btn.disabled:hover {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
    color: #fff;
    opacity: 0.55;
    box-shadow: none;
    transform: none;
    /* Bootstrap sets pointer-events:none on disabled buttons, which hides the
       cursor. Re-enable pointer events so the "blocked" cursor is shown on hover;
       a natively disabled <button> still cannot be clicked or submitted. */
    pointer-events: auto;
    cursor: not-allowed;
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background-color: #16a34a;
    color: #fff;
}

.btn-warning {
    background-color: var(--warning);
    color: #fff;
}

.btn-outline-primary {
    border: 1.5px solid var(--merkle-color-primary);
    color: var(--merkle-color-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--merkle-color-primary);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-control,
.form-select {
    font-family: var(--font-family);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--surface);
    transition: var(--transition);
}

.form-select {
    padding: 0.6rem 2.25rem 0.6rem 0.9rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235a6580' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--merkle-color-primary);
    box-shadow: 0 0 0 3px rgba(65, 84, 125, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.invalid-feedback {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.35rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-switch .form-check-input {
    border-radius: 50px;
}

.form-check-input:checked {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
}

/* --------------------------------------------------------------------------
   Tables & DataTables
   -------------------------------------------------------------------------- */

/* Table wrapper — rounded card-like container */
.dataTables_wrapper {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.table-responsive {
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.table {
    font-family: var(--font-family);
    font-size: 0.875rem;
    border-collapse: collapse;
    border-spacing: 0;
    width: 100% !important;
    margin: 0 !important;
}

/* Table header */
.table thead th,
table.dataTable thead th,
table.dataTable tfoot th {
    background: var(--merkle-color-primary) !important;
    color: #fff;
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.85rem 1rem;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    position: relative;
}

.table thead th:first-child,
table.dataTable thead th:first-child {
    border-radius: var(--border-radius-sm) 0 0 0;
}

.table thead th:last-child,
table.dataTable thead th:last-child {
    border-radius: 0 var(--border-radius-sm) 0 0;
}

/* Sorting indicators */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    opacity: 0.7;
}

table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    opacity: 1;
    color: var(--merkle-yellow);
}

/* Table body */
.table tbody td,
table.dataTable tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

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

.table tbody tr:last-child td,
table.dataTable tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td,
table.dataTable tbody tr:hover td {
    background-color: rgba(65, 84, 125, 0.04);
}

.table tfoot tr:hover th,
table.dataTable tfoot tr:hover th {
    color: #fff;
    background: var(--merkle-color-primary) !important;
}

/* Striped rows */
.table-striped tbody tr:nth-of-type(odd),
table.dataTable.stripe tbody tr:nth-of-type(odd) {
    background-color: var(--surface-raised);
}

.table-striped tbody tr:nth-of-type(odd):hover,
table.dataTable.stripe tbody tr:nth-of-type(odd):hover {
    background-color: rgba(65, 84, 125, 0.04);
}

/* Table action buttons */
.table .btn-sm,
table.dataTable .btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* DataTables top/bottom controls */
.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-family: var(--font-family);
    background: var(--surface);
    transition: var(--transition);
    min-width: 200px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--merkle-color-primary);
    box-shadow: 0 0 0 3px rgba(65, 84, 125, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_length {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-family: var(--font-family);
    background: var(--surface);
    transition: var(--transition);
    cursor: pointer;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--merkle-color-primary);
    box-shadow: 0 0 0 3px rgba(65, 84, 125, 0.1);
    outline: none;
}

/* DataTables pagination */
.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
}

.page-item.active .page-link {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
    box-shadow: 0 2px 8px rgba(65, 84, 125, 0.3);
}

.page-link {
    font-family: var(--font-family);
    color: var(--merkle-color-primary);
    border-radius: var(--border-radius-sm) !important;
    margin: 0 3px;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.page-link:hover {
    background-color: var(--surface-hover);
    color: var(--merkle-blue);
    border-color: var(--merkle-color-primary);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    background: var(--surface);
}

/* DataTables empty state */
.dataTables_wrapper .dataTables_empty,
table.dataTable td.dataTables_empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Table inside cards — remove double border */
.card .dataTables_wrapper,
.card .table-responsive {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}

.card .table {
    margin: 0;
}

.card .table thead th:first-child,
.card table.dataTable thead th:first-child {
    border-radius: 0;
}

.card .table thead th:last-child,
.card table.dataTable thead th:last-child {
    border-radius: 0;
}

/* Table hover row accent */
.table-hover tbody tr:hover td {
    background-color: rgba(65, 84, 125, 0.04);
    border-color: rgba(65, 84, 125, 0.08);
}

/* --------------------------------------------------------------------------
   Badges / Pills
   -------------------------------------------------------------------------- */
.badge {
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
    border-radius: 50px;
}

.badge.bg-success,
.badge.text-bg-success {
    background-color: var(--success-soft) !important;
    color: #166534 !important;
}

.badge.bg-warning,
.badge.text-bg-warning {
    background-color: var(--warning-soft) !important;
    color: #92400e !important;
}

.badge.bg-danger,
.badge.text-bg-danger {
    background-color: var(--danger-soft) !important;
    color: #991b1b !important;
}

.badge.bg-info,
.badge.text-bg-info {
    background-color: var(--info-soft) !important;
    color: #1e40af !important;
}

.badge.bg-primary,
.badge.text-bg-primary {
    background-color: rgba(65, 84, 125, 0.12) !important;
    color: var(--merkle-color-primary) !important;
}

.rounded-pill {
    margin: auto;
    width: fit-content;
}

/* --------------------------------------------------------------------------
   Notifications
   -------------------------------------------------------------------------- */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 340px;
    padding: 1rem 1.25rem;
    padding-right: 2.5rem;
    border-radius: var(--border-radius);
    color: #fff;
    display: none;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    animation: fadeInUp 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-content p {
    color: inherit;
    margin: 0;
    font-size: 0.875rem;
}

.notification.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.notification.fail {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification.info,
.notification.msg {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition-fast);
}

.close-btn:hover {
    color: #fff;
}

/* --------------------------------------------------------------------------
   Tooltips (custom)
   -------------------------------------------------------------------------- */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    cursor: help;
    display: inline-block;
    color: var(--info);
}

.tooltip-text {
    visibility: hidden;
    max-width: 300px;
    width: max-content;
    background-color: var(--merkle-blue);
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    position: absolute;
    z-index: 9999;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    white-space: normal;
    word-wrap: break-word;
    box-shadow: var(--shadow-md);
    font-size: 0.8rem;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-container:focus .tooltip-text,
.tooltip-icon:focus + .tooltip-text,
.tooltip-container:focus-within .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-container:focus .tooltip-text,
.tooltip-icon:focus + .tooltip-text,
.tooltip-container:focus-within .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: 0;
    border-width: 5px;
    border-style: solid;
    border-color: var(--merkle-blue) transparent transparent transparent;
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.required {
    color: var(--danger);
}

.flex-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mesa-margin-left-10 {
    margin-left: 10px;
}

/* Checkbox */
.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.custom-checkbox:checked {
    border-color: var(--merkle-color-primary);
    background-color: var(--merkle-color-primary);
}

.checkbox-offset {
    margin-left: 20px;
}

/* Disabled review CTA */
.review-cta-disabled,
.review-cta-disabled:hover,
.review-cta-disabled:focus {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Select2 Overrides
   -------------------------------------------------------------------------- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    min-height: 38px;
    padding: 0.2rem 0.5rem;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:focus {
    border-color: var(--merkle-color-primary);
    box-shadow: 0 0 0 3px rgba(65, 84, 125, 0.1);
}

.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
}

.select2-results__option--highlighted {
    background-color: var(--merkle-color-primary) !important;
}

/* --------------------------------------------------------------------------
   SweetAlert2 Overrides
   -------------------------------------------------------------------------- */
.swal2-popup {
    border-radius: var(--border-radius-lg) !important;
    font-family: var(--font-family);
}

.swal2-confirm {
    background-color: var(--merkle-color-primary) !important;
    border-radius: var(--border-radius-sm) !important;
}

.swal2-cancel {
    border-radius: var(--border-radius-sm) !important;
}

/* --------------------------------------------------------------------------
   No-data Tooltip (from scriptsTemplate)
   -------------------------------------------------------------------------- */
.no-data {
    background-color: var(--surface);
    color: var(--text-secondary);
    width: 240px;
    height: auto;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-md);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    line-height: 1.4;
    display: none;
    font-family: var(--font-family);
    position: fixed;
    z-index: 9999;
    right: 0;
    margin-top: 15px;
}

.no-data p {
    margin-top: 0;
}

.no-data .bi-exclamation-octagon {
    float: left;
    margin-right: 12px;
    height: 40px;
    margin-top: 6px;
    font-size: 2em;
    color: var(--danger);
}

.no-data .bi-info-square {
    float: left;
    margin-right: 12px;
    height: 40px;
    margin-top: 6px;
    font-size: 2em;
    color: var(--info);
}

.no-data .bi-check-square {
    float: left;
    margin-right: 12px;
    height: 40px;
    margin-top: 6px;
    font-size: 2em;
    color: var(--success);
}

/* --------------------------------------------------------------------------
   Review Year Separator
   -------------------------------------------------------------------------- */
.review-year-separator {
    position: relative;
    text-align: center;
}

.review-year-separator hr {
    position: absolute;
    left: 0;
    width: 100%;
}

.review-year-separator h4 {
    background-color: var(--surface-raised) !important;
    padding: 2px 12px;
    display: inline-block;
    position: relative;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   My Details Header
   -------------------------------------------------------------------------- */
.my-details-header {
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
}

.my-details-header h3 {
    display: inline-block;
}

.my-details-header aside {
    float: right;
}

/* --------------------------------------------------------------------------
   DataTables Enhance (from pages/datatables-enhance.css)
   -------------------------------------------------------------------------- */
.card.content-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

.main-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 0;
}

.highlight-row-last tbody tr:last-of-type td {
    background-color: var(--merkle-color-primary) !important;
    color: #fff;
}

.highlight-row-last tbody tr:last-of-type td:last-child {
    background-color: var(--merkle-orange, #ff644c) !important;
    color: #fff;
}

/* --------------------------------------------------------------------------
   My Details List (number/grade)
   -------------------------------------------------------------------------- */
.number-container {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
    width: 40px;
}

.grade-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    border-radius: 10px;
}

#my_detail_list tbody tr:last-child td:not(:last-child) .grade-bar {
    height: 0px !important;
}

#my_detail_list tbody tr:last-child td:last-child .grade-bar {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Loading Overlay Spinner
   -------------------------------------------------------------------------- */
.loadingoverlay {
    border-radius: var(--border-radius);
}

/* --------------------------------------------------------------------------
   Responsive Helpers
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .app-content {
        padding: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

/* --------------------------------------------------------------------------
   Form Builder (forms/edit, forms/create, forms/index)
   -------------------------------------------------------------------------- */

/* Form index cards grid */
.form-card .card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    overflow: hidden;
}

.form-card .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(65, 84, 125, 0.2);
}

.form-card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.form-card .card-body {
    padding: 1.25rem;
}

.form-card .card-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Question items in form editor */
.question-item {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm) !important;
}

.question-item:hover {
    border-color: rgba(65, 84, 125, 0.2) !important;
    box-shadow: var(--shadow-md) !important;
}

.question-item .question-header {
    background: var(--surface-raised) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.85rem 1rem !important;
    border-radius: 0 !important;
}

.question-item .question-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.15s ease;
}

.question-item .question-title:hover {
    color: var(--merkle-color-primary);
}

.question-item .question-content {
    padding: 1.25rem !important;
    background: var(--surface);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.question-item .drag-handle {
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.question-item:hover .drag-handle {
    opacity: 1;
}

.question-item:focus .drag-handle,
.question-item:focus-within .drag-handle {
    opacity: 1;
}

.question-item:focus .drag-handle,
.question-item:focus-within .drag-handle {
    opacity: 1;
}

/* Questions card */
#questionsCard {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#questionsCard .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

#questionsCard .card-footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Form detail card (edit page header) */
#form_details {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

#form_details .card-body {
    padding: 1.5rem;
}

/* Lock overlay in form edit */
.lock-overlay {
    border-radius: var(--border-radius) !important;
    backdrop-filter: blur(4px);
}

.lock-overlay .overlay-message {
    background: var(--warning-soft);
    color: #92400e;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

/* Modals */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-header .modal-title {
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--surface-raised);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Form preview page */
.form-card .dropdown-menu {
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
}

.form-card .dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.form-card .dropdown-item:hover {
    background: var(--surface-hover);
}

.form-card .dropdown-item.text-danger:hover {
    background: var(--danger-soft);
}

/* --------------------------------------------------------------------------
   Settings Page
   -------------------------------------------------------------------------- */
.settings-content {
    animation: fadeInUp 0.3s ease-out;
}

/* Settings sidebar nav */
#tabMenu {
    gap: 4px;
}

#tabMenu > .nav-item > .nav-link {
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    padding: 0.65rem 1rem;
    transition: var(--transition);
    border: none;
}

#tabMenu > .nav-item > .nav-link:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

#tabMenu > .nav-item > .nav-link.active {
    background: linear-gradient(135deg, var(--merkle-color-primary), #556b94);
    color: #fff;
    box-shadow: inset 4px 0 0 0 var(--merkle-orange), 0 2px 8px rgba(65, 84, 125, 0.25);
}

/* Settings sub-menu */
#review-config-submenu {
    gap: 2px;
    padding-top: 0.25rem;
}

#review-config-submenu .sub-tab {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    color: var(--text-muted);
    border-radius: 6px;
    transition: var(--transition-fast);
}

#review-config-submenu .sub-tab:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

#review-config-submenu .sub-tab.active {
    color: var(--merkle-color-primary);
    background: rgba(65, 84, 125, 0.08);
    font-weight: 500;
    box-shadow: inset 3px 0 0 0 var(--merkle-orange);
}

/* Settings content cards */
.settings-content .card {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.settings-content .card .card-body {
    padding: 1.5rem;
}

.settings-content .card .card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem 1.5rem;
}

/* Settings form groups */
.settings-content .form-control,
.settings-content .form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.9rem;
    transition: var(--transition);
}

.settings-content .form-control:focus,
.settings-content .form-select:focus {
    border-color: var(--merkle-color-primary);
    box-shadow: 0 0 0 3px rgba(65, 84, 125, 0.1);
}

.settings-content .form-check-input {
    border-radius: 5px;
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
}

.settings-content .form-check-input:checked {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
}

.settings-content .form-check-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Settings main-header card (sidebar) */
.settings-content .main-header,
.main-header {
    border-radius: var(--border-radius) !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Content card in settings — remove the top border-radius override */
.settings-content .content-card,
.content-card {
    border-radius: var(--border-radius) !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Period table in review config */
.settings-content .table {
    margin-bottom: 0;
}

/* Color picker (spectrum) integration */
.sp-replacer {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 4px;
    transition: var(--transition-fast);
}

.sp-replacer:hover {
    border-color: var(--merkle-color-primary);
}

.sp-preview {
    border-radius: 4px;
}

/* Date range picker integration */
.daterangepicker {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    font-family: var(--font-family);
}

.daterangepicker td.active {
    background-color: var(--merkle-color-primary);
}

.daterangepicker .btn-primary {
    background-color: var(--merkle-color-primary);
    border-color: var(--merkle-color-primary);
}

/* --------------------------------------------------------------------------
   Focus States (Accessibility)
   -------------------------------------------------------------------------- */
*:focus-visible {
    outline: 2px solid var(--merkle-color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--merkle-color-primary);
    outline-offset: 2px;
}

/* Collapsible form sections in the sections configuration editor */
.section-collapse-toggle {
    color: var(--merkle-color-primary, #41547d);
    line-height: 1;
}

.section-collapse-icon {
    transition: transform 0.2s ease;
    display: inline-block;
}

.section-collapse-toggle.collapsed .section-collapse-icon {
    transform: rotate(-90deg);
}


/* Consistent help link (WCAG 3.2.6) in the app footer. */
.app-footer .support-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 24px;
    margin-left: 1rem;
    text-decoration: underline;
}

/* WCAG 2.2.2 / 2.3.3: stop non-essential motion for users who ask for it,
   including Bootstrap's animated progress bars and the fade-in transitions. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

}


/* Manager name shown under the user name (header dropdown + profile card).
   Smaller than the user name (1.3rem on the profile, 1rem in the dropdown). */
.profile-manager {
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
}

.user-menu .user-header small.user-manager {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    opacity: 0.8;
}
