:root{
  --bg:#020617;
  --card:#0b1220;
  --border:#111827;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --primary:#f97316;
}

*{ box-sizing:border-box; font-family: system-ui, -apple-system, Segoe UI, sans-serif; }
body{ margin:0; background:var(--bg); color:var(--text); }

.app-shell{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
} 

.card{
  width: min(560px, 100%);
  background: var(--card);
  border:1px solid var(--border);
  border-radius:18px;
  padding:24px;
}

.title{ margin:0 0 8px; }
.sub{ margin:0 0 18px; color:var(--muted); line-height:1.4; }

.form{ display:grid; gap:12px; }
.label{ display:grid; gap:6px; font-size:0.9rem; color:#d1d5db; }

.input{
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#070d18;
  color:var(--text);
  outline:none;
}

.input:focus{ border-color: rgba(249,115,22,0.6); }

.btn{
  background:var(--primary);
  color:#111827;
  border:none;
  border-radius:12px;
  padding:12px 14px;
  font-weight:700;
  cursor:pointer;
}

.btn-outline{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}

.links{ margin-top:6px; }
.links a{ color: var(--muted); text-decoration:none; }
.links a:hover{ color: #fff; }

.app-top{
  position: sticky;
  top: 0;
  background: rgba(2,6,23,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.app-top-inner{
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.app-top-right{ display:flex; align-items:center; gap:10px; }

.badge{
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  color: var(--muted);
  font-size: 0.85rem;
}

.project{ margin-top:14px; padding:14px; border:1px solid var(--border); border-radius:14px; background:#070d18; }
.project-row{ display:flex; justify-content:space-between; align-items:center; gap:12px; }
.status{ color: var(--muted); font-size:0.9rem; }

.bar{ height:10px; background:#0b1220; border:1px solid var(--border); border-radius:999px; margin-top:10px; overflow:hidden; }
.fill{ height:100%; background: var(--primary); width:0; }

/* ===== APP LAYOUT ===== */
.app-layout{
  display:flex;
  min-height:100vh;
}

/* ===== SIDEBAR ===== */
.sidebar{
  width:240px;
  background:#020617;
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding:16px;
}

.sidebar-top{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:20px;
}

.logo{
  background:var(--primary);
  color:#111827;
  font-weight:900;
  padding:8px 12px;
  border-radius:10px;
}

.sidebar-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.sidebar-btn{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  text-align:left;
  cursor:pointer;
  font-weight:600;
}

.sidebar-btn:hover{
  border-color:rgba(249,115,22,0.5);
}

.sidebar-btn.active{
  background:#070d18;
}

.sidebar-btn.primary{
  background:var(--primary);
  color:#111827;
  border:none;
  margin-top:12px;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-bottom{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* ===== MAIN CONTENT ===== */
.main{
  flex:1;
  padding:28px;
}

.page-title{
  margin:0;
}

.small{
  padding:8px 10px;
  font-size:0.85rem;
}

.page { display: none; }
.page.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 999;
}

.modal-card{
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.followups-modal-card{
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.followups-modal-body{
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  padding: 16px;
}

.followups-modal-left,
.followups-modal-right{
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #070d18;
  position: relative;
  overflow: hidden;
}

.followups-modal-right{
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.followups-modal-right-log{
  flex: 1;
  min-height: 0;
  margin: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  background: rgba(7,13,24,0.6);
}

.followups-message{
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
  flex-direction: column;
}

.followups-message-role{
  min-width: 110px;
  font-weight: 600;
  color: #e2e8f0;
}

.followups-message-text{
  color: #0b1a12;
  line-height: 1.35;
  background: #16a34a;
  border-radius: 12px;
  padding: 8px 12px;
  max-width: 75%;
}

.followups-message-sender{
  margin-top: 0;
  font-size: 12px;
  color: rgba(226,232,240,0.75);
  max-width: 75%;
}

.followups-message-sender.is-dcc{
  margin-left: auto;
  text-align: right;
}

.followups-message-sender.is-client{
  margin-right: auto;
  text-align: left;
}

.followups-message-text.is-client{
  margin-right: auto;
}

.followups-message-text.is-dcc{
  margin-left: auto;
}

.followups-message-text.is-dcc{
  background: #2563eb;
  color: #eef2ff;
}

.followups-log-meta{
  font-size: 12px;
  color: rgba(148,163,184,0.85);
  margin-bottom: 12px;
}

.followups-context-menu{
  position: fixed;
  z-index: 2000;
  min-width: 160px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

.followups-context-menu button{
  width: 100%;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.followups-context-menu button:hover{
  background: rgba(148,163,184,0.2);
}

.followups-modal-right-actions{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}

.followups-modal-right-actions .btn-outline{
  height: 42px;
  border-radius: 12px;
}

.followups-modal-right-input{
  width: 100%;
  padding: 0 16px 8px 16px;
}

.followups-modal-right-input textarea{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
  min-height: 90px;
}

.followups-modal-right-input textarea:focus{
  outline: none;
  border-color: rgba(249,115,22,0.55);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.18);
}

#followupsModal{
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

#followupsModal .modal-card{
  margin: 0 !important;
}

#followupsProposalFrame{
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

#followupsProposalEmpty{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

.modal-title{
  margin: 0 0 12px;
}

.modal-form{
  display: grid;
  gap: 12px;
}

.modal-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}



/* ===== product data card ===== */
.quote-card{
  margin-top: 12px;
  padding: 26px 20px;   /* ⬅️ MORE vertical padding */
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #070d18;
}


/* Top bar for Quotes + Product pages */
.quotes-topbar,
.product-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 28px; /* ⬅️ ADD THIS */
}

/* product data sheet-Excel-like sheet */
.sheet-wrap{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #070d18;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;   /* ✅ required */
}

.sheet-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.sheet-grid{
  width:100%;
  border-collapse: collapse;
}

.sheet-grid th,
.sheet-grid td{
  border-bottom: 1px solid var(--border);
  padding: 10px;
  vertical-align: middle;
}

.sheet-grid thead th{
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sheet-rownum{
  width: 56px;
  color: #9ca3af;
  text-align: right;
  padding-right: 12px;
}

.sheet-input{
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: #e5e7eb;
  padding: 8px 10px;
  border-radius: 10px;
}

.sheet-input:focus{
  outline: none;
  border-color: var(--border);
  background: rgba(255,255,255,0.03);
}

/* Add-row control */
.sheet-add-row td{
  border-bottom: none;
}

.sheet-add-cell{
  cursor: pointer;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: #9ca3af;
  user-select: none;
}

.sheet-add-cell:hover{
  color: #e5e7eb;
}

.product-card { cursor: pointer; }
/* ===== Product Data card hover highlight (nicer version) ===== */
.product-card{
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.product-card:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

/* Product sheet card action area */
.product-card-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.product-card-title{
  font-weight:600;
  color:#f9fafb;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.product-card-actions{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  min-width:160px;
}

.product-card-date{
  color:#9ca3af;
  font-size:0.85rem;
  white-space:nowrap;
}

/* dots hidden until hover over the right side */
.product-menu-btn{
  display:none;
  border:1px solid var(--border);
  background:transparent;
  color:#e5e7eb;
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
  line-height:1;
}

.product-card-actions:hover .product-card-date{
  display:none;
}

.product-card-actions:hover .product-menu-btn{
  display:inline-flex;
}

/* dropdown menu with trash */
.product-menu{
  display:none;
  position:absolute;
  top: calc(100% + 6px);
  right: 0;
  background:#0b1220;
  border:1px solid var(--border);
  border-radius:12px;
  padding:6px;
  z-index:50;
}

.product-menu.open{ display:block; }

.product-delete-btn{
  width:40px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background:transparent;
  cursor:pointer;
}

/* Modal + danger text */
.danger-text{
  color:#ef4444;
  font-weight:700;
}

.btn-danger{
  background:#ef4444;
  color:white;
  border:none;
  border-radius:12px;
  padding:10px 14px;
  cursor:pointer;
}

/* If you don't already have modal styles, keep these minimal ones */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:9999;
}

.modal.open{ display:block; }

.modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.55);
}

.modal__panel{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:min(520px, 92vw);
  background:#070d18;
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px;
}

.modal__title{
  margin:0 0 8px 0;
  color:#f9fafb;
}

.modal__text{
  margin:0 0 14px 0;
  color:#cbd5e1;
  line-height:1.4;
}

.modal__actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
}

.sheet-name-btn{
  background: transparent;
  border: 1px solid transparent;
  color: #f9fafb;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
}

.sheet-name-btn:hover{
  border-color: var(--border);
  background: rgba(255,255,255,0.03);
}

.sheet-name-input{
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: #f9fafb;
  padding: 6px 10px;
  border-radius: 10px;
  width: 260px;
}

.sheet-title-row th{
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.sheet-title-cell{
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  color: #e5e7eb;
  padding: 10px 12px;
}



/* ===== ↓ Client ↓  ===== */


.client-details-card {
  width: min(1100px, 96vw);
  height: min(90vh, 900px);
  max-height: 90vh;

  display: flex;
  flex-direction: column;
}

/* Stack client info tightly (address, phone, email) */
.client-details-card .modal-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  justify-content: flex-start;
}

/* Client details info should NOT push projects down */
.client-details-card .modal-form {
  flex: 0;
  overflow: visible;
}

/* Keep buttons pinned to bottom */
.client-details-card .modal-actions {
  margin-top: auto;
}

/* ===== Clients list card layout ===== */
.client-card-row{
  display: flex;
  align-items: flex-start;
}

.client-card-left{
  max-width: 420px;
}

.client-card-name{
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.client-card-address{
  opacity: 0.85;
  font-size: 14px;
  line-height: 1.35;
}

.client-card-mid{
  margin-left: 32px;
  min-width: 220px;
}

.client-card-phone{
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 6px;
  opacity: 0.9;
}

.client-card-email{
  font-size: 14px;
  line-height: 1.35;
  opacity: 0.9;
  word-break: break-word;
}

.client-card-right{
  margin-left: auto;
  width: 140px;
  text-align: right;
  opacity: 0.75;
  font-size: 13px;
  line-height: 1.35;
}

/* ===== Client card hover highlight (nicer version) ===== */
#clientsList .quote-card{
  transition: border-color 0.15s ease, transform 0.15s ease;
}

#clientsList .quote-card:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

#quotesList .quote-card{
  transition: border-color 0.15s ease, transform 0.15s ease;
}
#quotesList .quote-card:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}




/* ↓  Project Info  ↓ */


.client-details-card #clientProjectsList {
  margin-top: 8px;
  overflow-y: auto;
  max-height: 45vh;
}

/* tighten Projects heading spacing */
.client-details-card h3 {
  margin: 10px 0 8px 0 !important;
}

/* ===== Project card right-side menu ===== */
.project-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 120px;
}

/* Date is visible by default */
.project-menu .project-date {
  display: inline-block;
}

/* Dots are hidden until hover */
.project-menu .project-dots {
  display: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #ffffff;
  opacity: 0.9;
  user-select: none;
}

/* Trash hidden by default */
.project-menu .project-trash {
  display: none;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: #ffffff;
  opacity: 0.95;
}

/* Hover: replace date with dots */
.project-menu:hover .project-date {
  display: none;
}
.project-menu:hover .project-dots {
  display: inline-block;
}

/* When "armed", show trash instead of dots */
.project-menu.armed .project-dots {
  display: none !important;
}
.project-menu.armed .project-trash {
  display: inline-block !important;
}
.project-menu.armed .project-date {
  display: none !important;
}

.project-edit { cursor: text; }
.project-edit:hover { text-decoration: underline; text-decoration-color: rgba(255,255,255,0.35); }

/* ===== Project card hover highlight (nicer version) ===== */
#clientProjectsList .quote-card{
  transition: border-color 0.15s ease, transform 0.15s ease;
}

#clientProjectsList .quote-card:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}


/* ===== ↓. Quote modal pickers (client/project). ↓ ===== */

/* ===== Create Quote modal picker cards hover (nicer version) ===== */
#quoteClientPicker .quote-card,
#quoteProjectPicker .quote-card{
  transition: border-color 0.15s ease, transform 0.15s ease;
}

#quoteClientPicker .quote-card:hover,
#quoteProjectPicker .quote-card:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

.quotes-subtitle{
  font-weight:600;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picker-card {
  cursor: pointer;
}

.picker-card.selected {
  border-color: rgba(249, 115, 22, 0.55); /* orange selection */
}

/* ===== Quote modal scroll boxes for client/project pickers ===== */
.picker-scroll {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.18);
}

/* Slightly tighter spacing inside scroll boxes */
.picker-scroll .picker-list {
  gap: 8px;
}

/* ===== Quote modal picker headers + search ===== */
.picker-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}

.picker-title{
  font-weight:700;
}

.picker-search{
  width: 240px;
  max-width: 45%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  color: #fff;
  outline: none;
}

.picker-search::placeholder{
  color: rgba(255,255,255,0.55);
}

.picker-search:focus{
  border-color: rgba(255,255,255,0.22);
}

.picker-actions{
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* ===== Quotes scope toggle ===== */
.quotes-filter-row{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  margin-top:20px;
}

.quotes-filter-label{
  width: 95px;      /* ⬅️ FIXED WIDTH so text change doesn’t move toggle */
}

/* Toggle switch container */
.toggle-switch{
  position:relative;
  display:inline-block;
  width:42px;
  height:22px;
  margin:0;          /* ⬅️ remove manual positioning */
}

/* Hide default checkbox */
.toggle-switch input{
  opacity:0;
  width:0;
  height:0;
}

/* Slider */
.toggle-slider{
  position:absolute;
  cursor:pointer;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(255,255,255,0.25);
  border-radius:999px;
  transition:background 0.2s ease;
}

/* Knob */
.toggle-slider::before{
  content:"";
  position:absolute;
  height:16px;
  width:16px;
  left:3px;
  top:3px;
  background:#fff;
  border-radius:50%;
  transition:transform 0.2s ease;
}

/* Checked state */
.toggle-switch input:checked + .toggle-slider{
  background:rgba(249,115,22,0.85);
}

.toggle-switch input:checked + .toggle-slider::before{
  transform:translateX(20px);
}

/* ===== Quotes list scroll container ===== */
.quotes-scroll{
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.10);
}

/* Remove extra top margin when cards are inside the scroll box */
.quotes-scroll .quote-card{
  margin-top: 0;
  margin-bottom: 10px;
}

/* ===== Quote card layout (left -> right) ===== */
.quote-item-row{
  display:flex;
  align-items:flex-start;
  gap:18px;
}

.quote-item-client{
  min-width: 220px;
  max-width: 280px;
  font-weight: 700;
  line-height: 1.2;
}

.quote-item-mid{
  min-width: 200px;
}

.quote-item-num{
  font-weight: 700;
  line-height: 1.2;
}

.quote-item-project{
  margin-top: 6px;
  opacity: 0.85;
  font-size: 14px;
  line-height: 1.3;
}

.quote-item-address{
  flex: 1;
  opacity: 0.85;
  font-size: 14px;
  line-height: 1.35;
}

.quote-item-date{
  width: 140px;
  text-align: right;
  opacity: 0.75;
  font-size: 13px;
  white-space: nowrap;
}

/* ===== Quote Calculator full-screen modal ===== */
.modal-card.modal-large{
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}

/* Scroll container for the spreadsheet (works inside flex split layout) */
.quote-sheet-scroll{
  flex: 1;
  min-height: 0;      /* ✅ required so overflow scroll works in flex */
  overflow: auto;
  border-radius: 14px;
  position: relative;
}

/* Make quote editor grid feel more "excel-like" */

#quoteEditorGrid td[contenteditable="true"]{
  outline: none;
}

