/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

:root {
  --green: #1d9e75;
  --green-dark: #0f6e56;
  --bg: #f7f7f5;
  --white: #ffffff;
  --text: #1a1a1a;
  --muted: #777;
  --border: #e0e0da;
}

body {
  background: var(--bg);
  color: var(--text);
}

/* ============================================================
   AUTH
   ============================================================ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 430px;
  padding: 20px;
}

.auth-card {
  background: var(--white);
  padding: 35px;
  border-radius: 18px;
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.auth-card h1 { font-size: 32px; margin-bottom: 5px; }
.auth-card h1 span { color: var(--green); }
.auth-subtitle { color: var(--muted); margin-bottom: 25px; }

.auth-tabs {
  display: flex;
  background: #eeeeea;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tabs button {
  flex: 1;
  border: none;
  padding: 10px;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
}

.auth-tabs button.active {
  background: var(--white);
  color: var(--green);
}

.auth-card input {
  width: 100%;
  padding: 13px;
  margin-bottom: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}

.auth-card input:focus { border-color: var(--green); }

.auth-btn {
  width: 100%;
  padding: 13px;
  border: none;
  background: var(--green);
  color: white;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.auth-btn:hover { background: var(--green-dark); }

#authMessage {
  margin-top: 15px;
  font-size: 13px;
  color: #a32d2d;
  text-align: center;
}

/* ============================================================
   TOPBAR & NAV
   ============================================================ */
