/* ============================================================================
 * shared/app.css — B.6 Theme Refresh   (Apr 2026, 3C: Forest + Mustard)
 * ============================================================================
 *  Brand colors:  Forest #14532d  |  Mustard #ca8a04
 *  Fonts:         Lora (headings)  |  Inter (body)  |  Noto Sans Gurmukhi (Punjabi)
 *
 *  Module CSS files keep their existing class names — every selector below
 *  is either the same as before or strictly additive. CSS variable NAMES
 *  (--navy, --blue) are kept for backward compat; only their VALUES changed.
 * ============================================================================ */

/* ─── Web fonts ────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:wght@500;600;700&family=Noto+Sans+Gurmukhi:wght@400;500;600&display=swap');

/* ─── CSS variables ────────────────────────────────────────────── */
:root {
  /* Brand — Forest Green & Mustard (3C) */
  --navy:        #14532d;   /* forest green; var name kept for compat */
  --navy-dark:   #052e16;
  --navy-light:  #166534;
  --forest:      #14532d;   /* readable alias */
  --forest-deep: #052e16;

  /* Accent — mustard values, names kept as --blue* for backward compat */
  --blue:        #ca8a04;   /* mustard-600 */
  --blue-bright: #eab308;   /* yellow-500 */
  --blue-light:  #fef9c3;   /* yellow-100 — pill bg */
  --mustard:     #ca8a04;   /* readable alias */
  --mustard-deep:#a16207;
  /* Old amber aliases — preserved so any leftover module code keeps working */
  --amber:       #ca8a04;
  --amber-deep:  #a16207;

  /* Status */
  --green:       #16a34a;
  --green-light: #ecfdf5;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --yellow:      #eab308;
  --yellow-light:#fef9c3;
  --orange:      #ea580c;
  --purple:      #7c3aed;

  /* Surfaces — warm ivory family */
  --bg:          #fdfaee;
  --bg-soft:     #fffbeb;
  --surface:     #ffffff;
  --border:      #fde68a;   /* soft mustard border */
  --border-soft: #fef9c3;

  /* Text */
  --text:        #292524;   /* warm dark */
  --text-mute:   #6b7280;
  --text-dim:    #a8a29e;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(20, 83, 45, 0.06);
  --shadow-md:   0 4px 14px rgba(20, 83, 45, 0.10);
  --shadow-lg:   0 12px 32px rgba(20, 83, 45, 0.16);
  --shadow-glow: 0 0 0 3px rgba(202, 138, 4, 0.25);   /* mustard focus ring */

  /* Geometry */
  --radius:      10px;
  --radius-lg:   14px;
  --radius-pill: 999px;
  --sidebar-w:   244px;
  --topbar-h:    60px;

  /* Typography */
  --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', 'Noto Sans Gurmukhi', Arial, Helvetica, sans-serif;

  /* Motion */
  --ease:        cubic-bezier(.2,.8,.2,1);
  --t-fast:      0.15s;
  --t-med:       0.22s;
}

