/* ============================================================================
   Modern skin for Jahaji-Admin
   ----------------------------------------------------------------------------
   A global visual layer loaded AFTER the legacy theme CSS. It restyles the
   theme's existing classes (.panel, .btn, .table, .form-control, .header,
   .sidebar-left, .alert, ...) so every page — including views not yet migrated
   to Blade components — gets a cleaner, modern look without markup changes.
   ============================================================================ */

:root {
    --m-primary: #4f46e5;
    --m-primary-dark: #4338ca;
    --m-success: #16a34a;
    --m-info: #0ea5e9;
    --m-warning: #f59e0b;
    --m-danger: #ef4444;
    --m-bg: #f1f5f9;
    --m-surface: #ffffff;
    --m-border: #e5e7eb;
    --m-text: #1e293b;
    --m-muted: #64748b;
    --m-sidebar: #0f172a;
    --m-sidebar-2: #1e293b;
    --m-radius: 12px;
    --m-radius-sm: 8px;
    --m-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
    --m-shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, .12), 0 8px 10px -6px rgba(15, 23, 42, .08);
}

/* ---- Base typography & background -------------------------------------- */
html.fixed body,
body {
    font-family: 'Inter', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background: var(--m-bg) !important;
    color: var(--m-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.content-body {
    background: var(--m-bg) !important;
}

h1, h2, h3, h4, h5, .panel-title {
    font-family: inherit !important;
    color: var(--m-text);
}

a {
    color: var(--m-primary);
}
a:hover, a:focus {
    color: var(--m-primary-dark);
}

/* ---- Top bar ----------------------------------------------------------- */
.header {
    background: var(--m-surface) !important;
    border-bottom: 1px solid var(--m-border) !important;
    box-shadow: 0 1px 0 rgba(15,23,42,.04), var(--m-shadow);
}
.header .logo-container {
    background: var(--m-surface) !important;
    border-bottom: 1px solid var(--m-border) !important;
}

/* search box → pill with icon + focus ring */
.header .search .input-search .form-control {
    border-radius: 999px !important;
    background: var(--m-bg) !important;
    border: 1px solid var(--m-border) !important;
    height: 38px !important;
    min-height: 38px;
    padding-left: 16px !important;
    transition: box-shadow .15s ease, border-color .15s ease, width .2s ease;
}
.header .search .input-search .form-control:focus {
    border-color: var(--m-primary) !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12) !important;
    background: #fff !important;
}
.header .search .input-search .input-group-btn .btn {
    border-radius: 0 999px 999px 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: var(--m-muted) !important;
    box-shadow: none !important;
}

/* notification + user icons → circular hover targets.
   Reset the base theme's white background + drop shadow + 30px box so the
   bell sits flush inside the 60px header instead of poking out as a circle. */
.header .notifications { margin-top: 0; }
.header .notifications > li > a.notification-icon {
    position: relative;
    width: 38px; height: 38px;
    margin: 11px 4px 0;
    border-radius: 50%;
    background: transparent !important;
    box-shadow: none !important;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--m-muted) !important;
    transition: background .15s ease, color .15s ease;
}
.header .notifications > li > a.notification-icon i { line-height: 1 !important; }
.header .notifications > li > a.notification-icon:hover {
    background: var(--m-bg) !important;
    color: var(--m-primary) !important;
}
/* badge → pill that fits the count and stays inside the icon's bounds.
   Selector is specific enough to beat the base theme's right:-8px;top:-3px. */
.header .notifications > li .notification-icon .badge,
.header .notifications .badge {
    background: var(--m-success);
    border-radius: 999px;
    position: absolute;
    top: 1px; right: 1px;
    min-width: 16px; height: 16px;
    line-height: 12px;
    padding: 2px 4px;
    box-sizing: border-box;
    border: 2px solid var(--m-surface);
    font-size: 9px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    text-align: center;
}
.header .notifications .badge.bg-success { background: var(--m-success) !important; }
.header .separator {
    background: var(--m-border) !important;
    margin: 0 6px;
}
.notification-menu { border-radius: var(--m-radius) !important; border-color: var(--m-border) !important; box-shadow: var(--m-shadow-lg) !important; }
.notification-menu .notification-title { background: var(--m-bg); color: var(--m-text); font-weight: 700; border-radius: var(--m-radius) var(--m-radius) 0 0; }

