/* IMD modern look: one layer over AdminLTE 3 / Bootstrap 4.
   Everything is driven by the tokens below. Remove the <link> in includes/head.blade.php to go back to the old look.
   html[data-theme="dark"] switches every token. */

:root {
  --imd-bg: #e8ebee;
  --imd-panel: #f6f7f8;
  --imd-ink: #101418;
  --imd-mute: #667085;
  --imd-line: #d5dae0;
  --imd-soft: #e9ecef;
  --imd-hover: #eef0f2;
  --imd-accent: #c8102e;
  --imd-accent-ink: #ffffff;
  --imd-accent-soft: #fdeef0;
  --imd-accent-strong: #a60d26;
  --imd-ok: #1f7a45;   --imd-ok-bg: #e5f4eb;
  --imd-warn: #8a5a00; --imd-warn-bg: #fbefd6;
  --imd-bad: #b3261e;  --imd-bad-bg: #fbe5e3;
  --imd-info: #1d5fa8; --imd-info-bg: #e4eefa;
  --imd-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --imd-pop: 0 12px 32px rgba(16, 24, 40, .16);
  --imd-radius: 12px;
  --imd-radius-sm: 10px;
  --imd-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --imd-bg: #1c2127;
  --imd-panel: #252c33;
  --imd-ink: #e7ecef;
  --imd-mute: #a1adb6;
  --imd-line: #3a444d;
  --imd-soft: #2e363e;
  --imd-hover: #2b333b;
  --imd-accent: #ff5a73;
  --imd-accent-ink: #2a0710;
  --imd-accent-soft: #3d2229;
  --imd-accent-strong: #ff7a8e;
  --imd-ok: #6fd39a;   --imd-ok-bg: #16301f;
  --imd-warn: #f0be62; --imd-warn-bg: #3a2d10;
  --imd-bad: #ff8f86;  --imd-bad-bg: #40201e;
  --imd-info: #7fb5f0; --imd-info-bg: #182c44;
  --imd-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --imd-pop: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- base ---------- */
body, .wrapper, .content-wrapper, .content-header, section.content, .content {
  font-family: var(--imd-font);
  background-color: var(--imd-bg);
  color: var(--imd-ink);
}
body { font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .page-title { font-family: var(--imd-font); color: var(--imd-ink); letter-spacing: -.01em; }
.page-title { font-size: 24px; }
a { color: var(--imd-accent); }
a:hover { color: var(--imd-accent-strong); }
hr { border-top-color: var(--imd-line); }
.text-muted, .text-secondary { color: var(--imd-mute) !important; }
.text-dark, .text-black { color: var(--imd-ink) !important; }
.bg-white, .bg-light { background-color: var(--imd-panel) !important; color: var(--imd-ink); }
.bg-gray-light, .bg-gray { background-color: var(--imd-soft) !important; color: var(--imd-ink); }
.border, .border-top, .border-bottom, .border-left, .border-right, .border-dark, .border-secondary { border-color: var(--imd-line) !important; }
:focus-visible { outline: 2px solid var(--imd-accent); outline-offset: 2px; }
::selection { background: var(--imd-accent-soft); color: var(--imd-ink); }
* { scrollbar-color: var(--imd-line) transparent; }
.content-wrapper { min-height: calc(100vh - 60px); }
.content-header { padding-top: 22px; padding-bottom: 6px; }
.main-footer { background: var(--imd-panel); border-top: 1px solid var(--imd-line); color: var(--imd-mute); font-size: 13px; }
.main-footer a { color: var(--imd-mute); text-decoration: underline; }

/* ---------- top bar ---------- */
.main-header.navbar {
  background: var(--imd-panel) !important;
  border-bottom: 1px solid var(--imd-line);
  box-shadow: none;
  min-height: 60px;
  padding: 0 20px;
}
.main-header.navbar .navbar-nav .nav-link { color: var(--imd-mute); border-radius: 8px; }
.main-header.navbar .navbar-nav .nav-link:hover { background: var(--imd-soft); color: var(--imd-ink); }
.imd-tools { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.imd-cmd {
  display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: 460px;
  padding: 7px 12px; border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm);
  background: var(--imd-soft); color: var(--imd-mute); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.imd-cmd:hover { border-color: var(--imd-mute); }
.imd-cmd span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imd-cmd kbd, .imd-pal kbd { font: inherit; font-size: 11px; border: 1px solid var(--imd-line); border-radius: 5px; padding: 1px 6px; background: var(--imd-panel); color: var(--imd-mute); box-shadow: none; }
.imd-iconbtn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm); background: var(--imd-panel); color: var(--imd-mute); cursor: pointer; padding: 0;
}
.imd-iconbtn:hover { color: var(--imd-ink); border-color: var(--imd-mute); }

/* ---------- sidebar: icon rail that expands on hover ---------- */
.main-sidebar, .main-sidebar.sidebar-dark-primary, .main-sidebar.sidebar-grey-primary {
  background: var(--imd-panel) !important;
  border-right: 1px solid var(--imd-line);
  box-shadow: none !important;
}
.sidebar-mini.sidebar-collapse .main-sidebar { width: 72px; }
.sidebar-mini.sidebar-collapse .main-sidebar:hover { width: 250px; box-shadow: var(--imd-pop) !important; }
.sidebar-mini.sidebar-collapse .content-wrapper, .sidebar-mini.sidebar-collapse .main-footer, .sidebar-mini.sidebar-collapse .main-header { margin-left: 72px; }
.main-sidebar .sidebar { padding: 0 12px; }
.main-sidebar .brand-link { background: var(--imd-panel) !important; border-bottom: 1px solid var(--imd-line); padding: 14px 16px; height: 60px; }
.main-sidebar .brand-link img { max-height: 26px; width: auto; }
.imd-brand { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 4px; margin: 0 -2px 6px; color: var(--imd-ink); text-decoration: none !important; white-space: nowrap; overflow: hidden; }
.imd-mark { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--imd-accent); color: var(--imd-accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.main-sidebar .sidebar a.imd-brand, .main-sidebar .sidebar a.imd-brand:hover { color: var(--imd-ink) !important; }
.imd-word { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.user-panel { border-bottom: 1px solid var(--imd-line) !important; margin: 0 0 8px !important; padding: 6px 4px 12px !important; white-space: nowrap; overflow: hidden; }
.user-panel .image { padding-left: 7px !important; padding-right: 0 !important; }
.user-panel .image img { display: none; }
.imd-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--imd-accent-soft); color: var(--imd-accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-panel .info a { color: var(--imd-ink) !important; font-weight: 600; font-size: 13.5px; }
.main-sidebar .nav-sidebar { padding-top: 4px; }
.main-sidebar .nav-sidebar > .nav-item { margin-bottom: 2px; }
.main-sidebar .nav-sidebar .nav-link {
  color: var(--imd-mute) !important; border-radius: var(--imd-radius-sm); padding: 9px 12px; font-weight: 500; white-space: nowrap;
}
.main-sidebar .nav-sidebar .nav-link .nav-icon { color: inherit; width: 1.6rem; margin-right: 10px; }
.main-sidebar .nav-sidebar .nav-link p { margin: 0; font-size: 14px; }
.main-sidebar .nav-sidebar .nav-link:hover { background: var(--imd-soft) !important; color: var(--imd-ink) !important; }
.main-sidebar .nav-sidebar > .nav-item > .nav-link.active,
.main-sidebar .nav-sidebar > .nav-item > .nav-link.active:hover {
  background: var(--imd-accent-soft) !important; color: var(--imd-accent) !important; box-shadow: none !important; font-weight: 600;
}
.main-sidebar .nav-sidebar strong { font-weight: inherit; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .imd-word,
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .user-panel .info { display: none; }
.main-sidebar .btn-outline-secondary, .main-sidebar .btn-block { border-radius: var(--imd-radius-sm); }
.main-sidebar .btn-danger { margin-bottom: 6px; }

/* ---------- cards ---------- */
.card {
  background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius);
  box-shadow: var(--imd-shadow); color: var(--imd-ink);
}
.card[class*="card-outline"], .card.card-primary.card-outline, .card.card-danger.card-outline { border-top: 1px solid var(--imd-line); }
.card-header { background: transparent; border-bottom: 1px solid var(--imd-line); padding: 14px 18px; font-size: 16px; font-weight: 600; }
.card-header .card-title { font-weight: 600; }
.card-body { color: var(--imd-ink); }
.card-footer { background: transparent !important; border-top: 1px solid var(--imd-line); }
.callout { background: var(--imd-panel); color: var(--imd-ink); border: 1px solid var(--imd-line); border-left-width: 4px; border-radius: var(--imd-radius-sm); box-shadow: none; }
.callout.callout-danger { border-left-color: var(--imd-bad); }
.callout.callout-info { border-left-color: var(--imd-info); }
.callout.callout-warning { border-left-color: var(--imd-warn); }
.callout.callout-success { border-left-color: var(--imd-ok); }
.alert { border-radius: var(--imd-radius-sm); }
.alert-info { background: var(--imd-info-bg); border-color: transparent; color: var(--imd-info); }
.alert-success { background: var(--imd-ok-bg); border-color: transparent; color: var(--imd-ok); }
.alert-warning { background: var(--imd-warn-bg); border-color: transparent; color: var(--imd-warn); }
.alert-danger { background: var(--imd-bad-bg); border-color: transparent; color: var(--imd-bad); }
.alert a { color: inherit; text-decoration: underline; }
.small-box, .info-box { background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius); box-shadow: var(--imd-shadow); color: var(--imd-ink); }
.small-box .inner h3, .small-box .inner p { color: var(--imd-ink); }
.small-box[class*="bg-"], .small-box[class*="bg-"] .inner h3, .small-box[class*="bg-"] .inner p, .small-box[class*="bg-"] .icon > i { color: #ffffff !important; }
.small-box[class*="bg-warning"], .small-box[class*="bg-warning"] .inner h3, .small-box[class*="bg-warning"] .inner p { color: #1f2328 !important; }
.info-box-text, .info-box-number { color: var(--imd-ink); }
fieldset.border, fieldset { border-color: var(--imd-line) !important; border-radius: var(--imd-radius-sm); }
fieldset legend { color: var(--imd-ink); font-size: 17px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn { border-radius: var(--imd-radius-sm); font-weight: 600; font-size: 13.5px; box-shadow: none; transition: background-color .12s, border-color .12s, color .12s; }
.btn-sm { font-size: 13px; padding: .3rem .7rem; }
.btn-primary, .btn-danger, .btn-primary:not(:disabled):not(.disabled):active, .btn-danger:not(:disabled):not(.disabled):active {
  background-color: var(--imd-accent); border-color: var(--imd-accent); color: var(--imd-accent-ink);
}
.btn-primary:hover, .btn-danger:hover, .btn-primary:focus, .btn-danger:focus { background-color: var(--imd-accent-strong); border-color: var(--imd-accent-strong); color: var(--imd-accent-ink); }
.btn-secondary, .btn-default, .btn-light, .btn-outline-secondary, .btn-outline-dark, .btn-outline-primary {
  background-color: var(--imd-panel); border: 1px solid var(--imd-line); color: var(--imd-ink);
}
.btn-secondary:hover, .btn-default:hover, .btn-light:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover, .btn-outline-primary:hover { background-color: var(--imd-soft); border-color: var(--imd-mute); color: var(--imd-ink); }
.btn-outline-danger { background-color: transparent; border: 1px solid var(--imd-accent); color: var(--imd-accent); }
.btn-outline-danger:hover { background-color: var(--imd-accent); color: var(--imd-accent-ink); }
.btn-success { background-color: var(--imd-ok); border-color: var(--imd-ok); color: #fff; }
html[data-theme="dark"] .btn-success { color: #06210f; }
.btn-warning { background-color: var(--imd-warn-bg); border-color: var(--imd-warn-bg); color: var(--imd-warn); }
.btn-info { background-color: var(--imd-info-bg); border-color: var(--imd-info-bg); color: var(--imd-info); }
.btn.disabled, .btn:disabled { opacity: .5; }
.btn-circle { border-radius: 50% !important; }
.btn-group > .btn.active { background-color: var(--imd-ink); color: var(--imd-panel); border-color: var(--imd-ink); }
.dt-buttons .btn, .dt-buttons .dt-button { border-radius: var(--imd-radius-sm); background: var(--imd-soft) !important; border: 1px solid var(--imd-line) !important; color: var(--imd-ink) !important; }

/* ---------- forms ---------- */
.form-control, .custom-select, select.form-control, textarea.form-control {
  background-color: var(--imd-panel); color: var(--imd-ink); border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm);
}
.form-control::placeholder { color: var(--imd-mute); opacity: .8; }
.form-control:focus, .custom-select:focus { background-color: var(--imd-panel); color: var(--imd-ink); border-color: var(--imd-accent); box-shadow: 0 0 0 3px var(--imd-accent-soft); }
.form-control:disabled, .form-control[readonly], .custom-select:disabled { background-color: var(--imd-soft); color: var(--imd-mute); }
.input-group-text { background: var(--imd-soft); border: 1px solid var(--imd-line); color: var(--imd-mute); border-radius: var(--imd-radius-sm); }
.form-group > label, .col-form-label { font-weight: 600; color: var(--imd-ink); }
.help-block, .form-text, small.text-muted { color: var(--imd-mute) !important; }
.custom-control-label { color: var(--imd-ink); }
.custom-file-label { background: var(--imd-panel); border-color: var(--imd-line); color: var(--imd-mute); }
.custom-file-label::after { background: var(--imd-soft); color: var(--imd-ink); border-left-color: var(--imd-line); }
.has-error .form-control, .form-control.is-invalid { border-color: var(--imd-bad); }
.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple {
  background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm); color: var(--imd-ink); min-height: 38px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--imd-ink); line-height: 36px; }
.select2-dropdown { background: var(--imd-panel); border: 1px solid var(--imd-line); color: var(--imd-ink); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--imd-accent-soft); color: var(--imd-accent); }
.select2-container--default .select2-search--dropdown .select2-search__field { background: var(--imd-panel); color: var(--imd-ink); border-color: var(--imd-line); }

/* ---------- tables and DataTables ---------- */
.table { color: var(--imd-ink); }
.table td, .table th { border-color: var(--imd-line); vertical-align: middle; }
.table thead th, table.dataTable thead th {
  background: var(--imd-soft); color: var(--imd-mute); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--imd-line); border-top: 0;
}
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--imd-line); }
.table-striped tbody tr:nth-of-type(odd) { background-color: transparent; }
.table-hover tbody tr:hover, table.dataTable tbody tr:hover { background-color: var(--imd-hover); color: var(--imd-ink); }
table.dataTable tbody tr, table.dataTable tbody td { background-color: transparent; }
table.dataTable.no-footer { border-bottom: 1px solid var(--imd-line); }
.table-responsive { border-radius: var(--imd-radius-sm); }
.dataTables_wrapper { color: var(--imd-ink); }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select {
  background: var(--imd-panel); color: var(--imd-ink); border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm); padding: 5px 10px;
}
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_paginate { color: var(--imd-mute); }
.page-link { background: var(--imd-panel); border-color: var(--imd-line); color: var(--imd-ink); }
.page-link:hover { background: var(--imd-soft); color: var(--imd-ink); border-color: var(--imd-line); }
.page-item.active .page-link { background: var(--imd-accent); border-color: var(--imd-accent); color: var(--imd-accent-ink); }
.page-item.disabled .page-link { background: var(--imd-panel); color: var(--imd-mute); opacity: .6; }
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after { opacity: .3; }
.badge-success { background: var(--imd-ok-bg); color: var(--imd-ok); }
.badge-danger { background: var(--imd-bad-bg); color: var(--imd-bad); }
.badge-warning { background: var(--imd-warn-bg); color: var(--imd-warn); }
.badge-info, .badge-primary { background: var(--imd-info-bg); color: var(--imd-info); }
.badge-secondary, .badge-light { background: var(--imd-soft); color: var(--imd-mute); }
.badge { font-weight: 600; border-radius: 99px; padding: .3em .7em; }

