/* ==========================================================================
   IT DEPARTMENT — REDESIGN DESIGN SYSTEM
   Light gray, glass, gradient-accented admin theme.
   Built to sit alongside jQuery / DataTables / Select2 / daterangepicker —
   we restyle their generated markup instead of removing them, so all
   existing server-side logic keeps working untouched.
   ========================================================================== */

:root {
    --bg-0: #eef1f6;
    --bg-1: #e6eaf1;
    --bg-2: #dde3ec;
    --surface: rgba(20, 30, 50, 0.035);
    --surface-hover: rgba(20, 30, 50, 0.07);
    --surface-solid: #ffffff;
    --border: rgba(20, 30, 50, 0.09);
    --border-strong: rgba(20, 30, 50, 0.16);

    --text-0: #1a2233;
    --text-1: #3d4759;
    --text-2: #6b7488;
    --text-3: #98a0b3;

    --accent-1: #2f8fe0;   /* electric blue */
    --accent-2: #6c4fe0;   /* violet */
    --accent-3: #0fb89e;   /* teal / marine */
    --accent-warn: #d98a2b;
    --accent-danger: #e0435f;
    --accent-success: #1fae7d;

    --grad-brand: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
    --grad-brand-soft: linear-gradient(135deg, rgba(47, 143, 224, 0.14), rgba(108, 79, 224, 0.11) 55%, rgba(15, 184, 158, 0.1) 100%);

    /* Text/icon color to use ON TOP of --grad-brand (buttons, active nav,
       pagination "current", date-picker selected day, dt-buttons "add", etc).
       White reads cleanly across all three gradient stops (blue/violet/teal);
       the previous dark navy (#04101f) had weak contrast on the violet/teal
       portion of the gradient — that's the single source of truth now, so
       fixing contrast means changing this one variable. */
    --on-grad: #ffffff;
    --on-grad-shadow: 0 1px 2px rgba(4, 8, 16, 0.35);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-glow: 0 0 0 1px rgba(20,30,50,0.04), 0 20px 50px -22px rgba(47, 143, 224, 0.3);
    --shadow-card: 0 8px 24px -14px rgba(30, 40, 60, 0.18);
    --shadow-pop: 0 20px 55px -20px rgba(30, 40, 60, 0.28);

    --font-display: 'Sora', 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;

    --sidebar-w: 264px;
    --sidebar-w-collapsed: 84px;
    --navbar-h: 72px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap');

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

html, body {
    background: var(--bg-0);
    color: var(--text-1);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 8% -10%, rgba(47, 143, 224, 0.08), transparent 60%),
        radial-gradient(900px 600px at 100% 0%, rgba(108, 79, 224, 0.07), transparent 55%),
        radial-gradient(1000px 800px at 50% 110%, rgba(15, 184, 158, 0.05), transparent 60%),
        var(--bg-0);
    background-attachment: fixed;
}

a { color: var(--accent-1); }
a:hover { color: var(--accent-3); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-0);
    font-weight: 700;
    letter-spacing: -0.01em;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(20,30,50,0.15); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,30,50,0.28); background-clip: content-box; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */

#app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
    background: linear-gradient(180deg, #ffffff 0%, #f4f6fa 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width .25s ease, transform .25s ease;
}

.app-sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-brand {
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.4rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand .brand-mark {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--grad-brand);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px -6px rgba(58,169,255,.55);
    flex-shrink: 0;
}
.sidebar-brand .brand-mark svg { width: 20px; height: 20px; }

.sidebar-brand .brand-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.02rem;
    color: var(--text-0);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-brand .brand-text span {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .12em;
}

.app-sidebar.is-collapsed .brand-text { display: none; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem .8rem 1.5rem;
    list-style: none;
    margin: 0;
}

