/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a202c;
  line-height: 1.5;
  min-height: 100vh;
}
input, textarea, button, select { font-family: inherit; font-size: inherit; }
a { color: #1a365d; }

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; cursor: pointer;
  font-weight: 600; transition: all 0.15s ease;
  min-height: 44px; padding: 10px 20px; gap: 6px;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; }
.btn-lg { min-height: 50px; padding: 12px 28px; font-size: 1.1rem; }
.btn-primary { background: #1a365d; color: #fff; }
.btn-primary:hover { background: #234681; }
.btn-accent { background: #d4a843; color: #1a365d; }
.btn-accent:hover { background: #c49a35; }
.btn-success { background: #276749; color: #fff; }
.btn-success:hover { background: #22543d; }
.btn-danger { background: #c53030; color: #fff; }
.btn-danger:hover { background: #9b2c2c; }
.btn-outline { background: #fff; color: #1a365d; border: 1.5px solid #cbd5e0; }
.btn-outline:hover { background: #edf2f7; border-color: #a0aec0; }

/* ===== LOGIN ===== */
#loginScreen {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f7f8fa 0%, #e2e8f0 100%);
}
#loginScreen.active { display: flex; }
.login-container {
  text-align: center; padding: 40px 30px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  max-width: 380px; width: 100%;
}
.login-logo { max-width: 200px; height: auto; margin-bottom: 16px; border-radius: 8px; }
.login-title { font-size: 1.15rem; color: #1a365d; margin-bottom: 2px; }
.login-subtitle { font-size: 0.9rem; color: #718096; margin-bottom: 24px; }
.pin-dots {
  display: flex; justify-content: center; gap: 14px; margin-bottom: 8px;
}
.pin-dots .dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #cbd5e0; background: #fff;
  transition: background 0.15s, border-color 0.15s;
}
.pin-dots .dot.filled { background: #1a365d; border-color: #1a365d; }
.pin-error {
  color: #c53030; font-size: 0.85rem; min-height: 22px;
  margin-bottom: 10px; opacity: 0; transition: opacity 0.2s;
}
.pin-error.show { opacity: 1; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.pin-dots.shake { animation: shake 0.4s ease; }
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; max-width: 280px; margin: 0 auto;
}
.pin-btn {
  width: 100%; aspect-ratio: 1.3; border: none; border-radius: 10px;
  font-size: 1.6rem; font-weight: 600; cursor: pointer;
  background: #edf2f7; color: #1a365d; transition: all 0.1s;
  align-items: center; justify-content: center;
}
.pin-btn:hover { background: #e2e8f0; }
.pin-btn:active { background: #cbd5e0; transform: scale(0.95); }
.pin-fn { font-size: 1.3rem; background: #e2e8f0; }
.pin-enter { background: #1a365d; color: #fff; }
.pin-enter:hover { background: #234681; }

/* ===== TOP BAR ===== */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 100;
  flex-wrap: wrap; gap: 8px;
}
.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 10px; }
.top-bar-logo { height: 36px; border-radius: 4px; }
.top-bar-title { font-weight: 700; color: #1a365d; font-size: 1rem; }
.welcome-text { font-size: 0.9rem; color: #4a5568; }

/* ===== DASHBOARD ===== */
.dashboard-content { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.dashboard-header h2 { font-size: 1.5rem; color: #1a365d; }
.filter-tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-tab {
  padding: 8px 18px; border: none; border-radius: 20px;
  background: #edf2f7; color: #4a5568; cursor: pointer;
  font-weight: 600; font-size: 0.875rem; transition: all 0.15s;
}
.filter-tab:hover { background: #e2e8f0; }
.filter-tab.active { background: #1a365d; color: #fff; }
.bids-list { display: flex; flex-direction: column; gap: 10px; }
.bid-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  flex-wrap: wrap; gap: 8px;
}
.bid-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }
.bid-card-left { display: flex; flex-direction: column; gap: 2px; }
.bid-card-num { font-weight: 700; color: #1a365d; font-size: 1.05rem; }
.bid-card-client { color: #4a5568; font-size: 0.9rem; }
.bid-card-date { color: #a0aec0; font-size: 0.8rem; }
.bid-card-right { display: flex; align-items: center; gap: 14px; }
.bid-card-total { font-weight: 700; font-size: 1.1rem; color: #1a365d; }
.status-badge {
  padding: 3px 12px; border-radius: 12px; font-size: 0.75rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-draft { background: #edf2f7; color: #718096; }
.status-submitted { background: #fefcbf; color: #975a16; }
.status-approved { background: #c6f6d5; color: #276749; }
.empty-msg { text-align: center; padding: 40px 20px; color: #a0aec0; font-size: 1rem; }

/* ===== CARD ===== */
.card {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-bottom: 16px;
}

/* ===== FORMS ===== */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1; min-width: 160px; }
.form-group.flex2 { flex: 2; }
.form-group.flex3 { flex: 3; }
label { font-weight: 600; font-size: 0.85rem; color: #4a5568; }
input[type="text"], input[type="number"], textarea, select {
  padding: 10px 12px; border: 1.5px solid #cbd5e0; border-radius: 6px;
  background: #fff; transition: border-color 0.15s;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #1a365d; }

/* ===== BUILDER ===== */
.builder-body { padding: 16px; max-width: 1400px; margin: 0 auto; }
.builder-columns { display: flex; gap: 16px; align-items: flex-start; }
.catalog-panel {
  width: 320px; min-width: 280px; position: sticky; top: 70px;
  max-height: calc(100vh - 80px); overflow-y: auto; flex-shrink: 0;
}
.catalog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.catalog-header h3 { margin: 0; }
.catalog-close-mobile { display: none; }
.catalog-search {
  margin-bottom: 10px; padding: 9px 12px;
  border: 1.5px solid #cbd5e0; border-radius: 6px; width: 100%;
}
.catalog-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.cat-tab {
  padding: 4px 10px; border: none; border-radius: 14px;
  background: #edf2f7; color: #4a5568; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; transition: all 0.12s;
}
.cat-tab:hover { background: #e2e8f0; }
.cat-tab.active { background: #1a365d; color: #fff; }
.catalog-list { display: flex; flex-direction: column; gap: 2px; }
.catalog-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  transition: background 0.1s; font-size: 0.85rem; gap: 8px;
}
.catalog-item:hover { background: #edf2f7; }
.catalog-item-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-item-price { font-weight: 600; color: #1a365d; white-space: nowrap; }
.catalog-item-unit { color: #a0aec0; font-size: 0.75rem; white-space: nowrap; }

.items-section { flex: 1; min-width: 0; }
.items-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.section-sub-title { margin: 20px 0 10px; color: #1a365d; font-size: 1rem; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.items-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.items-table thead { background: #1a365d; color: #fff; }
.items-table th { padding: 10px 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.items-table td { padding: 8px; border-bottom: 1px solid #edf2f7; vertical-align: middle; }
.items-table tbody tr:nth-child(even) { background: #f7f8fa; }
.items-table tbody tr:hover { background: #edf2f7; }
.items-table input[type="number"] {
  width: 70px; padding: 5px 6px; border: 1px solid #cbd5e0;
  border-radius: 4px; font-size: 0.85rem; text-align: right;
}
.items-table input.readonly-field {
  background: #f7f8fa; color: #718096; cursor: not-allowed;
}
.items-table .col-num { width: 36px; text-align: center; }
.items-table .col-desc { min-width: 200px; }
.items-table .col-qty { width: 70px; }
.items-table .col-unit { width: 50px; }
.items-table .col-cost { width: 90px; text-align: right; }
.items-table .col-markup, .items-table .col-oh, .items-table .col-bond { width: 70px; }
.items-table .col-nomu { width: 50px; text-align: center; }
.items-table .col-total { width: 100px; text-align: right; font-weight: 700; }
.items-table .col-actions { width: 40px; text-align: center; }
.items-table .col-hrs { width: 70px; }
.items-table .col-rate { width: 90px; text-align: right; }
.delete-item-btn {
  background: none; border: none; color: #c53030; cursor: pointer;
  font-size: 1.1rem; padding: 4px; border-radius: 4px; line-height: 1;
}
.delete-item-btn:hover { background: #fed7d7; }
td.text-right { text-align: right; }

/* ===== EXCLUSIONS ===== */
.exclusions-section { margin-top: 16px; }
.exclusion-checks { display: flex; flex-direction: column; gap: 8px; }
.exclusion-check {
  display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem;
}
.exclusion-check input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }

/* ===== SUMMARY ===== */
.summary-section { margin-top: 16px; }
.summary-grid { display: flex; flex-direction: column; gap: 6px; }
.summary-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  font-size: 0.95rem; border-bottom: 1px solid #edf2f7;
}
.summary-row span:last-child { font-weight: 600; }
.summary-grand {
  font-size: 1.2rem !important; font-weight: 800 !important;
  border-top: 2px solid #1a365d; border-bottom: none;
  padding-top: 12px; margin-top: 4px;
}
.summary-grand span { color: #1a365d; }
.summary-grand span:last-child { font-size: 1.3rem; }

/* ===== SETTINGS ===== */
.settings-content { max-width: 700px; margin: 0 auto; padding: 24px 16px; }
.settings-content .card { margin-bottom: 20px; }
.excl-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid #edf2f7; gap: 8px;
}
.excl-setting-row span { flex: 1; font-size: 0.9rem; }
.excl-setting-row button {
  background: none; border: none; color: #c53030; cursor: pointer;
  font-size: 0.9rem; padding: 4px 8px;
}
.excl-setting-row button:hover { background: #fed7d7; border-radius: 4px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 24px;
  max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal-box h3 { margin-bottom: 12px; color: #1a365d; }
.modal-box p { margin-bottom: 8px; color: #4a5568; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #1a365d; color: #fff; padding: 12px 28px;
  border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  z-index: 2000;
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast.error { background: #c53030; }

/* ===== PROPOSAL ===== */
.proposal-toolbar {
  padding: 12px 20px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; gap: 10px; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.proposal-page {
  max-width: 850px; margin: 24px auto; padding: 48px 56px;
  background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border-radius: 4px; min-height: 900px; line-height: 1.6;
}
.proposal-page .prop-header { text-align: center; margin-bottom: 24px; }
.proposal-page .prop-logo { max-width: 200px; margin-bottom: 10px; border-radius: 6px; }
.proposal-page .prop-company { font-size: 1.2rem; font-weight: 700; color: #1a365d; }
.proposal-page .prop-contact { font-size: 0.9rem; color: #4a5568; margin-bottom: 12px; }
.proposal-page .prop-hr { border: none; border-top: 2px solid #1a365d; margin: 16px 0; }
.proposal-page .prop-title { text-align: center; font-size: 1.6rem; font-weight: 800; color: #1a365d; margin-bottom: 20px; letter-spacing: 2px; }
.proposal-page .prop-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-bottom: 16px; font-size: 0.95rem; }
.proposal-page .prop-info-item strong { color: #1a365d; }
.proposal-page .prop-scope { margin-bottom: 20px; }
.proposal-page .prop-scope h4 { color: #1a365d; margin-bottom: 4px; }
.proposal-page .prop-scope p { font-size: 0.95rem; white-space: pre-wrap; }
.proposal-page table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 0.9rem; }
.proposal-page thead { background: #1a365d; color: #fff; }
.proposal-page th { padding: 8px 10px; text-align: left; font-weight: 600; }
.proposal-page td { padding: 7px 10px; border-bottom: 1px solid #e2e8f0; }
.proposal-page tbody tr:nth-child(even) { background: #f7f8fa; }
.proposal-page .prop-total-row td { font-weight: 800; font-size: 1.1rem; border-top: 2px solid #1a365d; }
.proposal-page .prop-subtotal-row td { font-weight: 600; border-top: 1px solid #a0aec0; }
.proposal-page .text-right { text-align: right; }
.proposal-page .prop-exclusions { margin: 20px 0; }
.proposal-page .prop-exclusions h4 { color: #1a365d; margin-bottom: 6px; }
.proposal-page .prop-exclusions ul { padding-left: 24px; font-size: 0.9rem; }
.proposal-page .prop-exclusions li { margin-bottom: 3px; }
.proposal-page .prop-validity { margin: 24px 0; font-size: 0.9rem; font-style: italic; color: #4a5568; }
.proposal-page .prop-sig { margin-top: 40px; font-size: 0.9rem; }
.proposal-page .prop-sig-line { display: flex; gap: 40px; margin-top: 30px; flex-wrap: wrap; }
.proposal-page .prop-sig-field { border-bottom: 1px solid #1a365d; min-width: 200px; padding-bottom: 4px; flex: 1; }
.proposal-page .prop-sig-label { font-size: 0.8rem; color: #718096; margin-top: 2px; }
.proposal-page .prop-sig-company { margin-top: 20px; font-weight: 700; color: #1a365d; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .builder-columns { flex-direction: column; }
  .catalog-panel {
    position: fixed; inset: 0; z-index: 200; width: 100%; min-width: 0;
    max-height: 100vh; border-radius: 0; display: none;
  }
  .catalog-panel.open { display: block; }
  .catalog-close-mobile { display: inline-flex; }
  .top-bar { padding: 8px 12px; }
  .top-bar-right { flex-wrap: wrap; }
  .proposal-page { padding: 24px 20px; margin: 12px; }
  .prop-info { grid-template-columns: 1fr !important; }
}
@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
  .form-group { min-width: 0; }
  .bid-card { flex-direction: column; align-items: flex-start; }
  .bid-card-right { width: 100%; justify-content: space-between; }
  .items-table { font-size: 0.78rem; }
  .items-table input[type="number"] { width: 55px; }
}

/* ===== PRINT ===== */
@media print {
  body { background: #fff; }
  .no-print, .top-bar, .proposal-toolbar { display: none !important; }
  .screen { display: none !important; }
  #proposalScreen { display: block !important; }
  .proposal-page {
    box-shadow: none; margin: 0; padding: 20px 24px;
    max-width: 100%; border-radius: 0;
  }
  .proposal-page .prop-company, .proposal-page th,
  .proposal-page .prop-title, .proposal-page .prop-info-item strong {
    color: #000 !important;
  }
  .proposal-page thead { background: #ddd !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .proposal-page tbody tr:nth-child(even) { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Share button */
.btn-share { background:none; border:1px solid #ccc; border-radius:6px; padding:4px 8px; cursor:pointer; font-size:14px; transition:all .2s; }
.btn-share:hover { background:#f0f0f0; border-color:#999; }
.btn-sm { padding:4px 10px; font-size:12px; }

/* ===== BID CONTROLS ===== */
.bid-controls-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider:before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: #2563eb; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.consum-input {
  width: 80px !important;
  padding: 4px 8px !important;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

/* ===== CATALOG MANAGEMENT ===== */
.cat-mgmt-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cat-mgmt-search {
  flex: 1;
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}
.cat-mgmt-count {
  color: #666;
  font-size: 13px;
  white-space: nowrap;
}
.cat-mgmt-list {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.cat-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cat-mgmt-table th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #d1d5db;
}
.cat-mgmt-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.cat-mgmt-table tr:hover { background: #f9fafb; }
.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.btn-icon {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}
.btn-icon:hover { background: #e5e7eb; }
.cat-edit-btn { color: #2563eb; }
.cat-del-btn { color: #dc2626; font-size: 20px; }

@media print {
  .bid-controls-grid { display: none; }
}

/* ===== BID CONTROLS ===== */
.bid-controls-section { }
.bid-controls-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  padding: 6px 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.toggle-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.toggle-label { font-size: 0.95rem; }
.consumables-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.consumables-control label { font-weight: 500; font-size: 0.95rem; white-space: nowrap; }
.consumables-input {
  width: 100px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

/* ===== PROPOSAL OPTIONS ===== */
.proposal-options-section { }
.proposal-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ===== CUSTOMER NOTES ===== */
#customerNotes {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  resize: vertical;
  font-family: inherit;
}

/* ===== PROPOSAL NOTES ===== */
.prop-notes {
  margin: 16px 0;
  padding: 12px;
  background: #f0f7ff;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
}
.prop-notes h4 {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  color: var(--primary);
}
.prop-notes p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

@media print {
  .prop-notes {
    background: #f0f7ff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Simple/Advanced mode toggle */
.adv-only { transition: opacity 0.2s; }
.line-num-col { width: 36px; }

/* Catalog project type filter */
.catalog-project-filter {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 6px;
  background: white;
}

/* Save to catalog button */
.save-catalog-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.save-catalog-btn:hover { opacity: 1; }

/* Mode toggle pill */
#modeToggle {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
}


/* ========== ADVANCED BUILDER v6 ========== */
.adv-items-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding: 0 4px;
}
#advItemsTable tbody tr { cursor: pointer; transition: background 0.15s; }
#advItemsTable tbody tr:hover { background: #f0f4ff; }
.adv-subtotal-row { background: #f8f9fa; border-top: 2px solid #dee2e6; }
.adv-subtotal-row td { padding: 10px 8px; }

/* Item Editor Modal */
.adv-item-editor { max-width: 920px; max-height: 90vh; overflow-y: auto; }
.adv-item-header-fields { display: flex; gap: 10px; margin-bottom: 16px; }
.adv-item-header-fields .form-group label { font-size: 0.82em; font-weight: 600; margin-bottom: 2px; }
.adv-item-header-fields input { font-size: 0.95em; }

.cost-section { border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; margin: 12px 0; background: #fafbfc; }
.cost-section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cost-add-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.cost-add-btns .btn { font-size: 0.8em; padding: 4px 10px; }

.cost-table input[type="number"] { width: 58px; padding: 3px 4px; font-size: 0.85em; }
.cost-table input[type="text"] { width: 100%; padding: 3px 4px; font-size: 0.85em; }
.cost-table select { padding: 3px 2px; font-size: 0.82em; }
.cost-table td { padding: 4px 3px; vertical-align: middle; }
.cost-table .cost-type-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 0.75em; font-weight: 600; text-transform: uppercase; }
.cost-type-material { background: #e3f2fd; color: #1565c0; }
.cost-type-labor { background: #fff3e0; color: #e65100; }
.cost-type-equipment { background: #f3e5f5; color: #7b1fa2; }
.cost-delete-btn { background: none; border: none; color: #dc3545; cursor: pointer; font-size: 1.1em; padding: 2px 4px; }
.cost-delete-btn:hover { color: #a71d2a; }

.adv-item-totals { margin-top: 12px; padding: 12px; border-top: 2px solid #dee2e6; }
.adv-total-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.adv-total-row strong { font-size: 1.05em; }

/* Catalog search inside editor */
.adv-cat-search { border: 1px solid #d0d7de; border-radius: 6px; padding: 8px; margin: 8px 0; background: #fff; }
.adv-cat-results { max-height: 180px; overflow-y: auto; margin-top: 4px; }
.adv-cat-result-item { padding: 6px 8px; cursor: pointer; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; font-size: 0.88em; }
.adv-cat-result-item:hover { background: #e8f0fe; }
.adv-cat-result-item .cat-r-desc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adv-cat-result-item .cat-r-price { font-weight: 600; margin-left: 12px; white-space: nowrap; }

@media (max-width: 700px) {
  .adv-item-header-fields { flex-wrap: wrap; }
  .adv-item-editor { max-width: 100%; }
  .cost-section-header { flex-direction: column; align-items: flex-start; }
}

/* ===== RETURNED STATUS ===== */
.status-returned { background: #fed7d7; color: #c53030; }

/* ===== FILTER TAB BADGES ===== */
.filter-tab { position: relative; }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e53e3e; color: white; font-size: 0.65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  margin-left: 4px; line-height: 1;
}
.filter-badge.zero { display: none; }

/* ===== DASHBOARD ALERT BANNER ===== */
.dashboard-alert {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid #f6ad55;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  color: #744210;
  cursor: pointer;
  transition: transform 0.15s;
}
.dashboard-alert:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.dashboard-alert-icon { font-size: 1.8rem; }
.dashboard-alert-text { flex: 1; }
.dashboard-alert-text strong { display: block; font-size: 1.1rem; margin-bottom: 2px; }
.dashboard-alert-btn {
  background: #dd6b20; color: white; border: none; padding: 8px 16px;
  border-radius: 6px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.dashboard-alert-btn:hover { background: #c05621; }

/* ===== RETURNED NOTES BANNER IN BUILDER ===== */
.returned-banner {
  background: #fff5f5;
  border: 2px solid #fc8181;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  color: #c53030;
}
.returned-banner strong { display: block; margin-bottom: 4px; font-size: 1rem; }
.returned-banner p { margin: 0; color: #742a2a; white-space: pre-wrap; }

/* ===== BID CARD SENT-BACK INDICATOR ===== */
.bid-card-returned {
  font-size: 0.75rem;
  color: #c53030;
  font-weight: 600;
}

/* ===== PULSE ANIMATION FOR SUBMITTED BADGE ===== */
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.filter-tab[data-filter="submitted"] .filter-badge:not(.zero),
.filter-tab[data-filter="returned"] .filter-badge:not(.zero) {
  animation: pulse-badge 2s ease-in-out infinite;
}

/* Settings: Rates */
.settings-help { color: #666; font-size: 0.9em; margin-bottom: 12px; }

.rate-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.rate-setting-row:last-child { border-bottom: none; }
.rate-title { flex: 2; font-weight: 500; }
.rate-value { flex: 1; font-weight: 600; color: var(--primary); text-align: right; }
.rate-badge { font-size: 0.75em; padding: 2px 8px; border-radius: 8px; font-weight: 600; }
.badge-owned { background: #e8f5e9; color: #2e7d32; }
.badge-rental { background: #fff3e0; color: #e65100; }

.crew-setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #eee;
}
.crew-setting-row:last-child { border-bottom: none; }
.crew-info { flex: 1; }
.crew-info strong { font-size: 1.05em; }
.crew-detail { color: #666; font-size: 0.9em; margin-top: 2px; }
.crew-total { font-weight: 700; color: var(--primary); margin-top: 4px; }
.crew-actions { display: flex; gap: 6px; }

.crew-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.crew-member-select { flex: 2; min-width: 150px; }
.crew-member-subtotal { font-weight: 600; color: var(--primary); min-width: 80px; text-align: right; }

.btn-danger-outline {
  background: transparent;
  border: 1px solid #dc3545;
  color: #dc3545;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 8px;
  font-weight: 700;
}
.btn-danger-outline:hover { background: #dc3545; color: #fff; }

/* Labor modal breakdown preview */
.labor-breakdown-preview {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.breakdown-title { font-weight: 600; margin-bottom: 4px; }
.breakdown-line { color: #555; font-size: 0.9em; padding: 1px 0; }
.breakdown-total { font-weight: 700; color: var(--primary); margin-top: 4px; border-top: 1px solid #dee2e6; padding-top: 4px; }

/* Advanced Bid Cost Summary */
.adv-bid-summary { margin-top: 16px; }
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 16px;
  background: #f0f4ff;
  border-radius: 8px;
  user-select: none;
}
.summary-header h3 { margin: 0; font-size: 1.1em; }
.summary-toggle-icon { font-size: 1.2em; transition: transform 0.2s; }
.summary-header.collapsed .summary-toggle-icon { transform: rotate(-90deg); }
.summary-body { padding: 16px; }
.summary-body.hidden { display: none; }
.summary-section { margin-bottom: 16px; }
.summary-section h4 { 
  margin: 0 0 8px 0; 
  font-size: 0.95em; 
  color: #555; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.92em;
  color: #444;
}
.summary-line .summary-label { flex: 2; }
.summary-line .summary-detail { flex: 1; text-align: right; color: #888; font-size: 0.9em; }
.summary-line .summary-amount { flex: 1; text-align: right; font-weight: 500; }
.summary-section-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  border-top: 1px solid #ddd;
  padding-top: 4px;
  margin-top: 4px;
}
.adv-bid-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.95em;
}
.adv-bid-summary .summary-subtotal { font-weight: 600; font-size: 1em; }
.adv-bid-summary .summary-grand {
  font-weight: 700;
  font-size: 1.15em;
  color: var(--primary);
  padding: 8px 0;
}
.adv-bid-summary .summary-margin {
  font-weight: 600;
  color: #2e7d32;
  font-size: 1em;
}
