/* ==========================================================================
   Admin UI (mobile first). Replaces the old AdminBSB look. The page markup is unchanged: this file restyles the Bootstrap 3 / AdminBSB class
   names the pages already use (card, header, body, btn bg-*, form-line, table, switch ...) and adds the new frame (appbar, drawer, tabbar).
   Light and dark themes (follows the device; the button in the app bar overrides it).
   ========================================================================== */

:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --line: #dfe7e4;
  --line-strong: #c7d3cf;
  --text: #17211e;
  --muted: #5d6e68;
  --primary: #0f766e;
  --primary-strong: #0b5d56;
  --primary-soft: #dcf1ee;
  --on-primary: #ffffff;
  --gold: #b7892b;
  --blue: #2563eb;
  --teal: #0e8a9a;
  --indigo: #4f46e5;
  --green: #16a34a;
  --amber: #d97706;
  --orange: #ea7a12;
  --red: #dc2626;
  --grey: #64748b;
  --warn-bg: #fff4dc;
  --warn-fg: #7a4a00;
  --danger-bg: #fde8e8;
  --danger-fg: #8a1c1c;
  --ok-bg: #def5e5;
  --ok-fg: #14532d;
  --shadow: 0 1px 2px rgba(16, 24, 21, .06), 0 4px 14px rgba(16, 24, 21, .05);
  --shadow-lg: 0 10px 40px rgba(16, 24, 21, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --sidebar-w: 276px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1412;
    --surface: #141e1b;
    --surface-2: #1a2623;
    --line: #25332f;
    --line-strong: #33453f;
    --text: #e5eeeb;
    --muted: #93a7a0;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-soft: #12332f;
    --on-primary: #04211d;
    --gold: #e0b252;
    --blue: #60a5fa;
    --teal: #22d3ee;
    --indigo: #a5b4fc;
    --green: #4ade80;
    --amber: #fbbf24;
    --orange: #fb923c;
    --red: #f87171;
    --grey: #94a3b8;
    --warn-bg: #3a2c0e;
    --warn-fg: #fde3a1;
    --danger-bg: #3d1717;
    --danger-fg: #fecaca;
    --ok-bg: #12301d;
    --ok-fg: #bbf7d0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1412;
  --surface: #141e1b;
  --surface-2: #1a2623;
  --line: #25332f;
  --line-strong: #33453f;
  --text: #e5eeeb;
  --muted: #93a7a0;
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --primary-soft: #12332f;
  --on-primary: #04211d;
  --gold: #e0b252;
  --blue: #60a5fa;
  --teal: #22d3ee;
  --indigo: #a5b4fc;
  --green: #4ade80;
  --amber: #fbbf24;
  --orange: #fb923c;
  --red: #f87171;
  --grey: #94a3b8;
  --warn-bg: #3a2c0e;
  --warn-fg: #fde3a1;
  --danger-bg: #3d1717;
  --danger-fg: #fecaca;
  --ok-bg: #12301d;
  --ok-fg: #bbf7d0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }      /* the login page does not load bootstrap.css, which used to set this */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  padding-top: calc(var(--appbar-h) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover, a:focus { color: var(--primary-strong); text-decoration: none; }
h1, h2, h3, h4 { color: var(--text); font-family: var(--font); }
small, .small { color: var(--muted); }
code { word-break: break-word; background: var(--surface-2); color: var(--primary-strong); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 90%; }
hr { border-color: var(--line); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px; z-index: 3000; }
.skip:focus { left: 8px; }
.material-icons { vertical-align: middle; user-select: none; }
[hidden] { display: none !important; }

/* ---------- app bar ---------- */
.appbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1030;
  height: calc(var(--appbar-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  display: flex; align-items: center; gap: 4px; padding-inline: 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; margin-right: auto; padding: 4px 6px; }
.appbar-brand b { font-weight: 700; letter-spacing: .1px; }
.appbar-title { display: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--primary), #0b4f49); flex: none; }
.brand-mark .material-icons { font-size: 20px; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .material-icons { font-size: 24px; }
.menu-btn { order: -1; }

/* ---------- drawer / sidebar ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 12, .5); z-index: 1040; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; z-index: 1050; top: 0; bottom: 0; left: 0; width: min(86vw, 330px);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease; visibility: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}
.drawer-open .drawer { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
.drawer-open body { overflow: hidden; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; min-height: var(--appbar-h); }
.drawer .brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 16px; }
.brand-text small { font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; overscroll-behavior: contain; }
.nav-section { margin-bottom: 8px; }
.nav-title { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 46px; padding: 9px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-link .material-icons { font-size: 22px; color: var(--muted); }
.nav-link span { flex: 1; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.nav-link.is-active .material-icons { color: var(--primary); }
.nav-group-toggle .material-icons:last-child { transition: transform .2s; }
.nav-group.is-open .nav-group-toggle .material-icons:last-child { transform: rotate(180deg); }
.nav-sub { display: none; margin: 2px 0 6px 22px; padding-left: 10px; border-left: 2px solid var(--line); }
.nav-group.is-open .nav-sub { display: block; }
.nav-sub .nav-link { min-height: 40px; font-weight: 400; }
.nav-sub .nav-link .material-icons { font-size: 19px; }
.drawer-foot { padding: 10px 14px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 12px; padding: 6px 2px 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 12px; }
.logout { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); color: var(--red); font-weight: 600; }
.logout:hover { background: var(--danger-bg); color: var(--red); }
.legal { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- bottom bar (phones) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 1030; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font: 500 11px/1 var(--font); cursor: pointer; }
.tab .material-icons { font-size: 24px; width: 56px; height: 30px; line-height: 30px; border-radius: 16px; text-align: center; transition: background .15s; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary-strong); font-weight: 700; }
.tab.is-active .material-icons { background: var(--primary-soft); color: var(--primary); }

/* ---------- content ---------- */
main.content { padding: 16px 14px 28px; max-width: 1240px; margin-inline: auto; }
main.content > .container-fluid { padding: 0; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 16px; }
.page-head .back { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); flex: none; }
.page-head .back:hover { background: var(--surface-2); }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.2px; }
.trail { display: flex; flex-wrap: wrap; gap: 2px 6px; list-style: none; margin: 2px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.trail li + li::before { content: "›"; margin-right: 6px; opacity: .7; }
.trail a { color: var(--muted); }
.trail a:hover { color: var(--primary); }
.row { margin-left: -7px; margin-right: -7px; }
.row > [class*="col-"] { padding-left: 7px; padding-right: 7px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: visible; }
.card > .header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: transparent;
}
.card > .header h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--text); }
.card > .header h2 small { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; line-height: 1.5; color: var(--muted); }
.card > .header .pull-right { float: none !important; margin: 0 !important; }
.card > .header .btn-block { width: auto; display: inline-flex; }
.card > .body { padding: 16px 18px 18px; color: var(--text); overflow-wrap: anywhere; }
.card-inside-title { font-size: 14px; font-weight: 700; margin: 18px 0 8px; }
.pull-right { float: right; }
.clearfix::after { content: ""; display: table; clear: both; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font: 600 14px/1.2 var(--font); text-transform: none; letter-spacing: .1px; box-shadow: none; white-space: nowrap;
  background: var(--surface-2); color: var(--text); transition: filter .12s, background .12s, transform .05s;
}
.btn:hover, .btn:focus { filter: brightness(.96); color: inherit; }
.btn:active { transform: translateY(1px); }
.btn.btn-lg { min-height: 44px; padding: 9px 20px; font-size: 14px; border-radius: var(--radius-sm); }
.btn.btn-sm, .btn.btn-xs { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn.btn-block { display: flex; width: 100%; }
.btn .material-icons { font-size: 19px; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn.btn-primary, .btn.bg-blue { background: var(--primary); color: var(--on-primary); }
.btn.btn-default { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.btn-default:hover { background: var(--surface-2); filter: none; }
.btn.bg-orange, .btn.bg-amber { background: var(--amber); color: #1f1300; }
.btn.bg-red { background: var(--red); color: #fff; }
.btn.bg-teal { background: var(--teal); color: #fff; }
.btn.bg-green { background: var(--green); color: #fff; }
.btn.bg-indigo { background: var(--indigo); color: #fff; }
.btn.bg-grey, .btn.bg-blue-grey { background: var(--grey); color: #fff; }
:root[data-theme="dark"] .btn.bg-teal, :root[data-theme="dark"] .btn.bg-green, :root[data-theme="dark"] .btn.bg-indigo, :root[data-theme="dark"] .btn.bg-red, :root[data-theme="dark"] .btn.bg-grey { color: #04110f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.bg-teal, :root:not([data-theme="light"]) .btn.bg-green, :root:not([data-theme="light"]) .btn.bg-indigo, :root:not([data-theme="light"]) .btn.bg-red, :root:not([data-theme="light"]) .btn.bg-grey { color: #04110f; }
}
a > .btn { pointer-events: none; }      /* the anchor around the button does the navigating */
.waves-effect { position: relative; }

/* ---------- forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group > label, .form-label, label.control-label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.form-group > label + br { display: none; }
.form-group > label small, .form-group > label .col-grey { font-weight: 400; }
.form-line {
  position: relative; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-line:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); background: var(--surface); }
.form-line.disabled, .form-line:has(input[readonly], input[disabled]) { opacity: .75; }
.form-control {
  display: block; width: 100%; height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: 400 16px/1.4 var(--font); box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); background: var(--surface); outline: 0; }
.form-line .form-control { border: 0; background: transparent; box-shadow: none; border-radius: var(--radius-sm); }
.form-line .form-control:focus { box-shadow: none; background: transparent; }
textarea.form-control { height: auto; min-height: 96px; resize: vertical; }
textarea.no-resize { resize: none; }
select.form-control { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2393a7a0' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.form-control::placeholder { color: var(--muted); opacity: .75; }
input[type="file"].form-control { height: auto; padding: 10px; }
.help-block, .form-group .help-block { color: var(--muted); font-size: 13px; margin: 6px 2px 0; }
label.error, .has-error .help-block { color: var(--red); font-size: 13px; }
.input-group { display: flex; width: 100%; }
.input-group > .form-line { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group-addon { display: flex; flex: none; width: auto !important; align-items: stretch; border: 0; background: transparent; padding: 0 !important; }
.input-group-addon .btn { margin: 0 !important; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-height: 46px; }
.form-group > small, .form-group .col-grey { color: var(--muted); }
.m-t-15 { margin-top: 18px; }
.m-b-15 { margin-bottom: 15px; }
.m-l-10 { margin-left: 10px; }
.p-t-10 { padding-top: 10px; }
.p-r-35 { padding-right: 35px; }

/* radio ("with-gap") + checkbox */
input[type="radio"].with-gap, input[type="checkbox"].filled-in { position: absolute; opacity: 0; width: 1px; height: 1px; }
input[type="radio"].with-gap + label, input[type="checkbox"].filled-in + label {
  position: relative; display: inline-block; min-height: 28px; padding-left: 32px; margin: 0 18px 8px 0; cursor: pointer; line-height: 28px; font-weight: 400; color: var(--text);
}
input[type="radio"].with-gap + label::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); transition: .15s;
}
input[type="radio"].with-gap + label::after {
  content: ""; position: absolute; left: 6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); transform: scale(0); transition: transform .15s;
}
input[type="radio"].with-gap:checked + label::before { border-color: var(--primary); }
input[type="radio"].with-gap:checked + label::after { transform: scale(1); }
input[type="radio"].with-gap:focus-visible + label::before { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }
input[type="checkbox"].filled-in + label::before { content: ""; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-strong); background: var(--surface); }
input[type="checkbox"].filled-in:checked + label::before { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"].filled-in:checked + label::after { content: "✓"; position: absolute; left: 5px; top: 1px; color: var(--on-primary); font-weight: 700; font-size: 15px; }
.form-check { padding-left: 0; }

/* switch ("lever") */
.switch label { display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; font-weight: 500; color: var(--text); }
.switch label input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .lever { position: relative; display: inline-block; flex: none; width: 48px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background .18s; margin: 0; }
.switch .lever::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .18s; }
.switch input:checked + .lever { background: var(--primary); }
.switch input:checked + .lever::after { transform: translateX(20px); }
.switch input:focus-visible + .lever { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }
.switch input[disabled] + .lever { opacity: .5; }

/* select2 */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple {
  min-height: 46px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 44px; padding-left: 14px; color: var(--text); font-size: 16px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 44px; right: 8px; }
.select2-container--default.select2-container--focus .select2-selection--single, .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--primary); }
.select2-dropdown { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); overflow: hidden; }
.select2-search--dropdown .select2-search__field { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 16px; padding: 8px; }
.select2-container--default .select2-results__option--highlighted[aria-selected], .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--primary); color: var(--on-primary); }
.select2-container--default .select2-results__option[aria-selected=true] { background: var(--primary-soft); color: var(--primary-strong); }
.select2-results__option { padding: 11px 14px; }