/* notification dropdown — constrained width for all viewports */
.notification-menu {
    width: 340px !important;
    min-width: 320px !important;
    max-width: calc(100vw - 24px) !important;
}

/* scroll area: bounded height, subtle custom scrollbar, no legacy inline height */
.notification-contents {
    max-height: 380px !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
}
.notification-contents::-webkit-scrollbar { width: 8px; }
.notification-contents::-webkit-scrollbar-track { background: transparent; }
.notification-contents::-webkit-scrollbar-thumb { background: var(--m-border); border-radius: 999px; }

/* reset the base theme's default ul/li list styles inside the scroll area */
.notification-contents > ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* each notification row as a flex row with left-accent unread indicator */
.notification-contents ul li a.clearfix {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--m-border) !important;
    border-left: 3px solid var(--m-primary) !important;
    color: var(--m-text) !important;
    text-decoration: none !important;
    transition: background .15s ease !important;
    background: var(--m-surface) !important;
}
.notification-contents ul li:last-child a.clearfix {
    border-bottom: none !important;
}
.notification-contents ul li a.clearfix:hover {
    background: var(--m-bg) !important;
    color: var(--m-text) !important;
}

/* avatar circle: replace hard green square with soft primary tint */
.notification-contents .image {
    flex-shrink: 0 !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background: rgba(79, 70, 229, .10) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.notification-contents .image .fa-bell,
.notification-contents .image .bg-success {
    background: transparent !important;
    color: var(--m-primary) !important;
    font-size: 14px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* text column: title + relative-time stack cleanly in remaining flex space */
.notification-contents .notification-body {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}
.notification-contents .title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: var(--m-text) !important;
}
.notification-contents .message {
    display: block !important;
    font-size: 11px !important;
    color: var(--m-muted) !important;
    margin-top: 2px !important;
}

/* footer: full-width "mark all as read" link, visually separated */
.notification-contents hr {
    margin: 0 !important;
    border-color: transparent !important;
}
.notification-contents .text-right {
    text-align: center !important;
    padding: 0 !important;
    border-top: 1px solid var(--m-border) !important;
    background: var(--m-surface) !important;
}
.notification-contents .view-more {
    display: block !important;
    padding: 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--m-primary) !important;
    text-decoration: none !important;
    transition: background .15s ease !important;
}
.notification-contents .view-more:hover {
    background: var(--m-bg) !important;
    color: var(--m-primary-dark) !important;
}

/* empty state: centered muted bell + text, no hover effect */
.notification-contents ul li.notification-empty {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 28px 16px !important;
    color: var(--m-muted) !important;
    border-bottom: none !important;
}
.notification-contents ul li.notification-empty .fa {
    font-size: 28px !important;
    opacity: .4 !important;
    margin-bottom: 10px !important;
}
.notification-contents ul li.notification-empty span {
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--m-text) !important;
}
.notification-contents ul li.notification-empty .notification-empty-sub {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: var(--m-muted) !important;
    margin-top: 2px !important;
}
/* suppress the flex-row styles and left accent on the empty state row */
.notification-contents ul li.notification-empty a.clearfix { display: none !important; }

/* user box */
#userbox { transition: background .15s ease; border-radius: var(--m-radius-sm); }
#userbox > a { padding-top: 12px; padding-bottom: 10px; }
#userbox:hover { background: var(--m-bg); }
#userbox .profile-picture img {
    border: 2px solid var(--m-border);
    box-shadow: 0 0 0 2px #fff;
}
#userbox .profile-info .name { color: var(--m-text); font-weight: 600; }
#userbox .profile-info .role {
    color: var(--m-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-size: 10px;
}
/* drop the menu cleanly BELOW the trigger instead of the theme's default
   overlap (top:-10px + 45px top padding), which collided with the name/avatar
   once theme-modern reset the padding */
