/* ============================================================
   ACCOUNTIUM — Shared Design System
   Version 2.0
   Drop this file into your project and link it on every page
   AFTER your Bootstrap and AdminLTE stylesheets.
   
   Usage:
   <link rel="stylesheet" href="/css/accountium.css" />
   ============================================================ */


/* ============================================================
   1. COLOUR TOKENS
   Built from your existing palette: #3d85c6 / #e69138 / #6aa84f
   ============================================================ */
:root {

  /* --- Brand Blue (primary actions, links, focus) --- */
  --clr-blue-50:  #eaf2fb;
  --clr-blue-100: #c4dbf4;
  --clr-blue-200: #9dc4ec;
  --clr-blue-300: #6aa8e2;
  --clr-blue-400: #3d85c6;   /* ← your primary blue */
  --clr-blue-500: #2e6eab;
  --clr-blue-600: #215990;
  --clr-blue-700: #164376;
  --clr-blue-800: #0d2f5c;
  --clr-blue-900: #071c42;

  /* --- Amber (warnings, Due status, destructive-secondary) --- */
  --clr-amber-50:  #fdf3e7;
  --clr-amber-100: #f9ddb5;
  --clr-amber-200: #f5c782;
  --clr-amber-300: #efaa4d;
  --clr-amber-400: #e69138;   /* ← your amber */
  --clr-amber-500: #cc7a28;
  --clr-amber-600: #a8631b;
  --clr-amber-700: #864d11;
  --clr-amber-800: #643809;
  --clr-amber-900: #422503;

  /* --- Green (Paid status, success) --- */
  --clr-green-50:  #eef6e9;
  --clr-green-100: #cde7be;
  --clr-green-200: #abd793;
  --clr-green-300: #84c364;
  --clr-green-400: #6aa84f;   /* ← your green */
  --clr-green-500: #568f3e;
  --clr-green-600: #42762e;
  --clr-green-700: #305e20;
  --clr-green-800: #204614;
  --clr-green-900: #112e09;

  /* --- Red (delete, danger) --- */
  --clr-red-50:  #fdf0f0;
  --clr-red-100: #f7cccc;
  --clr-red-200: #f0a0a0;
  --clr-red-400: #e05252;
  --clr-red-500: #c73f3f;
  --clr-red-600: #b33a3a;

  /* --- Neutrals --- */
  --clr-gray-0:   #ffffff;
  --clr-gray-25:  #fafafa;
  --clr-gray-50:  #f5f6f8;
  --clr-gray-100: #eaecef;
  --clr-gray-200: #d4d8de;
  --clr-gray-300: #b0b7c2;
  --clr-gray-400: #8c95a4;
  --clr-gray-500: #636d7e;
  --clr-gray-600: #45505f;
  --clr-gray-700: #2e3847;
  --clr-gray-800: #1e2a38;
  --clr-gray-900: #111820;

  /* --- Sidebar --- */
  --clr-sidebar:  #1B2631;    /* your existing sidebar colour */
  --clr-sidebar-hover: #243344;
  --clr-sidebar-active: #2e3f52;
  --clr-sidebar-text: rgba(255,255,255,0.85);
  --clr-sidebar-text-muted: rgba(255,255,255,0.45);

  /* --- Semantic aliases (use these in components) --- */
  --color-primary:        var(--clr-blue-400);
  --color-primary-light:  var(--clr-blue-50);
  --color-primary-dark:   var(--clr-blue-600);
  --color-primary-hover:  var(--clr-blue-500);

  --color-warning:        var(--clr-amber-400);
  --color-warning-light:  var(--clr-amber-50);
  --color-warning-dark:   var(--clr-amber-600);

  --color-success:        var(--clr-green-400);
  --color-success-light:  var(--clr-green-50);
  --color-success-dark:   var(--clr-green-600);

  --color-danger:         var(--clr-red-400);
  --color-danger-light:   var(--clr-red-50);

  --color-bg:             var(--clr-gray-0);
  --color-bg-subtle:      var(--clr-gray-25);
  --color-bg-muted:       var(--clr-gray-50);
  --color-border:         var(--clr-gray-200);
  --color-border-strong:  var(--clr-gray-300);

  --color-text:           var(--clr-gray-800);
  --color-text-muted:     var(--clr-gray-500);
  --color-text-faint:     var(--clr-gray-400);

  /* --- Invoice status aliases --- */
  --status-due-bg:        var(--clr-amber-50);
  --status-due-text:      var(--clr-amber-600);
  --status-due-border:    var(--clr-amber-200);

  --status-paid-bg:       var(--clr-green-50);
  --status-paid-text:     var(--clr-green-600);
  --status-paid-border:   var(--clr-green-200);

  --status-sent-bg:       var(--clr-blue-50);
  --status-sent-text:     var(--clr-blue-500);
  --status-sent-border:   var(--clr-blue-200);
}