/* datepicker */
.datepicker.dropdown-menu { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; }
.datepicker table tr td, .datepicker table tr th { width: 40px; height: 38px; border-radius: 10px; }
.datepicker table tr td.active, .datepicker table tr td.active:hover, .datepicker table tr td.active.active { background: var(--primary) !important; color: var(--on-primary) !important; text-shadow: none; }
.datepicker table tr td.today { background: var(--primary-soft) !important; color: var(--primary-strong) !important; }
.datepicker table tr td.day:hover, .datepicker table tr th:hover { background: var(--surface-2) !important; }
.datepicker table tr td.old, .datepicker table tr td.new { color: var(--muted); }

/* floating labels (markup: .form-float > .form-line > input + label.form-label); ui.js adds .focused when the field has focus or a value */
.form-float .form-line { padding-top: 0; }
.form-float .form-line .form-control { height: 58px; padding-top: 22px; padding-bottom: 6px; }
.form-float .form-line textarea.form-control { height: auto; min-height: 90px; }
.form-float .form-line .form-label {
  position: absolute; left: 14px; top: 17px; margin: 0; font-size: 16px; font-weight: 400; color: var(--muted); pointer-events: none; transition: top .15s, font-size .15s, color .15s;
}
.form-float .form-line.focused .form-label { top: 7px; font-size: 12px; font-weight: 600; color: var(--primary); }

