/* TISI Quoting Tool — Team Inc Brand Design */
:root {
  /* Team Inc brand palette */
  --primary: #7a00df;
  --primary-dark: #5c00a8;
  --primary-light: #9b3def;
  --primary-glow: rgba(122, 0, 223, 0.12);
  --accent: #cf2e2e;
  --accent-light: #e85555;
  --success: #00c853;
  --success-bg: #e8faf0;
  --warning: #f5a623;
  --warning-bg: #fff8ec;

  /* Neutrals */
  --bg: #f5f5f7;
  --bg-alt: #eeeef1;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-light: #86868b;
  --border: #d2d2d7;
  --border-light: #e8e8ed;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-purple: 0 4px 14px rgba(122, 0, 223, 0.25);

  --radius: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, #1d1d1f 0%, #2c2c2e 100%);
  color: white;
  padding: 0 28px;
  display: flex;
  align-items: center;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.app-header h1 {
  font-size: 17px;
  font-weight: 700;
  margin-right: 36px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header h1::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 22px;
  background: var(--primary);
  border-radius: 3px;
}

.app-header nav {
  display: flex;
  gap: 4px;
}

.app-header nav a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.app-header nav a:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
}

.app-header nav a.active {
  color: white;
  background: var(--primary);
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.stat-card .value {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}

.stat-card .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== TABLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
}

tr { transition: background 0.15s ease; }
tr:hover td { background: var(--primary-glow); }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 5px;
}

input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: all 0.2s ease;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ===== BUTTONS ===== */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.1px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-purple);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(122, 0, 223, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #00b548; }

.btn-danger {
  background: var(--accent);
  color: white;
}
.btn-danger:hover { background: #b82525; }

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-draft { background: #f0f0f3; color: #6e6e73; }
.badge-submitted { background: #ede3f9; color: #7a00df; }
.badge-won { background: #e8faf0; color: #00873c; }
.badge-lost { background: #fde8e8; color: #b82525; }
.badge-revised { background: #fff3dc; color: #9a6700; }

/* Line type badges reuse colors */
.badge-labor { background: #ede3f9; color: #7a00df; }
.badge-equipment { background: #fff3dc; color: #9a6700; }
.badge-material { background: #e8faf0; color: #00873c; }
.badge-travel { background: #f0f0f3; color: #6e6e73; }
.badge-other { background: #f0f0f3; color: #6e6e73; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  margin-bottom: 20px;
  width: fit-content;
}

.tab {
  padding: 9px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.5);
}

.tab.active {
  color: var(--text);
  background: white;
  box-shadow: var(--shadow-sm);
}

/* ===== GANTT ===== */
.gantt-container {
  overflow-x: auto;
  min-height: 200px;
}

/* Override Frappe Gantt colors */
.gantt .bar { fill: var(--primary); }
.gantt .bar-progress { fill: var(--primary-dark); }
.gantt .bar-invalid { fill: #e8e8ed; stroke: var(--border); }
.gantt .bar-label { fill: white; font-weight: 600; }

/* ===== HISTOGRAM ===== */
.histogram-container {
  min-height: 300px;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--bg);
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.upload-area .upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.4;
}

.upload-area p {
  color: var(--text-light);
  font-size: 14px;
}

.upload-area p strong {
  color: var(--primary);
}

.upload-area input[type="file"] { display: none; }

/* ===== QUOTE TOTALS ===== */
.quote-totals {
  background: linear-gradient(135deg, #f9f5ff 0%, #f5f5f7 100%);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid #ede3f9;
}

.quote-totals .total-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.quote-totals .total-row.grand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px solid #d8c5f0;
  padding-top: 14px;
  margin-top: 10px;
  letter-spacing: -0.3px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 700;
}

/* ===== PHASE TAGS ===== */
.phase-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.phase-mob { background: #ede3f9; color: #7a00df; }
.phase-exec { background: #e8faf0; color: #00873c; }
.phase-demob { background: #fff3dc; color: #9a6700; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-sm { font-size: 13px; }
.money { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-size: 13px; }

.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-header { padding: 0 16px; }
  .app-header h1 { font-size: 15px; margin-right: 16px; }
  .app-header nav a { padding: 8px 10px; font-size: 12px; }
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}