/* ============================================================
   2. TYPOGRAPHY
   Using DM Sans — clean, modern, professional. Pairs well
   with Source Sans Pro already loaded on your pages.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --font-base:    'DM Sans', 'Source Sans Pro', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --text-xs:    11px;
  --text-sm:    12px;
  --text-base:  14px;
  --text-md:    16px;
  --text-lg:    18px;
  --text-xl:    22px;
  --text-2xl:   28px;
  --text-3xl:   36px;

  /* Weights */
  --fw-normal:  400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* Line heights */
  --lh-tight:   1.2;
  --lh-snug:    1.4;
  --lh-base:    1.6;
  --lh-relaxed: 1.75;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-bg-subtle);
  -webkit-font-smoothing: antialiased;
}


/* ============================================================
   3. SPACING & LAYOUT
   ============================================================ */
:root {
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-16:  64px;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-pill: 999px;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  --transition: 0.18s ease;
}


/* ============================================================
   4. BUTTONS
   ============================================================ */

/* Base */
.acm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  height: 36px;
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.acm-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Primary — blue fill */
.acm-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.acm-btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}

/* Secondary — outlined blue */
.acm-btn-secondary {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.acm-btn-secondary:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* Ghost — no border, subtle hover */
.acm-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}
.acm-btn-ghost:hover {
  background: var(--clr-gray-100);
  color: var(--color-text);
}

/* Danger — red outlined */
.acm-btn-danger {
  background: transparent;
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.acm-btn-danger:hover {
  background: var(--color-danger-light);
}

/* Warning — amber outlined */
.acm-btn-warning {
  background: transparent;
  border-color: var(--color-warning);
  color: var(--color-warning-dark);
}
.acm-btn-warning:hover {
  background: var(--color-warning-light);
}

/* Success — green outlined */
.acm-btn-success {
  background: transparent;
  border-color: var(--color-success);
  color: var(--color-success-dark);
}
.acm-btn-success:hover {
  background: var(--color-success-light);
}


/* ============================================================
   5. STATUS BADGES
   ============================================================ */
.acm-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}

.acm-status-due {
  background: var(--status-due-bg);
  color: var(--status-due-text);
  border-color: var(--status-due-border);
}

.acm-status-paid {
  background: var(--status-paid-bg);
  color: var(--status-paid-text);
  border-color: var(--status-paid-border);
}

.acm-status-sent {
  background: var(--status-sent-bg);
  color: var(--status-sent-text);
  border-color: var(--status-sent-border);
}

.acm-status-overdue {
  background: var(--color-danger-light);
  color: var(--clr-red-500);
  border-color: var(--clr-red-100);
}


/* ============================================================
   6. FORM INPUTS
   ============================================================ */
.acm-input,
.acm-select,
.acm-textarea {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-3);
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.acm-input::placeholder,
.acm-textarea::placeholder { color: var(--color-text-faint); }

.acm-input:hover,
.acm-select:hover,
.acm-textarea:hover { border-color: var(--color-border-strong); }

.acm-input:focus,
.acm-select:focus,
.acm-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(61, 133, 198, 0.15);
}

