/* ==========================================================
   Work Order Management System — Theme
   Built on top of Bootstrap 5. Ledger / registry aesthetic:
   deep navy + brass-gold accents on a warm paper background.
========================================================== */

:root{
  --ink:        #1B2A4A;
  --ink-2:      #24365C;
  --ink-soft:   #2E4066;
  --paper:      #F6F3EC;
  --paper-2:    #FFFFFF;
  --line:       #E4DFD1;
  --gold:       #2EED7A;
  --gold-soft:  #E8D9B0;
  --due-red:    #A93E2B;
  --paid-green: #3F7A55;
  --muted:      #766E60;

  --font-display: 'Lora', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --sidebar-w: 258px;
}

*{ box-sizing:border-box; }

html, body{
  height: 100%;
}

body{
  margin:0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
}

h1,h2,h3,h4{ font-family: var(--font-display); }

a{ text-decoration:none; }

/* ================= SIDEBAR ================= */
.app-sidebar{
  position: fixed;
  top:0; left:0; bottom:0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--ink) 0%, #16233F 100%);
  color: #E8E4D8;
  z-index: 1030;
  padding: 22px 16px;
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 4px 8px 22px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.brand-mark{
  width: 38px; height:38px;
  display:flex; align-items:center; justify-content:center;
  background: var(--gold);
  color: var(--ink);
  border-radius: 8px;
  font-size: 18px;
  flex-shrink:0;
}
.brand-name{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16.5px;
  color: #fff;
  line-height:1.2;
}
.brand-sub{
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-soft);
  opacity: .85;
}

.sidebar-nav{ display:flex; flex-direction:column; gap:2px; flex:1; }

.nav-section-label{
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(232,228,216,0.45);
  font-weight: 700;
  margin: 18px 10px 8px;
}
.nav-section-label:first-child{ margin-top: 4px; }