#quoteEditorGrid td[contenteditable="true"]:focus{
  border-color: rgba(249,115,22,0.55);
}

/* Row 1 C cell keeps the 10% button anchored */
#quoteEditorGrid td[data-r="2"][data-c="3"]{
  position: relative;
}

/* Row 1 subrow C cells keep the 10% button anchored */
#quoteEditorGrid td[data-r^="2."][data-c="3"]{
  position: relative;
}

/* Ten-toggle C cells keep the 10% button anchored */
.quote-ten-cell{
  position: relative;
}

/* Row 1 C-cell 10% toggle */
.quote-ten-toggle{
  position: absolute;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.25);
  background: #0f172a;
  color: #fff;
  cursor: pointer;
  top: 4px;
  right: 4px;
}

.quote-ten-toggle.active{
  background: #16a34a;
  border-color: #22c55e;
}

/* ===== Force Quote Calculator modal to truly fill window ===== */
#quoteEditorModal{
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

#quoteEditorModal .modal-card{
  margin: 0 !important;
}

/* ===== Quote Calculator spreadsheet (white sheet) ===== */
#quoteEditorGrid{
  background: #ffffff;
  color: #111;
  width: 100%;
  table-layout: fixed;   /* ✅ CRITICAL: prevents column stretching */
}