/* ---------- modals, menus, tabs ---------- */
.modal-content { background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: 14px; color: var(--imd-ink); box-shadow: var(--imd-pop); }
.modal-header, .modal-header.bg-danger, .modal-header.bg-primary, .modal-header[class*="bg-"] {
  background: var(--imd-panel) !important; color: var(--imd-ink) !important; border-bottom: 1px solid var(--imd-line); border-radius: 14px 14px 0 0;
}
.modal-header .modal-title { font-weight: 700; color: var(--imd-ink); }
.modal-header .close, .modal-header .close span { color: var(--imd-mute) !important; text-shadow: none; opacity: 1; }
.modal-footer { border-top: 1px solid var(--imd-line); }
.dropdown-menu { background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm); box-shadow: var(--imd-pop); padding: 6px; }
.dropdown-item { color: var(--imd-ink); border-radius: 8px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--imd-soft); color: var(--imd-ink); }
.dropdown-divider { border-top-color: var(--imd-line); }
.nav-tabs { border-bottom-color: var(--imd-line); }
.nav-tabs .nav-link { color: var(--imd-mute); border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.nav-tabs .nav-link.active { background: transparent; color: var(--imd-accent); border-bottom-color: var(--imd-accent); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--imd-accent); color: var(--imd-accent-ink); }
.nav-pills .nav-link { color: var(--imd-mute); border-radius: var(--imd-radius-sm); }
.breadcrumb { background: transparent; }
.list-group-item { background: var(--imd-panel); border-color: var(--imd-line); color: var(--imd-ink); }
.progress { background: var(--imd-soft); border-radius: 99px; }
.tooltip-inner { background: var(--imd-ink); color: var(--imd-panel); border-radius: 8px; }
.popover { background: var(--imd-panel); border-color: var(--imd-line); }
.popover-body { color: var(--imd-ink); }