.sidebar-section-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--text-3);
    font-weight: 700;
    padding: 1.1rem .7rem .5rem;
}
.app-sidebar.is-collapsed .sidebar-section-label { display: none; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .68rem .8rem;
    border-radius: var(--radius-md);
    color: var(--text-2);
    text-decoration: none;
    font-weight: 600;
    font-size: .89rem;
    margin-bottom: .2rem;
    position: relative;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    white-space: nowrap;
}

.sidebar-link .icon-wrap {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20,30,50,0.045);
    flex-shrink: 0;
    transition: background .18s ease, color .18s ease;
}
.sidebar-link .icon-wrap svg { width: 17px; height: 17px; }

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text-0);
    transform: translateX(2px);
}

/* Active nav item: solid, saturated gradient pill. Text/icon use --on-grad
   (white) — see the --on-grad definition in :root for why. */
.sidebar-link.active {
    background: var(--grad-brand);
    color: var(--on-grad);
    text-shadow: var(--on-grad-shadow);
    font-weight: 700;
    box-shadow: 0 10px 26px -12px rgba(58,169,255,.6);
}
.sidebar-link.active .icon-wrap {
    background: rgba(255,255,255,0.22);
    color: var(--on-grad);
    box-shadow: none;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -0.8rem;
    top: 50%; transform: translateY(-50%);
    width: 4px; height: 60%;
    border-radius: 4px;
    background: var(--grad-brand);
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: .7rem .8rem;
}

.sidebar-foot {
    padding: 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    width: 100%;
    display: flex; align-items: center; justify-content: center;
    gap: .5rem;
    padding: .55rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    font-size: .78rem;
    transition: all .15s ease;
}
.sidebar-collapse-btn:hover { background: var(--surface-hover); color: var(--text-0); }

/* ---- Main column ---- */
.app-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}
.app-sidebar.is-collapsed ~ .app-main,
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }

/* ---- Navbar ---- */
.app-navbar {
    height: var(--navbar-h);
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.75rem;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid var(--border);
}

.navbar-toggle {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
}
.navbar-toggle:hover { background: var(--surface-hover); color: var(--text-0); }

.navbar-page-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-0);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.navbar-right { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

.navbar-user {
    display: flex; align-items: center; gap: .65rem;
    padding: .4rem .7rem .4rem .4rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: background .15s ease;
}
.navbar-user:hover { background: var(--surface-hover); }
.navbar-user img {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(20,30,50,0.1);
}
.navbar-user .u-name { font-size: .85rem; font-weight: 600; color: var(--text-0); }

.navbar-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 190px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop);
    padding: .4rem;
    display: none;
    z-index: 60;
}
.navbar-dropdown.is-open { display: block; }
.navbar-dropdown a {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--text-1);
    font-size: .86rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .12s ease;
}
.navbar-dropdown a:hover { background: var(--surface-hover); color: var(--text-0); }
.navbar-dropdown a.danger { color: var(--accent-danger); }
.navbar-dropdown a.danger:hover { background: rgba(255,92,122,0.12); }
.navbar-dropdown hr { border: none; border-top: 1px solid var(--border); margin: .3rem 0; }

/* ---- Content / footer ---- */
.app-content {
    flex: 1;
    padding: 1.9rem 2rem 3rem;
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
}

.app-footer {
    padding: 1.2rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: .8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.page-header h1 {
    font-size: 1.55rem;
    margin: 0 0 .25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.page-header .eyebrow {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: .7rem;
    font-weight: 700;
    color: var(--accent-3);
    margin-bottom: .4rem;
    display: block;
}

.page-header .subtitle { color: var(--text-2); font-size: .9rem; }

.page-header-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .86rem;
    padding: .68rem 1.3rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
    white-space: nowrap;
    line-height: 1.1;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--grad-brand);
    color: var(--on-grad);
    text-shadow: var(--on-grad-shadow);
    box-shadow: 0 10px 26px -10px rgba(58,169,255,.65);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px rgba(58,169,255,.8); transform: translateY(-1px); color: var(--on-grad); }