.acm-textarea { height: auto; padding: var(--sp-3); resize: vertical; line-height: var(--lh-base); }
.acm-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238c95a4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }

/* Floating label wrapper */
.acm-field {
  position: relative;
  margin-bottom: var(--sp-5);
}

.acm-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-1);
}


/* ============================================================
   7. CARDS
   ============================================================ */
.acm-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.acm-card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acm-card-body {
  padding: var(--sp-5);
}


/* ============================================================
   8. TABLES
   ============================================================ */
.acm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.acm-table thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.acm-table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

.acm-table tbody td.text-end { text-align: right; }
.acm-table tbody td.text-muted { color: var(--color-text-muted); font-size: var(--text-sm); }

.acm-table tbody tr:last-child td { border-bottom: none; }
.acm-table tbody tr:hover td { background: var(--clr-blue-50); }
.acm-table tbody tr.clickable { cursor: pointer; }

/* Amount column — monospace numbers */
.acm-table .col-amount {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: right;
}

/* Summary row */
.acm-table tfoot td {
  padding: var(--sp-3) var(--sp-4);
  border-top: 2px solid var(--color-border-strong);
  font-weight: var(--fw-semi);
  background: var(--color-bg-subtle);
}


/* ============================================================
   9. PAGE TOOLBAR
   ============================================================ */
.acm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  margin-bottom: var(--sp-4);
}

.acm-toolbar-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semi);
  margin-right: auto;
}

.acm-toolbar-search {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.acm-toolbar-search .acm-input {
  padding-left: 36px;
}

.acm-toolbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  font-size: 14px;
  pointer-events: none;
}


/* ============================================================
   10. STAT CARDS
   ============================================================ */
.acm-stat {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.acm-stat-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}

.acm-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.acm-stat.stat-due .acm-stat-value   { color: var(--color-warning-dark); }
.acm-stat.stat-paid .acm-stat-value  { color: var(--color-success-dark); }
.acm-stat.stat-total .acm-stat-value { color: var(--color-primary); }


/* ============================================================
   11. PAGINATION
   ============================================================ */
.acm-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-4) 0;
}

.acm-pagination a,
.acm-pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-family: var(--font-base);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.acm-pagination a:hover,
.acm-pagination button:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.acm-pagination .active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}


/* ============================================================
   12. MODAL / OVERLAY
   ============================================================ */
.acm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.acm-overlay.open {
  opacity: 1;
  visibility: visible;
}

.acm-modal {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.acm-modal-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acm-modal-body { padding: var(--sp-6); }

.acm-modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* Mobile bottom sheet */
@media (max-width: 640px) {
  .acm-overlay { align-items: flex-end; padding: 0; }
  .acm-modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 100%;
  }
}


/* ============================================================
   13. TOAST NOTIFICATIONS
   ============================================================ */
.acm-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-md);
  z-index: 1100;
  animation: acm-toast-in 0.25s ease;
}

@keyframes acm-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.acm-toast-success { background: var(--color-bg); border: 1.5px solid var(--color-success); color: var(--color-success-dark); }
.acm-toast-error   { background: var(--color-bg); border: 1.5px solid var(--color-danger); color: var(--clr-red-500); }
.acm-toast-warning { background: var(--color-bg); border: 1.5px solid var(--color-warning); color: var(--color-warning-dark); }
.acm-toast-info    { background: var(--color-bg); border: 1.5px solid var(--color-primary); color: var(--color-primary); }


/* ============================================================
   14. INVOICE-SPECIFIC COMPONENTS
   ============================================================ */

/* Invoice line item row */
.acm-line-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.acm-line-row:last-child { border-bottom: none; }

/* Totals block */
.acm-totals {
  margin-left: auto;
  width: 260px;
}

.acm-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  font-size: var(--text-base);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.acm-totals-row:last-child { border-bottom: none; }

.acm-totals-row.total {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  border-top: 2px solid var(--color-border-strong);
  padding-top: var(--sp-3);
  margin-top: var(--sp-1);
}