/* Header cells (A–F) */
#quoteEditorGrid thead th{
  background: #f3f4f6;
  color: #111;
  border-top: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  border-left: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
}

/* Body cells */
#quoteEditorGrid td{
  background: #ffffff;
  color: #111;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-left: 1px solid #d1d5db;   /* ⬅️ vertical divider */
  border-right: 1px solid #d1d5db;  /* ⬅️ vertical divider */
}

/* Focused cell */
#quoteEditorGrid td:focus{
  outline: none;
  background: #fff7ed; /* subtle orange tint */
}

/* ===== Quote Calculator row numbers ===== */
#quoteEditorGrid .row-header{
  background: #f3f4f6;
  color: #111;
  text-align: center;      /* ⬅️ center instead of right */
  padding: 0 6px;          /* ⬅️ reduce horizontal padding */
  font-size: 13px;
  user-select: none;
  border-color: #d1d5db;
  min-width: 32px;         /* ⬅️ narrower column */
}

/* Top-left corner cell */
#quoteEditorGrid thead .row-header{
  background: #e5e7eb;
}

/* ===== Quote Calculator: 2/3 spreadsheet + 1/3 paper preview ===== */
#quoteEditorModal .quote-editor-body{
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0; /* important so scroll areas work inside flex */
}

#quoteEditorModal .quote-editor-left{
  flex: 3;        /* or 2 — whatever ratio you want */
  min-width: 0;

  display: flex;
  flex-direction: column;
  min-height: 0;
}