.btn-primary.disabled, .btn-primary[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-1);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-0); }

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-1);
}
.btn-outline:hover { border-color: var(--accent-1); color: var(--accent-1); }

.btn-danger {
    background: rgba(255,92,122,0.12);
    color: var(--accent-danger);
    border-color: rgba(255,92,122,0.25);
}
.btn-danger:hover { background: rgba(255,92,122,0.22); }

.btn-sm { padding: .45rem .85rem; font-size: .78rem; border-radius: 7px; }
.btn-icon { padding: .55rem; width: 38px; height: 38px; }
.btn-block { width: 100%; }

.btn .spinner {
    width: 16px; height: 16px;
    animation: spin .8s linear infinite;
    display: none;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   CARDS / SURFACES
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(6px);
}

.card-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h4 { margin: 0; font-size: 1rem; }

.card-body { padding: 1.6rem; }

.card-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: .8rem;
}

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

/* Stat / KPI cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.6rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-glow);
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: -40% -40% auto auto;
    width: 140px; height: 140px;
    background: var(--grad-brand);
    opacity: .12;
    filter: blur(30px);
    border-radius: 50%;
}
.stat-card .stat-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--grad-brand-soft);
    color: var(--accent-3);
    margin-bottom: .9rem;
}
.stat-card .stat-icon svg { width: 21px; height: 21px; }
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--text-0);
    line-height: 1;
    margin-bottom: .35rem;
}
.stat-card .stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-2);
    font-weight: 700;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.field-group { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 0; }

.field-label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: .35rem;
}
.field-label .req { color: var(--accent-danger); }

.form-control,
input.form-control,
select.form-control,
textarea.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
textarea {
    width: 100%;
    background: rgba(20,30,50,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-0);
    font-family: var(--font-body);
    font-size: .89rem;
    padding: .72rem .9rem;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-1);
    background: rgba(58,169,255,0.06);
    box-shadow: 0 0 0 3px rgba(58,169,255,0.15);
}

.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--text-3); }

textarea.form-control { min-height: 110px; resize: vertical; }

.invalid-feedback { display: none; font-size: .76rem; color: var(--accent-danger); margin-top: .1rem; }
.errors { font-size: .78rem; color: var(--accent-danger); min-height: 1em; }

input[type="file"].form-control { padding: .55rem .8rem; cursor: pointer; }
input[type="file"]::file-selector-button {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-0);
    border-radius: 7px;
    padding: .4rem .8rem;
    margin-right: .8rem;
    font-weight: 600;
    font-size: .78rem;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem 1.6rem;
}
@media (max-width: 992px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-span-full { grid-column: 1 / -1; }

/* Native <select> — used where Select2/JS can't safely own the element
   (e.g. inside Livewire components with wire:ignore). Styled to look
   consistent with Select2 fields without needing any JS plugin. */
select.native-select,
select.form-control.native-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(20,30,50,0.03);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 16px;
    padding-right: 2.6rem;
    color: var(--text-0);
    cursor: pointer;
}
select.native-select:focus {
    border-color: var(--accent-1);
    background-color: rgba(58,169,255,0.06);
    box-shadow: 0 0 0 3px rgba(58,169,255,0.15);
}
/* Style the native <option> list itself (browser support varies, but
   Chrome/Edge/Firefox on desktop all honor these) */
select.native-select option {
    background-color: var(--surface-solid);
    color: var(--text-0);
    padding: .5rem;
}
select.native-select option:disabled {
    color: var(--text-3);
}

/* Select2 skin */
.select2-container { width: 100% !important; }
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    background: rgba(20,30,50,0.03) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    min-height: 44px !important;
    padding: .2rem .2rem !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-0) !important;
    line-height: 42px !important;
    padding-left: .8rem !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px !important; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-selection--single:focus,