.sidebar-nav .nav-link{
  display:flex;
  align-items:center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 7px;
  color: #C9CEDD;
  font-weight: 500;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav .nav-link i{ font-size: 16px; width:18px; text-align:center; opacity:.9; }
.sidebar-nav .nav-link:hover{ background: rgba(255,255,255,0.07); color:#fff; }
.sidebar-nav .nav-link.active{
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
}
.sidebar-nav .nav-link.active i{ opacity:1; }
.sidebar-nav .nav-link.disabled{
  opacity: .4;
  cursor: default;
  display:flex;
  justify-content:space-between;
}
.sidebar-nav .nav-link.disabled:hover{ background: transparent; color:#C9CEDD; }
.soon-badge{
  font-size: 9.5px;
  border: 1px solid rgba(232,228,216,0.4);
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
  font-weight:700;
}

.sidebar-footer{
  font-size: 11.5px;
  color: rgba(232,228,216,0.45);
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 10px;
}
.sidebar-footer i{ margin-right: 6px; }

/* Mobile offcanvas variant reuses same nav styles */
.app-sidebar-mobile{
  background: linear-gradient(180deg, var(--ink) 0%, #16233F 100%);
  color: #E8E4D8;
  width: 280px;
}
.app-sidebar-mobile .offcanvas-header{ border-bottom: 1px solid rgba(255,255,255,0.12); }

/* ================= MAIN AREA ================= */
.app-main{
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display:flex;
  flex-direction:column;
}
.app-topbar{
  position: sticky;
  top:0;
  z-index: 1020;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display:flex;
  align-items:center;
  gap: 16px;
}
.topbar-titles{ flex:1; min-width:0; }
.topbar-titles h1{
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.topbar-titles p{
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.btn-icon{
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  width: 38px; height: 38px;
  display:flex; align-items:center; justify-content:center;
  color: var(--ink);
  font-size: 18px;
}

.app-content{
  padding: 26px 28px 60px;
  max-width: 1240px;
  width: 100%;
}

/* ================= BUTTONS ================= */
.btn{ border-radius: 6px; font-weight: 600; font-size: 13.5px; }
.btn-gold{
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  display:inline-flex; align-items:center; gap:7px;
}
.btn-gold:hover{ background:#a6812a; border-color:#a6812a; color: var(--ink); }
.btn-ink{
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  display:inline-flex; align-items:center; gap:7px;
}
.btn-ink:hover{ background: var(--ink-2); border-color: var(--ink-2); color:#fff; }
.btn-outline-ink{
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: transparent;
  display:inline-flex; align-items:center; gap:7px;
}
.btn-outline-ink:hover{ background: var(--ink); color:#fff; }

/* ================= STAT CARDS ================= */
.stat-card{
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: 8px;
  padding: 18px 20px;
  height: 100%;
}
.stat-card.due{ border-left-color: var(--due-red); }
.stat-card.paid{ border-left-color: var(--paid-green); }
.stat-card.gold{ border-left-color: var(--gold); }
.stat-card .label{
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--muted); font-weight:700; margin-bottom:8px;
  display:flex; align-items:center; justify-content:space-between;
}
.stat-card .label i{ font-size: 15px; opacity:.55; }
.stat-card .value{
  font-family: var(--font-display);
  font-size: 25px; font-weight:700;
  color: var(--ink);
}
/* ================= CARD / PANEL ================= */
.panel{
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.panel-header{
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between;
  gap: 12px; flex-wrap:wrap; 
}

.panel-header h2{
  font-size: 15.5px; font-weight:700; margin:0; color: var(--ink);
}
/* ================= TABLE ================= */
.table-ledger{ margin-bottom:0; font-size: 13.8px; }
.table-ledger thead th{
  text-transform: uppercase;
  font-size: 10.8px;
  letter-spacing: 1px;
  color: var(--muted);
  background: #F1ECE0;
  border-bottom: 2px solid var(--ink) !important;
  font-weight: 700;
  padding: 12px 16px;
  white-space: nowrap;
}
.table-ledger tbody td{
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom-color: var(--line);
}
.table-ledger tbody tr:hover{ background: #FBF9F4; }
.wo-no{ font-family: var(--font-display); font-weight:700; color: var(--ink); }
.amount{ font-variant-numeric: tabular-nums; font-weight:600; }
.amount.due{ color: var(--due-red); }
.amount.paid{ color: var(--paid-green); }

.status-badge{
  display:inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 10.8px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.status-Pending{ background:#F4E8D0; color:#8A6A1E; }
.status-In-Progress{ background:#DCE6F5; color:#2A4E8C; }
.status-Completed{ background:#DCEFE0; color:var(--paid-green); }
.status-Cancelled{ background:#F5DCDC; color:var(--due-red); }

.empty-state{ text-align:center; padding: 70px 20px; color: var(--muted); }
.empty-state i{ font-size: 40px; color: var(--gold); margin-bottom: 14px; display:block; }
.empty-state h3{ font-family: var(--font-display); color: var(--ink); margin-bottom:6px; }

/* ================= FORMS ================= */
.form-card{ padding: 30px; }
.form-section-title{
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  margin: 26px 0 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.form-section-title:first-child{ margin-top: 0; }
.form-label{ font-size: 12.8px; font-weight:600; color: var(--ink-2); }
.form-control, .form-select{
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  background: var(--paper);
}
.form-control:focus, .form-select:focus{
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185,146,47,0.15);
}
.form-actions{
  display:flex; gap:12px; margin-top: 24px; padding-top:20px; border-top: 1px solid var(--line);
}
.badge-auto{
  display:inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 1px 8px;
  margin-left: 4px;
  vertical-align: middle;
}
#total_amount_display, #per_kg_display{
  font-weight: 700;
  color: var(--ink);
  background: #F1ECE0;
}

/* ================= ALERTS ================= */
.alert-ledger-success{ background:#DCEFE0; color: var(--paid-green); border:1px solid #b9dcc2; }
.alert-ledger-error{ background:#F5DCDC; color: var(--due-red); border:1px solid #e3bcbc; }

/* ================= STAMP (view page) ================= */
.stamp{
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  width: 92px; height: 92px;
  border: 2.5px dashed var(--gold);
  border-radius: 50%;
  color: var(--gold);
  transform: rotate(-8deg);
  font-family: var(--font-display);
  text-align:center;
  line-height:1.15;
  flex-shrink:0;
}
.stamp .top{ font-size:9px; letter-spacing:1.5px; text-transform:uppercase; font-weight:700; }
.stamp .mid{ font-size:15px; font-weight:700; }

/* ================= VIEW / PRINT SLIP ================= */
.slip{ padding: 34px; max-width: 760px; }
.slip-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  border-bottom: 3px double var(--ink);
  padding-bottom: 18px;
  margin-bottom: 24px;
  gap: 20px;
}
.slip-head h2{ margin:0 0 4px; font-size: 21px; }
.slip-meta{ font-size: 13px; color: var(--muted); }
.slip-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 20px 30px; margin-bottom: 24px; }
.slip-grid .k{ font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:3px; }
.slip-grid .v{ font-size: 15px; font-weight:600; }
.slip-desc{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 24px;
  white-space: pre-wrap;
}
.pay-table{ width:100%; border-collapse: collapse; margin-bottom: 10px; }
.pay-table td{ padding: 10px 4px; border-bottom: 1px solid var(--line); font-size:14px; }
.pay-table tr:last-child td{ border-bottom:none; font-weight:700; font-size:16px; padding-top:14px; }
.pay-table td.r{ text-align:right; font-variant-numeric: tabular-nums; }

/* ================= RECENT LIST (dashboard) ================= */
.mini-row{
  display:flex; align-items:center; gap:14px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.mini-row:last-child{ border-bottom:none; }
.mini-icon{
  width:38px; height:38px; border-radius:8px;
  background: var(--paper);
  border: 1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
  color: var(--gold);
  flex-shrink:0;
}
.mini-info{ flex:1; min-width:0; }
.mini-info .t{ font-weight:600; color: var(--ink); font-size: 13.8px; }
.mini-info .s{ font-size: 12px; color: var(--muted); }

@media print{
  .no-print, .app-sidebar, .app-topbar{ display:none !important; }
  .app-main{ margin-left:0; }
  body{ background:#fff; }
  .slip{ border:none !important; padding:0; }

}

@media (max-width: 991.98px){
  .app-main{ margin-left: 0; }
  .app-content{ padding: 20px 16px 50px; }
  .app-topbar{ padding: 14px 16px; }
}