#quoteEditorModal .quote-editor-right{
  flex: 2;        /* ⬅️ paper preview (wider) */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
  position: relative;
}

/* Make the scroll area use all left panel height */
#quoteEditorModal .quote-editor-left .quote-sheet-scroll{
  height: 100%;
  max-height: none;
}

/* Paper panel */
#quoteEditorModal .quote-paper-panel{
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  padding: 8px;
  border-radius: 14px;
}

/* White printer paper (Letter aspect ratio) */
#quoteEditorModal .quote-paper{
  width: min(580px, 100%);
  aspect-ratio: 8.5 / 11; /* printer paper */
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  overflow: auto;
}

#quoteEditorModal .proposal-download{
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 54px;
  height: 42px;
  border: 2px solid #84cc16;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  font-weight: 700;
  font-size: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

#quoteEditorModal .proposal-download:hover{
  background: #f7fee7;
}

#quoteEditorModal .quote-paper .proposal{
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 11px;
  color: #111827;
  padding: 0 10px 10px;
  line-height: 1.35;
}

#quoteEditorModal .proposal-meta{
  align-items: flex-start;
}

#quoteEditorModal .proposal-recipient{
  margin-bottom: 0;
}

#quoteEditorModal .proposal-recipient-address{
  margin-top: 2px;
  line-height: 1.2;
}

