/* ============================================================
   Bhagwati Print — bridge: existing view classes → Desi Finesse
   pixel system (textile-wholesale-ecomm-erp)
   ============================================================ */

:root {
  --sidebar-w: var(--sidebar-width, 260px);
}

/* Page shell already from reference app.css / sidebar.css */

/* Cards (legacy .card → surface card) */
.content-area .card,
.el-page .card {
  background: var(--surface, #fff);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.content-area .card > h2,
.content-area .card > h3,
.content-area .box-header {
  margin: -20px -22px 16px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 14px 14px 0 0;
}

/* Buttons */
.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .15s, color .15s, border-color .15s;
  line-height: 1.2;
  font-family: inherit;
  box-sizing: border-box;
}
.btn:hover { background: #15803d; box-shadow: 0 2px 8px rgba(22,163,74,.25); color: #fff; }
.btn-accent, .btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
a.btn.btn-ghost,
button.btn.btn-ghost,
.btn.btn-ghost,
a.btn.btn-default,
button.btn.btn-default,
.btn.btn-default {
  background: #fff !important;
  color: #166534 !important;
  border: 1px solid #86efac !important;
  box-shadow: none !important;
}
a.btn.btn-ghost:hover,
button.btn.btn-ghost:hover,
.btn.btn-ghost:hover,
a.btn.btn-default:hover,
.btn.btn-default:hover {
  background: #f0fdf4 !important;
  color: #14532d !important;
  border-color: #16a34a !important;
}
.btn-sm { height: 32px; padding: 0 10px; font-size: 0.78rem; border-radius: 8px; }
a.btn.btn-danger-ghost,
button.btn.btn-danger-ghost,
.btn.btn-danger-ghost {
  background: #fff !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
}
a.btn.btn-danger-ghost:hover,
button.btn.btn-danger-ghost:hover,
.btn.btn-danger-ghost:hover {
  background: #fef2f2 !important;
  border-color: #dc2626 !important;
  color: #b91c1c !important;
}
/* Active filter chip (solid green among ghosts) */
.actions > a.btn:not(.btn-ghost):not(.btn-default):not(.btn-danger-ghost) {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

/* Forms */
.content-area label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin: 0 0 5px;
}
.content-area input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.content-area select,
.content-area textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: #0f172a;
}
.content-area textarea { height: auto; min-height: 88px; padding: 10px 12px; }
.content-area input:focus,
.content-area select:focus,
.content-area textarea:focus {
  border-color: #20c997;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.15);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Tables */
.content-area table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.content-area th,
.content-area td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid #ececec;
  vertical-align: middle;
}
.content-area th {
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.content-area tr:hover td { background: #f0fdf4; }
.table-scroll {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

/* Badges / flash / empty */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}
.badge-ok { background: #f0fdf4; color: #15803d; }
.badge-warn { background: #fffbeb; color: #b45309; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-info { background: #ecfeff; color: #0e7490; }

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin: 0 0 14px;
  border: 1px solid transparent;
  font-weight: 500;
}
.flash-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.flash-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.empty {
  margin: 8px 0 0;
  padding: 28px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #94a3b8;
  background: #fafafa;
  text-align: center;
}
.muted { color: #94a3b8; font-size: 0.85rem; }

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
.filter-bar input,
.filter-bar select {
  margin: 0 !important;
  max-width: 260px;
  flex: 1;
  height: 40px !important;
}
.filter-bar .btn { margin: 0; height: 40px; }

/* Stats / KPI (dashboard) */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  padding: 16px;
  position: relative;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #20c997;
  border-radius: 4px 0 0 4px;
}
.stat:nth-child(2)::before { background: #16a34a; }
.stat:nth-child(3)::before { background: #d97706; }
.stat:nth-child(4)::before { background: #0891b2; }
.stat b { display: block; font-size: 1.6rem; font-weight: 700; color: #111827; }
.stat span { font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

.kpi-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f766e;
  line-height: 1.25;
}
.kpi-red .kpi-sub { color: #b91c1c; }
.kpi-orange .kpi-sub { color: #b45309; }

.dash-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.dash-range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-range-meta {
  margin: 0 0 14px;
  font-size: 0.84rem;
}
.dash-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.dash-chart-wide { grid-column: 1 / -1; }
.dash-chart-card { margin: 0; }
.dash-chart-title {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
}
.dash-chart-wrap {
  position: relative;
  height: 260px;
}
.dash-chart-wrap--donut { height: 240px; }
.dash-side-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dash-side-grid .card { margin: 0; }

@media (max-width: 900px) {
  .dash-charts-grid,
  .dash-side-grid {
    grid-template-columns: 1fr;
  }
  .dash-chart-wide { grid-column: auto; }
  .dash-chart-wrap { height: 220px; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  padding: 18px 16px;
  border-radius: 14px;
  color: #111827 !important;
  text-decoration: none !important;
  background: #fff !important;
  border: 1px solid #e5e7eb;
  border-top: 3px solid #16a34a;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.06); color: #111827 !important; }
.kpi-value { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; color: #111827; line-height: 1.1; }
.kpi-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em; opacity: 1; font-weight: 600; color: #6b7280; }
.kpi-purple, .kpi-pink, .kpi-green, .kpi-blue, .kpi-orange,
.kpi-teal, .kpi-indigo, .kpi-slate { border-top-color: #16a34a; background: #fff !important; }
.kpi-red { border-top-color: #ef4444; background: #fff !important; }
.kpi-orange { border-top-color: #f59e0b; }
.kpi-blue { border-top-color: #2563eb; }
.kpi-process {
  background: #fff;
  color: #169B62 !important;
  border: 1px solid #D9EFE2;
}
.kpi-process .kpi-label { color: #475569; opacity: 1; }
.kpi-process-amt {
  background: #fff;
  color: #b91c1c !important;
  border: 1px solid #e5e7eb;
}
.kpi-process-amt .kpi-label { color: #475569; opacity: 1; }

.flow-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; align-items: center; }
.flow-strip span,
.flow-strip a {
  background: #e9f8ef;
  color: #169B62;
  border: 1px solid #D9EFE2;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.flow-strip a:hover { background: #169B62; color: #fff; border-color: #169B62; }
.flow-strip span.done { background: #d1fae5; color: #047857; border-color: #6ee7b7; }
.flow-strip span.current { background: #169B62; color: #fff; border-color: #169B62; box-shadow: 0 0 0 2px rgba(22,155,98,.25); }

.pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 14px 0 0; }
.pager a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 8px; border-radius: 8px; border: 1px solid #e5e7eb;
  color: #169B62; background: #fff; font-size: 0.8rem; font-weight: 600;
}
.pager a.active, .pager a:hover {
  background: #169B62; color: #fff; border-color: #169B62;
}

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
}
.alert-list .alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-list .alert-info { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }

.callout {
  padding: 12px 16px;
  margin: 0 0 14px;
  border-left: 4px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: 1px solid #e5e7eb;
  border-left-width: 4px;
}
.callout-info { border-left-color: #0891b2; }
.callout-warning { border-left-color: #d97706; }

/* Searchable autocomplete select (app.js) */
.ss-wrap { position: relative; display: block; width: 100%; min-width: 0; z-index: 1; }
.ss-wrap .ss-native {
  position: absolute !important;
  left: 0; top: 0;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important; pointer-events: none !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
}
.ss-input {
  width: 100%;
  margin: 0;
  height: 40px;
  padding: 0 52px 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.ss-input:focus,
.ss-wrap.ss-open .ss-input {
  outline: none;
  border-color: #20c997;
  box-shadow: 0 0 0 3px rgba(32, 201, 151, .15);
}
.ss-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.ss-wrap.ss-has-value .ss-clear:not([hidden]) { display: inline-flex; }
.ss-clear:hover { background: #cbd5e1; color: #0f172a; }
.ss-list {
  display: none;
  position: absolute;
  z-index: 120;
  left: 0; right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  -webkit-overflow-scrolling: touch;
}
/* Portal mode (appended to body) — escapes card/filter overflow clipping */
.ss-list[data-ss-portal="1"] {
  position: fixed !important;
  right: auto !important;
  margin: 0;
}
.ss-list.ss-open { display: block; }
.ss-wrap.ss-open { z-index: 40; }
.filter-bar { overflow: visible !important; position: relative; }
.form-grid { overflow: visible !important; }
.toolbar { overflow: visible !important; }
.content-area .table-scroll { overflow-x: auto; overflow-y: visible; }
.ss-opt {
  display: block; width: 100%; text-align: left; border: 0;
  background: #fff; padding: 9px 12px; font: inherit; color: #0f172a; cursor: pointer;
}
.ss-opt:hover, .ss-opt.ss-active { background: #e9f8ef; color: #169B62; }
.ss-opt.ss-selected { background: #e9f8ef; color: #169B62; font-weight: 600; }
.ss-opt.ss-blank { color: #94a3b8; font-style: italic; }
.ss-opt mark {
  background: #bbf7d0;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 600;
}
.ss-empty { padding: 12px; color: #94a3b8; font-size: 0.8rem; }
.filter-bar .ss-wrap { flex: 1; max-width: 320px; min-width: 160px; }
.filter-bar .ss-wrap.ss-wide,
.ss-wrap.ss-wide { max-width: 480px; min-width: 240px; }
.live-search-hint {
  font-size: 0.8rem;
  margin: 0.35rem 0 0.65rem;
  color: #64748b;
}

.list-filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin: 0 0 12px; padding: 10px 12px;
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px;
}
.list-filter-bar input[type="search"] {
  flex: 1; min-width: 180px; max-width: 420px; margin: 0 !important; height: 36px !important;
}
tr.list-filter-hide { display: none !important; }

.row-actions { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.form-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 16px; border-top: 1px solid #e5e7eb;
}

/* Page header inside content (when views don't have el-page) */
.bp-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.bp-page-head h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: #111827;
}
.bp-page-crumb {
  font-size: 0.78rem;
  color: #9ca3af;
  margin: 0 0 4px;
}
.bp-page-crumb a { color: #6b7280; text-decoration: none; }
.bp-page-crumb a:hover { color: #16a34a; }

/* Flat mega body without nested group chrome */
.app-sidebar .nav-mega-body > .nav-sub-item,
.app-sidebar .nav-mega-body > a.nav-sub-item {
  display: block;
  padding: 7px 12px 7px 18px;
  margin: 1px 0;
  color: var(--sidebar-muted, #6B7280);
  font-size: 0.78rem;
  border-radius: 8px;
  text-decoration: none;
}
.app-sidebar .nav-mega-body > a.nav-sub-item:hover {
  color: var(--sidebar-text, #3D4B57);
  background: var(--sidebar-hover, #EEF8F3);
}
.app-sidebar .nav-mega-body > a.nav-sub-item.active {
  color: var(--sidebar-primary, #169B62);
  background: var(--sidebar-active-bg, #E5F7ED);
  font-weight: 600;
}

/* User menu without bootstrap dropdown JS */
.bp-user-menu { position: relative; }
.bp-user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 4px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.bp-user-menu-btn:hover { background: #f8fafc; }
.user-avatar-initials {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e9f8ef; color: #169B62;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
}
.bp-user-dropdown {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  min-width: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 8px;
  z-index: 120;
}
.bp-user-menu.open .bp-user-dropdown { display: block; }
.bp-user-dropdown a,
.bp-user-dropdown .bp-user-meta {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-size: 0.85rem;
}
.bp-user-dropdown a:hover { background: #f0fdf4; color: #169B62; }
.bp-user-dropdown .bp-user-meta { color: #94a3b8; font-size: 0.75rem; }
.bp-user-dropdown .text-danger { color: #dc2626 !important; }

/* Login uses auth-premium when available; keep fallback */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(32, 201, 151, .18), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(22, 155, 98, .12), transparent 45%),
    #f7f8fa;
}
.login-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border: 1px solid #ececec;
}
.login-card h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  color: #0f172a;
  font-weight: 700;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
}
.login-card .tagline {
  margin: 0 0 22px;
  color: #94a3b8;
  text-align: center;
  font-size: 0.85rem;
}