/* ---------- SweetAlert (v1) ---------- */
.swal-overlay { background-color: rgba(8, 10, 12, .55); }
.swal-modal { background: var(--imd-panel); border-radius: 16px; border: 1px solid var(--imd-line); }
.swal-title { color: var(--imd-ink); font-weight: 700; }
.swal-text { color: var(--imd-mute); }
.swal-button { border-radius: var(--imd-radius-sm); font-weight: 600; background-color: var(--imd-accent); color: var(--imd-accent-ink); }
.swal-button:not([disabled]):hover { background-color: var(--imd-accent-strong); }
.swal-button--cancel { background-color: var(--imd-soft); color: var(--imd-ink); }
.swal-button--cancel:not([disabled]):hover { background-color: var(--imd-line); }
.swal-footer { border-radius: 0 0 16px 16px; }

/* ---------- date picker ---------- */
.bootstrap-datetimepicker-widget { background: var(--imd-panel) !important; border: 1px solid var(--imd-line) !important; border-radius: var(--imd-radius-sm); color: var(--imd-ink); box-shadow: var(--imd-pop); }
.bootstrap-datetimepicker-widget table td, .bootstrap-datetimepicker-widget table th { color: var(--imd-ink); border-radius: 8px; }
.bootstrap-datetimepicker-widget table td.day:hover, .bootstrap-datetimepicker-widget table td span:hover, .bootstrap-datetimepicker-widget table th:hover, .bootstrap-datetimepicker-widget .btn:hover { background: var(--imd-soft) !important; }
.bootstrap-datetimepicker-widget table td.active, .bootstrap-datetimepicker-widget table td.active:hover { background: var(--imd-accent) !important; color: var(--imd-accent-ink) !important; text-shadow: none; }
.bootstrap-datetimepicker-widget table td.old, .bootstrap-datetimepicker-widget table td.new, .bootstrap-datetimepicker-widget table th.disabled { color: var(--imd-mute); }
.bootstrap-datetimepicker-widget table td.today:before { border-bottom-color: var(--imd-accent); }
.bootstrap-datetimepicker-widget .list-unstyled { background: transparent; }
.daterangepicker { background: var(--imd-panel); border: 1px solid var(--imd-line); color: var(--imd-ink); }
.daterangepicker td.available:hover { background: var(--imd-soft); }
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--imd-accent); color: var(--imd-accent-ink); }