.acm-totals-row .amount {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* Action dropdown (replaces generic Bootstrap dropdown) */
.acm-action-menu {
  position: relative;
  display: inline-block;
}

.acm-action-menu-trigger {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

.acm-action-menu-trigger:hover { background: var(--color-primary-light); }

.acm-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  z-index: 100;
  overflow: hidden;
}

.acm-dropdown a,
.acm-dropdown button {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-family: var(--font-base);
  font-weight: var(--fw-normal);
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
  text-align: left;
}

.acm-dropdown a:hover,
.acm-dropdown button:hover { background: var(--color-bg-muted); }
.acm-dropdown a.danger,
.acm-dropdown button.danger { color: var(--color-danger); }
.acm-dropdown a.danger:hover,
.acm-dropdown button.danger:hover { background: var(--color-danger-light); }


/* ============================================================
   15. INVOICE CARD (grid/mobile view)
   ============================================================ */
.acm-invoice-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.acm-invoice-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.acm-invoice-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.acm-invoice-card-num {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.acm-invoice-card-name {
  font-size: var(--text-md);
  font-weight: var(--fw-semi);
  color: var(--color-text);
  line-height: var(--lh-snug);
}

.acm-invoice-card-summary {
  font-size: var(--text-sm);
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acm-invoice-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acm-invoice-card-amount {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.acm-invoice-card-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


/* ============================================================
   16. LOADER SPINNER
   ============================================================ */
.acm-loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--clr-blue-100);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: acm-spin 0.8s linear infinite;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: none;
}

@keyframes acm-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }


/* ============================================================
   17. UTILITY CLASSES
   ============================================================ */

/* Text */
.acm-text-muted   { color: var(--color-text-muted) !important; }
.acm-text-primary { color: var(--color-primary) !important; }
.acm-text-success { color: var(--color-success-dark) !important; }
.acm-text-warning { color: var(--color-warning-dark) !important; }
.acm-text-danger  { color: var(--color-danger) !important; }

/* Font sizes */
.acm-text-xs  { font-size: var(--text-xs) !important; }
.acm-text-sm  { font-size: var(--text-sm) !important; }
.acm-text-md  { font-size: var(--text-md) !important; }
.acm-text-lg  { font-size: var(--text-lg) !important; }

/* Font weights */
.acm-fw-normal { font-weight: var(--fw-normal) !important; }
.acm-fw-medium { font-weight: var(--fw-medium) !important; }
.acm-fw-semi   { font-weight: var(--fw-semi) !important; }
.acm-fw-bold   { font-weight: var(--fw-bold) !important; }

/* Spacing helpers */
.acm-mt-0 { margin-top: 0 !important; }
.acm-mt-2 { margin-top: var(--sp-2) !important; }
.acm-mt-4 { margin-top: var(--sp-4) !important; }
.acm-mb-0 { margin-bottom: 0 !important; }
.acm-mb-2 { margin-bottom: var(--sp-2) !important; }
.acm-mb-4 { margin-bottom: var(--sp-4) !important; }
.acm-mb-6 { margin-bottom: var(--sp-6) !important; }

/* Display */
.acm-hidden     { display: none !important; }
.acm-flex       { display: flex !important; }
.acm-flex-col   { flex-direction: column !important; }
.acm-items-center { align-items: center !important; }
.acm-justify-between { justify-content: space-between !important; }
.acm-gap-2      { gap: var(--sp-2) !important; }
.acm-gap-3      { gap: var(--sp-3) !important; }
.acm-gap-4      { gap: var(--sp-4) !important; }

/* Responsive show/hide */
@media (max-width: 767px) {
  .acm-hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .acm-hide-desktop { display: none !important; }
}


/* ============================================================
   18. SIDEBAR OVERRIDES
   ============================================================ */
.main-sidebar {
  background-color: var(--clr-sidebar) !important;
}

.main-sidebar .nav-link {
  color: var(--clr-sidebar-text) !important;
  transition: background var(--transition);
}

.main-sidebar .nav-link:hover {
  background: var(--clr-sidebar-hover) !important;
}

.main-sidebar .nav-link.active {
  background: var(--clr-sidebar-active) !important;
}

/* Active indicator bar */
.main-sidebar .nav-sidebar > .nav-item > .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.main-sidebar .nav-sidebar .nav-link { position: relative; }

/* Company name in sidebar */
.user-panel .info #CompanyName {
  font-family: var(--font-base) !important;
  font-size: var(--text-md) !important;
  font-weight: var(--fw-semi) !important;
  letter-spacing: 0.02em;
}


