* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #2c3e50;
}

.container {
  max-width: 1400px;
  margin: 20px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  padding: 18px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #e94560;
}

.header h1 {
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header h1 span {
  color: #e94560;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right span {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

/* ── Navigation Tabs ── */
.nav-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 0 20px;
  overflow-x: auto;
}

.nav-tab {
  padding: 13px 22px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  font-weight: 500;
}

.nav-tab:hover {
  color: #e94560;
  background: rgba(233,69,96,0.05);
}

.nav-tab.active {
  color: #e94560;
  border-bottom-color: #e94560;
  font-weight: 600;
}

/* ── Tab Content ── */
.tab-content {
  display: none;
  padding: 25px 30px 35px;
}

.tab-content.active {
  display: block;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.82rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
  font-family: inherit;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233,69,96,0.08);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary { background: #e94560; color: #fff; }
.btn-primary:hover { background: #d63851; }

.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }

.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #e08e0b; }

.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #d44332; }

.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }

.btn-info { background: #0077B6; color: #fff; }
.btn-info:hover { background: #005A8C; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

table th, table td {
  padding: 11px 14px;
  text-align: left;
  font-size: 0.88rem;
}

table th {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table th:first-child {
  border-radius: 8px 0 0 0;
}

table th:last-child {
  border-radius: 0 8px 0 0;
}

table td {
  border-bottom: 1px solid #f0f0f0;
}

table tbody tr:hover {
  background: #fafbfc;
}

table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid #eef0f2;
}

.card h3 {
  color: #1a1a2e;
  font-size: 1rem;
  margin-bottom: 15px;
}

/* ── Stat Cards ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid #eef0f2;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, #e94560, #f39c12); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #f39c12, #e08e0b); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, #0077B6, #00B4D8); }

.stat-card .stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

/* ── Badges ── */
.role-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.role-badge.admin { background: #fef5e7; color: #d68910; }
.role-badge.sales { background: #eef0f2; color: #636e72; }

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
}

.status-badge.draft { background: #eef0f2; color: #636e72; }
.status-badge.pending_approval { background: #fef5e7; color: #d68910; }
.status-badge.approved { background: #e8f8f0; color: #27ae60; }
.status-badge.rejected { background: #fdedeb; color: #e74c3c; }

/* ── Modal ── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #1a1a2e;
  font-size: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #e74c3c;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar h2 {
  font-size: 1.15rem;
  color: #1a1a2e;
  font-weight: 700;
}

.search-input {
  padding: 9px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 250px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233,69,96,0.08);
}

.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-group select {
  padding: 8px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ── Alert / Messages ── */
.alert {
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #e8f8f0; color: #27ae60; border-left: 4px solid #27ae60; }
.alert-error { background: #fdedeb; color: #e74c3c; border-left: 4px solid #e74c3c; }
.alert-warning { background: #fef9e7; color: #d68910; border-left: 4px solid #f39c12; }
.alert-info { background: #e8f4f8; color: #2e86c1; border-left: 4px solid #3498db; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #bbb;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 15px;
}

/* ── Quote detail styling ── */
.quote-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.quote-meta-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.88rem;
}

.quote-meta-item:last-child { border-bottom: none; }

.quote-meta-item .label {
  color: #888;
  font-size: 0.82rem;
}

.quote-meta-item .value {
  font-weight: 600;
  color: #1a1a2e;
}

.quote-totals {
  text-align: right;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 2px solid #f0f0f0;
}

.quote-totals .row {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  padding: 4px 0;
  font-size: 0.9rem;
}

.quote-totals .row .label { color: #888; min-width: 120px; text-align: right; }
.quote-totals .row .value { font-weight: 600; min-width: 120px; text-align: right; }

.quote-totals .grand-total {
  font-size: 1.25rem;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 2px solid #e94560;
}

.quote-totals .grand-total .value {
  color: #e94560;
  font-weight: 700;
}

/* ── Download button special ── */
.btn-download {
  background: linear-gradient(135deg, #0077B6, #005A8C);
  color: #fff;
  padding: 12px 24px;
  font-size: 0.9rem;
}

.btn-download:hover {
  background: linear-gradient(135deg, #005A8C, #004A73);
}

/* ── INR formatting in tables ── */
.amount-cell {
  font-family: 'Segoe UI', Roboto, monospace;
  font-weight: 600;
  text-align: right !important;
}

/* ── Activity Feed ── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #1a1a2e;
}

.activity-body { flex: 1; min-width: 0; }

.activity-desc {
  font-size: 0.88rem;
  font-weight: 500;
  color: #2c3e50;
}

.activity-meta {
  font-size: 0.78rem;
  color: #999;
  margin-top: 2px;
}

/* ── Audit Action Badges ── */
.audit-action {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  background: #eef0f2;
  color: #636e72;
}

.audit-action.create { background: #e8f8f0; color: #27ae60; }
.audit-action.update { background: #e8f4f8; color: #2e86c1; }
.audit-action.submit { background: #fef5e7; color: #d68910; }
.audit-action.approve { background: #e8f8f0; color: #27ae60; }
.audit-action.reject { background: #fdedeb; color: #e74c3c; }
.audit-action.delete { background: #fdedeb; color: #e74c3c; }
.audit-action.duplicate { background: #f0e6ff; color: #8e44ad; }
.audit-action.download_pdf { background: #e0f0ff; color: #0077B6; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { margin: 10px; border-radius: 10px; }
  .header { flex-direction: column; gap: 10px; text-align: center; }
  .tab-content { padding: 15px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  table { font-size: 0.8rem; }
  table th, table td { padding: 8px 10px; }
  .quote-meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .btn-group { flex-direction: column; }
}