.topbar {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid #e0e0da;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo { font-size: 22px; font-weight: 800; }
.logo span { color: #1d9e75; }

.nav { display: flex; gap: 8px; flex: 1; }

.nav a {
  text-decoration: none;
  color: #666;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}

.nav a.active, .nav a:hover { background: #efefec; color: #1a1a1a; }

.user-box { display: flex; align-items: center; gap: 10px; }
.user-box span { font-size: 13px; color: #666; }

.user-box button {
  border: 1px solid #ddd;
  background: white;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.content { max-width: 1200px; margin: auto; padding: 28px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 26px; }
.page-header p { color: #777; margin-top: 4px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: #1d9e75;
  color: white;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  background: white;
  color: #1a1a1a;
  border: 1px solid #d8d8d2;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.full-btn { width: 100%; margin-top: 22px; }

.small-btn {
  border: 1px solid #d8d8d2;
  background: white;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 5px;
  font-weight: 600;
}

.small-btn:hover { background: #f3f3f0; }

.small-btn.danger {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
}

.small-btn.danger:hover { background: #fecaca; }

/* ============================================================
   DASHBOARD METRICS & CARDS
   ============================================================ */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  background: white;
  border: 1px solid #e0e0da;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.04);
}

.metric p { color: #777; font-size: 13px; margin-bottom: 8px; }
.metric h2 { font-size: 28px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.card {
  background: white;
  border: 1px solid #e0e0da;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.04);
}

.card h3 { margin-bottom: 15px; }

.list-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #eee;
}

.list-row span { color: #1d9e75; font-weight: 700; }

/* ============================================================
   TABLE CARD
   ============================================================ */
.table-card {
  background: #ffffff;
  border: 1px solid #e0e0da;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.04);
}

.table-toolbar {
  padding: 16px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid #e0e0da;
  flex-wrap: wrap;
}

.table-toolbar input,
.table-toolbar select {
  padding: 11px 13px;
  border: 1px solid #d8d8d2;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}

.table-toolbar input { min-width: 260px; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  background: #f3f3f0;
  padding: 13px 16px;
  color: #666;
  font-size: 13px;
}

td {
  padding: 14px 16px;
  border-top: 1px solid #eeeeea;
  font-size: 14px;
}

.empty-cell { text-align: center; color: #777; padding: 30px; }

.stage-badge {
  background: #e1f5ee;
  color: #0f6e56;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.text-right { text-align: right; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-bg.open { display: flex; }

.modal {
  width: 560px;
  max-width: 94vw;

  max-height: 90vh;
  overflow-y: auto;

  background: white;
  border-radius: 18px;
  padding: 26px;

  border: 1px solid #e0e0da;
  box-shadow: 0 14px 45px rgba(0,0,0,0.16);

  position: relative;
}

.modal h3 { margin-bottom: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #666;
  font-weight: 700;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid #d8d8d2;
  border-radius: 10px;
  margin-bottom: 14px;
  outline: none;
  font-size: 14px;
}

.modal textarea { min-height: 80px; resize: vertical; }

.modal input:focus,
.modal select:focus,
.modal textarea:focus { border-color: #1d9e75; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   PIPELINE
   ============================================================ */
.pipeline-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 20px; }

.pipeline-column {
  min-width: 270px;
  background: #f3f3f0;
  border: 1px solid #e0e0da;
  border-radius: 16px;
  padding: 14px;
}

.pipeline-column-header { margin-bottom: 14px; }
.pipeline-column-header h3 { font-size: 16px; margin-bottom: 4px; }
.pipeline-column-header p { font-size: 12px; color: #777; }

.pipeline-list { min-height: 420px; }

.pipeline-card {
  background: #ffffff;
  border: 1px solid #e0e0da;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  cursor: grab;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}

.pipeline-card:active { cursor: grabbing; }
.pipeline-card-title { font-weight: 800; margin-bottom: 5px; }
.pipeline-card-company { font-size: 13px; color: #666; margin-bottom: 12px; }

.pipeline-card-footer { display: flex; justify-content: space-between; align-items: center; }
.pipeline-card-footer span { color: #1d9e75; font-weight: 800; }

.pipeline-card-footer button {
  border: 1px solid #d8d8d2;
  background: white;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
}

.pipeline-empty { padding: 18px; color: #999; text-align: center; font-size: 13px; }

/* ============================================================
   PROGRESS & TARGETS
   ============================================================ */
.progress-box { width: 100%; height: 8px; background: #eeeeea; border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.progress-bar { height: 100%; background: #1d9e75; border-radius: 999px; }

.target-card {
  background: #ffffff;
  border: 1px solid #e0e0da;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.04);
}

.target-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.target-card-header h3 { margin-bottom: 4px; }
.target-card-header p { color: #777; font-size: 13px; }
.target-card-header strong { font-size: 26px; color: #1d9e75; }

.target-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.target-grid div { background: #f7f7f5; border-radius: 12px; padding: 14px; }
.target-grid span { display: block; color: #777; font-size: 12px; margin-bottom: 5px; }
.target-grid strong { font-size: 18px; }
.target-note { margin-top: 12px; color: #777; font-size: 13px; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }

.settings-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #e1f5ee;
  color: #0f6e56;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.settings-header h1 { font-size: 30px; margin-bottom: 4px; }
.settings-header p { color: #667085; }

.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 22px;
}

.settings-panel {
  background: #ffffff;
  border: 1px solid #e0e0da;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.panel-title {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid #eeeeea;
}

.panel-title span { font-size: 24px; }
.panel-title h2 { font-size: 21px; margin-bottom: 4px; }
.panel-title p { color: #667085; font-size: 14px; }

.logo-upload-row { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; margin-bottom: 24px; }

.logo-preview-large {
  min-height: 150px;
  border: 1px solid #d8d8d2;
  border-radius: 14px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.logo-preview-large img { max-width: 85%; max-height: 110px; object-fit: contain; }
.logo-preview-large img[src=""] { display: none; }
#logoPlaceholder { color: #98a2b3; font-weight: 700; }

.upload-box {
  border: 1px dashed #cfd4dc;
  border-radius: 14px;
  background: #fcfcfd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px;
  text-align: center;
}

.upload-icon { font-size: 30px; color: #1d9e75; }
.upload-box p { font-weight: 700; }
.upload-box small { color: #667085; }
.upload-box input { margin-top: 8px; font-size: 13px; }

.settings-panel label { display: block; margin-bottom: 7px; color: #344054; font-weight: 700; font-size: 13px; }

.settings-panel input,
.settings-panel textarea,
.settings-panel select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #d8d8d2;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  margin-bottom: 16px;
}

.settings-panel textarea { min-height: 85px; resize: vertical; }

.settings-panel input:focus,
.settings-panel textarea:focus {
  border-color: #1d9e75;
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}

.template-grid-pro { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.template-option {
  border: 1px solid #d8d8d2;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  position: relative;
  transition: 0.2s;
  background: #fff;
}

.template-option:hover { transform: translateY(-2px); border-color: #1d9e75; }

.template-option.selected {
  border-color: #1d9e75;
  background: #f0fbf6;
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}

.template-option input { position: absolute; right: 14px; bottom: 14px; width: auto; margin: 0; }

.template-mini {
  height: 130px;
  border-radius: 12px;
  border: 1px solid #e0e0da;
  background: #fff;
  padding: 18px;
  margin-bottom: 14px;
}

.template-mini div { height: 12px; border-radius: 999px; background: #d0d5dd; margin-bottom: 12px; }
.template-mini div:nth-child(1) { width: 45%; }
.template-mini div:nth-child(2) { width: 80%; }
.template-mini div:nth-child(3) { width: 65%; }

.modern-mini { background: linear-gradient(to bottom, #0f6e56 0 34%, #fff 34%); }
.modern-mini div:first-child { background: #ffffff; }
.industrial-mini { background: linear-gradient(to bottom, #333 0 34%, #fff 34%); }
.industrial-mini div:first-child { background: #ffffff; }
.minimal-mini { background: #fafafa; }

.template-info h4 { font-size: 16px; margin-bottom: 4px; }
.template-info p { color: #667085; font-size: 13px; }

.settings-note {
  background: #e1f5ee;
  color: #0f6e56;
  border: 1px solid #b8e6d6;
  padding: 13px 15px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 22px;
  font-size: 14px;
}

/* ============================================================
   QUOTATION PAGE LAYOUT
   ============================================================ */
.quote-page-layout {
  display: grid;
  grid-template-columns: 58% 42%;
  gap: 24px;
  align-items: start;
}

.quote-form-panel,
.quote-preview-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.04);
}

.quote-form-panel h2 { font-size: 30px; margin-bottom: 24px; }

.quote-form-panel label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #344054;
}

.quote-form-panel input,
.quote-form-panel select,
.quote-form-panel textarea {
  width: 100%;
  height: 48px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  background: white;
}

.quote-form-panel textarea { height: 100px; padding-top: 12px; resize: vertical; }

.quote-form-panel input:focus,
.quote-form-panel select:focus,
.quote-form-panel textarea:focus {
  border-color: #1d9e75;
  box-shadow: 0 0 0 4px rgba(29,158,117,0.12);
}

.quote-preview-panel {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* ============================================================
   ITEMS TABLE (form side)
   ============================================================ */
.quotation-items-panel { margin-top: 22px; }

.quotation-table-wrap { overflow-x: auto; margin: 16px 0; }

.quotation-table-wrap table { width: 100%; border-collapse: collapse; min-width: 700px; }

.quotation-table-wrap th {
  background: #f7f7f5;
  padding: 12px 14px;
  font-size: 13px;
  text-align: left;
  color: #667085;
}

.quotation-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid #eaecf0;
  vertical-align: middle;
}

.quotation-table-wrap td input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d8d8d2;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.quotation-table-wrap td input:focus { border-color: #1d9e75; }
.quotation-table-wrap td input[type="number"] { text-align: right; }

/* ============================================================
   QUOTATION DOCUMENT PREVIEW (.qdoc)
   FIX: Removed duplicate definitions & 210mm/297mm fixed sizes
   that made the preview overflow on screen.
   ============================================================ */
.quote-preview {
  background: white;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 4px;
  min-height: 500px;
}

.qdoc {
  position: relative;
  overflow: hidden;
  background: #fff;
  padding: 24px;
  color: #222;
  /* FIX: No fixed mm width — that was breaking screen preview */
}

/* Watermark */
.qdoc-watermark {
  position: absolute;
  width: 280px;
  opacity: 0.045;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.qdoc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 3px solid var(--q-primary, #1d9e75);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.qdoc-brand { display: flex; gap: 14px; align-items: flex-start; }

.qdoc-logo {
  width: 110px;
  height: 75px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.qdoc-logo img { max-width: 100%; max-height: 65px; object-fit: contain; }

.qdoc-brand h2 { margin: 0 0 5px; font-size: 20px; }
.qdoc-brand p { margin: 2px 0; color: #555; font-size: 12px; }

.qdoc-meta { text-align: right; min-width: 170px; }
.qdoc-meta h1 { margin: 0 0 8px; font-size: 26px; color: var(--q-primary, #1d9e75); }
.qdoc-meta p { margin: 3px 0; font-size: 12px; color: #444; }

/* Customer */
.qdoc-customer {
  background: #f8f9fb;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.qdoc-customer p { margin: 0 0 4px; font-size: 12px; color: #667085; }
.qdoc-customer h3 { margin: 4px 0 2px; font-size: 18px; }

/* Items table */
.qdoc-table { width: 100%; border-collapse: collapse; margin-top: 10px; }

.qdoc-table th {
  background: var(--q-primary, #1d9e75);
  color: #fff;
  padding: 10px;
  font-size: 12px;
  text-align: left;
}

.qdoc-table th.text-right,
.qdoc-table td.text-right { text-align: right; }

.qdoc-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
}

/* Summary */
.qdoc-summary {
  width: 280px;
  margin-left: auto;
  margin-top: 16px;
}

.qdoc-summary div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.qdoc-grand {
  border-top: 2px solid var(--q-primary, #1d9e75);
  padding-top: 8px;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 800;
}

/* Bottom section — stacked (block), not grid */
/* FIX: Removed the grid override that was fighting the block override */
.qdoc-bottom { margin-top: 20px; }

.qdoc-box {
  background: #f8f9fb;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  break-inside: avoid;
  page-break-inside: avoid;
  overflow: visible;
}

.qdoc-box h4 {
  margin: 0 0 10px;
  color: var(--q-primary, #1d9e75);
  font-size: 15px;
}

.qdoc-box p { margin: 4px 0; font-size: 12px; color: #475467; }

/* Terms */
.terms-list { display: flex; flex-direction: column; gap: 6px; }
.term-item { line-height: 1.8; font-size: 12px; color: #444; }

/* Bank */
.bank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bank-grid p { margin-bottom: 6px; font-size: 12px; }

/* Footer */
.qdoc-footer {
  margin-top: 16px;
  background: var(--q-primary, #1d9e75);
  color: #fff;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Print page-break fixes */
.qdoc-table tr,
.qdoc-box,
.qdoc-summary,
.qdoc-footer,
.qdoc-customer { break-inside: avoid; page-break-inside: avoid; }

.no-break { break-inside: avoid !important; page-break-inside: avoid !important; }

/* ============================================================
   TEMPLATE VARIANTS
   ============================================================ */

/* Industrial */
.qdoc-industrial { border-top: 7px solid var(--q-primary, #1d9e75); }
.qdoc-industrial .qdoc-header { border-bottom: 3px solid var(--q-primary, #1d9e75); }
.qdoc-industrial .qdoc-customer { background: var(--q-secondary, #f0fbf6); }
.qdoc-industrial .qdoc-footer { background: var(--q-primary, #1d9e75); color: white; }

/* Classic */
.qdoc-classic .qdoc-header { border-bottom: 2px solid #111; }
.qdoc-classic .qdoc-meta h1 { color: #111; }
.qdoc-classic .qdoc-customer { background: #f7f7f5; }
.qdoc-classic .qdoc-table th { background: #222; color: white; }
.qdoc-classic .qdoc-footer { background: #222; color: white; }

/* Modern */
.qdoc-modern .qdoc-header {
  background: var(--q-primary, #1d9e75);
  color: white;
  padding: 18px;
  border-radius: 12px;
  border-bottom: none;
  margin-bottom: 16px;
}
.qdoc-modern .qdoc-brand p,
.qdoc-modern .qdoc-meta p { color: rgba(255,255,255,0.85); }
.qdoc-modern .qdoc-meta h1 { color: white; }
.qdoc-modern .qdoc-customer { background: var(--q-secondary, #f0fbf6); }
.qdoc-modern .qdoc-footer { background: var(--q-primary, #1d9e75); color: white; }

/* Minimal */
.qdoc-minimal .qdoc-header { border-bottom: 1px solid #ddd; }
.qdoc-minimal .qdoc-logo { border: none; }
.qdoc-minimal .qdoc-customer { background: #fafafa; }
.qdoc-minimal .qdoc-table th { background: #f3f4f6; color: #111; }
.qdoc-minimal .qdoc-footer { background: #f3f4f6; color: #111; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body { background: #fff; }

  .qdoc {
    padding: 14mm;
    box-shadow: none;
    border: none;
  }

  .qdoc-footer { margin-top: 20px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .quote-page-layout { grid-template-columns: 1fr; }
  .quote-preview-panel { position: relative; top: 0; max-height: unset; }
}

@media (max-width: 1000px) {
  .settings-layout { grid-template-columns: 1fr; }
  .logo-upload-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .target-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .table-card { overflow-x: auto; }
  table { min-width: 700px; }
}

@media (max-width: 650px) {
  .template-grid-pro { grid-template-columns: 1fr; }
}

.quotation-toolbar{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    margin-bottom:20px;
}

.quotation-filter{
    width:220px;
}

.quotation-filter label{
    display:block;
    font-size:12px;
    font-weight:600;
    color:#64748b;
    margin-bottom:6px;
    text-transform:uppercase;
    letter-spacing:0.5px;
}

.quotation-filter select{
    width:100%;
    height:40px;
    padding:0 12px;
    border:1px solid #dbe3ea;
    border-radius:10px;
    background:#fff;
    font-size:14px;
    cursor:pointer;
    transition:all .2s ease;
}

.quotation-filter select:hover{
    border-color:#14b884;
}

.quotation-filter select:focus{
    outline:none;
    border-color:#14b884;
    box-shadow:0 0 0 3px rgba(20,184,132,.15);
}

.quote-actions{
    display:flex;
    gap:8px;
    align-items:center;
    justify-content:center;
    flex-wrap:nowrap;
}

.quote-actions .small-btn{
    min-width:75px;
}

/* Notification Bell */

.notification-wrap{
  position: relative;
  margin-left: 20px;
}

.notification-btn{
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
  position: relative;
  transition: .2s;
}

.notification-btn:hover{
  transform: translateY(-2px);
}

.notification-badge{
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:700;
}

.notification-dropdown{
  position:absolute;
  top:60px;
  right:0;
  width:360px;
  background:#fff;
  border-radius:16px;
  box-shadow:0 15px 40px rgba(0,0,0,.15);
  display:none;
  overflow:hidden;
  z-index:9999;
}

.notification-dropdown.show{
  display:block;
}

.notification-header{
  padding:16px;
  border-bottom:1px solid #eee;
  font-weight:700;
}

.notification-header h4{
  margin:0;
}

#notificationList{
  max-height:400px;
  overflow-y:auto;
}

.empty-notification{
  padding:20px;
  text-align:center;
  color:#777;
}

.notification-item{
  padding:15px;
  border-bottom:1px solid #eee;
  cursor:pointer;
}

.notification-item:hover{
  background:#f8fafc;
}

.notification-item strong{
  display:block;
  margin-bottom:5px;
}

.notification-item small{
  color:#666;
}

.overdue-row {
  background: #fff5f5;
}

.overdue-row td:first-child {
  color: #dc2626;
  font-weight: 700;
}

.overdue-badge {
  background: #ef4444;
  color: white;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 8px;
}

/* ===============================
   SHIVFLOW AI ASSISTANT
================================ */

/* Floating AI Button */
#aiFab {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  border: none !important;
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  font-size: 28px !important;
  cursor: pointer !important;
  box-shadow: 0 12px 35px rgba(15, 118, 110, 0.35) !important;
  transition: 0.25s ease !important;
  z-index: 99999 !important;
}

#aiFab:hover {
  transform: scale(1.08) !important;
}

/* AI Chat Panel */
#aiPanel {
  position: fixed !important;
  right: 24px !important;
  bottom: 95px !important;
  width: 410px !important;
  height: 640px !important;
  max-width: calc(100vw - 35px) !important;
  max-height: calc(100vh - 115px) !important;
  background: #ffffff !important;
  border-radius: 22px !important;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25) !important;
  display: none !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border: 1px solid #e5e7eb !important;
  z-index: 99999 !important;
}

/* Panel opens only when .open class is added */
#aiPanel.open {
  display: flex !important;
}

/* Header */
.ai-header {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
  color: #ffffff !important;
  padding: 18px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.ai-title {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.ai-title span:first-child,
.ai-header h3 {
  margin: 0 !important;
  font-size: 18px !important;
  font-weight: 700 !important;
}

.ai-title span:last-child,
.ai-status {
  font-size: 12px !important;
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

#closeAI {
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  cursor: pointer !important;
  font-size: 18px !important;
}

/* Quick Buttons */
.ai-quick-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid #e5e7eb !important;
  background: #ffffff !important;
}

.ai-quick-actions button {
  border: none !important;
  padding: 8px 13px !important;
  border-radius: 999px !important;
  cursor: pointer !important;
  background: #f3f4f6 !important;
  color: #111827 !important;
  font-size: 13px !important;
  transition: 0.2s ease !important;
}

.ai-quick-actions button:hover {
  background: #d1fae5 !important;
  color: #065f46 !important;
}

/* Messages Area */
#aiMessages {
  flex: 1 !important;
  padding: 16px !important;
  overflow-y: auto !important;
  background: #f8fafc !important;
}

/* AI Message */
.ai-message {
  width: fit-content !important;
  max-width: 85% !important;
  background: #ffffff !important;
  color: #111827 !important;
  padding: 12px 14px !important;
  border-radius: 16px 16px 16px 5px !important;
  margin-bottom: 12px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
  line-height: 1.5 !important;
  font-size: 14px !important;
  white-space: pre-wrap !important;
}

/* User Message */
.user-message {
  width: fit-content !important;
  max-width: 85% !important;
  margin-left: auto !important;
  background: #d1fae5 !important;
  color: #064e3b !important;
  padding: 12px 14px !important;
  border-radius: 16px 16px 5px 16px !important;
  margin-bottom: 12px !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  white-space: pre-wrap !important;
}

/* Input Area */
.ai-footer,
.ai-input-area {
  display: flex !important;
  padding: 14px !important;
  gap: 10px !important;
  background: #ffffff !important;
  border-top: 1px solid #e5e7eb !important;
}

#aiInput {
  flex: 1 !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 90px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 14px !important;
  padding: 12px !important;
  outline: none !important;
  font-size: 14px !important;
  resize: none !important;
}

#aiInput:focus {
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15) !important;
}

/* Send Button */
#sendAI {
  min-width: 82px !important;
  border: none !important;
  border-radius: 14px !important;
  background: #0f766e !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: 0.25s ease !important;
}

#sendAI:hover {
  background: #115e59 !important;
}

/* Scrollbar */
#aiMessages::-webkit-scrollbar {
  width: 6px !important;
}

#aiMessages::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 10px !important;
}

/* Message Animation */
.ai-message,
.user-message {
  animation: slideUp 0.25s ease !important;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsive */
@media (max-width: 600px) {
  #aiPanel {
    right: 10px !important;
    bottom: 85px !important;
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 110px) !important;
  }

  #aiFab {
    right: 18px !important;
    bottom: 18px !important;
  }
}

.column-editor-list {
  display: grid;
  gap: 10px;
}

.column-editor-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
}

.column-editor-row span {
  font-weight: 700;
  color: #222;
}

.column-editor-row small {
  color: #888;
  font-size: 12px;
}

.column-editor-row input {
  width: 16px;
  height: 16px;
  accent-color: #1d9e75;
}

.quote-lead-picker {
  position: relative;
  width: 100%;
}

.quote-lead-picker input {
  width: 100%;
}

.quote-lead-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #d8dee9;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  max-height: 260px;
  overflow-y: auto;
  z-index: 99999;
  padding: 6px;
}

.quote-lead-dropdown.open {
  display: block;
}

.quote-lead-item {
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.15s ease;
}

.quote-lead-item:hover {
  background: #f0fbf6;
}

.quote-lead-item strong {
  display: block;
  font-size: 14px;
  color: #1f2937;
  font-weight: 800;
}

.quote-lead-item span {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
  line-height: 1.4;
}

.quote-lead-manual {
  background: #eefaf5;
  color: #1d9e75;
  font-weight: 800;
}

.quote-lead-empty {
  padding: 13px;
  font-size: 13px;
  color: #777;
}

/* ============================================================
   COMPACT LEAD MODAL - FINAL CLEAN VERSION
   ============================================================ */

#leadModal.modal-bg.open {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px !important;
}

#leadModal .modal.lead-modal-box {
  width: 620px !important;
  max-width: 90vw !important;
  max-height: 86vh !important;
  overflow-y: auto !important;
  background: #ffffff !important;
  border-radius: 18px !important;
  padding: 20px 22px !important;
  position: relative !important;
}

#leadModal .lead-modal-box h3 {
  font-size: 24px !important;
  margin: 0 0 16px 0 !important;
}

#leadModal .modal-close {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 9px !important;
  font-size: 18px !important;
  line-height: 1 !important;
}

#leadModal .lead-form-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px 14px !important;
}

#leadModal .lead-form-grid label {
  display: block !important;
  margin-bottom: 5px !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  color: #374151 !important;
}

#leadModal .lead-form-grid input,
#leadModal .lead-form-grid select {
  width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 11px !important;
  border-radius: 11px !important;
  font-size: 14px !important;
  margin-bottom: 0 !important;
}

#leadModal .lead-form-grid textarea {
  width: 100% !important;
  min-height: 72px !important;
  padding: 10px 11px !important;
  border-radius: 11px !important;
  font-size: 14px !important;
  margin-bottom: 0 !important;
  resize: vertical !important;
}

#leadModal .lead-form-full {
  grid-column: 1 / -1 !important;
}

#leadModal .modal-actions {
  margin-top: 16px !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

#leadModal .modal-actions button {
  padding: 10px 16px !important;
  border-radius: 11px !important;
}

@media (max-width: 650px) {
  #leadModal .modal.lead-modal-box {
    width: 94vw !important;
    padding: 18px !important;
  }

  #leadModal .lead-form-grid {
    grid-template-columns: 1fr !important;
  }

  #leadModal .lead-form-full {
    grid-column: auto !important;
  }
}

/* ============================================================
   FINAL SMALL LEAD MODAL FIX
   ============================================================ */

#leadModal.modal-bg.open {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
}

#leadModal .modal.lead-modal-box {
  width: 540px !important;
  max-width: 90vw !important;
  max-height: 86vh !important;
  overflow-y: auto !important;
  padding: 20px !important;
  border-radius: 18px !important;
}

#leadModal .lead-modal-box h3 {
  font-size: 22px !important;
  margin-bottom: 16px !important;
}

#leadModal .lead-form-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px 12px !important;
}

#leadModal .lead-form-grid label {
  font-size: 12.5px !important;
  font-weight: 800 !important;
  margin-bottom: 5px !important;
  color: #374151 !important;
}

#leadModal .lead-form-grid input,
#leadModal .lead-form-grid select {
  height: 38px !important;
  min-height: 38px !important;
  padding: 7px 10px !important;
  font-size: 13.5px !important;
  border-radius: 10px !important;
  margin-bottom: 0 !important;
}

#leadModal .lead-form-grid textarea {
  min-height: 65px !important;
  padding: 9px 10px !important;
  font-size: 13.5px !important;
  border-radius: 10px !important;
  margin-bottom: 0 !important;
}

#leadModal .lead-form-full {
  grid-column: 1 / -1 !important;
}

#leadModal .modal-actions {
  margin-top: 14px !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

#leadModal .modal-actions button {
  padding: 9px 15px !important;
  border-radius: 10px !important;
}

#leadModal .modal-close {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  font-size: 17px !important;
}

@media (max-width: 650px) {
  #leadModal .modal.lead-modal-box {
    width: 94vw !important;
  }

  #leadModal .lead-form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   PROFESSIONAL PASSWORD SHOW / HIDE FIELD
   ============================================================ */

.password-field {
  position: relative;
  width: 100%;
  margin-bottom: 13px;
}

.password-field input {
  width: 100% !important;
  padding-right: 72px !important;
  margin-bottom: 0 !important;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #1d9e75;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}

.password-toggle:hover {
  background: #eefaf5;
}

.modal .password-field {
  margin-bottom: 14px;
}

.firm-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e0e0da;
  border-radius: 14px;
  background: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.04);
}

.firm-card strong {
  display: inline-block;
  font-size: 16px;
  margin-right: 8px;
}

.firm-card p {
  margin-top: 6px;
  color: #555;
}

.firm-card small {
  display: block;
  margin-top: 4px;
  color: #777;
}

@media (max-width: 700px) {
  .firm-card {
    flex-direction: column;
  }
}

/* ============================================================
   FIRM MODAL CLEAN DESIGN
   ============================================================ */

#firmModal.modal-bg.open {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px !important;
}

#firmModal .modal.firm-modal-box {
  width: 720px !important;
  max-width: 92vw !important;
  max-height: 88vh !important;
  overflow-y: auto !important;
  padding: 26px !important;
  border-radius: 22px !important;
}

.firm-modal-header {
  margin-bottom: 18px;
  padding-right: 36px;
}

.firm-modal-header h3 {
  margin: 0 0 4px 0 !important;
  font-size: 26px !important;
}

.firm-modal-header p {
  color: #667085;
  font-size: 14px;
}

.firm-section-title {
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eeeeea;
  font-size: 15px;
  font-weight: 900;
  color: #1d9e75;
}

.firm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.firm-form-grid label,
#firmModal label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #344054;
}

.firm-form-grid input,
.firm-form-grid select,
.firm-form-grid textarea,
#firmModal textarea {
  width: 100%;
  margin-bottom: 0 !important;
  border-radius: 12px !important;
}

.firm-form-grid input,
.firm-form-grid select {
  height: 44px;
}

.firm-form-grid input[type="color"] {
  padding: 6px !important;
  cursor: pointer;
}

.firm-form-full {
  grid-column: 1 / -1;
}

.firm-form-full textarea,
#firmModal textarea {
  min-height: 82px;
  resize: vertical;
}

.firm-default-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  background: #f7f7f5;
  border: 1px solid #e0e0da;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.firm-default-row input {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  accent-color: #1d9e75;
}

.firm-default-row span {
  font-size: 14px;
  font-weight: 800;
  color: #344054;
}

#firmModal .modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 700px) {
  #firmModal .modal.firm-modal-box {
    width: 94vw !important;
    padding: 20px !important;
  }

  .firm-form-grid {
    grid-template-columns: 1fr;
  }

  .firm-form-full {
    grid-column: auto;
  }
}

/* ============================================================
   FIRM LOGO UPLOAD
   ============================================================ */

.firm-logo-upload-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: stretch;
}

.firm-logo-preview {
  min-height: 120px;
  border: 1px solid #d8d8d2;
  border-radius: 14px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.firm-logo-preview img {
  max-width: 90%;
  max-height: 95px;
  object-fit: contain;
  display: none;
}

.firm-logo-preview span {
  color: #98a2b3;
  font-weight: 800;
  font-size: 13px;
}

.firm-upload-box {
  min-height: 120px;
}

.firm-upload-box .upload-icon {
  font-size: 14px;
  font-weight: 900;
  color: #1d9e75;
}

@media (max-width: 700px) {
  .firm-logo-upload-row {
    grid-template-columns: 1fr;
  }
}

.qdoc-contact-name {
  margin-top: 4px;
  font-size: 13px;
  color: #475467;
  font-weight: 600;
}


.lead-name-with-priority {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lead-priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.lead-priority.priority-high {
  background: #fee2e2;
  color: #b91c1c;
}

.lead-priority.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.lead-priority.priority-low {
  background: #dcfce7;
  color: #166534;
}

.small-btn.success {
  background: #dcfce7;
  color: #166534;
}

.followup-done-badge {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  font-weight: 900;
  font-size: 13px;
}

.lead-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.lead-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.lead-status-completed {
  background: #dcfce7;
  color: #166534;
}


.action-dropdown {
  position: relative;
  display: inline-block;
}

.action-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 150px;
  background: #ffffff;
  border: 1px solid #e0e0da;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  padding: 8px;
  z-index: 999;
  display: none;
}

.action-menu.open {
  display: block;
}

.action-menu button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #333;
}

.action-menu button:hover {
  background: #f4f4ee;
}

.admin-analytics {
  overflow: visible;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.analytics-card {
  background: #ffffff;
  border: 1px solid #e4e4dc;
  border-radius: 18px;
  padding: 18px;
  min-height: 330px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
}

.analytics-card h3 {
  margin-bottom: 14px;
  color: #222;
}

.analytics-card canvas {
  width: 100% !important;
  max-height: 260px;
}

.analytics-wide {
  grid-column: span 2;
}

.agent-analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.agent-analysis-card {
  background: #ffffff;
  border: 1px solid #e5e5dd;
  border-radius: 16px;
  padding: 16px;
}

.agent-analysis-card h4 {
  margin-bottom: 12px;
}

.agent-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  font-size: 14px;
}

.agent-stat-row span {
  color: #666;
}

.agent-stat-row strong {
  color: #222;
}

.agent-mini-bars {
  margin-top: 14px;
}

.agent-mini-bar {
  margin-bottom: 10px;
}

.agent-mini-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
  color: #555;
}

.agent-mini-bar-track {
  width: 100%;
  height: 8px;
  background: #f0f0ea;
  border-radius: 50px;
  overflow: hidden;
}

.agent-mini-bar-fill {
  height: 100%;
  background: #222;
  border-radius: 50px;
}

@media (max-width: 980px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-wide {
    grid-column: span 1;
  }

  .agent-analysis-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  margin-bottom: 18px;
}

.analytics-action-bar .active {
  background: #222;
  color: #fff;
}

.analytics-empty-state {
  padding: 26px;
  background: #fafaf6;
  border: 1px dashed #d8d8ce;
  border-radius: 16px;
  color: #666;
  font-weight: 600;
}

.analytics-panel {
  animation: fadeIn 0.2s ease;
}

.agent-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.agent-filter-btn {
  border: 1px solid #deded5;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.agent-filter-btn.active {
  background: #222;
  color: #fff;
  border-color: #222;
}

.selected-agent-header {
  background: #fafaf6;
  border: 1px solid #e4e4dc;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.selected-agent-header h3 {
  margin-bottom: 4px;
}

.selected-agent-header p {
  color: #666;
  margin: 0;
}

.agent-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.agent-kpi {
  background: #ffffff;
  border: 1px solid #e4e4dc;
  border-radius: 16px;
  padding: 16px;
}

.agent-kpi span {
  color: #666;
  font-size: 13px;
}

.agent-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  color: #222;
}

@media (max-width: 980px) {
  .agent-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .agent-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.premium-analytics-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 420px));
  gap: 16px;
  align-items: end;
  margin-top: 20px;
  margin-bottom: 20px;
}

.premium-select-box {
  background: #fafaf6;
  border: 1px solid #e4e4dc;
  border-radius: 18px;
  padding: 16px;
}

.premium-select-box label {
  display: block;
  margin-bottom: 8px;
  color: #666;
  font-size: 13px;
  font-weight: 800;
}

.premium-select-box select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d8d8cf;
  border-radius: 14px;
  background: #ffffff;
  color: #222;
  font-weight: 800;
  outline: none;
}

.premium-select-box select:focus {
  border-color: #222;
}

.premium-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fafaf6;
  border: 1px solid #e4e4dc;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
}

.premium-chart-header h3 {
  margin-bottom: 4px;
}

.premium-chart-header p {
  margin: 0;
  color: #666;
}

.premium-chart-card {
  min-height: 430px;
}

.premium-chart-card canvas {
  width: 100% !important;
  max-height: 360px;
}

@media (max-width: 900px) {
  .premium-analytics-toolbar {
    grid-template-columns: 1fr;
  }

  .premium-chart-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.lead-action-cell {
  min-width: 150px;
  width: 150px;
}

.lead-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.lead-action-buttons .small-btn {
  white-space: nowrap;
  min-width: 64px;
}

.table-card {
  overflow-x: auto;
}

.table-card table {
  min-width: 1200px;
}

.quote-action-cell {
  width: 80px;
  min-width: 80px;
  position: relative;
}

.quote-action-dropdown {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

.quote-three-dot-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #ddd;
  background: #ffffff;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.quote-three-dot-btn:hover {
  background: #f5f5f5;
}

.quote-action-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 160px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 14px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  padding: 8px;
  z-index: 999;
}

.quote-action-menu.open {
  display: block;
}

.quote-action-menu button {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 12px;
  text-align: left;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.quote-action-menu button:hover {
  background: #f5f5f5;
}

.quote-action-menu button.danger {
  color: #d71920;
}

.quote-action-menu button.danger:hover {
  background: #ffe5e7;
}

.contact-action-cell {
  width: 80px;
  min-width: 80px;
  position: relative;
}

.contact-action-dropdown {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

.contact-three-dot-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #ddd;
  background: #ffffff;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.contact-three-dot-btn:hover {
  background: #f5f5f5;
}

.contact-action-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 145px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 14px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  padding: 8px;
  z-index: 9999;
}

.contact-action-menu.open {
  display: block;
}

.contact-action-menu button {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 12px;
  text-align: left;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.contact-action-menu button:hover {
  background: #f5f5f5;
}

.contact-action-menu button.danger {
  color: #d71920;
}

.contact-action-menu button.danger:hover {
  background: #ffe5e7;
}

.agent-target-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.agent-target-cards .target-card {
  margin: 0;
}

.saved-quote-row {
  cursor: pointer;
}

.saved-quote-row:hover {
  background: #f8faf9;
}

.quote-form-panel .btn-secondary {
  white-space: nowrap;
}

.quote-items-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.quote-customize-btn {
  min-width: 330px;
  min-height: 58px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quote-items-hint {
  color: #777;
  font-size: 16px;
  line-height: 1.5;
}

.quotation-table-wrap {
  overflow-x: auto;
}

.quote-items-table {
  min-width: 1250px;
  table-layout: fixed;
}

.quote-items-table th,
.quote-items-table td {
  vertical-align: middle;
  white-space: nowrap;
}

.quote-items-table th {
  padding: 16px 14px;
  font-size: 15px;
}

.quote-items-table td {
  padding: 14px;
}

.quote-items-table .qi-desc,
.quote-items-table .qi-desc-cell {
  width: 260px;
}

.quote-items-table .qi-hsn,
.quote-items-table .qi-hsn-cell {
  width: 120px;
}

.quote-items-table .qi-make,
.quote-items-table .qi-make-cell {
  width: 150px;
}

.quote-items-table .qi-unit,
.quote-items-table .qi-unit-cell {
  width: 95px;
}

.quote-items-table .qi-qty,
.quote-items-table .qi-qty-cell {
  width: 95px;
}

.quote-items-table .qi-rate,
.quote-items-table .qi-rate-cell {
  width: 130px;
}

.quote-items-table .qi-net,
.quote-items-table .qi-net-cell {
  width: 130px;
  text-align: right;
}

.quote-items-table .qi-discount,
.quote-items-table .qi-discount-cell {
  width: 105px;
}

.quote-items-table .qi-gst,
.quote-items-table .qi-gst-cell {
  width: 105px;
}

.quote-items-table .qi-taxable,
.quote-items-table .qi-taxable-cell {
  width: 130px;
  text-align: right;
}

.quote-items-table .qi-total,
.quote-items-table .qi-total-cell {
  width: 130px;
  text-align: right;
  cursor: pointer;
}

.quote-items-table .qi-remove,
.quote-items-table .qi-remove-cell {
  width: 70px;
  text-align: center;
}

.quote-items-table .qi-input {
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  border-radius: 12px;
}

.quote-items-table .qi-number {
  text-align: right;
}

.quote-items-table .qi-net-cell strong,
.quote-items-table .qi-taxable-cell strong,
.quote-items-table .qi-total-cell strong {
  font-size: 16px;
  font-weight: 800;
}

.quote-item-remove {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
}

.qdoc-salesperson {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  color: #555;
  line-height: 1.6;
}

.qdoc-salesperson p {
  margin: 3px 0;
}

.rows-view-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.rows-view-filter label {
  font-weight: 700;
  color: #444;
}

.rows-view-filter select {
  min-width: 90px;
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  font-weight: 700;
}

#contactRowsInfo {
  color: #777;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .rows-view-filter {
    margin-left: 0;
    width: 100%;
  }
}