/* ─── Reset & basics ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 1px 1px, rgba(202, 138, 4, 0.07) 1px, transparent 0),
    var(--bg);
  background-size: 22px 22px, auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--navy);
  margin-top: 0;
  letter-spacing: -0.005em;
}
h1 { font-weight: 700; }
a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { text-decoration: underline; color: var(--blue-bright); }
code {
  font-family: 'JetBrains Mono', Menlo, Consolas, 'Courier New', monospace;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--navy);
  border: 1px solid var(--border-soft);
}

/* ─── App layout ───────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.app-layout::before, .app-layout::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}
.app-layout::before {
  top: -180px; right: -160px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(234, 179, 8, 0.32) 0%, rgba(234, 179, 8, 0) 70%);
}
.app-layout::after {
  bottom: -200px; left: 200px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(20, 83, 45, 0.18) 0%, rgba(20, 83, 45, 0) 70%);
}
.sidebar { z-index: 5; }
.topbar  { z-index: 50; }

/* ═══════════════════════════════════════════════════════════════════════
 *  SIDEBAR
 * ═══════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #166534 0%, #14532d 50%, #052e16 100%);
  color: #ecfccb;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  box-shadow: 4px 0 14px rgba(20, 83, 45, 0.16);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-head {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
}
.sidebar-logos { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.sidebar-logos img { height: 44px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.sidebar-title {
  font-family: var(--font-heading);
  font-size: 19px; font-weight: 700;
  letter-spacing: 0.2px;
}
.sidebar-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 4px;
  font-weight: 500;
}
.sidebar-nav { flex: 1; padding: 14px 0; }
.nav-section { margin-bottom: 16px; }
.nav-label {
  padding: 0 22px 8px;
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.42);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 22px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              padding-left var(--t-fast) var(--ease);
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  padding-left: 26px;
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.30) 0%, rgba(234, 179, 8, 0.06) 100%);
  border-left-color: var(--blue-bright);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 14px; top: 50%;
  width: 5px; height: 5px;
  background: var(--blue-bright);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 8px var(--blue-bright);
}
.nav-item.disabled { color: rgba(255,255,255,0.32); cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; padding-left: 22px; }
.nav-ico { font-size: 16px; width: 22px; text-align: center; }

.sidebar-foot {
  padding: 14px 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  border-top: 1px solid rgba(255,255,255,0.10);
  text-align: center;
  letter-spacing: 0.4px;
}

/* ═══════════════════════════════════════════════════════════════════════
 *  TOPBAR + MAIN
 * ═══════════════════════════════════════════════════════════════════════ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-burger {
  background: none; border: 0; font-size: 22px;
  cursor: pointer; color: var(--navy);
  display: none;
  padding: 4px 8px; border-radius: var(--radius);
  transition: background var(--t-fast) var(--ease);
}
.topbar-burger:hover { background: var(--blue-light); }
.topbar-title {
  font-family: var(--font-heading);
  font-size: 19px; font-weight: 600;
  color: var(--navy); flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-pill {
  display: flex; flex-direction: column;
  font-size: 13px; color: var(--text);
  text-align: right; line-height: 1.2;
}
.user-pill strong { color: var(--navy); font-weight: 600; }
.user-role {
  font-size: 10.5px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-top: 1px;
}
.btn-logout {
  background: var(--navy); color: #fff;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--navy);
  transition: all var(--t-med) var(--ease);
}
.btn-logout:hover {
  background: var(--blue);
  border-color: var(--blue);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.content { padding: 28px; max-width: 1320px; position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════════════════════════
 *  WELCOME / DASHBOARD CARDS
 * ═══════════════════════════════════════════════════════════════════════ */
