/* Page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 21px; margin: 0 0 2px; font-weight: 700; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-head .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.page-head .crumbs a { color: var(--red-2); }
.page-head .actions, .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Summary cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 13px; align-items: flex-start; color: inherit; box-shadow: 0 1px 3px rgba(140,60,0,.05); min-width: 0; }
a.stat:hover { border-color: var(--gold); box-shadow: 0 8px 18px rgba(140,60,0,.09); color: inherit; }
.stat .ico { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 21px; flex: none; background: #fbe3dc; color: var(--red); }
.stat.gold .ico { background: var(--gold-soft); color: #8a6d0e; }
.stat.saffron .ico { background: #fdebdc; color: #b95d0e; }
.stat.green .ico { background: #e2f2ea; color: var(--ok); }
.stat.red .ico { background: #fae6e4; color: var(--bad); }
.stat .lbl { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat .val { font-size: 20px; font-weight: 700; color: var(--red); line-height: 1.3; white-space: nowrap; }
.stat .note { font-size: 11.5px; color: var(--muted); }
.up { color: var(--ok); font-weight: 700; } .down { color: var(--bad); font-weight: 700; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(140,60,0,.05); min-width: 0; }
.panel > .panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > .panel-h h2 { font-size: 14.5px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel > .panel-h h2 i { color: var(--gold); font-size: 18px; }
.panel > .panel-b { padding: 16px; }
.panel > .panel-b.flush { padding: 0; }
.panel.fill { height: calc(100% - 18px); }

/* Filters & tables */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; background: #fff5da; border-bottom: 1px solid var(--line); align-items: flex-end; }
.filters > div { flex: 1 1 150px; max-width: 220px; min-width: 130px; }
.filters .form-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.filters > .f-reset { flex: 0 0 auto; min-width: 0; }
body.erp table.erp-table, body.erp table.grid { width: 100% !important; margin: 0 !important; font-size: 13px; border-collapse: collapse !important; }
body.erp table.erp-table thead th, body.erp table.grid thead th { background: #fdeac0; color: var(--red); font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); padding: 10px 12px; }
body.erp table.erp-table tbody td, body.erp table.grid tbody td { padding: 9px 12px; vertical-align: middle; border-bottom: 1px solid #f6e3b6; color: var(--ink); white-space: nowrap; }
body.erp table.erp-table tbody td.wrap, body.erp table.grid tbody td.wrap { white-space: normal; min-width: 180px; }
body.erp table.erp-table tbody tr:hover td, body.erp table.grid tbody tr:hover td { background: #fdf9ec; }
body.erp table.grid tfoot td, body.erp table.grid tfoot th, body.erp table.erp-table tfoot th { padding: 10px 12px; background: #fdeac0; font-weight: 700; color: var(--red); border-top: 2px solid var(--gold); white-space: nowrap; }
body.erp table.grid tr.group td { background: #fdf0cf; font-weight: 700; color: var(--red); }
body.erp table .num { text-align: right; font-variant-numeric: tabular-nums; }
body.erp .dataTables_wrapper .dt-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
body.erp .dataTables_wrapper .dt-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
body.erp .dataTables_wrapper label { margin: 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
body.erp .dataTables_wrapper .dataTables_filter input { min-width: 200px; margin: 0; }
body.erp .dataTables_wrapper .dataTables_length select { width: 72px; }
body.erp .dataTables_info { font-size: 12.5px; color: var(--muted); padding: 0 !important; }
body.erp .page-link { color: var(--red); font-size: 12.5px; }
body.erp .page-item.active .page-link { background: var(--red); border-color: var(--red); color: #fff; }
.row-actions { display: inline-flex; gap: 4px; }
.row-actions button { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--card); border-radius: 7px; color: var(--red); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; padding: 0; }
.row-actions button:hover { background: var(--red); color: #fff; border-color: var(--red); }
.row-actions button.danger { color: var(--bad); }
.row-actions button.danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

/* Badges */
.badge-s { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 2px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-s::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-s.ok { background: #e2f2ea; color: var(--ok); }
.badge-s.warn { background: #fcf0d6; color: var(--warn); }
.badge-s.bad { background: #fae6e4; color: var(--bad); }
.badge-s.info { background: #fbe3dc; color: var(--red-2); }
.badge-s.muted { background: #f3e8cf; color: #5f646f; }
.tag { display: inline-block; background: var(--gold-soft); color: #6e5608; border-radius: 6px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; margin: 0 4px 4px 0; }

/* Tabs */
.erp-tabs { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.erp-tabs button { background: none; border: 0; padding: 9px 14px; font-weight: 700; font-size: 13px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.erp-tabs button.active { color: var(--red); border-bottom-color: var(--gold); }

/* Modals */
body.erp .modal-content { border: 0; border-radius: 14px; overflow: hidden; }
body.erp .modal-header { background: var(--red); border-bottom: 3px solid var(--gold); padding: 12px 18px; }
body.erp .modal-header .modal-title { color: #fff; font-size: 15.5px; font-weight: 700; }
body.erp .modal-header .btn-close { filter: invert(1) grayscale(1) brightness(2); }
body.erp .modal-footer { background: #fff5da; }
body.erp .modal-body { padding: 18px; }
.form-section { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--red); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 6px; }
.check-group { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 4px; }
.upload { border: 1.5px dashed #e3bd6c; border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center; cursor: pointer; background: #fff5da; }
.upload i { font-size: 26px; color: var(--gold); }
.upload img { height: 48px; width: 48px; object-fit: cover; border-radius: 8px; }
.upload input { display: none; }

/* Detail list */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; }
.dl-grid div small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.dl-grid div span { font-weight: 600; word-break: break-word; }

/* Toast, empty, loading */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.erp-toast { background: var(--card); border-left: 4px solid var(--ok); border-radius: 8px; box-shadow: 0 10px 28px rgba(140,60,0,.2); padding: 10px 16px; display: flex; gap: 10px; align-items: center; min-width: 260px; font-weight: 600; animation: toast-in .2s ease; }
.erp-toast.info { border-color: var(--red-2); } .erp-toast.warning { border-color: var(--saffron); } .erp-toast.error { border-color: var(--bad); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty i { font-size: 34px; color: var(--gold); display: block; margin-bottom: 6px; }
.loading { display: flex; justify-content: center; padding: 60px; }
.loading::after { content: ""; width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
body.erp .swal2-popup { border-radius: 14px; font-family: inherit; }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }
.list-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid #f6e3b6; }
.list-line:last-child { border-bottom: 0; }
.list-line b { display: block; font-size: 13px; }
.list-line small { color: var(--muted); }
.list-line .amt { font-weight: 700; color: var(--red); white-space: nowrap; text-align: right; }
.date-chip { width: 46px; text-align: center; border: 1px solid var(--gold); border-radius: 8px; overflow: hidden; flex: none; line-height: 1.2; }
.date-chip small { display: block; background: var(--red); color: var(--gold); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.date-chip b { font-size: 16px; color: var(--red); }
.progress-thin { height: 6px; border-radius: 6px; background: #f6e0ac; overflow: hidden; }
.progress-thin i { display: block; height: 100%; background: var(--gold); }