#quoteEditorModal .proposal-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

#quoteEditorModal .proposal-company{
  font-size: 9px;
  margin-bottom: 0;
}

#quoteEditorModal .proposal-company-name{
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

#quoteEditorModal .proposal-logo{
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 6px;
}

#quoteEditorModal .proposal-meta{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: -14px;
}

#quoteEditorModal .proposal-label{
  font-size: 9px;
  font-weight: 700;
  margin-bottom: 0;
}

#quoteEditorModal .proposal-strong{
  font-weight: 700;
  font-size: 13px;
}

#quoteEditorModal .proposal-recipient-address{
  font-size: 9px;
}

#quoteEditorModal .proposal-box{
  border: 1px solid #73b61a;
  min-width: 220px;
  position: relative;
  top: 12px;
}

#quoteEditorModal .proposal-box-title{
  background: #73b61a;
  color: #fff;
  font-weight: 700;
  padding: 6px 10px;
  font-size: 13px;
}

#quoteEditorModal .proposal-box-row{
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid #e5e7eb;
}

#quoteEditorModal .proposal-box-total{
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: #73b61a;
  color: #fff;
  font-weight: 700;
}

#quoteEditorModal .proposal-service{
  margin-top: -32px;
}

#quoteEditorModal .proposal-service-line{
  font-size: 10px;
}

#quoteEditorModal .proposal-table{
  margin-top: 16px;
  border-top: 3px solid #73b61a;
}

#quoteEditorModal .proposal-table-head{
  display: grid;
  grid-template-columns: 0.5fr 2.5fr 80px;
  gap: 10px;
  background: #73b61a;
  color: #fff;
  font-weight: 700;
  padding: 2px 10px;
}

#quoteEditorModal .proposal-table-row{
  display: grid;
  grid-template-columns: 0.5fr 2.5fr 80px;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 9px;
}

