:root {
  --primary: #3062e1;
  --primary-hover: #2045d1;
  --primary-light: #e8f1ff;
  --primary-border: #3062e133;
  --bg: #f8f9fb;
  --card-bg: #ffffff;
  --line: #e4e9f0;
  --line-light: #edf0f5;
  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
a { color: var(--primary); text-decoration: none; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* App Shell */
.app-shell { display: flex; min-height: 100vh; }

/* Top Header */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  transition: left 0.2s ease;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }

.store-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}
.store-selector-pill:hover { border-color: var(--primary); background: var(--primary-light); }
.store-icon { color: var(--primary); font-size: 16px; }

.lang-pill {
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  color: #4b5563;
}

.header-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.15s;
}
.header-btn:hover { border-color: #cbd5e1; color: var(--text-main); background: #f8fafc; }
.header-btn.primary-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}
.header-btn.primary-btn:hover { background: var(--primary-hover); }

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--primary-border);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 750;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #3062e1, #1d4ed8);
  color: white;
  display: grid;
  place-items: center;
}

.sidebar-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.sidebar-collapse-btn:hover { background: #f1f5f9; color: var(--text-main); }

.sidebar-search {
  padding: 10px 14px;
}
.sidebar-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.sidebar-search-box input {
  border: 0;
  background: transparent;
  width: 100%;
  color: var(--text-main);
  outline: none;
  font-size: 13px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: #f1f5f9; color: var(--primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon {
  width: 18px;
  height: 18px;
  color: #64748b;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav-arrow {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  transition: transform 0.2s;
}
.nav-arrow.open { transform: rotate(180deg); }

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
  text-transform: uppercase;
}
.badge-new { background: #eff6ff; color: #2563eb; }
.badge-beta { background: #fef3c7; color: #b45309; }

.sub-menu {
  padding-left: 28px;
  margin-bottom: 4px;
  display: none;
}
.sub-menu.open { display: block; }
.sub-item {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
  margin-bottom: 1px;
  transition: all 0.15s;
}
.sub-item:hover { color: var(--primary); background: #f8fafc; }
.sub-item.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trust-badges { display: flex; align-items: center; justify-content: space-between; font-weight: 500; }
.secure-pill { color: #16a34a; display: flex; align-items: center; gap: 4px; }

/* Main Area */
.main-wrapper {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left 0.2s ease;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.page-actions { display: flex; align-items: center; gap: 10px; }

/* Cards & Grid */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-bottom: 20px;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metric-box {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.metric-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.metric-icon-green { background: #dcfce7; color: #16a34a; }
.metric-icon-orange { background: #fef3c7; color: #d97706; }
.metric-icon-red { background: #fee2e2; color: #dc2626; }
.metric-icon-blue { background: #dbeafe; color: #2563eb; }
.metric-icon-purple { background: #f3e8ff; color: #9333ea; }
.metric-icon-teal { background: #ccfbf1; color: #0d9488; }

.metric-info { display: flex; flex-direction: column; }
.metric-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.metric-val { font-size: 20px; font-weight: 700; color: var(--text-main); margin-top: 2px; }

/* Quick Actions Grid */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.quick-btn {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s;
  cursor: pointer;
  text-align: center;
}
.quick-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
  transform: translateY(-2px);
}
.quick-btn svg { width: 24px; height: 24px; color: var(--primary); }

/* Tabs Bar */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tab-btn {
  padding: 10px 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Toolbar & Filters */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input {
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
}
.search-input:focus { border-color: var(--primary); }
.select-input {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text-main);
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-orange {
  background: #ea580c;
  color: #ffffff;
}
.btn-orange:hover { background: #c2410c; }
.btn-green {
  background: #16a34a;
  color: #ffffff;
}
.btn-green:hover { background: #15803d; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

/* Tables */
.table-responsive {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}
table.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-light);
  color: #334155;
  white-space: nowrap;
}
table.data-table tbody tr:hover { background: #fafcff; }
table.data-table tbody tr:last-child td { border-bottom: 0; }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-badge.in-stock, .status-badge.paid, .status-badge.cash {
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.out-of-stock, .status-badge.unpaid, .status-badge.due {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-badge.upi { background: var(--purple-bg); color: var(--purple); }
.status-badge.card { background: #e0f2fe; color: #0284c7; }

.table-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  margin-right: 8px;
  vertical-align: middle;
}

.table-actions { display: flex; align-items: center; gap: 8px; }
.action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.delete-btn:hover { border-color: var(--danger); color: var(--danger); }

/* POS Billing Counter Screen */
.pos-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.pos-topbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #ffffff;
}
.pos-tabs { display: flex; align-items: center; gap: 8px; }
.pos-tab {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.pos-tab.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary-border); }

.pos-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.pos-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.pos-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pos-search-input {
  flex: 1;
  height: 44px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 14px;
  outline: none;
}
.pos-search-input:focus { border-color: var(--primary); background: #ffffff; }

.pos-table-wrap { flex: 1; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }

.pos-right {
  width: 360px;
  background: #fbfcfd;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  overflow-y: auto;
}
.pos-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.pos-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13.5px; }
.pos-row.total { font-size: 18px; font-weight: 700; color: var(--text-main); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 6px; }

.pos-hotkeys-bar {
  height: 44px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
}
.hotkey-pill {
  padding: 4px 10px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
}

/* Invoice Creation Form View */
.invoice-form-view {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.invoice-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.invoice-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-field label { font-size: 12.5px; font-weight: 600; color: #475569; }
.form-field input, .form-field select, .form-field textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--primary); }

/* Modal & Dialogs */
dialog {
  margin: auto;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
  max-width: 600px;
  width: 90%;
  padding: 0;
  background: #ffffff;
}
dialog::backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.invoice-form-view .invoice-grid-2 {display:grid;grid-template-columns:minmax(260px, .85fr) minmax(320px, 1.15fr);gap:18px;align-items:start}
.invoice-form-view .invoice-grid-2>div{border-radius:8px;background:#eaf4ff;padding:16px}
.invoice-form-view .invoice-grid-2>div+div{background:#f7f0fd}
.invoice-form-view .form-field input,.invoice-form-view .form-field select{min-width:0}
#inv-items-table{background:#f9fbff}
#entry-form label,#upi-form label{display:grid;gap:5px;font-size:13px}
#upi-result canvas{display:block;image-rendering:pixelated}
@media(max-width:800px){.invoice-form-view .invoice-grid-2{grid-template-columns:1fr}}
.billing-editor .sidebar,.billing-editor .topbar{display:none}
.billing-editor #main{margin:0!important;width:100%;padding:0 14px 90px;background:#f8f8fb;min-height:100vh;color:#152238}
.be-title,.be-firm,.be-footer,.tender,.be-number,.be-bottom label span{display:flex;align-items:center;gap:9px}
.be-title{background:white;padding:12px 18px;border-bottom:1px solid #e5e7ec;margin:0 -14px}.be-title h1{font-size:17px;font-weight:600}.be-title small{color:#687080}
.billing-editor main button,.billing-editor main select,.billing-editor main input{font:inherit;border:1px solid #dde2ea;border-radius:6px;background:white;padding:8px 10px;color:inherit;min-width:0}
.be-title button{font-size:24px!important;border:0!important}.be-firm{padding:14px 2px 8px}.be-sheet{background:white;border:1px solid #eceef3;border-radius:10px;padding:14px}.be-panels,.be-bottom{display:grid;grid-template-columns:40% minmax(0,1fr);gap:14px}.be-sheet h3{font-size:15px;font-weight:550;margin:4px 0 12px}.be-sheet label{display:grid;gap:6px;font-size:13px}.be-customer,.be-details,.be-items,.be-bottom section{padding:14px;border-radius:8px}.be-customer,.be-items{background:#e6f2ff}.be-details{background:#f7effc;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.be-number input{width:100%}.be-number b{font-weight:600}.be-items{margin:12px 0}.be-scroll{overflow:auto}.be-items table{border-collapse:collapse;background:white;width:100%;font-size:13px}.be-items th,.be-items td{padding:6px;text-align:left;border:1px solid #e8ecf3}.be-items th{background:#f8f9fc}.be-items input{width:100%}.be-items .item-search{min-width:180px}.be-items td:nth-child(2){width:31%}.be-items td:nth-child(4),.be-items td:nth-child(6){width:10%}.be-items>button{margin-top:10px}.be-bottom section{background:#f8fafb;border:1px solid #e6e9ee}.tender{margin-bottom:7px}.be-bottom p{margin:10px 0 0}.be-footer{position:fixed;bottom:0;left:0;right:0;background:#f3f4f7;border-top:1px solid #e1e5eb;padding:12px 22px;z-index:4}.be-footer>span{flex:1}.be-footer #bill-save,.be-items #bill-row{background:#315ee9;color:white}.be-customer select{width:100%}
#product-popover{position:fixed;z-index:12;width:min(800px,94vw);background:white;border:1px solid #dae0eb;border-radius:9px;box-shadow:0 8px 30px #16264433;overflow:hidden}#product-popover .table-responsive{max-height:min(34vh,270px);overflow:auto}#product-popover th{position:sticky;top:0;background:#f4f5f7}#product-popover td,#product-popover th{font-size:12px;padding:9px}#product-popover tr:hover td,#product-popover tr:focus td{background:#e8f1ff;cursor:pointer}#product-popover button{margin:6px;color:#305ee2}
@media(max-width:780px){.be-panels,.be-bottom{grid-template-columns:1fr}.be-details{grid-template-columns:repeat(2,minmax(0,1fr))}.be-footer{flex-wrap:wrap;padding:8px}.be-firm{flex-wrap:wrap}}
#layout-form{padding:16px;background:#f4f5f8;display:grid;gap:12px}#layout-form header{position:sticky;top:0;background:white;padding:10px;display:flex;align-items:center;gap:8px;z-index:1}#layout-form h2{flex:1;font-size:18px}#layout-form section,#firm-extra{display:grid;grid-template-columns:1fr 1fr;gap:12px;background:white;padding:14px}#firm-extra:empty{display:none}#layout-form label{display:block;font-size:13px}#layout-form input:not([type=checkbox]),#layout-form textarea,#layout-form select,.be-bottom textarea{display:block;width:100%;padding:8px;border:1px solid #dce2ed;border-radius:6px}#layout-form h3{grid-column:1/-1}.billing-editor label[hidden]{display:none}
#quotation-alerts{position:fixed;right:16px;top:16px;z-index:50;max-height:85vh;overflow:auto}.quotation-alert{background:#fff;border:1px solid #a8bdf0;border-left:4px solid #315fea;border-radius:8px;padding:15px;box-shadow:0 5px 18px #21325122}.quotation-alert button{margin-left:8px}
.cat-tabs{display:flex;gap:14px;border-bottom:1px solid #e8ebf2;margin-bottom:15px}.cat-tabs button,.cat-more,.cat-pages button,#cat-menu button{background:white;border:0;cursor:pointer;padding:8px 12px}.cat-tabs .selected{border-bottom:2px solid #3563ec;color:#305ee2}.catalogue .filter-toolbar{margin:12px 0}.catalogue .data-table td{height:48px}.catalogue tbody tr:hover{background:#eef5ff}.cat-more,.cat-pages button{border:1px solid #dbe2ed;border-radius:6px}.qty-badge{padding:3px 7px;border:1px solid;border-radius:4px;font-size:12px;white-space:nowrap}.available{color:#397f25;background:#f6fff1}.empty-stock{color:#b64242;background:#fff5f5}.cat-pages{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:10px}#cat-menu{position:fixed;background:white;border:1px solid #e2e5ef;box-shadow:0 4px 18px #18284028;border-radius:7px;padding:5px;min-width:135px;z-index:40}#cat-menu button{display:block;width:100%;text-align:left}#cat-menu button:hover,#cat-menu button:focus{background:#edf3ff}.cat-form label{display:grid;gap:4px;margin:8px 0}.cat-form input,.cat-form select{padding:7px;border:1px solid #dce3ed;border-radius:5px}
.bill-addresses{display:grid;grid-template-columns:1fr 1fr;gap:15px}.bill-addresses textarea,.invoice-manage input,.invoice-manage select,.invoice-manage textarea{border:1px solid #dce2ea;border-radius:6px;padding:7px;max-width:100%}.bill-addresses textarea{width:100%}.invoice-manage label{display:grid;gap:4px;margin:8px 0}.invoice-manage table input{width:85px}.invoice-manage [role=alert]{color:#b42318}
.data-table th,.be-items th{background:#d9e3ef;color:#192b44;border-color:#b4c2d1}.data-table td,.be-items td{border-bottom:1px solid #c5d0db;color:#172538}.data-table tbody tr:nth-child(even),.be-items tbody tr:nth-child(even){background:#eff3f8}.be-customer{position:relative}.customer-results{position:absolute;z-index:7;background:white;border:1px solid #9babc1;box-shadow:0 5px 20px #25344d33;max-height:220px;overflow:auto;left:12px;right:12px}.customer-results button{display:block;width:100%;text-align:left}.checkout-extra,.product-sheet fieldset{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.checkout-extra{margin-top:12px;padding:15px;background:#edf3f0;border-radius:8px}.checkout-extra img{max-height:65px;max-width:150px}.be-bottom section:first-child{background:#e2efe9}.tender{display:grid;grid-template-columns:2fr 1fr 1fr auto}.tender-note{resize:vertical}.be-footer strong,#bill-total{font-variant-numeric:tabular-nums;font-size:19px}.product-sheet{padding:18px;background:#f4f6fa}.product-sheet header{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:8px;background:white;padding:10px}.product-sheet h2{flex:1}.product-sheet fieldset,.product-sheet details{background:white;padding:14px;border:1px solid #ccd6e1;margin:8px 0}.product-sheet label{display:block;font-size:13px}.product-sheet input:not([type=checkbox]),.product-sheet textarea,.product-sheet select{display:block;width:100%;border:1px solid #bdcbd9;padding:7px;border-radius:5px}.product-sheet summary{cursor:pointer;font-weight:600}
.report-card button,.report-controls button,#report-output button,#all-reports{background:white;color:#19314c;border:1px solid #b7c6d9;border-radius:6px;padding:9px 12px;margin:4px;cursor:pointer}.report-card h3{border-bottom:1px solid #cbd5e1;padding:8px}.report-controls{display:flex;gap:14px;align-items:end;flex-wrap:wrap}#report-output{overflow:auto}#report-output td,#report-output th{padding:9px;border-bottom:1px solid #c5d1df}#daily-print{display:none}@media print{body:has(#daily-print)>*:not(#daily-print){display:none!important}#daily-print{display:block}#daily-print td,#daily-print th{padding:5px;border-bottom:1px solid #aaa}}.invoice-summary{padding:16px;background:#e3f1e9;border-radius:8px}.invoice-summary p{display:flex;justify-content:space-between;margin:5px}
#dialog:has(.record-view){width:min(850px,96vw);max-width:96vw;padding:0;border:0;border-radius:12px}#dialog:has(.record-drawer){margin:0 0 0 auto;height:100dvh;max-height:none;width:min(730px,96vw);border-radius:0}#dialog:has(.record-view)::backdrop{background:#15203170;backdrop-filter:blur(2px)}.record-view>header,.record-footer,.record-filters{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.record-view>header{justify-content:space-between;padding:20px;border-bottom:1px solid #cdd6e3}.record-body{padding:18px}.record-stats,.switch-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:10px;margin:12px 0}.record-stats>div,.switch-grid label{border:1px solid #d6dfea;padding:12px;border-radius:8px}.record-stats strong{display:block;color:#183652}.record-link{color:#1955bb;background:none;border:0;text-align:left;cursor:pointer}.record-filters{background:#f4f6fa;padding:12px;margin:12px 0}.record-filters label{display:grid}.record-footer .record-stats{flex:1}.record-view button,.record-footer button,.record-filters button{cursor:pointer}.switch-grid{grid-template-columns:1fr 1fr}.history-table{max-height:45vh;overflow:auto}@media print{body:has(.record-view)>*:not(dialog){display:none!important}#dialog:has(.record-view){position:static;width:100%;max-width:none;max-height:none}.record-view button,.record-view nav,.record-filters{display:none}.history-table{max-height:none;overflow:visible}}
/* Shared screen table treatment, including report and transaction dialogs. */
@media screen {
  :is(main,dialog) table{border-collapse:collapse;border:1px solid #788a9e}
  :is(main,dialog) table:is(.data-table,table) :is(th,td),#report-output :is(th,td),#bill-lines td{border:1px solid #8797a9}
  :is(main,dialog) table thead th{background:#dae3ed;color:#192f46;border-bottom:2px solid #657b90}
  :is(main,dialog) table tbody tr:hover>td{background-color:#edf4fc}
}
.dash-home{max-width:1500px;margin:auto;color:#182e44}.dash-header,.dash-section,.dash-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.dash-header{padding:24px 28px;background:#183b59;border-radius:14px;color:white;margin-bottom:22px}.dash-header small{color:#a9dcd9;font-weight:650}.dash-header h1{font-size:clamp(24px,3vw,34px);margin:3px 0}.dash-header p{color:#e0ebf4}.dash-actions{justify-content:flex-start}.dash-home h2{font-size:17px}.dash-section{margin-bottom:14px}.dash-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:16px}.dash-metrics>div{padding:16px;border:1px solid #a7b8c9;border-top:4px solid #007d78;border-radius:9px;background:#fff}.dash-metrics>div:nth-child(2){border-top-color:#315ec5}.dash-metrics>div:nth-child(3){border-top-color:#815baa}.dash-metrics>div:nth-child(4){border-top-color:#bc712c}.dash-metrics strong{display:block;margin-top:6px;font-size:clamp(20px,2vw,29px);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.dash-panels{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(240px,1fr);gap:14px}.dash-home .card{min-width:0;padding:20px}.dash-home select,.dash-actions>button:not(.btn){border:1px solid #8797a9;border-radius:6px;background:white;color:#19334e;padding:8px 12px}.dash-actions button{cursor:pointer}#dash-balances>div{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #b2c0cd;padding:13px 0}#dash-chart{display:grid;grid-template-columns:repeat(7,minmax(58px,1fr));overflow:auto;gap:4px;margin-top:14px}.dash-day{text-align:center;font-size:12px}.dash-day small{white-space:nowrap}.dash-track{height:70px;border-bottom:1px solid #8797a9;display:flex;align-items:end;justify-content:center}.dash-track i{background:#16877f;width:48%;border-radius:4px 4px 0 0}.dash-day span{display:block;margin-top:5px}@media(max-width:850px){.dash-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dash-panels{grid-template-columns:1fr}.dash-header{padding:18px}.dash-home .card{padding:12px}}
/* Shared application controls. Native selects retain keyboard and form behavior. */
@media screen {
  :root {
    --ui-ink: #1b304a;
    --ui-edge: #9aaabb;
    --ui-rule: #99aabb;
    --ui-accent: #254fbd;
    --ui-focus: #2e64d6;
  }
  body {color:var(--ui-ink);background:#f0f3f8}
  .main-wrapper {min-width:0}
  .card,.be-sheet {border:1px solid #c4cfdd;box-shadow:0 2px 7px #2339570c}
  .page-title,.record-view h2,.modal-header h2 {letter-spacing:-.025em;color:#18314f}
  .page-subtitle {color:#4c6177}
  .filter-toolbar,.record-filters,.report-controls {align-items:center;justify-content:flex-start;gap:9px;background:#f4f7fb;border:1px solid #cad5e2;border-radius:10px;padding:10px}
  .catalogue .filter-toolbar {display:flex;flex-wrap:wrap}
  .catalogue #cat-query {flex:1 1 190px;min-width:150px}
  :is(.filter-toolbar,.record-filters,.report-controls,.filter-group) input:not([type=checkbox]),
  #report-search {min-height:36px;border:1px solid var(--ui-edge);border-radius:7px;padding:6px 10px;background:#fff;color:var(--ui-ink);max-width:100%}
  body :is(main,dialog,.topbar) select:not([multiple]):not([size]),body #cat-actions {
    appearance:none;min-height:36px;max-width:100%;border:1px solid var(--ui-edge);border-radius:8px;
    padding:6px 32px 6px 11px;color:var(--ui-ink);font:inherit;font-size:13px;font-weight:550;line-height:1.35;
    background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23415874' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    box-shadow:0 1px 2px #18345112;cursor:pointer;
  }
  body :is(main,dialog,.topbar) select:hover:not(:disabled) {border-color:#55749e}
  body :is(main,dialog,.topbar) select:disabled {opacity:.6;cursor:default}
  @supports (appearance:base-select) {
    body :is(main,dialog,.topbar) select:not([multiple]):not([size]),body #cat-actions {
      appearance:base-select;background:#fff;padding-right:10px;align-items:center;gap:12px
    }
    select:not([multiple]):not([size])::picker(select) {
      appearance:base-select;background:white;color:var(--ui-ink);margin-block:4px;
      min-width:anchor-size(width);max-width:min(420px,96vw);max-height:min(340px,50vh);
      padding:5px;border:1px solid #acbbce;border-radius:10px;box-shadow:0 8px 24px #18345130;
    }
    select::picker-icon {color:#486180;font-size:11px}
    select:not([multiple]):not([size]) option {padding:8px 10px;min-height:32px;border-radius:5px;gap:8px;white-space:normal;overflow-wrap:anywhere}
    select:not([multiple]):not([size]) option:checked {background:#eaf0ff;color:#214ba6;font-weight:650}
    select option:focus-visible,select option:hover {background:#dbe8fa;outline:1px solid #8aa8d3;outline-offset:-1px}
  }
  :is(button,a,input,select,textarea,summary):focus-visible {outline:2px solid var(--ui-focus);outline-offset:2px}
  .table-responsive,.history-table {border:1px solid #8799ae;border-radius:9px;overflow:auto;max-width:100%}
  :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table {border-collapse:collapse;width:100%;font-size:13px;font-variant-numeric:tabular-nums}
  body :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table :is(th,td) {border:1px solid var(--ui-rule);vertical-align:middle;line-height:1.45}
  body :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table thead th {background:#e1e9f2;color:#243b55;border-bottom:2px solid #71869f;padding:10px 12px;font-weight:650;text-align:start}
  body :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table tbody td {padding:9px 12px}
  body :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table tbody tr:nth-child(even)>td {background-color:#f4f7fb}
  body :is(main,dialog,#product-popover,#pos-fullscreen-wrap) table tbody tr:is(:hover,:focus-within)>td {background-color:#e9f1ff}
  body :is(main,dialog) table :is(td,th).numeric {text-align:right;white-space:nowrap}
  .record-link {font-weight:600;text-underline-offset:3px}.record-link:hover{text-decoration:underline}
  .cat-tabs {overflow-x:auto;gap:6px}.cat-tabs button {flex-shrink:0}
  .cat-pages,.record-footer {padding-top:10px;color:#415770;font-variant-numeric:tabular-nums}
  .qty-badge,.status-badge {border-radius:5px;font-weight:600}
  .record-view>header,.modal-header {background:#f6f9fd;border-bottom:1px solid #bdcad9}
  @media(max-width:800px) {
    .filter-toolbar,.record-filters,.report-controls {flex-wrap:wrap}
    .table-responsive table {min-width:max-content}
    body :is(main,dialog) table tbody td,body :is(main,dialog) table thead th {padding:8px}
  }
}
#nav-open{display:none}.desktop-nav-hidden #nav-open{display:inline-flex}
@media screen and (max-width:800px){
  #nav-open{display:inline-flex;flex-shrink:0}
  .sidebar{transform:translateX(-100%)!important;z-index:120}
  .mobile-nav-open .sidebar{transform:translateX(0)!important;box-shadow:12px 0 32px #1c304933}
  .topbar{left:0!important;overflow-x:auto;padding-inline:8px}
  .topbar-left,.topbar-right{gap:5px}.topbar-right{margin-left:6px}
  .main-wrapper{margin-left:0!important;padding:12px;width:100%;min-width:0}
  .page-header,.filter-group{flex-wrap:wrap}
  .card{min-width:0;max-width:100%}
}
.customer-picker{position:relative;min-width:0;flex:1}.customer-picker>input{width:100%}.customer-picker .customer-results{position:absolute;top:100%;left:0;right:0;z-index:15;background:white;border-radius:8px;box-shadow:0 5px 18px #152f502b;max-height:260px;overflow:auto}.customer-results small{display:block;padding:8px}.alert-entry{display:block;width:100%;padding:14px;text-align:left;border-bottom:1px solid #acbacb}.alert-entry:hover{background:#eef5ff}
#doc-party[hidden],#inv-customer[hidden],.customer-results[hidden]{display:none!important}
@media screen {
  #dialog:has(>.product-sheet){width:min(1240px,94vw);max-width:94vw;height:min(920px,93dvh);max-height:93dvh;padding:0;border:1px solid #a7b7c9;border-radius:16px;overflow:auto;background:#f1f5fa}
  #dialog:has(>.product-sheet)::backdrop{background:#12284088;backdrop-filter:blur(3px)}
  .product-sheet{min-height:100%;padding:0 clamp(16px,3vw,38px) 20px;background:#f1f5fa}
  .product-sheet header{margin:0 clamp(-38px,-3vw,-16px) 20px;padding:16px clamp(16px,3vw,38px);border-bottom:1px solid #c1cfe0;background:#fcfdff;box-shadow:0 3px 12px #223f6810}
  .product-sheet h2{font-size:clamp(20px,2vw,28px);color:#193758;letter-spacing:-.03em}
  .product-sheet fieldset,.product-sheet details{min-width:0;border:1px solid #c3d0de;border-radius:12px;padding:17px 20px 20px;margin:14px 0;background:white}
  .product-sheet fieldset{grid-template-columns:repeat(3,minmax(0,1fr));gap:15px 20px;align-items:end}
  .product-sheet legend,.product-sheet summary{color:#193f68;font-size:15px;font-weight:650}
  .product-sheet legend{padding:0 7px}.product-sheet details fieldset{padding:0;border:0;margin:16px 0 0}
  .product-sheet label{font-weight:550;color:#304760}
  .product-sheet label :is(input:not([type=checkbox]),select,textarea){margin-top:5px;min-height:39px;border-radius:7px}
  body #dialog .product-sheet select{display:flex;justify-content:space-between;align-items:center}
  .tracking-options{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}.tracking-options label{display:flex;align-items:center;gap:7px;padding:7px 12px;border-radius:20px;background:#edf2f8;border:1px solid #bdccdc;cursor:pointer}.tracking-options label:has(:checked){background:#e1ebff;color:#204fb1;border-color:#6892d7}.tracking-options input{accent-color:#285bc7}
  #generate-code{justify-self:start;align-self:end;padding:9px 15px;color:#2250a6;background:#edf3ff;border:1px solid #afc4e5;border-radius:7px;font-weight:600}
  .invoice-register .page-header>div{display:flex;flex-wrap:wrap;gap:8px}
  .invoice-register .cat-tabs{gap:4px;padding:5px;background:#edf2f8;border:1px solid #c9d5e2;border-radius:10px}
  .invoice-register .cat-tabs button{background:transparent;border:1px solid transparent;border-radius:7px;color:#415875;font-weight:550}
  .invoice-register .cat-tabs button.selected{background:#fff;border-color:#afc4e5;color:#194baf;box-shadow:0 1px 3px #243d6018}
  .invoice-register .record-filters{display:grid;grid-template-columns:minmax(210px,2fr) repeat(3,minmax(120px,1fr));align-items:end;padding:14px;gap:10px}
  .invoice-register .record-filters label{font-size:12px;font-weight:600;color:#425772;gap:4px}
  .invoice-register .record-filters label :is(input,select){width:100%;min-width:0}
  .more-invoice-filters{grid-column:1/-1}.more-invoice-filters summary{cursor:pointer;color:#2251a4;font-weight:600;width:fit-content;padding:4px}.more-invoice-filters>div{display:flex;flex-wrap:wrap;gap:8px;padding-top:9px}
  @media(max-width:850px){.product-sheet fieldset,.invoice-register .record-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.invoice-register .invoice-search{grid-column:1/-1}}
  @media(max-width:540px){#dialog:has(>.product-sheet){width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}.product-sheet fieldset{grid-template-columns:1fr}.product-sheet header{gap:5px}.product-sheet header .btn{padding:8px}.invoice-register .page-header{align-items:flex-start}}
}
.paper-workbench{display:grid;grid-template-columns:minmax(235px,320px) minmax(0,1fr);gap:18px}.paper-workbench form{max-height:75vh;overflow:auto}.paper-workbench fieldset{margin-bottom:14px;padding:14px;border:1px solid #bdcbd9;border-radius:10px;background:white}.paper-workbench legend{font-weight:650;color:#28558c}.paper-workbench label{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0}.paper-workbench input[type=file]{max-width:160px}.paper-workbench input[type=checkbox]{appearance:none;width:32px;height:18px;border-radius:15px;background:#8998aa;cursor:pointer}.paper-workbench input[type=checkbox]:before{content:"";display:block;background:white;width:14px;height:14px;border-radius:50%;margin:2px}.paper-workbench input:checked{background:#275ace}.paper-workbench input:checked:before{transform:translateX(14px)}.swatches{display:flex;gap:8px}.swatches button{width:24px;height:24px;border-radius:50%;border:2px solid white;outline:1px solid #a7b6c9}.invoice-paper{width:100%;height:75vh;border:1px solid #9eaebf;border-radius:8px;background:#515b68}.manage-invoice{border:1px solid #9eb5d6;border-radius:7px;padding:6px 12px;color:#214d8f;background:#eff5ff;font-weight:650}.manage-invoice:hover{background:#dceaff}#cat-menu button{display:flex;align-items:center;gap:10px}#cat-menu button:before{display:inline-grid;place-items:center;width:18px;font-weight:700}#cat-menu [data-action-name="Edit"]:before{content:"✎"}#cat-menu [data-action-name="Share"]:before{content:"↗"}#cat-menu [data-action-name="Stock In"]:before{content:"⊕";color:#148349}#cat-menu [data-action-name="Stock Out"]:before{content:"⊖";color:#bd4336}#cat-menu [data-action-name="Archive"]:before,#cat-menu [data-action-name="Restore"]:before{content:"▣"}#cat-menu [data-action-name="Delete"]:before{content:"×"}#cat-menu [data-action-name="Delete"]{color:#ac302a}@media(max-width:760px){.paper-workbench{grid-template-columns:1fr}.paper-workbench form{max-height:40vh}.invoice-paper{height:58vh}}
.invoice-badge{display:inline-flex;align-items:center;gap:6px;border-radius:20px;border:1px solid;padding:3px 9px;font-size:12px;font-weight:650;white-space:nowrap}.invoice-badge:before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}.invoice-badge.paid{color:#10603e;background:#e2f6e9;border-color:#99cdb0}.invoice-badge.partial{color:#875107;background:#fff1cf;border-color:#ddbd77}.invoice-badge.pending{color:#2d5288;background:#e9f1fd;border-color:#a6bfde}.invoice-badge.cancelled{color:#9c3544;background:#fce8ed;border-color:#dfadb6}.dash-metrics small{display:block;margin-top:6px;color:#486079}
.expense-entry{display:grid;gap:14px}.expense-entry label{display:grid;gap:5px;font-weight:550;color:#334963}.expense-entry label[hidden]{display:none}.expense-entry input,.expense-entry textarea{padding:9px;border:1px solid #adbdd0;border-radius:7px}.expense-line{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:6px;margin:5px 0}.expense-line input{min-width:0}.expense-category{display:flex;justify-content:space-between;align-items:center;padding:8px 4px;border-bottom:1px solid #d7e0ea}.overview-quick,.growth-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:12px;margin-top:15px}.overview-quick button,.growth-grid>div{border-radius:10px;background:#e1effe;color:#193f69;padding:15px}.overview-quick strong,.growth-grid strong,.growth-grid small{display:block}.overview-quick strong{font-size:22px}.growth-grid strong{font-size:20px;margin:5px 0}.dash-metrics>div:nth-child(4n+1),.overview-quick button:nth-child(4n+2),.growth-grid>div:first-child{background:#e1f2e7}.dash-metrics>div:nth-child(4n+2){background:#e0edff}.dash-metrics>div:nth-child(4n+3),.overview-quick button:nth-child(4n+3){background:#fbedd7}.dash-metrics>div:nth-child(4n),.growth-grid>div:nth-child(3){background:#fae4e6}
.dashboard-range{display:flex;gap:8px;flex-wrap:wrap}.dashboard-range label{font-size:12px;color:#456079}.dashboard-range input{border:1px solid #9aaabd;padding:7px;border-radius:6px}
.finance-series{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-top:15px}.finance-series>div{padding:10px;border:1px solid #d1dce7;border-radius:8px}.finance-bar{margin-top:6px}.finance-bar small{display:block}.finance-bar i{display:block;height:5px;border-radius:4px;background:#357ad0}.finance-bar:nth-child(3) i{background:#238459}.finance-bar:nth-child(4) i{background:#c87831}
/* Give item names priority over stock and pricing while entering a bill. */
#bill-lines .item-search:not(:placeholder-shown),#product-popover tbody tr[tabindex] td:first-child,#inv-items-tbody select[data-change="onSelectInvoiceProduct"]{font-weight:700;color:#193451}

/* Shared desktop workspace and keyboard navigation */
@media screen {
  .main-wrapper {background:linear-gradient(145deg,#edf4fb 0%,#f7f8fc 52%,#eef7f5 100%);}
  .topbar {border-bottom:1px solid #bacbdd;box-shadow:0 3px 14px #263b6010;}
  .nav-item.active {background:linear-gradient(100deg,#dce9ff,#edf4ff);color:#1645a6;box-shadow:inset 3px 0 #3864df;}
  .card {border-radius:14px;box-shadow:0 4px 16px #213e5d0c;}
  .btn-primary,.primary-btn {background:linear-gradient(115deg,#2457ce,#4842ba);color:white;border-color:#3654b9;}
  .btn:hover:enabled,.header-btn:hover:enabled {box-shadow:0 2px 8px #263f6929;}
  :is(button,input,textarea,select,[tabindex]):focus-visible {outline:3px solid #547edc;outline-offset:2px;}
  main table thead th {background:#e5edf8;color:#243d60;border-color:#a2b4cb;}
  main table tbody tr:hover td {background-color:#edf5ff;}
  .be-bottom>section {border-radius:14px;border:1px solid #a9c8c6;padding:18px;background:#f0f9f6;}
  .be-bottom>section:nth-child(2) {border-color:#b8c7df;background:linear-gradient(140deg,#f1f5ff,#fafbff);}
  .be-bottom label {color:#294363;font-weight:600;}
  .be-bottom textarea {padding:10px;border:1px solid #abbcd2;border-radius:8px;}
  .be-bottom .invoice-summary {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,155px),1fr));gap:12px;padding:15px;margin:12px 0;border:1px solid #b9c9df;border-radius:12px;background:white;}
  .invoice-summary>label {display:grid;gap:5px;min-width:0;align-content:start;}
  .invoice-summary>label:has(#invoice-round) {grid-column:1/-1;display:flex;align-items:center;gap:9px;cursor:pointer;}
  .invoice-summary #invoice-round {width:18px;height:18px;accent-color:#315ccb;margin:0;}
  #invoice-breakdown {grid-column:1/-1;font-variant-numeric:tabular-nums;}
  #invoice-breakdown p {display:flex;justify-content:space-between;align-items:center;padding:6px 9px;margin:0;gap:10px;}
  #invoice-breakdown .bill-grand-total {border-radius:8px;background:#d8f2e8;color:#095c45;font-weight:700;font-size:1.05rem;}
  .staff-performance h1 {color:#263c85;}
  .staff-performance tbody td:nth-child(3) {color:#095d50;font-weight:700;}
  .staff-performance tbody td:nth-child(5) {color:#62329a;font-weight:700;}
  @media (prefers-reduced-motion:no-preference) {
    .btn,.header-btn,.nav-item {transition:background-color .15s,box-shadow .15s;}
  }
}
@media screen { #sidebar-nav .nav-item {font-size:15px;line-height:1.4} #sidebar-nav .sub-item {font-size:14px;line-height:1.4} }
.invoice-manage .manage-document-fields{border:0;background:#f1f6fc;border-radius:12px;padding:12px;display:grid;gap:0 16px;grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}.invoice-manage #manage-fields{margin:16px 0}.invoice-manage table{width:100%}.be-firm select[hidden]{display:none!important}
.reports-heading{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap}.reports-heading input{min-width:min(100%,300px);border:1px solid #96acc5;border-radius:8px;padding:10px}#report-groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:14px}.report-card{margin:0;border-top:3px solid #4578c2}.report-card button:hover,.report-card button:focus-visible{background:#e7f0ff}.report-card:nth-child(3n+2){border-top-color:#258677}.report-card:nth-child(3n){border-top-color:#8357b3}#report-output{overflow:auto}
#dialog:has(.firm-picker){width:min(440px,calc(100vw - 32px));padding:0;border:1px solid #bac9dc;border-radius:16px;box-shadow:0 20px 70px #17294540}
.firm-picker header,.firm-picker footer{display:flex;align-items:center;padding:16px 20px}
.firm-picker header{justify-content:space-between;background:#f1f5fd;border-bottom:1px solid #d3dfed}
.firm-picker h2{margin:0;color:#203958;font-size:20px}
.firm-close{width:34px;height:34px;border:1px solid #becde0;background:white;color:#344761;border-radius:9px;font-size:22px;cursor:pointer}
.firm-picker #firm-list{display:grid;gap:8px;padding:16px 20px;max-height:50vh;overflow:auto}
.firm-choice{width:100%;display:grid;grid-template-columns:42px 1fr 24px;align-items:center;gap:12px;text-align:left;padding:10px;border:1px solid #c3cede;border-radius:10px;background:white;color:#253951;cursor:pointer}
.firm-choice:hover{background:#f4f7fc}.firm-choice[aria-pressed=true]{border-color:#5980c9;background:#edf3ff}
.firm-prefix,.firm-mark{display:grid;place-items:center}.firm-prefix{min-height:38px;background:#e6ecf6;color:#354e77;border-radius:8px;font-weight:700}.firm-name{overflow-wrap:anywhere;font-weight:650}.firm-choice[aria-pressed=true] .firm-prefix{background:#3659af;color:white}.firm-mark{color:#3659af;font-size:19px}
.firm-picker footer{justify-content:flex-end;padding-top:12px;border-top:1px solid #d9e2ee}
.tender-mode{display:grid;gap:5px;min-width:0}.tender-mode .custom-mode{width:100%;box-sizing:border-box}.tender-mode [hidden]{display:none!important}
#bill-balance{display:flex;flex-wrap:wrap;align-items:center;gap:8px}#bill-balance .bill-received,#bill-balance .bill-due{display:inline-flex;align-items:baseline;gap:6px;padding:5px 10px;border-radius:7px;font-size:15px;font-weight:600}#bill-balance strong{font-size:17px;font-variant-numeric:tabular-nums}#bill-balance .bill-received{background:#daf4e6;color:#12583b}#bill-balance .bill-due{background:#ffebd2;color:#83400c}
.staff-performance .page-header,.staff-profile header{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.staff-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(135px,1fr));gap:12px;margin:16px 0 22px}
.staff-metrics>div{display:grid;gap:6px;background:#e6f5ed;color:#195c46;padding:14px 16px;border-radius:10px}.staff-metrics>div:nth-child(2){background:#eaf1fe;color:#254e8b}.staff-metrics>div:nth-child(3){background:#f2ebfa;color:#633581}.staff-metrics strong{font-size:22px;font-variant-numeric:tabular-nums}.staff-metrics span{font-size:13px;font-weight:600}
.staff-link{background:transparent;border:0;color:#204e99;font-weight:700;text-decoration:underline;text-underline-offset:3px;cursor:pointer}.staff-performance tr:has(.staff-link){cursor:pointer}
.staff-performance progress,.staff-target progress{display:block;height:7px;width:min(145px,100%);margin-top:6px;accent-color:#27816d}
#dialog:has(.staff-profile){width:min(800px,94vw);max-height:88vh;overflow:auto;border-radius:15px}.staff-profile{padding:clamp(12px,3vw,26px)}.staff-profile header p{margin:0;color:#495e79}.staff-profile h2{margin:3px 0}.staff-profile h3{margin:18px 0 10px}.staff-profile .table-responsive{max-height:40vh;overflow:auto}

.account-feedback:not(:empty) { margin: 8px 0; }
.account-feedback[role="alert"] { color: #b42318; }

.current-account td { background: #e6f0ff; color: #173d79; font-weight: 600; }
.current-account td:last-child .btn, td .btn + .btn { margin-inline-start: .4rem; }
#header-logout[hidden] { display: none; }

/* Invoice and quotation workflows */
.invoice-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.invoice-row-actions button { margin: 0; }
.invoice-manage .manage-document-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.invoice-manage .manage-document-fields textarea { min-height: 70px; resize: vertical; }
.document-items-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.quotation-form .invoice-grid-2 > div { align-self: start; }
.quotation-form .invoice-grid-2 > div:first-child { border: 1px solid #d5e1f0; }
.customer-picker .customer-results button { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 0; background: white; color: #1a3455; }
.customer-picker .customer-results button:hover,
.customer-picker .customer-results button:focus-visible { background: #e9f2ff; }
.customer-picker .customer-results button span { color: #526782; white-space: nowrap; }
.customer-picker .customer-results .customer-picker-add { border-top: 1px solid #d5e1f0; color: #2052a0; font-weight: 600; }
.selected-quotation-customer:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; padding: 12px; margin-bottom: 12px; border: 1px solid #d5e1f0; border-radius: 8px; background: white; }
.selected-quotation-customer small, .selected-quotation-customer strong { display: block; overflow-wrap: anywhere; }
.selected-quotation-customer small { color: #526782; margin-bottom: 2px; }
.firm-settings-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid #dbe4ef; padding: 12px 0; }
.firm-settings-row small { display: block; color: #526782; margin-top: 4px; }
.firm-settings-row button { min-width: 70px; }

/* Report directory */
.reports-heading { padding: 20px; }
.reports-heading label { display: grid; gap: 4px; color: #4b607b; font-weight: 600; }
#report-groups { align-items: start; }
.report-card { padding: 16px; }
.report-card h2 { font-size: 16px; margin: 0 0 10px; color: #1a3455; }
.report-card ul { list-style: none; padding: 0; margin: 0; }
.report-card li + li { border-top: 1px solid #e3eaf2; }
.report-card li button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; margin: 0; padding: 9px 8px; }
.report-card li button span:last-child { color: #426ca1; font-size: 18px; line-height: 1; }
.report-empty { grid-column: 1 / -1; }
#report-output table { width: 100%; border-collapse: collapse; }
#report-output th { background: #e7eef7; text-align: left; }
#report-output tr:nth-child(even) td { background: #f6f9fc; }

.record-stats .unpaid-stat { border-color: #efc4c4; background: #fff4f4; }
.record-stats .unpaid-stat small, .record-stats .unpaid-stat strong { color: #a52222; }