#userbox .dropdown-menu,
.userbox.open .dropdown-menu {
    border-radius: var(--m-radius) !important;
    border-color: var(--m-border) !important;
    box-shadow: var(--m-shadow-lg) !important;
    box-sizing: border-box !important;
    padding: 6px !important;
    top: calc(100% + 6px) !important;
    left: auto !important;
    right: 8px !important;
    width: auto !important;
    min-width: 200px;
}
/* the leading empty <li class="divider"> would draw a stray top border */
#userbox .dropdown-menu .divider:first-child { display: none; }
#userbox .dropdown-menu > ul > li > a,
#userbox .dropdown-menu > ul > li > form > button {
    border-radius: var(--m-radius-sm);
    padding: 9px 12px;
    font-weight: 500;
    color: var(--m-text);
}
#userbox .dropdown-menu > ul > li > a:hover,
#userbox .dropdown-menu > ul > li > form > button:hover { background: var(--m-bg); color: var(--m-primary); }

/* ---- Sidebar ----------------------------------------------------------- */
.sidebar-left,
.sidebar-left .nano-content,
html.fixed .sidebar-left {
    background: var(--m-sidebar) !important;
}
.sidebar-left .sidebar-header {
    background: var(--m-sidebar) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-left .sidebar-header .sidebar-title {
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 11px !important;
    font-weight: 700;
    color: #64748b !important;
}
.sidebar-left .sidebar-header .sidebar-toggle { background: rgba(255,255,255,.04); border-radius: var(--m-radius-sm); }
.sidebar-left .sidebar-header .sidebar-toggle:hover { background: rgba(255,255,255,.1); }

/* nav items */
.sidebar-left .nav-main a {
    color: #cbd5e1 !important;
    border-radius: var(--m-radius-sm);
    margin: 2px 10px;
    padding: 10px 14px !important;
    transition: background .15s ease, color .15s ease, padding-left .15s ease;
    font-weight: 500;
    position: relative;
    display: flex;
    align-items: center;
}
.sidebar-left .nav-main > li > a { font-weight: 600; }
/* fixed-width icons so labels align */
.sidebar-left .nav-main a > i {
    color: #94a3b8 !important;
    width: 22px;
    text-align: center;
    margin-right: 6px;
    font-size: 15px;
    flex: 0 0 22px;
    transition: color .15s ease;
}
.sidebar-left .nav-main a > span { flex: 1 1 auto; }
.sidebar-left .nav-main a:hover {
    background: rgba(255, 255, 255, .07) !important;
    color: #fff !important;
    padding-left: 18px !important;
}
.sidebar-left .nav-main a:hover > i { color: #fff !important; }

/* active item → indigo pill with left accent bar + glow */
.sidebar-left .nav-main li.nav-active > a,
.sidebar-left .nav-main li.active > a {
    background: var(--m-primary) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .45);
}
.sidebar-left .nav-main li.nav-active > a > i,
.sidebar-left .nav-main li.active > a > i { color: #fff !important; }
.sidebar-left .nav-main li.nav-active > a:before,
.sidebar-left .nav-main li.active > a:before {
    content: "";
    position: absolute;
    left: -6px; top: 8px; bottom: 8px;
    width: 3px; border-radius: 3px;
    background: #fff;
}

/* expandable parent: chevron caret that rotates when open */
.sidebar-left .nav-main li.nav-parent > a:after {
    content: "\f105"; /* fa-angle-right */
    font-family: 'FontAwesome';
    margin-left: auto;
    font-size: 13px;
    color: #64748b;
    transition: transform .2s ease, color .15s ease;
}
.sidebar-left .nav-main li.nav-parent.nav-expanded > a:after { transform: rotate(90deg); color: #cbd5e1; }
.sidebar-left .nav-main li.nav-parent.nav-expanded > a { color: #fff !important; }
.sidebar-left .nav-main li.nav-parent.nav-expanded > a > i { color: var(--m-primary) !important; }

/* submenu: indented with a connector rail */
.sidebar-left .nav-main .nav-children {
    background: rgba(0, 0, 0, .18) !important;
    border-radius: var(--m-radius-sm);
    margin: 2px 10px 6px;
    padding: 6px 0 6px 0;
    position: relative;
}
.sidebar-left .nav-main .nav-children:before {
    content: "";
    position: absolute;
    left: 22px; top: 8px; bottom: 8px;
    width: 1px;
    background: rgba(255,255,255,.1);
}
.sidebar-left .nav-main .nav-children li a {
    margin: 1px 8px;
    padding: 7px 14px 7px 30px !important;
    font-weight: 500;
    font-size: 13px;
    color: #94a3b8 !important;
}
.sidebar-left .nav-main .nav-children li a:hover { color: #fff !important; padding-left: 33px !important; }
.sidebar-left .nav-main .nav-children li.active > a {
    background: rgba(79,70,229,.18) !important;
    color: #fff !important;
    box-shadow: none;
}
.sidebar-left .nav-main .nav-children li.active > a:before { display: none; }
ul.nav-main li.nav-expanded .nav-children li.active { background: transparent; }

/* custom thin scrollbar for the sidebar */
.sidebar-left .nano-content::-webkit-scrollbar { width: 7px; }
.sidebar-left .nano-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }
.sidebar-left .nano-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }
.sidebar-left .nano > .nano-pane > .nano-slider { background: rgba(255,255,255,.18) !important; border-radius: 999px; }

/* ---- Page header / breadcrumb ------------------------------------------ */
/* The legacy theme renders the breadcrumb as a FIXED bar (position:fixed;
   top:60px; height:50px) with inner-wrapper reserving 110px for it. We instead
   put it back in normal flow so it's a lightweight, backgroundless strip that
   simply scrolls up under the fixed top nav. !important beats the
   html.fixed(.sidebar-*) variants. */
html.fixed .page-header,
.page-header {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
    z-index: auto !important;
}
/* reclaim the 50px the fixed breadcrumb bar used to reserve — only the 60px
   top nav needs clearing now */
html.fixed .inner-wrapper { padding-top: 60px !important; }
/* the theme's 40px content padding leaves a big gap under the nav now that the
   breadcrumb is in-flow — tighten just the top */
.content-body { padding-top: 10px !important; }
/* kill the base theme's "/" separator (li:after) — theme-modern uses a
   single ">" chevron via li + li:before, so the "/" caused a double mark */
.page-header .breadcrumbs li:after { content: none !important; margin: 0 !important; }
/* let the breadcrumb bar span the full content width (the theme floats it
   left inside .right-wrapper.pull-left, which shrinks it to its content) */
.page-header .right-wrapper {
    float: none !important;
    width: 100% !important;
}
.breadcrumbs {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0 !important;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;   /* reset the theme's 50px fixed-bar line-height */
    min-height: 26px;
}
.breadcrumbs > li { display: inline-flex; align-items: center; }
/* home chip */
.breadcrumbs > li:first-child > a {
    width: 26px; height: 26px;
    border-radius: 999px;
    background: var(--m-bg);
    color: var(--m-primary) !important;
    display: inline-flex; align-items: center; justify-content: center;
}
.breadcrumbs > li:first-child > a:hover { background: var(--m-primary); color: #fff !important; }
.breadcrumbs > li + li:before {
    content: "\f105"; /* fa-angle-right */
    font-family: 'FontAwesome';
    color: #cbd5e1;
    padding: 0 6px;
    font-size: 13px;
}
.breadcrumbs a, .breadcrumbs span {
    color: var(--m-muted);
    font-weight: 500;
    padding: 3px 7px;
    border-radius: var(--m-radius-sm);
}
.breadcrumbs li:not(:first-child) a:hover { background: var(--m-bg); color: var(--m-primary); }
.breadcrumbs li:last-child span,
.breadcrumbs li:last-child a {
    color: var(--m-text);
    font-weight: 700;
}

/* ---- Panels = cards ---------------------------------------------------- */
.panel {
    background: var(--m-surface);
    border: 1px solid var(--m-border) !important;
    border-radius: var(--m-radius) !important;
    box-shadow: var(--m-shadow);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}
.panel:hover {
    box-shadow: var(--m-shadow-lg);
}
.panel > .panel-heading,
.panel .panel-heading {
    background: var(--m-surface) !important;
    border-bottom: 1px solid var(--m-border) !important;
    padding: 16px 20px !important;
}
.panel .panel-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .2px;
    color: var(--m-text);
}
.panel .panel-body {
    padding: 20px !important;
}

/* featured accent bar (the theme's coloured top border) */
.panel.panel-featured {
    border-top: 0 !important;
    position: relative;
}
.panel.panel-featured:before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.panel-featured-primary:before { background: var(--m-primary); }
.panel-featured-success:before { background: var(--m-success); }
.panel-featured-info:before    { background: var(--m-info); }
.panel-featured-warning:before { background: var(--m-warning); }
.panel-featured-danger:before  { background: var(--m-danger); }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
    border-radius: var(--m-radius-sm) !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, filter .15s ease !important;
    text-shadow: none !important;
}
.btn:hover {
    transform: translateY(-1px);
    filter: brightness(.97);
}
.btn:active {
    transform: translateY(0);
}
.btn-sm, .btn-xs {
    padding: 4px 12px !important;
}
.btn-primary {
    background: var(--m-primary) !important;
    border-color: var(--m-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .25) !important;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--m-primary-dark) !important;
}
.btn-success {
    background: var(--m-success) !important;
    border-color: var(--m-success) !important;
    color: #fff !important;
}
.btn-info {
    background: var(--m-info) !important;
    border-color: var(--m-info) !important;
    color: #fff !important;
}
.btn-warning {
    background: var(--m-warning) !important;
    border-color: var(--m-warning) !important;
    color: #fff !important;
}
.btn-danger {
    background: var(--m-danger) !important;
    border-color: var(--m-danger) !important;
    color: #fff !important;
}
.btn-default {
    background: var(--m-surface) !important;
    border-color: var(--m-border) !important;
    color: var(--m-text) !important;
}
.btn-default:hover {
    background: var(--m-bg) !important;
}

/* ---- Tables ------------------------------------------------------------ */
.table {
    border-collapse: separate;
    border-spacing: 0;
}
.table > thead > tr > th {
    background: #f8fafc !important;
    color: var(--m-muted) !important;
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: .5px;
    font-weight: 700;
    border-bottom: 1px solid var(--m-border) !important;
    padding: 7px 12px !important;
}
.table > tbody > tr > td {
    padding: 7px 12px !important;
    border-top: 1px solid #f1f5f9 !important;
    vertical-align: middle;
    color: var(--m-text);
    font-size: 13px;
    line-height: 1.35;
}
/* "Comfortable" density — opt-out applied per-table by app-enhancements.js
   (the Density toggle in the column-tools dropdown). Compact is the default. */
.table.dt-comfortable > thead > tr > th { padding: 12px 14px !important; }
.table.dt-comfortable > tbody > tr > td {
    padding: 12px 14px !important;
    font-size: 14px;
    line-height: 1.5;
}
.table > tbody > tr {
    transition: background .12s ease;
}
.table > tbody > tr:hover > td {
    background: #f8fafc !important;
}
.table > tbody > tr:hover td:nth-child(1) {
    background: #f8fafc !important;
}

/* ---- Pagination (Bootstrap-3 numbered markup) -------------------------- */
.pagination {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
    padding: 0;
}
.pagination > li { display: inline-flex; }
.pagination > li > a,
.pagination > li > span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px;
    padding: 0 10px;
    margin: 0 !important;
    border: 1px solid var(--m-border) !important;
    border-radius: var(--m-radius-sm) !important;
    background: var(--m-surface) !important;
    color: var(--m-text) !important;
    font-size: 13px; font-weight: 600;
    line-height: 1;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.pagination > li > a:hover,
.pagination > li > a:focus {
    background: var(--m-bg) !important;
    border-color: var(--m-primary) !important;
    color: var(--m-primary) !important;
}
.pagination > li.active > span,
.pagination > li.active > a {
    background: var(--m-primary) !important;
    border-color: var(--m-primary) !important;
    color: #fff !important;
}
.pagination > li.disabled > span {
    color: #cbd5e1 !important;
    background: var(--m-surface) !important;
    cursor: not-allowed;
    opacity: .7;
}

/* ---- Forms ------------------------------------------------------------- */
.form-control {
    border-radius: var(--m-radius-sm) !important;
    border: 1px solid var(--m-border) !important;
    background-color: #fff !important;
    box-shadow: none !important;
    padding: 10px 14px !important;
    height: auto !important;
    min-height: 42px;
    font-size: 14px !important;
    line-height: 1.45 !important;
    color: var(--m-text) !important;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control::placeholder { color: #9aa5b4 !important; }
.form-control:hover { border-color: #cbd5e1 !important; }
.form-control:focus {
    border-color: var(--m-primary) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15) !important;
    background-color: #fff !important;
}
.form-control[readonly],
.form-control:disabled {
    background-color: #f8fafc !important;
    color: var(--m-muted) !important;
    cursor: not-allowed;
}

/* native selects: custom chevron, no OS arrow */
select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    cursor: pointer;
}
select.form-control::-ms-expand { display: none; }

/* textareas */
textarea.form-control {
    min-height: 110px;
    resize: vertical;
    line-height: 1.6 !important;
}

/* labels */
.control-label, label {
    color: var(--m-text);
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 6px;
}
/* Top-aligned (stacked) labels: override the legacy horizontal grid so the
   label sits above its input full-width, instead of floating to the left. */
.form-horizontal .form-group {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.form-horizontal .form-group > .control-label,
.form-horizontal .form-group > [class*="col-sm-"],
.form-horizontal .form-group > [class*="col-md-"] {
    float: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.form-horizontal .control-label {
    display: block;
    text-align: left !important;
    padding-top: 0 !important;
    margin-bottom: 7px !important;
}
/* labels written as <b> right before a control (legacy search filters) */
.form-group > b,
.panel-body b:has(+ .form-control),
.panel-body b:has(+ .select2-container),
.panel-body .filter-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--m-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
/* give stacked filter inputs breathing room */
.panel-body .row > [class*="col-"] > .form-control,
.panel-body .row > [class*="col-"] > .select2-container {
    margin-bottom: 12px;
}

/* spacing between horizontal form rows */
.panel-body .form-horizontal .form-group {
    margin-bottom: 20px;
}

/* required marker */
.control-label.required:after,
label.required:after {
    content: " *";
    color: var(--m-danger);
}

/* file inputs */
input[type="file"] {
    display: inline-block;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px dashed var(--m-border);
    border-radius: var(--m-radius-sm);
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}

/* checkboxes & radios */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--m-primary);
    width: 16px;
    height: 16px;
    vertical-align: middle;
    cursor: pointer;
}

/* validation */
.form-control.is-invalid,
.has-error .form-control {
    border-color: var(--m-danger) !important;
}
.form-control.is-invalid:focus,
.has-error .form-control:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15) !important;
}
.help-block.text-danger,
.has-error .help-block {
    font-size: 12px;
    margin-top: 5px;
    color: var(--m-danger) !important;
}