.select2-selection.select2-selection--single:focus { border-color: var(--accent-1) !important; }
.select2-dropdown {
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    box-shadow: var(--shadow-pop);
}
.select2-search--dropdown .select2-search__field {
    background: rgba(20,30,50,0.04) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-0) !important;
    border-radius: 7px !important;
}
.select2-results__option {
    color: var(--text-1) !important;
    padding: .55rem .9rem !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgba(58, 169, 255, 0.22) !important;
    color: var(--text-0) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--grad-brand-soft) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-0) !important;
    border-radius: 6px !important;
    padding: 2px 6px !important;
}
.select2-container--default .select2-results__option[aria-disabled=true] { color: var(--text-3) !important; }

/* Daterangepicker skin (best-effort dark override) */
.daterangepicker {
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text-1) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-pop) !important;
}
.daterangepicker .calendar-table { background: transparent !important; border: none !important; }
.daterangepicker td.available:hover, .daterangepicker th.available:hover { background: var(--surface-hover) !important; }
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--grad-brand) !important; color: var(--on-grad) !important; text-shadow: var(--on-grad-shadow); }
.daterangepicker th, .daterangepicker td { color: var(--text-1) !important; }
.daterangepicker select.monthselect, .daterangepicker select.yearselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect {
    background: var(--surface) !important; color: var(--text-0) !important; border: 1px solid var(--border) !important;
}
.daterangepicker:after { border-bottom-color: var(--surface-solid) !important; }
.daterangepicker:before { border-bottom-color: var(--border-strong) !important; }

/* Login-style centered inputs w/ underline (tests/show min-max fields) */
.underline-field {
    background: transparent !important;
    border: none !important;
    border-bottom: 1.5px solid var(--border-strong) !important;
    border-radius: 0 !important;
    text-align: center;
    font-weight: 700;
}
.underline-field:focus { border-bottom-color: var(--accent-1) !important; box-shadow: none !important; }

/* ==========================================================================
   ALERTS
   ========================================================================== */

.alert {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .9rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: .87rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: rgba(52, 224, 161, 0.1); color: var(--accent-success); border-color: rgba(52,224,161,0.25); }
.alert-success a { color: var(--accent-3); font-weight: 700; text-decoration: underline; }
.alert-danger { background: rgba(255, 92, 122, 0.1); color: var(--accent-danger); border-color: rgba(255,92,122,0.25); }

/* ==========================================================================
   TABLES  (DataTables shell restyle — logic untouched)
   ========================================================================== */

.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.4rem 1rem;
    overflow: hidden;
}

table.dataTable, table#table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    color: var(--text-1);
    font-size: .87rem;
}

table.dataTable thead th, table#table thead th {
    background: transparent !important;
    color: var(--text-2) !important;
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .09em;
    font-weight: 700;
    border: none !important;
    padding: .6rem .9rem !important;
    text-align: left;
}

table.dataTable tbody tr, table#table tbody tr {
    background: rgba(20,30,50,0.02);
    transition: background .15s ease, transform .15s ease;
}
table.dataTable tbody tr:hover, table#table tbody tr:hover {
    background: rgba(58,169,255,0.07);
}

table.dataTable tbody td, table#table tbody td {
    border: none !important;
    border-top: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: .85rem .9rem !important;
    vertical-align: middle;
}
table.dataTable tbody td:first-child, table#table tbody td:first-child {
    border-left: 1px solid var(--border) !important;
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    font-weight: 700;
    color: var(--text-0);
}
table.dataTable tbody td:last-child, table#table tbody td:last-child {
    border-right: 1px solid var(--border) !important;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

table.dataTable tbody tr.odd, table.dataTable tbody tr.even { background: rgba(20,30,50,0.02); }

/* row action links rendered server-side inside the action column
   (controllers emit <a class="edit-button">/<a class="delete-button"> wrapping FA icons) */