#quoteEditorModal .proposal-desc p{
  margin: 0 0 2px;
}

#quoteEditorModal .proposal-desc{
  line-height: 1.2;
  padding-right: 0;
}

#quoteEditorModal .proposal-table-row{
  position: relative;
}

#quoteEditorModal .proposal-row-actions{
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  gap: 6px;
  align-items: center;
}

#quoteEditorModal .proposal-item-menu,
#quoteEditorModal .proposal-item-delete{
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

#quoteEditorModal .proposal-item-menu:hover{
  background: #f3f4f6;
}

#quoteEditorModal .proposal-item-delete{
  display: none;
}

#quoteEditorModal .proposal-row-actions.is-open .proposal-item-menu{
  display: none;
}

#quoteEditorModal .proposal-row-actions.is-open .proposal-item-delete{
  display: grid;
  background: #fee2e2;
  border-color: #fecaca;
}

#quoteEditorModal .proposal-right{
  text-align: right;
  font-weight: 700;
  padding-left: 2px;
  padding-right: 0;
}

#quoteEditorModal .proposal-table-row .proposal-right[contenteditable="true"]{
  display: inline-block;
  min-width: 64px;
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  box-sizing: border-box;
  justify-self: end;
}

#quoteEditorModal .proposal-table-row .proposal-right[contenteditable="true"]:focus{
  border-color: #cbd5f5;
  background: #ffffff;
  outline: none;
}

#quoteEditorModal .proposal-foot{
  margin-top: 12px;
  font-size: 10px;
}

#quoteEditorModal .proposal-add-item{
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px dashed #cbd5f5;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#quoteEditorModal .proposal-add-item:hover{
  background: #eef2ff;
}

#quoteEditorModal .proposal-remove-item{
  align-self: start;
  margin-left: 4px;
  margin-top: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

#quoteEditorModal .proposal-remove-item:hover{
  background: #fee2e2;
  border-color: #fecaca;
}

#quoteEditorModal .proposal-total-line{
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-weight: 700;
}

#quoteEditorModal .proposal-terms{
  margin-top: 10px;
}

/* ===== Quote Calculator internal header row (row 0) ===== */
#quoteEditorGrid .quote-header-cell{
  font-weight: 700;
  color: #dc2626;          /* red */
  background: #fff5f5;    /* subtle red tint */
  text-align: center;
  cursor: default;
}

#quoteEditorGrid td.row1-ten-cell{
  position: relative;
  padding-right: 44px;
}

#quoteEditorGrid td.row1-ten-cell .row1-ten-toggle{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

/* ===== Quote Calculator: Row 1 + its subrows (light gray) ===== */
#quoteEditorGrid td.row-header[data-rowlabel="1"],
#quoteEditorGrid td.row-header[data-rowlabel="1"] ~ td:not(.quote-hint-cell),
#quoteEditorGrid tr[data-subrow="1"] td:not(.quote-hint-cell),
#quoteEditorGrid td.row-header[data-rowlabel="3"],
#quoteEditorGrid td.row-header[data-rowlabel="3"] ~ td:not(.quote-hint-cell),
#quoteEditorGrid td.row-header[data-rowlabel="5"],
#quoteEditorGrid td.row-header[data-rowlabel="5"] ~ td:not(.quote-hint-cell),
#quoteEditorGrid tr[data-subrow="5"] td:not(.quote-hint-cell){
  background: #f1f1f1;
}

#quoteEditorGrid td.row-header[data-rowlabel="7"],
#quoteEditorGrid td.row-header[data-rowlabel="7"] ~ td:not(.quote-hint-cell){
  background: #f1f1f1;
}

#quoteEditorGrid td.row-header[data-rowlabel="9"],
#quoteEditorGrid td.row-header[data-rowlabel="9"] ~ td:not(.quote-hint-cell){
  background: #f1f1f1;
}

#quoteEditorGrid td.row-header[data-rowlabel="11"],
#quoteEditorGrid td.row-header[data-rowlabel="11"] ~ td:not(.quote-hint-cell),
#quoteEditorGrid tr[data-subrow="11"] td:not(.quote-hint-cell){
  background: #f1f1f1;
}

#quoteEditorGrid td.row-header[data-rowlabel="13"],
#quoteEditorGrid td.row-header[data-rowlabel="13"] ~ td:not(.quote-hint-cell),
#quoteEditorGrid tr[data-subrow="13"] td:not(.quote-hint-cell){
  background: #f1f1f1;
}