/* ---------- alerts / labels ---------- */
.card > .alert.alert-warning { display: none; }      /* the form script slides it in when there is something to say */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 18px 4px; font-size: 14px; }
.alert.bg-orange, .alert-warning { background: var(--warn-bg); color: var(--warn-fg); border-color: color-mix(in srgb, var(--warn-fg) 25%, transparent); }
.alert.alert-danger { background: var(--danger-bg); color: var(--danger-fg); border-color: color-mix(in srgb, var(--danger-fg) 25%, transparent); }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); }
.alert .close { color: inherit; opacity: .6; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.label, .badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.4; color: #fff; background: var(--grey); text-shadow: none; vertical-align: middle;
}
.label.bg-green, .badge.bg-green { background: var(--green); }
.label.bg-teal, .badge.bg-teal { background: var(--teal); }
.label.bg-blue, .badge.bg-blue { background: var(--blue); }
.label.bg-orange, .badge.bg-orange { background: var(--orange); }
.label.bg-red, .badge.bg-red { background: var(--red); }
.label.bg-grey, .badge.bg-grey { background: var(--grey); }
.label.bg-indigo, .badge.bg-indigo { background: var(--indigo); }
.col-grey, .grey-text { color: var(--muted) !important; }
.col-indigo { color: var(--primary) !important; }
.col-teal, .teal-text { color: var(--teal) !important; }
.blue-text { color: var(--blue) !important; }
.text-primary { color: var(--primary) !important; }
.text-danger { color: var(--red) !important; }
.text-warning { color: var(--amber) !important; }
.text-success { color: var(--green) !important; }
.text-center { text-align: center; }
.text-hide { display: none; }
.progress { height: 8px; border-radius: 999px; background: var(--line); box-shadow: none; overflow: hidden; margin: 0; }
.progress-bar { background: var(--primary); box-shadow: none; }