/* ---------- rich text editor: toolbar follows the theme, the writing surface stays paper-like ---------- */
.note-editor.note-frame { border: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm); background: var(--imd-panel); }
.note-editor .note-toolbar { background: var(--imd-soft); border-bottom: 1px solid var(--imd-line); border-radius: var(--imd-radius-sm) var(--imd-radius-sm) 0 0; }
.note-editor .note-btn { background: transparent; border: 0; color: var(--imd-ink); border-radius: 6px; }
.note-editor .note-btn:hover, .note-editor .note-btn.active { background: var(--imd-line); color: var(--imd-ink); }
.note-editor .note-editing-area .note-editable { background: #ffffff; color: #1a1a1a; }
.note-editor .note-statusbar { background: var(--imd-soft); border-top: 1px solid var(--imd-line); }
.note-editor .note-statusbar .note-resizebar .note-icon-bar { border-top-color: var(--imd-mute); }
.note-editor .dropdown-menu, .note-popover .popover-content { background: var(--imd-panel); }
.note-modal .modal-content { background: var(--imd-panel); }
.note-editor .note-codable { background: #1b1f23; color: #d6dde2; }
.note-editor .note-placeholder { color: #8a8f94; }

/* ---------- command palette (Ctrl K) ---------- */
.imd-pal-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(8, 10, 12, .5); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.imd-pal-overlay.open { display: flex; }
.imd-pal { width: min(560px, 92vw); background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: 16px; box-shadow: var(--imd-pop); overflow: hidden; color: var(--imd-ink); font-family: var(--imd-font); }
.imd-pal input { width: 100%; border: 0; border-bottom: 1px solid var(--imd-line); padding: 16px 18px; font: inherit; font-size: 15px; background: transparent; color: var(--imd-ink); outline: none; }
.imd-pal ul { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.imd-pal li a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--imd-ink) !important; text-decoration: none !important; font-weight: 500; }
.imd-pal li a i { width: 18px; text-align: center; color: var(--imd-mute); }
.imd-pal li a small { margin-left: auto; color: var(--imd-mute); font-weight: 400; }
.imd-pal li.on a { background: var(--imd-accent-soft); color: var(--imd-accent) !important; }
.imd-pal li.on a i { color: var(--imd-accent); }
.imd-pal .none { padding: 18px; color: var(--imd-mute); text-align: center; }
.imd-pal .hint { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--imd-line); font-size: 12px; color: var(--imd-mute); }

/* ---------- misc ---------- */
/* ---------- loading overlay: a small card with a ring, shown only if the wait is longer than a quarter second ---------- */
.modal-loader {
  background: rgba(244, 245, 247, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
html[data-theme="dark"] .modal-loader { background: rgba(8, 10, 12, .55); }
body.loader .modal-loader { animation: imd-fade-in .18s ease-out .25s both; }
.modal-loader::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: 20px; box-shadow: var(--imd-pop);
}
.modal-loader::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 3px solid var(--imd-line); border-top-color: var(--imd-accent); border-radius: 50%;
  animation: imd-spin .8s linear infinite;
}
@keyframes imd-spin { to { transform: rotate(360deg); } }
@keyframes imd-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal-loader::after { animation-duration: 2.4s; } body.loader .modal-loader { animation: none; } }
.elevation-3, .elevation-4 { box-shadow: none !important; }
.dropzone { background: var(--imd-soft); border: 2px dashed var(--imd-line); border-radius: var(--imd-radius-sm); color: var(--imd-mute); }
.login-form form { background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius); box-shadow: var(--imd-shadow); }
img.img-fluid.border { border-radius: var(--imd-radius-sm); }
@media (max-width: 991.98px) {
  .imd-cmd span { display: none; }
  .imd-cmd { min-width: 0; }
  .sidebar-mini.sidebar-collapse .content-wrapper, .sidebar-mini.sidebar-collapse .main-footer, .sidebar-mini.sidebar-collapse .main-header { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Dashboard ---------- */
.imd-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--imd-ink); }
.imd-sub { margin: 4px 0 0; color: var(--imd-mute); font-size: 14px; }
.imd-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.imd-kpi { position: relative; background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: var(--imd-radius); box-shadow: var(--imd-shadow); padding: 18px 20px; }
.imd-kpi-ico { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px; background: var(--imd-accent-soft); color: var(--imd-accent); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.imd-kpi-label { color: var(--imd-mute); font-size: 13px; font-weight: 500; padding-right: 44px; }
.imd-kpi-val { color: var(--imd-ink); font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.imd-kpi-note { color: var(--imd-mute); font-size: 13px; }
.imd-panel { padding: 18px 20px 14px; }
.imd-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.imd-panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--imd-ink); }
.imd-panel-head p { margin: 2px 0 0; font-size: 13px; color: var(--imd-mute); }
.imd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.imd-chip { background: var(--imd-soft); color: var(--imd-mute); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.imd-chip b { color: var(--imd-ink); font-weight: 600; }
.imd-chart { position: relative; height: 280px; }
.imd-meters { display: flex; flex-direction: column; gap: 20px; padding-top: 6px; }
.imd-meter-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--imd-mute); margin-bottom: 8px; }
.imd-meter-top b { color: var(--imd-ink); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.imd-bar { height: 8px; border-radius: 999px; background: var(--imd-soft); overflow: hidden; }
.imd-bar i { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: var(--imd-accent); }
@media (max-width: 991px) { .imd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .imd-kpis { grid-template-columns: 1fr; } }

/* ---------- Races list ---------- */
.imd-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.imd-head-actions { display: flex; align-items: center; gap: 8px; }
.dropdown-item i { width: 18px; margin-right: 8px; color: var(--imd-mute); text-align: center; }
.imd-racelist { padding: 0; overflow: hidden; }
.imd-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--imd-line); }
.imd-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.imd-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--imd-mute); font-size: 13px; }
.imd-search input { width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--imd-line); border-radius: 10px; background: var(--imd-panel); color: var(--imd-ink); font: inherit; font-size: 14px; outline: none; }
.imd-search input:focus { border-color: var(--imd-accent); box-shadow: 0 0 0 3px var(--imd-accent-soft); }
.imd-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--imd-soft); }
.imd-seg button { border: 0; background: transparent; color: var(--imd-mute); font: inherit; font-size: 13px; font-weight: 500; padding: 5px 14px; border-radius: 8px; cursor: pointer; }
.imd-seg button.on { background: var(--imd-panel); color: var(--imd-ink); box-shadow: var(--imd-shadow); }
#tableEmdRaces_wrapper .dt-buttons { display: none; }
#tableEmdRaces_wrapper .row { margin: 0; padding: 10px 16px; align-items: center; }
#tableEmdRaces_wrapper .dataTables_info { color: var(--imd-mute); font-size: 13px; padding: 0; }
.imd-table { margin: 0 !important; border: 0 !important; }
.imd-table thead th { border-top: 0; border-bottom: 1px solid var(--imd-line); padding: 10px 16px; }
.imd-table tbody td { padding: 14px 16px; vertical-align: middle; border-top: 1px solid var(--imd-line); }
.imd-table tbody tr:hover { background: var(--imd-hover); }
.imd-race-title { font-weight: 600; color: var(--imd-ink); line-height: 1.35; }
.imd-race-meta { display: flex; gap: 10px; margin-top: 2px; font-size: 12px; color: var(--imd-mute); }
.imd-race-meta span + span::before { content: "·"; margin-right: 10px; }
.imd-chip-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--imd-info-bg); color: var(--imd-info); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.imd-reg { min-width: 120px; }
.imd-reg-top { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--imd-mute); margin-bottom: 5px; }
.imd-reg-top b { color: var(--imd-ink); font-size: 14px; margin-right: 3px; }
.imd-reg .imd-bar { height: 6px; }
.imd-reg.full .imd-bar i { background: var(--imd-ok); }
.imd-range { font-size: 13px; color: var(--imd-ink); white-space: nowrap; }
.imd-range span { color: var(--imd-mute); margin: 0 6px; }
.imd-pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.imd-pill.ok { background: var(--imd-ok-bg); color: var(--imd-ok); }
.imd-pill.warn { background: var(--imd-warn-bg); color: var(--imd-warn); }
.imd-acts { display: inline-flex; align-items: center; gap: 6px; }
.imd-more { width: 28px; height: 28px; border: 1px solid var(--imd-line); border-radius: 8px; background: var(--imd-panel); color: var(--imd-mute); cursor: pointer; }
.imd-more:hover { color: var(--imd-ink); border-color: var(--imd-mute); }
@media (max-width: 767px) { .imd-search { max-width: none; } }
.imd-seg button:focus { outline: none; }
.imd-seg button:focus-visible { box-shadow: 0 0 0 3px var(--imd-accent-soft); }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before, table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before { background-color: var(--imd-accent); box-shadow: none; border: 0; height: 16px; width: 16px; line-height: 16px; top: 50%; margin-top: -8px; }
table.dataTable > tbody > tr.child ul.dtr-details { width: 100%; }
@media (max-width: 575px) { .imd-acts .btn-default { display: none; } }
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before, table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before { background-color: var(--imd-accent) !important; box-shadow: none !important; border: 0 !important; color: var(--imd-accent-ink); }