table.dataTable td .edit-button,
table.dataTable td .delete-button,
table#table td .edit-button,
table#table td .delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    margin: 0 2px;
    text-decoration: none;
    transition: all .15s ease;
    font-size: .82rem;
}
table.dataTable td .edit-button:hover,
table#table td .edit-button:hover {
    background: var(--grad-brand-soft);
    border-color: var(--accent-1);
    color: var(--accent-1);
    transform: translateY(-1px);
}
table.dataTable td .delete-button,
table#table td .delete-button {
    color: var(--accent-danger);
}
table.dataTable td .delete-button:hover,
table#table td .delete-button:hover {
    background: rgba(255,92,122,0.14);
    border-color: rgba(255,92,122,0.4);
    transform: translateY(-1px);
}
table.dataTable td .edit-button i.fa-print,
table.dataTable td .edit-button i.prints {
    color: var(--accent-3);
}

table.dataTable .action-btn, table#table .action-btn,
table.dataTable a[href*="edit"], table.dataTable a[href*="show"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    margin: 0 2px;
    transition: all .15s ease;
}
table.dataTable a, table#table td a { color: var(--accent-1); }
table.dataTable button, table#table td button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent-danger);
    border-radius: 8px;
    padding: .35rem .6rem;
    cursor: pointer;
}
table.dataTable button:hover { background: rgba(255,92,122,0.15); }

/* DataTables controls (search box, length, pagination, info) */
.dataTables_wrapper { color: var(--text-2); font-size: .84rem; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing {
    color: var(--text-2) !important;
    margin-bottom: 1rem;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(20,30,50,0.03);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-0);
    padding: .4rem .7rem;
    margin-left: .5rem;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus { outline: none; border-color: var(--accent-1); }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-1) !important;
    border-radius: 7px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    padding: .35rem .7rem !important;
    margin-left: .2rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--surface-hover) !important;
    border-color: var(--border) !important;
    color: var(--text-0) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--grad-brand) !important;
    color: var(--on-grad) !important;
    text-shadow: var(--on-grad-shadow);
    font-weight: 700;
    border-color: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .35; }

.dataTables_processing {
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-0) !important;
}

/* DataTables custom buttons (Print / New X) */
.dt-buttons { display: flex; gap: .6rem; margin-bottom: 1.1rem; float: none !important; }
.dt-buttons .dt-button, .dt-button, .buttons-add, .buttons-print {
    display: inline-flex !important;
    align-items: center;
    gap: .45rem;
    background: var(--surface) !important;
    background-color: initial !important;
    border: 1px solid var(--border) !important;
    color: var(--text-0) !important;
    padding: .6rem 1.1rem !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 700 !important;
    font-size: .83rem !important;
    cursor: pointer;
    opacity: 1 !important;
    transition: all .15s ease;
}
div.dt-buttons button.dt-button.buttons-add,
div.dt-buttons button.buttons-add,
.dt-buttons .dt-button.buttons-add,
.dt-buttons .buttons-add {
    background: var(--grad-brand) !important;
    background-color: transparent !important;
    background-image: var(--grad-brand) !important;
    color: var(--on-grad) !important;
    text-shadow: var(--on-grad-shadow);
    border: none !important;
    box-shadow: 0 10px 24px -10px rgba(58,169,255,.6);
}
div.dt-buttons button.buttons-add span,
.dt-buttons .buttons-add span,
.dt-buttons .buttons-add .dt-button-text {
    color: var(--on-grad) !important;
    -webkit-text-fill-color: var(--on-grad) !important;
}
.dt-buttons .dt-button:hover { background: var(--surface-hover) !important; }
.dt-buttons .buttons-add:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(58,169,255,.8); }

/* jquery-confirm skin */
.jconfirm .jconfirm-box {
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text-1) !important;
}
.jconfirm .jconfirm-title { color: var(--text-0) !important; }
.jconfirm .jconfirm-content { color: var(--text-2) !important; }
.jconfirm-bg { background: rgba(4,8,16,0.72) !important; backdrop-filter: blur(4px); }

/* Status badges — usable inside DataTables 'status' columns via server HTML,
   also as utility classes for our own markup */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-todo { background: rgba(255,180,84,0.12); color: var(--accent-warn); }