/* ---------- tables ---------- */
.table-responsive { position: relative; border: 0; margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }   /* position: the hidden <select>s of select2 are absolutely placed and would otherwise stretch the page */
table.table { width: 100%; margin: 0; color: var(--text); background: transparent; border-collapse: separate; border-spacing: 0; }
.table > thead > tr > th { padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.table > thead > tr > th:first-child { border-top-left-radius: 10px; }
.table > thead > tr > th:last-child { border-top-right-radius: 10px; }
.table > tbody > tr > td { padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-bordered, .table-bordered > thead > tr > th, .table-bordered > tbody > tr > td { border-left: 0; border-right: 0; }
.table-striped > tbody > tr:nth-of-type(odd) { background: transparent; }
.table-hover > tbody > tr:hover { background: var(--surface-2); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table .btn { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.table td .form-control { height: 42px; }
table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc { cursor: pointer; }
table.dataTable.no-footer { border-bottom: 0; }
table.dataTable thead > tr > th:last-child, table.dataTable thead > tr > th[width] { }

/* DataTables chrome (layout set in ui-defaults.js) */
.dataTables_wrapper { padding: 0; }
.dt-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dt-search { flex: 1 1 220px; min-width: 0; }
.dt-length { flex: 0 0 auto; }
.dataTables_filter, .dataTables_length { margin: 0; text-align: left !important; }
.dataTables_filter label { display: block; margin: 0; position: relative; font-weight: 400; }
.dataTables_filter input.form-control, .dataTables_filter input {
  display: block; width: 100% !important; height: 44px; margin: 0 !important; padding: 8px 14px 8px 42px; font-size: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background-color: var(--surface-2); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2393a7a0' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px center;
}
.dataTables_length label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 400; display: flex; align-items: center; gap: 8px; }
.dataTables_length select { height: 44px; width: auto; margin: 0; padding: 6px 30px 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background-color: var(--surface-2); color: var(--text); font-size: 15px; }
.dt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.dataTables_info { padding: 0 !important; color: var(--muted); font-size: 13px; }
.dataTables_paginate { margin: 0 !important; padding: 0 !important; }
.dataTables_paginate ul.pagination { display: flex; gap: 4px; margin: 0; }
.dataTables_paginate .pagination > li > a { min-width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 10px !important; background: var(--surface); color: var(--text); margin: 0; padding: 0 10px; font-weight: 600; }
.dataTables_paginate .pagination > .active > a, .dataTables_paginate .pagination > .active > a:hover { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.dataTables_paginate .pagination > .disabled > a { opacity: .45; }
.dataTables_empty { text-align: center !important; color: var(--muted); padding: 28px 12px !important; }

/* ---------- toasts (bootstrap-notify) ---------- */
.animated { animation-duration: .28s; animation-fill-mode: both; }
.bounceIn { animation-name: ui-toast-in; }
.bounceOut { animation-name: ui-toast-out; }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ui-toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.98); } }
.bootstrap-notify-container {
  width: min(92vw, 440px) !important; margin: 0 auto !important; padding: 13px 44px 13px 16px !important; border: 0 !important; border-radius: 14px !important;
  box-shadow: var(--shadow-lg) !important; font-size: 14.5px; color: #fff; background: #263330;
}
.bootstrap-notify-container.bg-teal, .bootstrap-notify-container.bg-green, .bootstrap-notify-container.alert-success { background: #0f766e; }
.bootstrap-notify-container.bg-orange { background: #b45309; }
.bootstrap-notify-container.bg-red, .bootstrap-notify-container.bg-danger { background: #b91c1c; }
.bootstrap-notify-container.bg-black { background: #263330; }
.bootstrap-notify-container .close { position: absolute; right: 14px; top: 10px; color: #fff; opacity: .8; font-size: 22px; text-shadow: none; }
.bootstrap-notify-container .progress { display: none; }

/* ---------- sweetalert (v1) ---------- */
.sweet-overlay { background: rgba(8, 14, 12, .55) !important; backdrop-filter: blur(2px); }
.sweet-alert {
  width: min(92vw, 420px) !important; left: 50% !important; margin-left: 0 !important; transform: translateX(-50%); padding: 22px 20px 18px !important;
  background: var(--surface) !important; color: var(--text); border-radius: 18px !important; box-shadow: var(--shadow-lg) !important; font-family: var(--font);
}
.sweet-alert.showSweetAlert { transform: translateX(-50%); }
.sweet-alert h2 { color: var(--text) !important; font-size: 20px !important; font-weight: 700 !important; margin: 18px 0 8px !important; }
.sweet-alert p { color: var(--muted) !important; font-size: 15px !important; line-height: 1.5; }
.sweet-alert button { border-radius: 12px !important; min-height: 44px; padding: 0 22px !important; font-size: 15px !important; font-weight: 600 !important; box-shadow: none !important; margin: 14px 5px 0 !important; }
.sweet-alert button.confirm { background-color: var(--primary) !important; color: var(--on-primary) !important; }
.sweet-alert button.cancel { background-color: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--line-strong) !important; }
.sweet-alert button.confirm[style*="DD6B55"] { background-color: var(--red) !important; }

/* ---------- dropzone ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); min-height: 120px; padding: 18px; }
.dropzone .dz-message { color: var(--muted); margin: 1.4em 0; }
.dropzone .dz-preview .dz-image { border-radius: 12px; }

/* ---------- dashboard ---------- */
.info-box { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); height: auto; }
.info-box .icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; position: static; }
.info-box .icon .material-icons { font-size: 26px; line-height: 1; }
.info-box .content { padding: 0; min-width: 0; }
.info-box .text { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin: 0; }
.info-box .number { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; margin: 2px 0 0; color: var(--text); }
.bg-blue-grey { background-color: #64748b; }
.bg-amber { background-color: #d97706; }
.bg-orange { background-color: var(--orange); }
.bg-teal { background-color: var(--teal); }
.bg-green { background-color: var(--green); }
.bg-blue { background-color: var(--blue); }
.bg-red { background-color: var(--red); }
.bg-indigo { background-color: var(--indigo); }
.bg-grey { background-color: var(--grey); }
.btn.bg-blue { background-color: var(--primary); }
.btn.bg-orange { background-color: var(--amber); }

/* ---------- dashboard v2 ---------- */
.hero {
  display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: 16px 28px; padding: 20px 22px; margin-bottom: 8px;
  border-radius: 20px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, #14806f 0%, #0b5d56 48%, #073b37 100%); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(closest-side, rgba(224, 178, 82, .35), transparent); pointer-events: none; }
.hero-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #e0b252; }
.hero-date { font-size: 24px; font-weight: 700; line-height: 1.2; margin-top: 6px; }
.hero-hijri { font-size: 14px; opacity: .85; margin-top: 2px; }
.hero-next { display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(4px); position: relative; z-index: 1; }
.hero-next-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .8; }
.hero-next-line { font-size: 26px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-next-line b { font-weight: 700; margin-right: 6px; }
.hero-next-in { font-size: 13px; opacity: .85; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 2px 10px; }
.prayer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prayer { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: .2s; }
.prayer .material-icons { font-size: 24px; color: var(--muted); margin-bottom: 4px; }
.prayer-name { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prayer-time { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.prayer.is-passed { opacity: .55; box-shadow: none; }
.prayer.is-next { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.prayer.is-next .material-icons, .prayer.is-next .prayer-name { color: var(--primary-strong); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-weight: 600; line-height: 1.25; box-shadow: var(--shadow); }
.quick:hover { border-color: var(--primary); color: var(--primary-strong); }
.quick .material-icons { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); font-size: 22px; }
.agenda { list-style: none; margin: 0; padding: 4px 18px; }
.agenda li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.agenda li:last-child { border-bottom: 0; }
.agenda-date { width: 46px; height: 50px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; line-height: 1; flex: none; }
.agenda-date small { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; color: inherit; }
.agenda-text { display: flex; flex-direction: column; min-width: 0; }
.agenda-text small { color: var(--muted); font-size: 13px; }
@media (min-width: 640px) { .prayer-grid, .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .prayer-grid, .quick-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .hero-date { font-size: 28px; } }

/* ---------- tables on wide screens ---------- */
@media (min-width: 768px) {
  .table > tbody > tr > td.text-center { white-space: nowrap; }
  .table td.cell-actions { white-space: normal !important; min-width: 256px; width: 1%; }   /* !important: some lists set white-space: nowrap inline */   /* up to four buttons wrap into two rows instead of widening the table */
  .table td.cell-actions > a { display: inline-block; margin: 2px; }
}
table.rt td.cell-long br { display: none; }

/* ---------- login ---------- */
html body.auth { padding: 0; min-height: 100vh; min-height: 100dvh; background: radial-gradient(120% 90% at 50% 0%, #14806f 0%, #0b5d56 42%, #062f2c 100%); }
:root[data-theme="dark"] body.auth, :root:not([data-theme="light"]) body.auth { }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-card { width: min(100%, 410px); padding: 28px 26px 22px; background: var(--surface); color: var(--text); border-radius: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 12px; }
.auth-brand .brand-mark .material-icons { font-size: 34px; }
.auth-brand h1 { font-size: 21px; line-height: 1.25; margin: 0; font-weight: 700; }
.auth-brand p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.auth-msg { margin: 0 0 14px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.auth-msg.bad { background: var(--danger-bg); color: var(--danger-fg); }
.auth-msg.ok { background: var(--ok-bg); color: var(--ok-fg); }
.form-line.has-action .form-control { padding-right: 52px; }
.pw-toggle { position: absolute; right: 4px; top: 7px; width: 44px; height: 44px; color: var(--muted); }
.auth-link { text-align: center; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.auth-foot { text-align: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- progress line ---------- */
.topbar-progress { position: fixed; z-index: 2500; top: 0; left: 0; height: 3px; width: 0; background: var(--primary); opacity: 0; transition: width .25s, opacity .2s; }
.topbar-progress.on { width: 85%; opacity: 1; transition: width 8s cubic-bezier(.1, .6, .2, 1), opacity .2s; }

/* ---------- wider screens ---------- */
@media (min-width: 768px) {
  main.content { padding: 24px 24px 36px; }
  .page-head h1 { font-size: 28px; }
  .card > .header { padding: 18px 22px; }
  .card > .body { padding: 20px 22px 22px; }
  .alert { margin: 0 22px 4px; }
  .dt-search { max-width: 340px; }
  .dt-top { flex-wrap: nowrap; }
}
@media (min-width: 1024px) {
  body { padding-bottom: 0; padding-left: var(--sidebar-w); }
  .appbar { left: 0; padding-inline: 12px 16px; }
  .menu-btn, .drawer-close, .scrim { display: none !important; }
  .tabbar { display: none; }
  .drawer { transform: none; visibility: visible; top: calc(var(--appbar-h) + env(safe-area-inset-top, 0px)); width: var(--sidebar-w); padding-top: 0; box-shadow: none; }
  .drawer-head { display: none; }
  .drawer-open body { overflow: auto; }
  .nav { padding-top: 8px; }
}

/* ---------- phones: tables become cards ---------- */
@media (max-width: 767px) {
  .table-responsive { overflow: visible; }
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100% !important; }
  table.rt thead { display: none; }
  table.rt { border: 0; }
  table.rt > tbody > tr {
    margin: 0 0 12px; padding: 6px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  }
  table.rt > tbody > tr:hover { background: var(--surface-2); }
  table.rt > tbody > tr > td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 0; border: 0; border-bottom: 1px dashed var(--line);
    text-align: left !important; min-height: 0; white-space: normal;
  }
  table.rt > tbody > tr > td:last-child { border-bottom: 0; }
  table.rt > tbody > tr > td::before {
    content: attr(data-label); flex: 0 0 34%; max-width: 34%; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 2px;
  }
  table.rt > tbody > tr > td[data-label=""]::before { display: none; }
  table.rt > tbody > tr > td > * { max-width: 100%; }
  table.rt > tbody > tr > td.cell-long { flex-direction: column; align-items: stretch; gap: 4px; }
  table.rt > tbody > tr > td.cell-long::before { flex: none; max-width: none; }
  table.rt > tbody > tr > td.cell-no { display: none; }
  table.rt td.cell-switch { align-items: center; }
  table.rt > tbody > tr > td.cell-actions { display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 8px; padding-top: 12px; }
  table.rt > tbody > tr > td.cell-actions::before { display: none; }
  table.rt > tbody > tr > td.cell-actions > a { flex: 1 1 calc(50% - 8px); display: block; }
  table.rt > tbody > tr > td.cell-actions .btn { width: 100%; min-height: 44px; }
  table.rt > tbody > tr > td .badge, table.rt > tbody > tr > td .label { align-self: flex-start; width: fit-content; }
  table.rt td .form-control { width: 100%; min-width: 0; }
  table.rt td.dataTables_empty { display: block; }
  table.rt td.dataTables_empty::before { display: none; }
  .dt-top { gap: 8px; }
  .dt-length { display: none; }            /* page size is not needed on a phone: the list scrolls */
  .dt-bottom { justify-content: center; }
  .dt-info { width: 100%; text-align: center; }
  .card > .header .btn { min-height: 42px; }
  .card > .header .pull-right, .card > .header .pull-right > a { width: 100%; }
  .card > .header .pull-right .btn { width: 100%; }
}
@media (max-width: 380px) {
  main.content { padding-inline: 10px; }
  .page-head h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}