#quoteEditorGrid td.row-header[data-rowlabel="15"],
#quoteEditorGrid td.row-header[data-rowlabel="15"] ~ td:not(.quote-hint-cell){
  background: #f1f1f1;
}

/* Row 24 highlight (blue) */
#quoteEditorGrid td.row-header[data-rowlabel="24"],
#quoteEditorGrid td.row-header[data-rowlabel="24"] ~ td:not(.quote-hint-cell){
  background: #dbeafe;
}

/* Row 35 highlight (blue) */
#quoteEditorGrid td.row-header[data-rowlabel="35"],
#quoteEditorGrid td.row-header[data-rowlabel="35"] ~ td:not(.quote-hint-cell){
  background: #dbeafe;
}

/* Row 50 highlight (blue) */
#quoteEditorGrid td.row-header[data-rowlabel="50"],
#quoteEditorGrid td.row-header[data-rowlabel="50"] ~ td:not(.quote-hint-cell){
  background: #dbeafe;
}

/* Row 39 A/B highlight (theme orange) */
#quoteEditorGrid td[data-r="40"][data-c="1"],
#quoteEditorGrid td[data-r="40"][data-c="2"]{
  background: var(--primary);
  color: #fff;
}

/* Row 54 A/B highlight (theme orange) */
#quoteEditorGrid td[data-r="55"][data-c="1"],
#quoteEditorGrid td[data-r="55"][data-c="2"]{
  background: var(--primary);
  color: #fff;
}

/* Row 62 A/B highlight (theme orange) */
#quoteEditorGrid td[data-r="63"][data-c="1"],
#quoteEditorGrid td[data-r="63"][data-c="2"]{
  background: var(--primary);
  color: #fff;
}

/* Row 40 highlight (red) */
#quoteEditorGrid td.row-header[data-rowlabel="40"],
#quoteEditorGrid td.row-header[data-rowlabel="40"] ~ td:not(.quote-hint-cell){
  background: #fee2e2;
}

/* Row 55 highlight (red) */
#quoteEditorGrid td.row-header[data-rowlabel="55"],
#quoteEditorGrid td.row-header[data-rowlabel="55"] ~ td:not(.quote-hint-cell){
  background: #fee2e2;
}

/* Row 63 highlight (red) */
#quoteEditorGrid td.row-header[data-rowlabel="63"],
#quoteEditorGrid td.row-header[data-rowlabel="63"] ~ td:not(.quote-hint-cell){
  background: #fee2e2;
}

/* Custom Input cell (row 32, col A) */
#quoteEditorGrid td.quote-custom-input{
  color: #2563eb;
}

/* Grand Total label */
#quoteEditorGrid td.quote-grand-total-label{
  background: #86efac;
  color: #14532d;
  font-weight: 700;
}

/* Furring section toggle */
#quoteEditorGrid .quote-furring-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#quoteEditorGrid .quote-furring-toggle-label{
  font-weight: 600;
  font-size: 12px;
}

#quoteEditorGrid .quote-furring-toggle .toggle-slider{
  background: #e5e7eb;
  border: 1px solid #9ca3af;
}

#quoteEditorGrid .quote-furring-toggle .toggle-slider::before{
  background: #ffffff;
  top: 2px;
}

#quoteEditorGrid .quote-furring-toggle input:checked + .toggle-slider{
  background: rgba(249,115,22,0.85);
  border-color: rgba(249,115,22,0.85);
}

#quoteEditorGrid .quote-air-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#quoteEditorGrid .quote-air-toggle-label{
  font-weight: 600;
  font-size: 12px;
}

#quoteEditorGrid .quote-air-toggle .toggle-slider{
  background: #e5e7eb;
  border: 1px solid #9ca3af;
}

#quoteEditorGrid .quote-air-toggle .toggle-slider::before{
  background: #ffffff;
  top: 2px;
}

#quoteEditorGrid .quote-air-toggle input:checked + .toggle-slider{
  background: rgba(249,115,22,0.85);
  border-color: rgba(249,115,22,0.85);
}

/* Furring section disabled rows */
#quoteEditorGrid td.quote-furring-disabled{
  background: #d1d5db !important;
  color: #6b7280 !important;
  pointer-events: none;
}

#quoteEditorGrid td.quote-furring-disabled .quote-ten-toggle{
  display: none;
}

