/* AfQuest admin — modern theme layer.
 * Loaded after style.css on every admin page. Pure visual overrides: no markup
 * or behaviour depends on this file, so removing the <link> restores the old look.
 */
:root {
  --am-bg: #f7f5ef;
  --am-surface: #ffffff;
  --am-ink: #0f2417;
  --am-text: #2b3a31;
  --am-muted: #6b726c;
  --am-line: #ece7da;
  --am-brand: #ffc82e;
  --am-brand-soft: #fff3cc;
  --am-brand-ink: #1a1405;
  --am-radius: 14px;
  --am-sidebar: 260px;
  --am-shadow: 0 1px 2px rgba(15, 36, 23, .04), 0 4px 16px rgba(15, 36, 23, .04);
}

html body {
  background: var(--am-bg);
  color: var(--am-text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body h1, body h2, body h3, body h4, body h5, body h6 { color: var(--am-ink); font-family: inherit; letter-spacing: -.01em; }
body a { color: #8a6500; }
body a:hover { color: var(--am-ink); }
.ph, [class^="ph-"], [class*=" ph-"] { line-height: 1; vertical-align: -.125em; }

/* ---------- Top bar ---------- */
.navbar-bg { display: none; }
.main-navbar.navbar {
  position: fixed; top: 0; left: var(--am-sidebar); right: 0; height: 64px;
  padding: 0 28px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--am-line); z-index: 890;
}
body.sidebar-mini .main-navbar.navbar { left: 76px; }
body.sidebar-gone .main-navbar.navbar { left: 0; }
.main-navbar .nav-link { color: var(--am-ink) !important; }
.main-navbar [data-toggle="sidebar"] {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; font-size: 20px; padding: 0; transition: background .15s;
}
.main-navbar [data-toggle="sidebar"]:hover { background: #f3efe2; }
.main-navbar .nav-link-user { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; }
.main-navbar .nav-link-user:hover { background: #f3efe2; }
.main-navbar .nav-link-user:after { display: none; }
.am-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--am-brand); color: var(--am-brand-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.am-username { font-weight: 600; font-size: 13.5px; }
.main-navbar .dropdown-menu { border: 1px solid var(--am-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 36, 23, .12); padding: 6px; min-width: 200px; }
.main-navbar .dropdown-item { border-radius: 8px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; color: var(--am-text); }
.main-navbar .dropdown-item i { font-size: 18px; color: var(--am-muted); }
.main-navbar .dropdown-item:hover { background: #f6f2e6; color: var(--am-ink); }

/* ---------- Sidebar ---------- */
.main-sidebar { width: var(--am-sidebar); background: #fff !important; border-right: 1px solid var(--am-line); box-shadow: none; }
body.sidebar-gone .main-sidebar { left: calc(var(--am-sidebar) * -1); }
.main-sidebar #sidebar-wrapper { padding-bottom: 32px; }
.main-sidebar .sidebar-menu { padding: 0 14px 24px; margin: 0; list-style: none; }
.main-sidebar .sidebar-brand { padding: 20px 6px 8px; text-align: left; margin: 0 !important; }
.main-sidebar .sidebar-brand:not(.sidebar-brand-sm) { padding: 16px 0 6px; }
.main-sidebar .sidebar-brand:not(.sidebar-brand-sm) a { display: flex; align-items: center; padding: 4px 8px; }
.main-sidebar .sidebar-brand img#full_logo { margin: 0; max-width: 150px; height: auto; display: block; }
.main-sidebar .nicescroll-rails, .nicescroll-rails { opacity: .6; }
.nicescroll-cursors { background: #d9d2bd !important; border: 0 !important; width: 4px !important; }
.main-sidebar .sidebar-brand.sidebar-brand-sm { text-align: center; }
.main-sidebar .sidebar-menu li { background: transparent !important; }
.main-sidebar .sidebar-menu li.menu-header {
  padding: 22px 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #9a9f95;
}
.main-sidebar .sidebar-menu li a, .main-sidebar .sidebar-menu li a.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 7px 12px; line-height: 1.3; margin: 1px 0;
  border-radius: 10px; color: var(--am-text) !important; font-weight: 500; font-size: 14px; background: transparent !important;
  box-shadow: none !important; transition: background .15s, color .15s;
}
.main-sidebar .sidebar-menu li a i { margin: 0; width: 20px; font-size: 20px; color: #7b8279; text-align: center; transition: color .15s; }
.main-sidebar .sidebar-menu li a span { flex: 1; }
.main-sidebar .sidebar-menu li a:hover { background: #f6f2e6 !important; color: var(--am-ink) !important; }
.main-sidebar .sidebar-menu li a:hover i { color: var(--am-ink); }
.main-sidebar .sidebar-menu li.is-current > a,
.main-sidebar .sidebar-menu li.active > a.has-dropdown { background: var(--am-brand-soft) !important; color: var(--am-ink) !important; font-weight: 600; }
.main-sidebar .sidebar-menu li.is-current > a i,
.main-sidebar .sidebar-menu li.active > a.has-dropdown i { color: var(--am-ink); }
.main-sidebar .sidebar-menu li a.has-dropdown:after {
  content: ""; width: 7px; height: 7px; margin-left: auto; border: solid #9aa096; border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg); transition: transform .2s; position: static; float: none; font-family: inherit;
}
.main-sidebar .sidebar-menu li.active > a.has-dropdown:after { transform: rotate(-135deg); }
.main-sidebar .sidebar-menu li ul.dropdown-menu {
  position: static !important; float: none; display: none; width: auto; margin: 2px 0 6px 21px; padding: 2px 0 2px 12px;
  background: transparent !important; border: 0; border-left: 1.5px solid var(--am-line); border-radius: 0; box-shadow: none; transform: none !important;
}
.main-sidebar .sidebar-menu li ul.dropdown-menu li a, .main-sidebar .sidebar-menu li ul.dropdown-menu li a.nav-link {
  min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13.5px; font-weight: 450; color: var(--am-muted) !important; padding: 0 10px;
}
.main-sidebar .sidebar-menu li ul.dropdown-menu li.is-current > a { color: var(--am-ink) !important; font-weight: 600; background: var(--am-brand-soft) !important; }
.main-sidebar .sidebar-menu li ul.dropdown-menu li.dropdown-title { display: none; }
.am-menu-search { position: relative; margin: 6px 0 4px; }
.am-menu-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 17px; color: #9a9f95; pointer-events: none; }
.am-menu-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--am-line); border-radius: 10px; background: #faf8f2;
  font-size: 13.5px; color: var(--am-ink); outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.am-menu-search input:focus { background: #fff; border-color: var(--am-brand); box-shadow: 0 0 0 3px rgba(255, 200, 46, .25); }
.am-hidden { display: none !important; }

/* mini (collapsed) sidebar */
body.sidebar-mini .main-sidebar { width: 76px; }
body.sidebar-mini .main-sidebar .sidebar-menu > li > a { justify-content: center; padding: 0; height: 44px; }
body.sidebar-mini .main-sidebar .sidebar-menu > li > a span { display: none; }
body.sidebar-mini .main-sidebar .sidebar-menu > li > a i { font-size: 22px; width: auto; }
body.sidebar-mini .main-sidebar .sidebar-menu > li > a.has-dropdown:after { display: none; }
body.sidebar-mini .main-sidebar .sidebar-menu > li.menu-header { height: 10px; padding: 0; font-size: 0; }
body.sidebar-mini .main-sidebar .am-menu-search { display: none; }
body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu {
  position: absolute !important; left: 68px; top: 0; min-width: 210px; margin: 0; padding: 8px; background: #fff !important;
  border: 1px solid var(--am-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 36, 23, .14);
}
body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li.dropdown-title { display: block; padding: 6px 10px; font-weight: 700; color: var(--am-ink); }
body.sidebar-mini .main-sidebar .sidebar-menu > li > a { box-shadow: none !important; }

/* ---------- Layout ---------- */
.main-content { padding: 92px 32px 8px calc(var(--am-sidebar) + 32px); }
.main-footer { padding: 16px 32px 24px calc(var(--am-sidebar) + 32px); color: #9a9f95; font-size: 13px; margin-top: 8px; }
.main-footer a { color: var(--am-muted); }
body.sidebar-mini .main-content, body.sidebar-mini .main-footer { padding-left: 108px; }
@media (max-width: 1024px) {
  .main-content, .main-footer { padding-left: 20px !important; padding-right: 20px !important; }
  .main-navbar.navbar { left: 0 !important; padding: 0 16px; }
  .am-username { display: none; }
}
.section .section-header { background: transparent; box-shadow: none; padding: 0; margin: 0 0 20px; }
.section .section-header h1 { font-size: 24px; font-weight: 700; color: var(--am-ink); }

/* ---------- Cards ---------- */
.card { background: var(--am-surface); border: 1px solid var(--am-line); border-radius: var(--am-radius); box-shadow: var(--am-shadow); }
.card .card-header { background: transparent; border-bottom: 1px solid var(--am-line); padding: 18px 24px; min-height: 0; }
.card .card-header h4 { font-size: 15px; font-weight: 650; color: var(--am-ink); line-height: 1.4; }
.card .card-body { padding: 22px 24px; }
.card .card-footer { background: transparent; border-top: 1px solid var(--am-line); }
.inner_heading, h6.inner_heading { color: var(--am-ink); font-size: 14px; }

/* ---------- Forms ---------- */
.form-control, .custom-select, select.form-control, .select2-container--default .select2-selection--single {
  height: 42px; border: 1px solid #e2dccb; border-radius: 10px; background: #fff; color: var(--am-ink); font-size: 14px; box-shadow: none;
}
textarea.form-control, select[multiple].form-control, select.form-control[size], select[multiple] { height: auto; }
.form-control:focus, .custom-select:focus { border-color: var(--am-brand); box-shadow: 0 0 0 3px rgba(255, 200, 46, .28); background: #fff; }
.form-control::placeholder { color: #a9ada5; }
label, .control-label { font-weight: 600; font-size: 13px; color: var(--am-ink); }
.form-group label { margin-bottom: 6px; }
.am-pw { position: relative; }
.am-pw .form-control { padding-right: 64px; }
.am-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 30px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: #8a6500; font-size: 12.5px; font-weight: 650; cursor: pointer; letter-spacing: .01em;
}
.am-pw-toggle:hover { background: var(--am-brand-soft); color: var(--am-ink); }
.am-pw-toggle:focus { outline: 2px solid var(--am-brand); }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; font-size: 14px; padding: 9px 18px; border-width: 1px; box-shadow: none !important; transition: transform .12s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary, .btn-info, .btn-success.btn-lg { background: var(--am-brand) !important; border-color: var(--am-brand) !important; color: var(--am-brand-ink) !important; }
.btn-primary:hover, .btn-info:hover { background: #f5b800 !important; border-color: #f5b800 !important; }
.btn-secondary, .btn-light, .btn-default { background: #fff; border-color: #e2dccb; color: var(--am-ink); }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn-sm, .btn-xs { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- Tables ---------- */
.table { color: var(--am-text); }
.table thead th, .bootstrap-table .fixed-table-container .table thead th {
  background: #faf8f2; border-bottom: 1px solid var(--am-line) !important; border-top: 0; color: var(--am-muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 12px 14px;
}
.table td { border-top: 1px solid #f1ede1; padding: 12px 14px; vertical-align: middle; }
.table-striped tbody tr:nth-of-type(odd) { background: #fcfbf7; }
.table-hover tbody tr:hover { background: #fff9e6; }
.bootstrap-table .fixed-table-container, .fixed-table-container { border: 1px solid var(--am-line); border-radius: 12px; overflow: hidden; }
.pagination .page-link { border: 0; border-radius: 8px; margin: 0 2px; color: var(--am-text); }
.pagination .page-item.active .page-link { background: var(--am-brand); color: var(--am-brand-ink); }
.badge { border-radius: 999px; font-weight: 600; padding: 5px 10px; }
.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 64px rgba(15, 36, 23, .22); }
.modal-header { border-bottom: 1px solid var(--am-line); }
.modal-footer { border-top: 1px solid var(--am-line); }
.nav-pills .nav-link { border-radius: 8px; }
.nav-pills .nav-link.active { background: var(--am-brand); color: var(--am-brand-ink); box-shadow: none; }
.alert { border: 0; border-radius: 12px; }
::selection { background: var(--am-brand); color: var(--am-brand-ink); }

/* ---------- Dashboard ---------- */
.am-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 24px; }
.am-page-head h1 { font-size: 26px; font-weight: 750; margin: 0 0 4px; letter-spacing: -.02em; }
.am-page-head p { margin: 0; color: var(--am-muted); }
.am-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.am-actions .btn { display: inline-flex; align-items: center; gap: 8px; }
.am-actions .btn i { font-size: 18px; }
.am-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
a.am-stat { display: block; color: inherit; text-decoration: none; background: #fff; border: 1px solid var(--am-line); border-radius: var(--am-radius);
  padding: 20px; box-shadow: var(--am-shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
a.am-stat:hover { transform: translateY(-2px); border-color: #e2d6b0; box-shadow: 0 8px 24px rgba(15, 36, 23, .08); color: inherit; }
.am-stat-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; margin-bottom: 16px; }
.am-stat-ico.t-yellow { background: #fff3cc; color: #8a6500; }
.am-stat-ico.t-green { background: #e3f4e9; color: #1f6b45; }
.am-stat-ico.t-orange { background: #ffe9d6; color: #b45a12; }
.am-stat-ico.t-blue { background: #e4efff; color: #2b5fb3; }
.am-stat-ico.t-rose { background: #fde6ee; color: #b4325f; }
.am-stat-ico.t-slate { background: #eceee9; color: #3e4a42; }
.am-stat-num { font-size: 30px; font-weight: 750; letter-spacing: -.02em; color: var(--am-ink); line-height: 1.1; }
.am-stat-label { margin-top: 4px; color: var(--am-muted); font-size: 13.5px; }
.am-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.am-panel { background: #fff; border: 1px solid var(--am-line); border-radius: var(--am-radius); box-shadow: var(--am-shadow); padding: 22px 24px; }
.am-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.am-panel-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.am-seg.nav-pills { background: #f3efe2; padding: 3px; border-radius: 10px; flex-wrap: nowrap; white-space: nowrap; }
.am-seg .nav-link { padding: 5px 14px; font-size: 13px; font-weight: 600; color: var(--am-muted) !important; background: transparent; }
.am-seg .nav-link.active { background: #fff !important; color: var(--am-ink) !important; box-shadow: 0 1px 3px rgba(15, 36, 23, .12); }
.am-links { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.am-links a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--am-text); text-decoration: none; font-weight: 500; }
.am-links a:hover { background: #f6f2e6; color: var(--am-ink); }
.am-links a i { font-size: 20px; color: #7b8279; }
.am-links a small { display: block; color: var(--am-muted); font-weight: 400; font-size: 12.5px; }
.am-links a .am-arrow { margin-left: auto; font-size: 16px; color: #b7b9b0; }
.am-status { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid #f1ede1; }
.am-status:first-of-type { border-top: 0; }
.am-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.am-pill:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.am-pill.on { background: #e3f4e9; color: #1f6b45; }
.am-pill.off { background: #fde6e6; color: #b3362f; }
@media (max-width: 1100px) { .am-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .am-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .am-stats { gap: 12px; } a.am-stat { padding: 16px; } .am-stat-num { font-size: 25px; } }

/* ---------- API docs ---------- */
.am-docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.am-docs-toc { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; padding: 18px 14px; background: #fff; border: 1px solid var(--am-line); border-radius: var(--am-radius); }
.am-docs-toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--am-muted); font-size: 13px; text-decoration: none; line-height: 1.35; }
.am-docs-toc a:hover { background: #f6f2e6; color: var(--am-ink); }
.am-docs-toc a.l3 { padding-left: 22px; font-size: 12.5px; }
.am-docs-body { background: #fff; border: 1px solid var(--am-line); border-radius: var(--am-radius); padding: 32px 36px; line-height: 1.7; overflow: hidden; }
.am-docs-body h1 { font-size: 28px; margin: 0 0 16px; }
.am-docs-body h2 { font-size: 21px; margin: 36px 0 12px; padding-top: 20px; border-top: 1px solid var(--am-line); }
.am-docs-body h3 { font-size: 16px; margin: 26px 0 8px; }
.am-docs-body code { background: #f5f1e3; color: #6b4d00; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
.am-docs-body pre { background: #10231a; color: #f6f1e6; padding: 16px 18px; border-radius: 12px; overflow: auto; }
.am-docs-body pre code { background: transparent; color: inherit; padding: 0; font-size: 12.5px; }
.am-docs-body table { width: 100%; display: block; overflow-x: auto; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.am-docs-body th, .am-docs-body td { border: 1px solid var(--am-line); padding: 8px 12px; text-align: left; vertical-align: top; }
.am-docs-body th { background: #faf8f2; }
.am-docs-body blockquote { border-left: 3px solid var(--am-brand); margin: 14px 0; padding: 4px 16px; color: var(--am-muted); background: #fffaf0; border-radius: 0 8px 8px 0; }
@media (max-width: 900px) { .am-docs { grid-template-columns: 1fr; } .am-docs-toc { position: static; max-height: 240px; } .am-docs-body { padding: 22px 18px; } }

/* ---------- Login ---------- */
body.login-modern { min-height: 100vh; background: var(--am-bg); display: block; }
.lm-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.lm-side {
  background: var(--am-brand); display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: var(--am-ink); position: relative; overflow: hidden;
}
.lm-side:before, .lm-side:after { content: ""; position: absolute; border: 1.5px solid rgba(15, 36, 23, .08); border-radius: 50%; }
.lm-side:before { width: 520px; height: 520px; right: -140px; bottom: -160px; }
.lm-side:after { width: 340px; height: 340px; right: -50px; bottom: -70px; }
.lm-side h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -.03em; font-weight: 800; max-width: 380px; margin: 0 0 12px; }
.lm-side p { max-width: 360px; margin: 0; font-size: 1.02rem; line-height: 1.6; color: rgba(15, 36, 23, .75); }
.lm-side .lm-logo { height: 40px; width: auto; align-self: flex-start; }
.lm-main { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.lm-card { width: 100%; max-width: 380px; }
.lm-logo-tile { display: block; margin-bottom: 32px; }
.lm-logo-tile img { height: 40px; width: auto; display: block; }
.lm-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.lm-card .lm-sub { color: var(--am-muted); margin: 0 0 28px; }
.lm-card .form-group { margin-bottom: 18px; }
.lm-card .form-control { height: 48px; border-radius: 12px; }
.lm-remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 22px; font-weight: 500; color: var(--am-text); cursor: pointer; }
.lm-remember input { width: 16px; height: 16px; accent-color: #e5a800; }
.lm-card .btn-primary { width: 100%; height: 50px; border-radius: 12px; font-size: 15px; }
.lm-foot { margin-top: 28px; text-align: center; font-size: 12.5px; color: #9a9f95; }
@media (max-width: 860px) {
  .lm-wrap { grid-template-columns: 1fr; }
  .lm-side { display: none; }
}

/* Uniform profile thumbnails in tables */
a[data-lightbox="Profile Picture"] img,
img.user-thumb {
  width: 56px !important;
  height: 56px !important;
  max-width: 56px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #f1efe8;
}

/* TinyMCE (maths / rich text) — match admin chrome */
.tox-tinymce {
  border: 1px solid var(--am-line) !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: none !important;
}
.tox .tox-toolbar,
.tox .tox-toolbar__primary,
.tox .tox-editor-header {
  background: #faf8f2 !important;
  border-bottom: 1px solid var(--am-line) !important;
  box-shadow: none !important;
}
.tox .tox-statusbar {
  border-top: 1px solid var(--am-line) !important;
  background: #faf8f2 !important;
}
.tox .tox-tbtn {
  border-radius: 8px !important;
}
.maths-html {
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 320px;
  overflow: hidden;
}
.maths-html .math-tex {
  background: #fff8e1;
  padding: 0 3px;
  border-radius: 3px;
}
