/* Temple ERP — brand layer on top of the Dreams theme (assets/theme/css/style.css) */
:root, html[data-color] {
  --red: #b30f0f; --red-deep: #7d0a0a; --red-2: #d8331f;
  --gold: #eda81c; --gold-bright: #ffc928; --gold-soft: #fdecbb; --saffron: #f2820c;
  --ink: #2e1a10; --muted: #7d6350; --line: #f1d79c; --paper: #fdf1cd; --card: #fffaeb;
  --ok: #1d7a4f; --warn: #a86b08; --bad: #b3362c;
  --primary-rgb: 179, 15, 15;
  --bs-primary: #b30f0f; --bs-primary-rgb: 179, 15, 15;
  --bs-link-color: #a30f0f; --bs-link-color-rgb: 163, 15, 15;
  --side-w: 252px; --side-min: 72px; --head-h: 64px;
}
body.erp { background: var(--paper); color: var(--ink); font-size: 14px; }
body.erp h1, body.erp h2, body.erp h3, body.erp h4, body.erp h5, body.erp h6 { color: var(--red); }
body.erp a { text-decoration: none; }

/* Buttons & controls */
body.erp .btn { border-radius: 8px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
body.erp .btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
body.erp .btn-primary:hover, body.erp .btn-primary:focus { background: var(--red-2); border-color: var(--red-2); color: #fff; }
body.erp .btn-gold { background: var(--gold); border-color: var(--gold); color: #241c02; }
body.erp .btn-gold:hover { background: #b8931f; color: #241c02; }
body.erp .btn-light { background: var(--card); border: 1px solid var(--line); color: var(--red); }
body.erp .btn-light:hover { background: var(--gold-soft); border-color: var(--gold); color: var(--red); }
body.erp .btn-outline-primary { color: var(--red); border-color: var(--red); }
body.erp .btn-outline-primary:hover, body.erp .btn-check:checked + .btn-outline-primary { background: var(--red); color: #fff; }
body.erp .form-control, body.erp .form-select { border-radius: 8px; border-color: #ecd094; font-size: 13.5px; min-height: 38px; color: var(--ink); }
body.erp .form-control:focus, body.erp .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(237,168,28,.18); }
body.erp .form-control[readonly] { background: #fbf0d4; }
body.erp .form-label { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: #3d465a; }
body.erp .req::after { content: " *"; color: var(--bad); }
body.erp .form-check-input:checked { background-color: var(--red); border-color: var(--red); }
body.erp .select2-container .select2-selection--single { height: 38px; border-color: #ecd094; border-radius: 8px; }
body.erp .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; font-size: 13.5px; }
body.erp .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
body.erp .select2-results__option--highlighted[aria-selected], body.erp .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--red) !important; color: #fff; }
body.erp .select2-container { z-index: 1060; }
body.erp .select2-container:not(.select2-container--open) { z-index: auto; }
body.erp .is-invalid + .select2-container .select2-selection { border-color: var(--bad); }

/* ---------- Layout ---------- */
body.erp .main-wrapper { min-height: 100vh; }
body.erp .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 1041; background: linear-gradient(180deg, var(--red) 0%, #7d0a0a 100%); border: 0; display: flex; flex-direction: column; transition: width .2s ease, transform .2s ease; padding: 0; margin: 0; box-shadow: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: var(--head-h); border-bottom: 1px solid rgba(237,168,28,.35); color: #fff; flex: none; overflow: hidden; white-space: nowrap; }
.brand img { width: 38px; height: 38px; flex: none; }
.brand b { display: block; font-size: 14px; letter-spacing: .2px; color: #fff; }
.brand small { display: block; color: var(--gold); font-size: 11px; }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.side-hdr { color: #ffc928; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; padding: 14px 10px 6px; font-weight: 700; white-space: nowrap; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 8px; color: #fff3da; font-size: 13.2px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; border: 0; background: none; width: 100%; text-align: left; }
.side-link i.ti { font-size: 18px; flex: none; }
.side-link span { overflow: hidden; text-overflow: ellipsis; }
body.erp a.side-link:hover, button.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
body.erp a.side-link.active { background: var(--gold); color: #231b00; font-weight: 700; }
.side-link .arrow { margin-left: auto; transition: transform .2s; font-size: 14px !important; }
.side-link[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.side-sub { padding-left: 30px; }
.side-sub a { display: block; color: #ffe3b8; padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.side-sub a:hover, body.erp .side-sub a.active { color: var(--gold); background: rgba(255,255,255,.06); }
.side-foot { flex: none; padding: 10px 16px; border-top: 1px solid rgba(255,255,255,.1); color: #ffc928; font-size: 11px; white-space: nowrap; overflow: hidden; }

body.erp .header { position: fixed; top: 0; left: var(--side-w); right: 0; height: var(--head-h); background: var(--card); border-bottom: 1px solid var(--line); z-index: 1030; display: flex; align-items: center; gap: 10px; padding: 0 18px; transition: left .2s ease; width: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--red); display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none; font-size: 18px; }
.icon-btn:hover { background: var(--gold-soft); }
.icon-btn .count { position: absolute; top: -6px; right: -6px; background: var(--saffron); color: #fff; font-size: 10px; border-radius: 10px; padding: 0 5px; line-height: 16px; font-weight: 700; }
.head-title { min-width: 0; line-height: 1.25; flex: 0 1 auto; }
.head-title b { display: block; color: var(--red); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-title small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.head-search { flex: 1 1 200px; max-width: 360px; position: relative; margin-left: auto; }
.head-search i { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.head-search input { padding-left: 34px; }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(140,60,0,.15); max-height: 340px; overflow: auto; z-index: 20; }
.search-results a { display: flex; gap: 10px; padding: 8px 12px; color: var(--ink); align-items: center; }
.search-results a:hover { background: var(--gold-soft); }
.search-results small { color: var(--muted); margin-left: auto; }
.head-select { width: auto; min-width: 0; }
body.erp .header .dropdown-menu { transform: none; border-radius: 10px; border-color: var(--line); box-shadow: 0 12px 30px rgba(140,60,0,.15); visibility: visible; opacity: 1; margin-top: 8px; display: none; }
body.erp .header .dropdown-menu.show { display: block; position: absolute; right: 0; left: auto; top: 100%; }
.noti-menu { width: 330px; max-width: 92vw; }
.noti-menu .item { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--ink); white-space: normal; }
.avatar-i { width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar-i.lg { width: 76px; height: 76px; font-size: 24px; }
.avatar-i.soft { background: var(--gold-soft); color: var(--red); }

body.erp .page-wrapper { margin: 0 0 0 var(--side-w); padding: var(--head-h) 0 0; min-height: 100vh; transition: margin .2s ease; position: static; }
body.erp .page-wrapper .content { padding: 20px 22px 10px; min-height: calc(100vh - var(--head-h) - 46px); }
.app-footer { padding: 10px 22px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.sb-overlay { position: fixed; inset: 0; background: rgba(60,10,0,.5); z-index: 1040; display: none; }

body.erp.sb-collapsed .sidebar { width: var(--side-min); }
body.erp.sb-collapsed .header { left: var(--side-min); }
body.erp.sb-collapsed .page-wrapper { margin-left: var(--side-min); }
body.erp.sb-collapsed .side-link span, body.erp.sb-collapsed .side-link .arrow, body.erp.sb-collapsed .brand div, body.erp.sb-collapsed .side-sub, body.erp.sb-collapsed .side-foot { display: none; }
body.erp.sb-collapsed .side-hdr { font-size: 0; padding: 8px 0 0; border-top: 1px solid rgba(255,255,255,.1); margin-top: 6px; }
body.erp.sb-collapsed .side-link { justify-content: center; padding: 10px 0; }
body.erp.sb-collapsed .brand { justify-content: center; padding: 0; }

@media (max-width: 1399px) { .head-title small { display: none; } }
@media (max-width: 1199px) { .head-select.fy { display: none; } }
@media (max-width: 991px) {
  body.erp .sidebar { transform: translateX(-100%); width: var(--side-w) !important; }
  body.erp .header, body.erp.sb-collapsed .header { left: 0; padding: 0 10px; gap: 8px; }
  body.erp .page-wrapper, body.erp.sb-collapsed .page-wrapper { margin-left: 0; }
  body.erp.sb-open .sidebar { transform: none; }
  body.erp.sb-open .sb-overlay { display: block; }
  body.erp.sb-collapsed .side-link span, body.erp.sb-collapsed .brand div { display: block; }
  body.erp.sb-collapsed .side-link { justify-content: flex-start; padding: 8px 11px; }
}
@media (max-width: 767px) {
  .head-title { display: none; }
  body.erp .page-wrapper .content { padding: 14px 12px 8px; }
}

/* Theme overrides: the template hard-codes its own button and label colours with high priority */
body.erp .btn.btn-primary { background: var(--red) !important; border: 1px solid var(--red) !important; color: #fff !important; box-shadow: none; }
body.erp .btn.btn-primary:hover, body.erp .btn.btn-primary:focus, body.erp .btn.btn-primary:active { background: var(--red-2) !important; border-color: var(--red-2) !important; }
body.erp .btn.btn-light { background: #fff !important; border: 1px solid var(--line) !important; color: var(--red) !important; }
body.erp .btn.btn-light:hover { background: var(--gold-soft) !important; border-color: var(--gold) !important; }
body.erp .btn.btn-light.text-danger { color: var(--bad) !important; }
body.erp .btn.btn-gold { background: var(--gold) !important; border: 1px solid var(--gold) !important; color: #241c02 !important; }
body.erp .btn.btn-gold:hover { background: #b8931f !important; }
body.erp .form-check-label { color: var(--ink) !important; }
body.erp .sidebar { height: 100vh !important; height: 100dvh !important; bottom: 0 !important; top: 0 !important; }body.erp .btn-row { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; width: auto; }
body.erp .btn-row > .btn { width: auto; margin: 0; flex: 0 0 auto; }
body.erp .panel-h > .btn-row { margin-left: auto; justify-content: flex-end; max-width: 100%; }body.erp .modal-header .btn-close { width: 30px; height: 30px; padding: 0 !important; margin: 0 0 0 auto; border: 0 !important; border-radius: 6px !important; opacity: .9; filter: none; background: transparent !important; position: relative; }
body.erp .modal-header .btn-close::before { content: "\00d7"; color: #fff; font-size: 24px; line-height: 28px; font-family: Arial, sans-serif; }
body.erp .modal-header .btn-close::after { content: none; }
body.erp .modal-header .btn-close:hover { background: rgba(255,255,255,.15) !important; }
/* English + Tamil labels: Tamil-capable fonts, and let long bilingual labels wrap instead of being cut off */
body.erp, body.erp input, body.erp select, body.erp button, body.erp textarea { font-family: "Nunito", "Nirmala UI", "Noto Sans Tamil", "Latha", sans-serif; }
body.erp .side-link { white-space: normal; align-items: flex-start; line-height: 1.3; }
body.erp .side-link span { overflow: visible; text-overflow: clip; }
body.erp .side-link .ti { margin-top: 2px; }
body.erp .side-hdr { white-space: normal; }
body.erp .grid th, body.erp table.dataTable thead th { white-space: normal; }