/* the centred submit group becomes a clean footer */
.panel-body form .form-group.text-center {
    margin-top: 24px;
    margin-bottom: 0;
    padding-top: 18px;
    border-top: 1px solid var(--m-border);
    text-align: right;
}
.panel-body form .form-group.text-center .btn {
    min-width: 140px;
}

/* input-group addons / buttons */
.input-group-addon {
    border-radius: var(--m-radius-sm) !important;
    border: 1px solid var(--m-border) !important;
    background: #f8fafc !important;
    color: var(--m-muted) !important;
}

/* select2 to match */
.select2-container .select2-choice,
.select2-container--default .select2-selection--single {
    border-radius: var(--m-radius-sm) !important;
    border: 1px solid var(--m-border) !important;
    height: 42px !important;
    padding: 6px 10px !important;
    display: flex !important;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
}
.select2-dropdown {
    border-color: var(--m-border) !important;
    border-radius: var(--m-radius-sm) !important;
    box-shadow: var(--m-shadow-lg);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--m-primary) !important;
}

/* ---- Alerts ------------------------------------------------------------ */
.alert {
    border: 0 !important;
    border-radius: var(--m-radius-sm) !important;
    border-left: 4px solid transparent !important;
    box-shadow: var(--m-shadow);
    padding: 14px 18px !important;
}
.alert-success { background: #f0fdf4 !important; border-left-color: var(--m-success) !important; color: #166534 !important; }
.alert-info    { background: #f0f9ff !important; border-left-color: var(--m-info) !important;    color: #075985 !important; }
.alert-warning { background: #fffbeb !important; border-left-color: var(--m-warning) !important; color: #92400e !important; }
.alert-danger  { background: #fef2f2 !important; border-left-color: var(--m-danger) !important;  color: #991b1b !important; }
.alert .close {
    opacity: .5;
    text-shadow: none;
}

/* ---- Modal (Alpine x-modal / x-confirm-delete dialogs) ----------------- */
.modal-overlay .panel,
.modal-content.panel {
    box-shadow: var(--m-shadow-lg);
    border: 0 !important;
}

/* ---- Badges & misc ----------------------------------------------------- */
.badge {
    border-radius: 999px;
    font-weight: 600;
    padding: 3px 9px;
}
.label {
    border-radius: 6px;
    font-weight: 600;
}
hr {
    border-top: 1px solid var(--m-border);
}

/* ---- Images: unsquish + broken-image placeholder ----------------------- */
/* Table thumbnails frequently have fixed width/height attributes, which
   distort non-square source images. object-fit:cover crops to fill the box
   so faces aren't stretched. */
.table td img,
img.cell-thumb {
    object-fit: cover;
    border-radius: var(--m-radius-sm);
    background: var(--m-bg);
}
/* applied by app-enhancements.js when an <img> fails to load: neutral tile
   with a centred picture glyph instead of the browser's torn-image icon */
img.img-broken {
    object-fit: contain !important;
    background:
        var(--m-bg)
        center / 42% no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E");
    border: 1px dashed var(--m-border);
}
/* hide the alt text / native broken glyph that would otherwise show through */
img.img-broken { color: transparent; font-size: 0; }

/* ---- Data-table tools (column selector + reorder) ---------------------- */
.dt-toolbar { position: relative; display: flex; justify-content: flex-end; margin-bottom: 10px; }
.dt-cols-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--m-surface); color: var(--m-text);
    border: 1px solid var(--m-border); border-radius: var(--m-radius-sm);
    padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.dt-cols-btn:hover { background: var(--m-bg); border-color: var(--m-primary); color: var(--m-primary); }
.dt-cols-btn i { font-size: 12px; }
.dt-cols-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
    width: 260px; max-height: 360px; overflow-y: auto;
    background: var(--m-surface); border: 1px solid var(--m-border);
    border-radius: var(--m-radius); box-shadow: var(--m-shadow-lg); padding: 8px;
}
.dt-cols-hint { font-size: 11px; color: var(--m-muted); padding: 2px 6px 8px; }

/* density toggle (Comfortable / Compact) */
.dt-density {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 6px 10px; margin-bottom: 6px;
    border-bottom: 1px solid var(--m-border);
}
.dt-density-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--m-muted); }
.dt-density-group {
    display: inline-flex; margin-left: auto;
    border: 1px solid var(--m-border); border-radius: var(--m-radius-sm); overflow: hidden;
}
.dt-density-opt {
    background: var(--m-surface); color: var(--m-text);
    border: 0; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.dt-density-opt + .dt-density-opt { border-left: 1px solid var(--m-border); }
.dt-density-opt:hover { background: var(--m-bg); }
.dt-density-opt.is-active { background: var(--m-primary); color: #fff; }
.dt-cols-list { list-style: none; margin: 0; padding: 0; }
.dt-cols-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; border-radius: var(--m-radius-sm);
    cursor: grab; user-select: none; font-size: 13px; color: var(--m-text);
}
.dt-cols-item:hover { background: var(--m-bg); }
.dt-cols-item.dt-dragging { opacity: .5; background: var(--m-bg); }
.dt-cols-grip { color: #cbd5e1; font-size: 12px; cursor: grab; }
.dt-cols-item input[type="checkbox"] { margin: 0; cursor: pointer; }
.dt-cols-label { flex: 1; }

.dt-rows-clickable tbody tr { cursor: pointer; }
.dt-rows-clickable tbody tr:hover { background: var(--m-bg); }

/* ---- Row-detail modal -------------------------------------------------- */
.dt-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.dt-modal[hidden] { display: none; }
.dt-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.dt-modal-dialog {
    position: relative; width: 92%; max-width: 640px; max-height: 86vh; overflow: hidden;
    background: var(--m-surface); border-radius: var(--m-radius); box-shadow: var(--m-shadow-lg);
    display: flex; flex-direction: column;
}
.dt-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--m-border);
}
.dt-modal-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--m-text); }
.dt-modal-close { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--m-muted); cursor: pointer; }
.dt-modal-close:hover { color: var(--m-danger); }
.dt-modal-body { padding: 8px 20px 20px; overflow-y: auto; }
.dt-detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 0; margin: 0; }
.dt-detail-list dt {
    padding: 10px 12px 10px 0; font-weight: 600; color: var(--m-muted);
    border-bottom: 1px solid var(--m-border); font-size: 13px;
}
.dt-detail-list dd {
    padding: 10px 0; margin: 0; color: var(--m-text);
    border-bottom: 1px solid var(--m-border); font-size: 14px; word-break: break-word;
}
.dt-detail-list dd img { max-width: 120px; height: auto; border-radius: var(--m-radius-sm); }
@media (max-width: 520px) {
    .dt-detail-list { grid-template-columns: 1fr; }
    .dt-detail-list dt { border-bottom: 0; padding-bottom: 0; }
    .dt-detail-list dd { padding-top: 2px; }
}