/* ---------- Race wizard ---------- */
fieldset.border { background: var(--imd-panel); padding: 20px 22px !important; margin-bottom: 18px; }
fieldset.border > legend, fieldset.border > legend.w-auto { float: left; width: 100% !important; padding: 0 !important; margin: 0 0 14px; font-size: 15px; font-weight: 600; letter-spacing: -.005em; border: 0; }
fieldset.border > legend + * { clear: both; }
.main-sidebar .brand-text:empty { display: none; }
html[data-theme="dark"] .main-sidebar .brand-link .brand-image { filter: brightness(1.7) saturate(1.1); }

/* ---------- logo ---------- */
.imd-logo { height: 18px; width: auto; display: block; }
.imd-logo-mark { display: none; height: 20px; width: auto; }
.imd-tag { margin-left: 2px; padding: 2px 7px; border-radius: 6px; background: var(--imd-soft); color: var(--imd-mute); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .imd-logo { display: none; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .imd-logo-mark { display: block; }
html[data-theme="dark"] .imd-logo, html[data-theme="dark"] .imd-logo-mark { filter: brightness(1.7) saturate(1.1); }
.brand-link .brand-image { height: 24px; width: auto; max-height: none; }

.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .imd-brand { justify-content: center; padding: 0 0 0 4px; margin-left: 0; margin-right: 0; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .user-panel .image { margin-left: -2px; }
.imd-brand { padding-left: 14px; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .imd-brand { padding: 0 0 0 4px; }

/* races list: wide tables scroll, phones get one card per race */
#tableEmdRaces_wrapper { overflow-x: auto; }
@media (max-width: 767px) {
  #tableEmdRaces, #tableEmdRaces tbody, #tableEmdRaces tr, #tableEmdRaces td { display: block; width: 100% !important; }
  #tableEmdRaces thead { display: none; }
  #tableEmdRaces tbody tr { position: relative; padding: 14px 16px 12px; border-top: 1px solid var(--imd-line); }
  #tableEmdRaces tbody td { padding: 4px 0 !important; border: 0 !important; text-align: left !important; }
  #tableEmdRaces td:nth-child(1) { padding-right: 76px !important; padding-bottom: 8px !important; }
  #tableEmdRaces td:nth-child(5) { position: absolute; top: 14px; right: 16px; width: auto !important; padding: 0 !important; }
  #tableEmdRaces td:nth-child(2), #tableEmdRaces td:nth-child(3), #tableEmdRaces td:nth-child(4) { display: flex; align-items: center; gap: 10px; }
  #tableEmdRaces td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; width: 108px; font-size: 11px; font-weight: 600; color: var(--imd-mute); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
  #tableEmdRaces td:nth-child(5)::before { display: none !important; }
  #tableEmdRaces td:nth-child(4) .imd-reg { flex: 1; }
  #tableEmdRaces td:nth-child(6) { margin-top: 6px; }
  #tableEmdRaces td:nth-child(6) .imd-acts { width: 100%; }
  #tableEmdRaces td:nth-child(6) .btn-primary { flex: 1; padding: 6px 0; }
  #tableEmdRaces .imd-acts .btn-default { display: inline-block; }
  .imd-range { white-space: normal; }
}
.imd-acts .btn-primary { min-width: 68px; height: 32px; padding: 0 18px; font-size: 13px; font-weight: 600; }
.imd-acts .imd-more { width: 32px; height: 32px; }

/* template list */
.imd-tpl-desc { margin-top: 2px; max-width: 520px; font-size: 13px; color: var(--imd-mute); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.imd-acts .btn-default.btn-xs { height: 32px; padding: 0 14px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; }
.imd-acts a.btn-primary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#tableRaceTemplate_wrapper { overflow-x: auto; }
#tableRaceTemplate_wrapper .row { margin: 0; padding: 10px 16px; align-items: center; }
@media (max-width: 767px) {
  #tableRaceTemplate, #tableRaceTemplate tbody, #tableRaceTemplate tr, #tableRaceTemplate td { display: block; width: 100% !important; }
  #tableRaceTemplate thead { display: none; }
  #tableRaceTemplate tbody tr { position: relative; padding: 14px 16px 12px; border-top: 1px solid var(--imd-line); }
  #tableRaceTemplate tbody td { padding: 4px 0 !important; border: 0 !important; text-align: left !important; }
  #tableRaceTemplate td:nth-child(1) { padding-right: 80px !important; padding-bottom: 8px !important; }
  #tableRaceTemplate td:nth-child(3) { position: absolute; top: 14px; right: 16px; width: auto !important; padding: 0 !important; }
  #tableRaceTemplate td:nth-child(2), #tableRaceTemplate td:nth-child(4) { display: flex; gap: 10px; align-items: center; }
  #tableRaceTemplate td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; width: 108px; font-size: 11px; font-weight: 600; color: var(--imd-mute); text-transform: uppercase; letter-spacing: .02em; }
  #tableRaceTemplate td:nth-child(3)::before { display: none !important; }
  #tableRaceTemplate td:nth-child(5) { margin-top: 6px; }
  #tableRaceTemplate td:nth-child(5) .imd-acts { width: 100%; }
  #tableRaceTemplate td:nth-child(5) .imd-acts .btn { flex: 1; }
}

/* push notification list */
.imd-pill.info { background: var(--imd-info-bg); color: var(--imd-info); }
.imd-perf { display: flex; gap: 18px; white-space: nowrap; }
.imd-perf div { display: flex; flex-direction: column; line-height: 1.25; }
.imd-perf b { font-size: 14px; font-weight: 600; color: var(--imd-ink); font-variant-numeric: tabular-nums; }
.imd-perf span { font-size: 11px; color: var(--imd-mute); }
.imd-perf .rate b { color: var(--imd-accent); }
#tableData_wrapper { overflow-x: auto; }
#tableData_wrapper .row { margin: 0; padding: 10px 16px; align-items: center; }
#tableData { width: 100% !important; }
@media (max-width: 767px) {
  .imd-notif-list #tableData, .imd-notif-list #tableData tbody, .imd-notif-list #tableData tr, .imd-notif-list #tableData td { display: block; width: 100% !important; }
  .imd-notif-list #tableData thead { display: none; }
  .imd-notif-list #tableData tbody tr { position: relative; padding: 14px 16px 12px; border-top: 1px solid var(--imd-line); }
  .imd-notif-list #tableData tbody td { padding: 4px 0 !important; border: 0 !important; text-align: left !important; }
  .imd-notif-list #tableData td:nth-child(1) { padding-right: 112px !important; padding-bottom: 8px !important; }
  .imd-notif-list #tableData td:nth-child(3) { position: absolute; top: 14px; right: 16px; width: auto !important; padding: 0 !important; text-align: right !important; }
  .imd-notif-list #tableData td:nth-child(2), .imd-notif-list #tableData td:nth-child(4), .imd-notif-list #tableData td:nth-child(5) { display: flex; gap: 10px; align-items: center; }
  .imd-notif-list #tableData td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; width: 96px; font-size: 11px; font-weight: 600; color: var(--imd-mute); text-transform: uppercase; letter-spacing: .02em; }
  .imd-notif-list #tableData td:nth-child(3)::before { display: none !important; }
  .imd-notif-list #tableData td:nth-child(2) > div:first-child { flex: none; }
  .imd-notif-list #tableData td:nth-child(6) { margin-top: 6px; }
  .imd-notif-list #tableData td:nth-child(6) .imd-acts { width: 100%; }
  .imd-notif-list #tableData td:nth-child(6) .imd-acts .btn { flex: 1; }
  .imd-perf { gap: 12px; flex-wrap: wrap; white-space: normal; }
}
.imd-acts .btn { white-space: nowrap; }

.imd-racelist .dataTables_wrapper { overflow-x: auto; }
.imd-racelist .dataTables_wrapper > .row { margin: 0; padding: 10px 16px; align-items: center; }
.imd-racelist .dataTables_filter input { margin-left: 8px; }
.btn.imd-danger-text, .btn.imd-danger-text i { color: var(--imd-bad) !important; }
.btn.imd-danger-text:hover { background: var(--imd-bad-bg); border-color: var(--imd-bad); }

/* email list */
.imd-email-list .imd-perf { gap: 16px; }
#tableEmails_wrapper, #tableLists_wrapper, #tableContacts_wrapper { overflow-x: auto; }
@media (max-width: 767px) {
  .imd-email-list #tableEmails, .imd-email-list #tableEmails tbody, .imd-email-list #tableEmails tr, .imd-email-list #tableEmails td { display: block; width: 100% !important; }
  .imd-email-list #tableEmails thead { display: none; }
  .imd-email-list #tableEmails tbody tr { position: relative; padding: 14px 16px 12px; border-top: 1px solid var(--imd-line); }
  .imd-email-list #tableEmails tbody td { padding: 4px 0 !important; border: 0 !important; text-align: left !important; }
  .imd-email-list #tableEmails td:nth-child(1) { padding-right: 100px !important; padding-bottom: 8px !important; }
  .imd-email-list #tableEmails td:nth-child(2) { position: absolute; top: 14px; right: 16px; width: auto !important; padding: 0 !important; }
  .imd-email-list #tableEmails td:nth-child(3), .imd-email-list #tableEmails td:nth-child(4), .imd-email-list #tableEmails td:nth-child(5) { display: flex; gap: 10px; align-items: center; }
  .imd-email-list #tableEmails td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; width: 96px; font-size: 11px; font-weight: 600; color: var(--imd-mute); text-transform: uppercase; letter-spacing: .02em; }
  .imd-email-list #tableEmails td:nth-child(2)::before { display: none !important; }
  .imd-email-list #tableEmails td:nth-child(5) .imd-perf { flex-wrap: wrap; gap: 10px 14px; white-space: normal; }
  .imd-email-list #tableEmails td:nth-child(6) { margin-top: 6px; }
  .imd-email-list #tableEmails td:nth-child(6) .imd-acts { width: 100%; }
  .imd-email-list #tableEmails td:nth-child(6) .imd-acts .btn { flex: 1; }
}

/* analytics pages */
.imd-panel-body { padding: 0; }
.imd-panel-head .badge { vertical-align: 2px; }
.imd-panel-head span.text-muted.small { display: block; width: 100%; margin-top: 2px; }
.imd-head-actions .form-control-sm { height: 32px; }
.imd-head-actions .btn { white-space: nowrap; }

/* the logo is the menu toggle on desktop; the hamburger stays for phones/tablets */
.imd-brand { cursor: pointer; }
@media (min-width: 992px) { body.imd-logo-toggle .main-header .navbar-nav [data-widget="pushmenu"] { display: none; } }

/* account chip (top right) */
.main-sidebar .user-panel { display: none !important; }
.imd-user { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 1px solid var(--imd-line); border-radius: 999px; background: var(--imd-panel); color: var(--imd-ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.imd-user:hover { border-color: var(--imd-mute); }
.imd-user .imd-avatar { width: 28px; height: 28px; font-size: 13px; }
.imd-user-caret { font-size: 10px; color: var(--imd-mute); }
.imd-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 575px) { .imd-user-name, .imd-user-caret { display: none; } .imd-user { padding: 0 4px; } }
.imd-user:focus, .imd-iconbtn:focus { outline: none; }
.imd-user:focus-visible, .imd-iconbtn:focus-visible { box-shadow: 0 0 0 3px var(--imd-accent-soft); border-color: var(--imd-accent); }

/* ---------- login ---------- */
body.imd-login-body { display: block; min-height: 100vh; background: var(--imd-bg); }
.imd-login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; font-family: var(--imd-font); background:
  radial-gradient(900px 420px at 15% -10%, var(--imd-accent-soft), transparent 60%),
  radial-gradient(700px 380px at 100% 110%, var(--imd-accent-soft), transparent 60%), var(--imd-bg); }
.imd-login-card { width: min(420px, 100%); background: var(--imd-panel); border: 1px solid var(--imd-line); border-radius: 20px; box-shadow: var(--imd-pop); padding: 40px 36px 28px; text-align: center; }
.imd-login-logo { height: 30px; width: auto; margin-bottom: 32px; }
html[data-theme="dark"] .imd-login-logo { filter: brightness(1.7) saturate(1.1); }
.imd-login-title { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--imd-ink); }
.imd-login-sub { margin: 0 0 28px; font-size: 14px; line-height: 1.5; color: var(--imd-mute); }
.imd-google { display: flex; align-items: center; justify-content: center; gap: 12px; height: 48px; border: 1px solid var(--imd-line); border-radius: 12px; background: var(--imd-panel); color: var(--imd-ink) !important; font-size: 15px; font-weight: 600; text-decoration: none !important; box-shadow: var(--imd-shadow); transition: border-color .15s, box-shadow .15s, transform .05s; }
.imd-google:hover { border-color: var(--imd-mute); box-shadow: 0 2px 8px rgba(16, 24, 40, .12); }
.imd-google:active { transform: translateY(1px); }
.imd-google:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--imd-accent-soft); border-color: var(--imd-accent); }
.imd-login-note { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--imd-line); font-size: 12.5px; color: var(--imd-mute); }
.imd-login-note i { margin-right: 6px; }
.imd-login-foot { margin: 20px 0 0; font-size: 12.5px; color: var(--imd-mute); }
.imd-login-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }

/* any leftover full-page preloader: same ring as the ajax loader, no broken GIF */
.preloader { background: var(--imd-bg); }
.preloader .loading img, .preloader .loading p { display: none; }
.preloader .loading { width: 30px; height: 30px; border: 3px solid var(--imd-line); border-top-color: var(--imd-accent); border-radius: 50%; animation: imd-spin .8s linear infinite; font-size: 0; }

/* ---------- shared list/page headers (older pages keep their markup) ---------- */
.content-wrapper .card.card-primary.card-outline > .card-header[style*="font-size"] { font-size: 20px !important; font-weight: 700; letter-spacing: -.01em; color: var(--imd-ink); padding: 18px 20px; border-bottom: 1px solid var(--imd-line); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.content-wrapper .card.card-primary.card-outline > .card-header[style*="font-size"] .float-right { float: none !important; margin: 0 !important; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.content-wrapper .card.card-primary.card-outline > .card-header[style*="font-size"] .float-right:first-of-type { margin-left: auto !important; }
.content-wrapper .card.card-primary.card-outline > .card-header[style*="font-size"] a > .btn { margin: 0 !important; }
.content-wrapper .card > .card-body > .imd-table { margin-top: 12px !important; }
.content-wrapper .card > .card-body .dataTables_wrapper > .row:first-child { padding: 0 0 10px; }
.content-wrapper .card > .card-body .dataTables_wrapper > .row:last-child { padding-top: 10px; align-items: center; }
.content-wrapper .card > .card-body .dataTables_wrapper { overflow-x: auto; }

/* ---------- stat boxes become quiet KPI cards (no loud colour blocks) ---------- */
.small-box, .small-box[class*="bg-"] { background: var(--imd-panel) !important; border: 1px solid var(--imd-line); border-left: 4px solid var(--imd-mute); box-shadow: var(--imd-shadow); }
.small-box[class*="bg-"] .inner h3, .small-box[class*="bg-"] .inner p, .small-box[class*="bg-"] .small-box-footer, .small-box[class*="bg-"] .icon > i { color: var(--imd-ink) !important; }
.small-box .inner p { color: var(--imd-mute) !important; font-size: 13px; }
.small-box .inner h3 { font-weight: 700; letter-spacing: -.02em; }
.small-box .icon > i { opacity: .12; }
.small-box .small-box-footer { background: transparent !important; color: var(--imd-mute) !important; }
.small-box.bg-info { border-left-color: var(--imd-info); }
.small-box.bg-success { border-left-color: var(--imd-ok); }
.small-box.bg-danger, .small-box.bg-primary { border-left-color: var(--imd-accent); }
.small-box.bg-warning { border-left-color: var(--imd-warn); }

/* destructive actions read differently from primary ones */
.btn-danger { background: var(--imd-bad-bg) !important; border-color: transparent !important; color: var(--imd-bad) !important; }
.btn-danger:hover, .btn-danger:focus { background: var(--imd-bad) !important; color: #fff !important; }
html[data-theme="dark"] .btn-danger:hover, html[data-theme="dark"] .btn-danger:focus { color: #1c0a09 !important; }

/* bare controls on older pages (date pickers, plain Filter/Export buttons) */
.content-wrapper input[type="date"]:not(.form-control), .content-wrapper input[type="month"]:not(.form-control) { height: 34px; padding: 0 10px; border: 1px solid var(--imd-line); border-radius: 10px; background: var(--imd-panel); color: var(--imd-ink); font: inherit; font-size: 14px; }
.content-wrapper :not(.imd-seg) > button:not([class]) { height: 34px; padding: 0 14px; border: 1px solid var(--imd-line); border-radius: 10px; background: var(--imd-panel); color: var(--imd-ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.content-wrapper :not(.imd-seg) > button:not([class]):hover { border-color: var(--imd-mute); }
.imd-pill.muted { background: var(--imd-soft); color: var(--imd-mute); }
.imd-pill-meta { flex-direction: column; gap: 0; margin-top: 4px; }
.imd-pill-meta span + span::before { content: none; margin: 0; }

/* pop up list */
#tableData_wrapper .imd-popup-list { overflow: visible; }
@media (max-width: 767px) {
  .imd-popup-list #tableData, .imd-popup-list #tableData tbody, .imd-popup-list #tableData tr, .imd-popup-list #tableData td { display: block; width: 100% !important; }
  .imd-popup-list #tableData thead { display: none; }
  .imd-popup-list #tableData tbody tr { position: relative; padding: 14px 16px 12px; border-top: 1px solid var(--imd-line); }
  .imd-popup-list #tableData tbody td { padding: 4px 0 !important; border: 0 !important; text-align: left !important; }
  .imd-popup-list #tableData td:nth-child(1) { padding-right: 100px !important; padding-bottom: 8px !important; }
  .imd-popup-list #tableData td:nth-child(2) { position: absolute; top: 14px; right: 16px; width: auto !important; padding: 0 !important; text-align: right !important; }
  .imd-popup-list #tableData td:nth-child(3) { margin-top: 6px; }
  .imd-popup-list #tableData td:nth-child(3) .imd-acts { width: 100%; }
  .imd-popup-list #tableData td:nth-child(3) .imd-acts .btn { flex: 1; }
}
.imd-popup-cell { display: flex; align-items: flex-start; gap: 14px; }
.imd-popup-thumb { flex: none; width: 56px; height: 56px; padding: 0; border: 1px solid var(--imd-line); border-radius: 10px; background: var(--imd-soft); overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--imd-mute); }
.imd-popup-thumb.empty { cursor: default; }
.imd-popup-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imd-popup-thumb:hover:not(.empty) { border-color: var(--imd-accent); }
.imd-popup-thumb:focus { outline: none; }
.imd-popup-thumb:focus-visible { box-shadow: 0 0 0 3px var(--imd-accent-soft); border-color: var(--imd-accent); }
.imd-popup-dest { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--imd-mute); max-width: 420px; }
.imd-popup-dest i { flex: none; font-size: 11px; }
.imd-popup-dest a, .imd-popup-dest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--imd-mute); }
.imd-popup-dest a:hover { color: var(--imd-accent); text-decoration: underline; }

/* phones: status sits in the card body (labelled), not floating over the title */
@media (max-width: 767px) {
  .imd-notif-list #tableData td:nth-child(1), .imd-popup-list #tableData td:nth-child(1) { padding-right: 0 !important; }
  .imd-notif-list #tableData td:nth-child(3), .imd-popup-list #tableData td:nth-child(2) { position: static !important; display: flex; gap: 10px; align-items: center; width: 100% !important; padding: 4px 0 !important; text-align: left !important; }
  .imd-notif-list #tableData td:nth-child(3)::before, .imd-popup-list #tableData td:nth-child(2)::before { display: block !important; }
  .imd-popup-list #tableData td:nth-child(2) .imd-pill-meta { margin-top: 0; }
}

/* notification list: fit the viewport, long text wraps or is cut with an ellipsis */
@media (min-width: 768px) {
  .imd-notif-list #tableData { table-layout: fixed; }
  .imd-notif-list #tableData th:nth-child(1) { width: 31% !important; }
  .imd-notif-list #tableData th:nth-child(2) { width: 13% !important; }
  .imd-notif-list #tableData th:nth-child(3) { width: 10% !important; }
  .imd-notif-list #tableData th:nth-child(4) { width: 18% !important; }
  .imd-notif-list #tableData th:nth-child(5) { width: 12% !important; }
  .imd-notif-list #tableData th:nth-child(6) { width: 16% !important; }
  .imd-notif-list #tableData td { overflow-wrap: break-word; }
  .imd-notif-list td:first-child .imd-race-meta span { white-space: nowrap; }
  .imd-notif-list td:nth-child(5) .imd-race-meta { flex-wrap: wrap; }
  .imd-notif-list td:nth-child(5) .imd-race-meta span { white-space: normal; overflow-wrap: anywhere; }
  .imd-notif-list .imd-perf { gap: 12px; }
}
.imd-popup-cell > .imd-race { min-width: 0; flex: 1; }
.imd-popup-dest { max-width: 100%; }

/* races list: timeline view */
.imd-tl-head { position: relative; height: 16px; margin-top: 6px; text-transform: none; font-weight: 500; letter-spacing: 0; }
.imd-tl-head span { position: absolute; top: 0; font-size: 11px; color: var(--imd-mute); transform: translateX(2px); border-left: 1px solid var(--imd-line); padding-left: 4px; height: 16px; line-height: 16px; }
.imd-tl { position: relative; height: 34px; margin: 0; }
.imd-tl-row { position: relative; height: 14px; margin-bottom: 4px; }
.imd-tl-bar { position: absolute; top: 2px; height: 10px; border-radius: 999px; display: block; min-width: 4px; }
.imd-tl-bar.reg { background: var(--imd-info); opacity: .75; }
.imd-tl-bar.act { background: var(--imd-accent); }
.imd-tl-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.imd-tl-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.imd-tl-today { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px dashed var(--imd-ink); opacity: .55; }
.imd-tl-note { font-size: 12.5px; color: var(--imd-mute); }
.imd-tl-legend { display: inline-flex; gap: 14px; font-size: 12px; color: var(--imd-mute); align-items: center; }
.imd-tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.imd-tl-legend i { display: inline-block; width: 18px; height: 8px; border-radius: 999px; }
.imd-tl-legend i.reg { background: var(--imd-info); opacity: .75; }
.imd-tl-legend i.act { background: var(--imd-accent); }
.imd-tl-legend i.today { width: 0; height: 12px; border-radius: 0; border-left: 2px dashed var(--imd-ink); opacity: .55; }
#tableEmdRaces.imd-tl-on td.imd-tl-col { min-width: 420px; padding-left: 10px; padding-right: 22px; }
#tableEmdRaces.imd-tl-on th.imd-tl-col { min-width: 420px; padding-right: 22px; }

/* audit trail */
.imd-select { width: auto; min-width: 150px; height: 36px; border-radius: 10px; }
.imd-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: var(--imd-mute); cursor: pointer; }
.imd-audit-res { margin-left: 4px; color: var(--imd-ink); }
.imd-audit-act { color: var(--imd-mute); }
.imd-audit-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--imd-line); font-size: 13px; color: var(--imd-mute); }
.audit-detail > td { background: var(--imd-soft); padding: 12px 16px !important; }
.imd-audit-meta { font-size: 12px; color: var(--imd-mute); margin-bottom: 6px; }
.imd-audit-pre { margin: 0; max-height: 280px; overflow: auto; padding: 12px; border-radius: 10px; background: var(--imd-panel); border: 1px solid var(--imd-line); color: var(--imd-ink); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.imd-empty { padding: 56px 20px; text-align: center; color: var(--imd-mute); }
.imd-empty i { font-size: 28px; margin-bottom: 12px; }
.imd-empty h3 { margin: 0 0 6px; font-size: 18px; color: var(--imd-ink); }
.imd-empty p { margin: 0; }
.imd-pill.bad { background: var(--imd-bad-bg); color: var(--imd-bad); }
@media (max-width: 767px) {
  .imd-audit #auditTable, .imd-audit #auditTable tbody, .imd-audit #auditTable tr, .imd-audit #auditTable td { display: block; width: 100% !important; }
  .imd-audit #auditTable thead { display: none; }
  .imd-audit #auditTable tbody tr { padding: 12px 16px; border-top: 1px solid var(--imd-line); }
  .imd-audit #auditTable tbody td { padding: 3px 0 !important; border: 0 !important; text-align: left !important; display: flex; gap: 10px; align-items: baseline; }
  .imd-audit #auditTable td[data-label]:not([data-label=""])::before { content: attr(data-label); flex: none; width: 64px; font-size: 11px; font-weight: 600; color: var(--imd-mute); text-transform: uppercase; }
  .imd-audit .audit-detail td { display: block; }
}
