/* APG Quoting Tool — Styles */
/* Acutec brand: primary teal #00605B, accent #02ADA4, fonts Poppins (headings) + Roboto (body) */

:root {
  --color-primary:        #00605B;
  --color-primary-dark:   #00403D;
  --color-primary-light:  #F2F9F9;
  --color-accent:         #02ADA4;
  --color-bg:             #FAFAFA;
  --color-surface:        #ffffff;
  --color-border:         #E1EAEA;
  --color-border-strong:  #C3C0C0;
  --color-text:           #1f1f1f;
  --color-text-muted:     #585858;
  --color-text-light:     #94a3b8;
  --color-danger:         #ef4444;
  --color-danger-light:   #fee2e2;
  --color-success:        #10b981;
  --color-success-light:  #d1fae5;
  --color-warning:        #f59e0b;
  --color-warning-light:  #fef3c7;
  --color-info:           #3b82f6;
  --color-info-light:     #dbeafe;
  --radius:               6px;
  --radius-lg:            10px;
  --shadow-sm:            0 1px 3px rgba(0,0,0,0.08);
  --shadow:               0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:            0 8px 24px rgba(0,0,0,0.14);
  --font:                 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading:         'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); color: #000; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { line-height: 1.6; }

/* ---- LAYOUT ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- TOP NAV ---- */
.top-nav {
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.top-nav .logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav .logo span { opacity: 0.8; font-weight: 400; font-size: 0.9rem; }

.tab-bar {
  display: flex;
  gap: 2px;
  flex: 1;
  padding-left: 16px;
}

.tab-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.tab-btn.active { background: rgba(255,255,255,0.2); color: #fff; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-chip {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* ---- TOOLBAR ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-outline   { background: #fff; color: var(--color-text); border-color: var(--color-border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--color-bg); }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-ghost     { background: none; color: var(--color-text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--color-bg); color: var(--color-text); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-icon { padding: 6px; border-radius: var(--radius); }

/* ---- INPUTS ---- */
input, select, textarea {
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,96,91,0.18);
}
input::placeholder { color: var(--color-text-light); }
.search-input { width: 220px; }
label { font-weight: 500; font-size: 0.825rem; color: var(--color-text-muted); display: block; margin-bottom: 4px; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* ---- TABLE ---- */
.table-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

thead th {
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
thead th:hover { background: #eef2f7; color: var(--color-text); }
thead th .sort-icon { opacity: 0.4; margin-left: 4px; }
thead th.sorted .sort-icon { opacity: 1; color: var(--color-primary); }

tbody tr {
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:hover { background: var(--color-primary-light); }
tbody tr.selected { background: #E1EAEA; }
tbody td { padding: 8px 10px; vertical-align: middle; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-new       { background: var(--color-info-light);    color: #1d4ed8; }
.badge-reviewing { background: var(--color-warning-light); color: #92400e; }
.badge-sent      { background: #ede9fe;                    color: #5b21b6; }
.badge-won       { background: var(--color-success-light); color: #065f46; }
.badge-lost      { background: var(--color-danger-light);  color: #991b1b; }
.badge-rush      { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.badge-generic   { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.question-status-new          { background: var(--color-info-light);    color: #1d4ed8; }
.question-status-in-progress  { background: var(--color-warning-light); color: #92400e; }
.question-status-responded    { background: var(--color-success-light); color: #065f46; }
.question-status-closed       { background: var(--color-bg);            color: var(--color-text-muted); border: 1px solid var(--color-border); }

.badge-pill {
  display: inline-block;
  margin-left: 4px;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.question-card:hover   { border-color: var(--color-primary); }
.question-card.active  { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-light); }
.question-card.is-new  { border-left: 3px solid var(--color-accent); }

.input-sm {
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
}

/* ---- SIDE PANEL ---- */
.side-panel {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: 520px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: var(--shadow-lg);
  transform: translateX(0);
  transition: transform 0.25s ease;
}
.side-panel.hidden { transform: translateX(100%); }
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

/* ---- TABS (within panel) ---- */
.panel-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 16px;
}
.panel-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.panel-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.panel-tab:hover:not(.active) { color: var(--color-text); }

/* ---- CARDS ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; color: var(--color-text-muted); }

/* ---- STAT CARDS ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--color-text); }
.stat-card .stat-label { font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); margin-top: 4px; }
.stat-card .stat-sub   { font-size: 0.7rem; color: var(--color-text-light); margin-top: 2px; }

/* ---- KANBAN ---- */
.kanban-board {
  display: flex;
  gap: 14px;
  padding: 16px;
  overflow-x: auto;
  align-items: flex-start;
  height: 100%;
}
.kanban-col {
  flex: 0 0 260px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.kanban-col-title { font-size: 0.8rem; font-weight: 600; }
.kanban-count { font-size: 0.75rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px; padding: 1px 8px; color: var(--color-text-muted); }
.kanban-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}
.kanban-card:hover { box-shadow: var(--shadow); border-color: var(--color-primary); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-col.drag-over { border-color: var(--color-primary); background: var(--color-primary-light); }
.kanban-card .kc-number { font-size: 0.7rem; color: var(--color-text-light); }
.kanban-card .kc-name   { font-size: 0.8rem; font-weight: 600; }
.kanban-card .kc-company{ font-size: 0.75rem; color: var(--color-text-muted); }

/* ---- MODALS ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-lg { width: 800px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ---- DRAG-DROP ZONE ---- */
.drop-zone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ---- PRICING TABLE ---- */
.pricing-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.pricing-table th {
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}
.pricing-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.pricing-table tr:hover td { background: var(--color-primary-light); }
.pricing-table .cost-col { color: var(--color-text-muted); font-style: italic; font-size: 0.75rem; }

/* ---- COMMUNICATION THREAD ---- */
.comm-thread { display: flex; flex-direction: column; gap: 12px; }
.comm-item {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.5;
}
.comm-item.outbound { background: var(--color-primary-light); border-left: 3px solid var(--color-primary); }
.comm-item.inbound  { background: #f0f9ff; border-left: 3px solid var(--color-info); }
.comm-item.internal { background: #fefce8; border-left: 3px solid var(--color-warning); }
.comm-meta { font-size: 0.7rem; color: var(--color-text-muted); margin-bottom: 4px; }

/* ---- CHANGELOG LIST ---- */
.change-list { display: flex; flex-direction: column; }
.change-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
}
.change-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-top: 5px;
  flex-shrink: 0;
}
.change-info { flex: 1; }
.change-field { font-weight: 600; }
.change-vals  { color: var(--color-text-muted); font-size: 0.75rem; }
.change-meta  { font-size: 0.7rem; color: var(--color-text-light); }

/* ---- CARBIDE PRICE WIDGET ---- */
.carbide-widget {
  background: linear-gradient(135deg, #F2F9F9, #E1EAEA);
  border: 1px solid #C3D9D8;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.carbide-price-active { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.carbide-price-market { font-size: 0.875rem; color: var(--color-text-muted); margin-top: 4px; }
.carbide-stale { color: var(--color-danger); font-size: 0.75rem; }

/* ---- BAR CHART ---- */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; }
.bar-label { width: 120px; text-align: right; color: var(--color-text-muted); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: var(--color-bg); border-radius: 3px; height: 14px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 3px; background: var(--color-primary); transition: width 0.4s ease; }
.bar-count { width: 32px; text-align: right; font-weight: 600; color: var(--color-text); flex-shrink: 0; }

/* ---- SETTINGS TABS ---- */
.settings-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--color-border); margin-bottom: 20px; }
.settings-tab { background: none; border: none; padding: 10px 18px; font-size: 0.85rem; font-weight: 500; cursor: pointer; color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.settings-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.settings-tab:hover:not(.active) { color: var(--color-text); }

/* ---- TOGGLE SWITCH ---- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 40px; height: 22px;
  background: var(--color-border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--color-primary); }
.toggle::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 21px; }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.825rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.alert-success { background: var(--color-success-light); color: #065f46; }
.alert-error   { background: var(--color-danger-light);  color: #991b1b; }
.alert-info    { background: var(--color-info-light);    color: #1d4ed8; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }

/* ---- AGING INDICATORS ---- */
.age-fresh  { color: var(--color-success); }
.age-normal { color: var(--color-text-muted); }
.age-old    { color: var(--color-warning); font-weight: 500; }
.age-stale  { color: var(--color-danger); font-weight: 600; }

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px;
  color: var(--color-text-muted); gap: 12px;
}
.empty-state-icon { font-size: 3rem; opacity: 0.3; }

/* ---- RESPONSIVE UTILS ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- AUTH SCREEN ---- */
.auth-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #F2F9F9, #E1EAEA);
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 56px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.auth-logo { font-size: 2rem; font-weight: 800; color: var(--color-primary); margin-bottom: 8px; }
.auth-sub  { color: var(--color-text-muted); font-size: 0.875rem; margin-bottom: 32px; }

/* ---- COLUMN DRAG-TO-REORDER ---- */
th[draggable="true"] { user-select: none; }
th[draggable="true"]:hover .col-drag-handle { opacity: 0.7 !important; }
.col-drag-handle { cursor: grab; transition: opacity 0.15s; }
.col-drag-over { background: #E1EAEA !important; outline: 2px dashed var(--color-primary); }
th.col-drag-over { color: var(--color-primary); }
.text-danger { color: var(--color-danger); }

/* ---- STAT CARD VARIANTS ---- */
.stat-card-warn { border-top: 3px solid var(--color-danger); }
.stat-card-win  { border-top: 3px solid var(--color-success); }

/* ---- FUNNEL VIEW ---- */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-label-left {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
}
.funnel-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}
.funnel-bar {
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  padding: 0 10px;
  transition: width 0.4s ease;
  min-width: 6%;
  position: relative;
}
.funnel-bar-inner {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.funnel-label-right {
  width: 120px;
  flex-shrink: 0;
}