/* ============================================================
   19. TOPBAR
   ============================================================ */

.acm-topbar {
  background: var(--clr-sidebar);
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 0 16px 0 12px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.acm-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.acm-topbar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.acm-topbar-toggle:hover { background: rgba(255,255,255,.08); }

.acm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: rgba(255,255,255,.5);
}

.acm-breadcrumb a {
  color: rgba(255,255,255,.5);
  text-decoration: none;
  transition: color var(--transition);
}

.acm-breadcrumb a:hover { color: rgba(255,255,255,.8); }

.acm-breadcrumb .acm-bc-sep { font-size: 10px; }

.acm-breadcrumb .acm-bc-current {
  color: rgba(255,255,255,.9);
  font-weight: var(--fw-medium);
}

.acm-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.acm-topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: rgba(255,255,255,.72);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition);
}
.acm-topbar-user:hover { color: #fff; }
.acm-topbar-user i { font-size: 20px; }

/* Hide username on very small screens, show on ≥600px */
.acm-topbar-user .acm-uname { display: none; }
@media (min-width: 600px) { .acm-topbar-user .acm-uname { display: inline; } }


/* ============================================================
   20. CONTENT AREA & PAGE LAYOUT HELPERS
   ============================================================ */

/* Standard page padding — use on the direct child of main */
.acm-page {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 48px;
}

@media (max-width: 767px) {
  .acm-page { padding: 16px 12px 32px; }
}

/* Page title */
.acm-page-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semi);
  margin-bottom: var(--sp-5);
}


/* ============================================================
   21. RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 767px) {
  /* Sidebar icon size */
  #side .nav-icon.fi {
    font-size: 18px !important;
    width: 22px !important;
    height: 22px !important;
  }

  .user-panel .info #CompanyName {
    font-size: 14px !important;
  }
}

/* Parent menu items */
#side .nav-sidebar > .nav-item > .nav-link > p {
    font-size: 16px !important;
}

/* Child menu items */
#side .nav-sidebar .nav-treeview > .nav-item > .nav-link > p {
    font-size: 14px !important;
}


/* ============================================================
   22. TOPBAR VIEWPORT TOGGLE & BREADCRUMB
   ============================================================ */

/* Topbar container */
.acm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0 8px;
}

.acm-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.acm-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

/* Menu button */
.acm-topbar-menu-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.acm-topbar-menu-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* Breadcrumb */
.acm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.6);
}

.acm-breadcrumb a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.acm-breadcrumb a:hover {
  color: #fff;
}

.acm-breadcrumb-home i {
  font-size: 14px;
}

.acm-breadcrumb-sep {
  color: rgba(255,255,255,0.3);
  font-size: 11px;
}

.acm-breadcrumb-current {
  color: rgba(255,255,255,0.9);
  font-weight: var(--fw-medium);
}

/* Viewport toggle buttons */
.acm-vp-toggle {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.acm-vp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.acm-vp-btn svg {
  stroke: rgba(255,255,255,0.5);
  transition: stroke var(--transition);
}

.acm-vp-btn:hover svg {
  stroke: rgba(255,255,255,0.8);
}

.acm-vp-btn.active {
  background: rgba(255,255,255,0.15);
}

.acm-vp-btn.active svg {
  stroke: #fff;
}

/* Topbar user link */
.acm-topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: color var(--transition);
}

.acm-topbar-user:hover {
  color: #fff;
}

.acm-topbar-user i {
  font-size: 20px;
}