/* Air/Water section disabled rows */
#quoteEditorGrid td.quote-air-disabled{
  background: #d1d5db !important;
  color: #6b7280 !important;
  pointer-events: none;
}

/* Disable subrow controls for furring section when toggle is off */
#quoteEditorGrid td.quote-furring-controls-disabled .row-subrow-controls{
  display: none !important;
}


/* Prevent focus outline on non-editable header cells */
#quoteEditorGrid .quote-header-cell:focus{
  outline: none;
}

/* ===== Quote Calculator: wrap text and grow rows vertically ===== */
#quoteEditorGrid td,
#quoteEditorGrid th{
  white-space: normal;      /* allow wrapping */
  word-break: break-word;  /* break long words */
  vertical-align: top;      /* text starts at top */
}

#quoteEditorGrid td{
  padding: 6px 8px;
  line-height: 1.25;
}

/* Quote calculator: dropdown cell */
#quoteEditorGrid .quote-dropdown-cell { padding: 0; }

/* Quote calculator: custom dropdown that can wrap */
#quoteEditorGrid .quote-dropdown-cell { padding: 0; vertical-align: top; }

#quoteEditorGrid .quote-cell-dropdown{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  width: 100%;
  cursor: pointer;
  user-select: none;
}

#quoteEditorGrid .quote-cell-dropdown-value{
  flex: 1;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

#quoteEditorGrid .quote-cell-dropdown-caret{
  opacity: 0.65;
  line-height: 1.25;
}

/* Floating menu */
.quote-panel-menu{
  position: fixed;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  z-index: 10000;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.quote-panel-item{
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

.quote-panel-item:hover{
  background: rgba(255,255,255,0.06);
}

#quoteEditorGrid .quote-dropdown-cell{
  vertical-align: top;       /* ⬅️ row grows downward */
}

/* ===== Quote calculator: section submenu (products) ===== */
.quote-panel-submenu{
  position: fixed;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  z-index: 10001;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.quote-panel-item-has-sub{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.quote-panel-item-caret{
  opacity:0.6;
}

/* Locked auto-filled cells (e.g. Item Price) */
#quoteEditorGrid .quote-locked-cell{
  background: #f3f4f6;
  color: #111;
  cursor: default;
}

#quoteEditorGrid .quote-locked-cell{
  background: #f3f4f6;
  cursor: default;
}

/* Hint message cell (e.g. row 12 pack size note) */
#quoteEditorGrid .quote-hint-cell{
  background: #0f172a;
  color: #7dd3fc;
  border: 1px solid rgba(125,211,252,0.25);
  font-style: italic;
  font-size: 12px;
  line-height: 1.35;
  border-radius: 8px;
  padding: 6px 8px;
}

/* Variant hint color (green) */
#quoteEditorGrid .quote-hint-cell.quote-hint-green{
  color: #86efac;
  border-color: rgba(134,239,172,0.3);
}

/* Row header needs positioning so the overlay can sit inside it */
#quoteEditorGrid .row-header{
  position: relative;
}

/* Overlay container (holds + and trash) */
#quoteEditorGrid .row-subrow-controls{
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  gap: 6px;
  align-items: center;
}

/* Buttons (shared style) */
#quoteEditorGrid .row-add-subrow,
#quoteEditorGrid .row-delete-subrow{
  width: 30px;
  height: 30px;
  border-radius: 10px;

  background: #070d18;               /* matches app dark cards */
  border: 1px solid var(--border);
  color: #e5e7eb;

  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  cursor: pointer;

  font-size: 16px;
  font-weight: 800;
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#quoteEditorGrid .row-delete-subrow svg{
  display: block;
}

/* ✅ Only hide the number if the controls exist on that row */
#quoteEditorGrid .row-header:has(.row-subrow-controls):hover .row-header-label{
  opacity: 0;
}

/* ✅ Only show controls on hover if they exist */
#quoteEditorGrid .row-header:has(.row-subrow-controls):hover .row-subrow-controls{
  display: inline-flex;
}

#quoteEditorGrid .row-add-subrow:hover,
#quoteEditorGrid .row-delete-subrow:hover{
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

#quoteEditorGrid .row-add-subrow:active,
#quoteEditorGrid .row-delete-subrow:active{
  transform: translateY(0px);
}

/* Optional: make subrows look slightly “nested” */
#quoteEditorGrid tr[data-subrow="1"] .row-header-label{
  padding-left: 6px;
  opacity: 0.9;
  font-size: 12px;
}