.welcome-card {
  background: linear-gradient(135deg, #14532d 0%, #166534 60%, #15803d 100%);
  color: #ecfccb;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.welcome-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(234, 179, 8, 0.22) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-card::after {
  content: '';
  position: absolute;
  bottom: -40%; left: -5%;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-card h1 {
  color: #fef9c3; font-size: 26px; margin: 0 0 6px;
  font-weight: 700;
  position: relative;
}
.welcome-sub {
  margin: 0; opacity: 0.92; font-size: 14.5px; position: relative;
  color: #ecfccb;
}

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--ease),
              box-shadow var(--t-med) var(--ease);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card:nth-child(2) { border-left-color: var(--mustard); }
.kpi-card:nth-child(3) { border-left-color: #b45309; }   /* copper */
.kpi-card:nth-child(4) { border-left-color: #7c2d12; }   /* plum brown */
.kpi-num {
  font-family: var(--font-heading);
  font-size: 30px; font-weight: 700;
  color: var(--navy); line-height: 1;
  letter-spacing: -0.01em;
}
.kpi-label {
  font-size: 11.5px; color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 8px;
  font-weight: 500;
}
.kpi-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

/* ═══════════════════════════════════════════════════════════════════════
 *  CARDS
 * ═══════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-med) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-title {
  font-family: var(--font-heading);
  font-size: 17px; font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 12px;
  position: relative;
}
.card-title::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 42px; height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright));
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
 *  ALERTS
 * ═══════════════════════════════════════════════════════════════════════ */
.alert {
  padding: 13px 16px 13px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid;
  border-left-width: 4px;
}
.alert-info { background: var(--blue-light);  border-color: var(--blue);   color: var(--navy); }
.alert-ok   { background: var(--green-light); border-color: #6ee7b7;        color: #065f46; }
.alert-warn { background: var(--yellow-light);border-color: #fde047;        color: #854d0e; }
.alert-err  { background: var(--red-light);   border-color: #fca5a5;        color: #991b1b; }

/* ═══════════════════════════════════════════════════════════════════════
 *  EMPTY STATES — unified component
 * ═══════════════════════════════════════════════════════════════════════ */
.empty-state {
  padding: 32px 20px;
  text-align: center;
  background: var(--bg-soft);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 13.5px;
}
.empty-state-icon { font-size: 36px; opacity: 0.5; display: block; margin: 0 auto 8px; }
.empty-state-text { font-weight: 500; }
.empty-state-hint { font-size: 12px; margin-top: 4px; opacity: 0.85; }

/* ═══════════════════════════════════════════════════════════════════════
 *  PROGRESS LIST
 * ═══════════════════════════════════════════════════════════════════════ */
.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list > li { padding: 7px 0; font-size: 14px; }
.progress-list ul { margin: 6px 0 0 24px; padding: 0; list-style: none; }
.progress-list ul li { padding: 3px 0; font-size: 13px; color: var(--text-mute); }
.progress-list .done > strong { color: var(--green); }
.progress-list .done { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════
 *  BUTTONS
 * ═══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff; color: var(--text);
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-body);
  letter-spacing: 0.1px;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-med) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] {
  opacity: 0.55; cursor: not-allowed;
  transform: none !important; box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(180deg, var(--blue) 0%, var(--mustard-deep) 100%);
  color: #fff; border-color: var(--mustard-deep);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--blue-bright) 0%, var(--blue) 100%);
  border-color: var(--blue); color: #fff;
  box-shadow: 0 4px 14px rgba(202, 138, 4, 0.36);
}
.btn-success {
  background: linear-gradient(180deg, #22c55e 0%, var(--green) 100%);
  color: #fff; border-color: var(--green);
}
.btn-success:hover {
  background: linear-gradient(180deg, #34d169 0%, #15803d 100%);
  color: #fff; border-color: #15803d;
  box-shadow: 0 4px 14px rgba(22,163,74,0.32);
}
.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, var(--red) 100%);
  color: #fff; border-color: var(--red);
}
.btn-danger:hover {
  background: linear-gradient(180deg, #f56565 0%, #b91c1c 100%);
  color: #fff; border-color: #b91c1c;
  box-shadow: 0 4px 14px rgba(220,38,38,0.32);
}

.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════════
 *  UNIFIED TABS  (B.6)
 * ═══════════════════════════════════════════════════════════════════════
 *  Old per-module tab classes are aliased so existing modules pick up
 *  the new look without HTML changes.
 * ═══════════════════════════════════════════════════════════════════════ */

.tabs,
.settings-tabs,
.detail-tabs,
.tx-tabs {
  display: flex; flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  background: transparent;
  padding: 0;
}

.tab,
.tab-btn,
.dt-tab,
.tx-tab-btn {
  background: none; border: 0;
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover, .tab-btn:hover, .dt-tab:hover,
.tx-tab-btn:hover { color: var(--navy); background: transparent; }

.tab.active, .tab-btn.active, .dt-tab.active,
.tx-tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--blue);
  background: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════
 *  FORMS
 * ═══════════════════════════════════════════════════════════════════════ */
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], input[type="tel"],
input[type="search"], input[type="url"], input[type="time"],
input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--shadow-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  display: block;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}

/* ═══════════════════════════════════════════════════════════════════════
 *  TABLES
 * ═══════════════════════════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--navy);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
}
tbody tr { transition: background var(--t-fast) var(--ease); }
tr:hover td { background: #f9fafc; }

/* ═══════════════════════════════════════════════════════════════════════
 *  SCROLLBAR
 * ═══════════════════════════════════════════════════════════════════════ */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
*::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════════════════
 *  RESPONSIVE
 * ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topbar-burger { display: block; }
  .sidebar {
    position: fixed; left: -260px; top: 0;
    transition: left var(--t-med) var(--ease);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
  }
  .content { padding: 18px; }
  .welcome-card { padding: 22px 24px; }
  .welcome-card h1 { font-size: 22px; }
  .user-pill { display: none; }
  .topbar-title { font-size: 17px; }
}

/* ═══════════════════════════════════════════════════════════════════════
 *  PRINT — base only. Modules override .receipt-print etc. as needed.
 * ═══════════════════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .btn, .btn-logout { display: none !important; }
  .app-layout::before, .app-layout::after { display: none !important; }
  body {
    background: #fff !important;
    background-image: none !important;
  }
  .content { padding: 0; max-width: none; }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