.badge-doing { background: rgba(58,169,255,0.12); color: var(--accent-1); }
.badge-done { background: rgba(52,224,161,0.12); color: var(--accent-success); }
.badge-neutral { background: rgba(20,30,50,0.06); color: var(--text-2); }

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-shell::before, .login-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .5;
    z-index: 0;
}
.login-shell::before {
    width: 480px; height: 480px;
    background: var(--accent-1);
    top: -160px; left: -120px;
    opacity: .22;
}
.login-shell::after {
    width: 480px; height: 480px;
    background: var(--accent-2);
    bottom: -160px; right: -120px;
    opacity: .2;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 2.6rem 2.2rem 2.2rem;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(16px);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.8rem;
}
.login-logo .brand-mark {
    width: 62px; height: 62px;
    border-radius: 18px;
    background: var(--grad-brand);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 14px 34px -10px rgba(58,169,255,.65);
}
.login-logo .brand-mark svg { width: 32px; height: 32px; }
.login-logo h1 { font-size: 1.2rem; margin: 0; text-align: center; }
.login-logo p { font-size: .8rem; color: var(--text-2); margin: 0; text-align: center; }

.login-form .field-group { margin-bottom: 1.15rem; }

.simple-footer {
    text-align: center;
    color: var(--text-3);
    font-size: .76rem;
    margin-top: 1.6rem;
}

/* ==========================================================================
   PROFILE WIDGET
   ========================================================================== */

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.6rem;
    text-align: center;
}
.profile-card img.profile-pic {
    width: 96px; height: 96px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 4px rgba(20,30,50,0.06), var(--shadow-glow);
    margin-bottom: 1rem;
}
.profile-item { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.profile-item:last-child { border-bottom: none; }

.detail-item {
    background: rgba(20,30,50,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
}
.profile-item-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; }
.profile-item-value { font-size: .95rem; color: var(--text-0); font-weight: 600; margin-top: .15rem; }

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.text-muted { color: var(--text-2); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .8rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }

.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.stagger > * { animation: fadeIn .45s ease both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }

/* Mobile */
@media (max-width: 992px) {
    .app-sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
    .app-sidebar.is-mobile-open { transform: translateX(0); box-shadow: var(--shadow-pop); }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 1.4rem 1.1rem 2.5rem; }
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 0; background: rgba(4,8,16,0.6); z-index: 39;
        backdrop-filter: blur(2px);
    }
    .sidebar-backdrop.is-visible { display: block; }
}

/* ==========================================================================
   PRINT  (DataTables "Print" button clones the table into its own popup
   window / print context — that context inherits this stylesheet but not
   our app shell, so without explicit rules here the popup shows raw
   DataTables markup: full pagination controls, search box, length picker,
   and rows can break mid-content across page boundaries.)
   ========================================================================== */

@media print {
    /* Kill all DataTables chrome that isn't the table itself */
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_processing,
    .dt-buttons,
    .app-navbar,
    .app-sidebar,
    .app-footer,
    .sidebar-backdrop,
    .page-header-actions {
        display: none !important;
    }

    body, .app-content {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-main { margin-left: 0 !important; }

    table.dataTable, table#table {
        width: 100% !important;
        border-collapse: collapse !important;
        border-spacing: 0 !important;
        font-size: 11pt;
        color: #000;
    }

    table.dataTable thead th, table#table thead th {
        color: #000 !important;
        border-bottom: 1.5px solid #000 !important;
        background: transparent !important;
    }

    table.dataTable tbody td, table#table tbody td {
        border: 1px solid #ccc !important;
        border-radius: 0 !important;
        color: #000 !important;
        padding: .5rem .6rem !important;
    }

    /* Prevent a row's content from splitting across a page break */
    table.dataTable tbody tr, table#table tbody tr {
        background: transparent !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Avoid breaking right after the header row, orphaning it at the
       bottom of a page with no data below it */
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
}