/* ============================================================================
   Top-nav search trigger + command palette (Cmd-K / Ctrl-K)
   ============================================================================ */
.nav-search-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 12px; min-width: 220px;
    background: var(--m-bg); border: 1px solid var(--m-border);
    border-radius: 999px; color: var(--m-text-muted, #64748b);
    font-size: 13px; cursor: text; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.nav-search-trigger:hover { border-color: var(--m-primary); background: #fff; }
.nav-search-trigger:focus { outline: none; border-color: var(--m-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.nav-search-trigger .fa-search { font-size: 13px; }
.nav-search-trigger-text { flex: 1 1 auto; text-align: left; }
.nav-search-kbd { display: inline-flex; gap: 3px; }
.nav-search-kbd kbd,
.cmdk kbd {
    font-family: inherit; font-size: 10px; line-height: 1; font-weight: 600;
    padding: 3px 5px; border-radius: 5px; color: var(--m-text-muted, #64748b);
    background: var(--m-surface, #fff); border: 1px solid var(--m-border); box-shadow: 0 1px 0 var(--m-border);
}
@media (max-width: 767px) {
    .nav-search-trigger { min-width: 0; }
    .nav-search-trigger-text, .nav-search-kbd { display: none; }
}

.cmdk { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-start; justify-content: center; }
.cmdk[hidden] { display: none; }
.cmdk-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); }
.cmdk-dialog {
    position: relative; width: 92%; max-width: 620px; margin-top: 12vh;
    background: var(--m-surface, #fff); border-radius: var(--m-radius, 12px);
    box-shadow: var(--m-shadow-lg); overflow: hidden; display: flex; flex-direction: column;
    max-height: 70vh;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--m-border); }
.cmdk-input-icon { color: var(--m-text-muted, #94a3b8); font-size: 15px; }
.cmdk-input {
    flex: 1 1 auto; border: 0; outline: none; background: transparent;
    font-size: 16px; color: var(--m-text, #0f172a);
}
.cmdk-input::placeholder { color: var(--m-text-muted, #94a3b8); }
.cmdk-esc {
    font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--m-text-muted, #94a3b8);
    border: 1px solid var(--m-border); border-radius: 5px; padding: 3px 6px;
}
.cmdk-list { overflow-y: auto; padding: 6px; flex: 1 1 auto; }
.cmdk-section {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--m-text-muted, #94a3b8); padding: 10px 10px 4px;
}
.cmdk-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: var(--m-radius-sm, 8px); cursor: pointer; color: var(--m-text, #0f172a);
}
.cmdk-item.is-active { background: rgba(79,70,229,.10); }
.cmdk-type {
    flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--m-primary, #4f46e5);
    background: rgba(79,70,229,.10); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.cmdk-label { flex: 1 1 auto; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-sub { flex: 0 0 auto; font-size: 12px; color: var(--m-text-muted, #94a3b8); }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--m-text-muted, #94a3b8); font-size: 14px; }
.cmdk-foot {
    display: flex; gap: 16px; align-items: center; padding: 9px 16px;
    border-top: 1px solid var(--m-border); font-size: 11px; color: var(--m-text-muted, #94a3b8);
}
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }
body.cmdk-open { overflow: hidden; }
@media (max-width: 520px) {
    .cmdk-dialog { margin-top: 6vh; max-height: 84vh; }
    .cmdk-foot { display: none; }
}

/* notifications dropdown footer: stacked links share one divider; full page
   highlights unread rows with a faint primary tint. */
.notification-footer .view-more + .view-more { border-top: none !important; }
.notification-row-unread > td { background: rgba(79, 70, 229, .045); }
