/* ForkStack Standalone CRM Stylesheet */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border: #334155;
  --border-light: #475569;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --whatsapp: #25d366;
  --whatsapp-hover: #20ba5a;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* App Header */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-badge {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-territory {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Layout Container */
.view-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--border-light);
}

.btn-outline {
  background: transparent;
  color: var(--text-sub);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-whatsapp {
  background: #128c7e;
  color: #fff;
}
.btn-whatsapp:hover {
  background: #075e54;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.4rem;
}

.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  background: #0b1120;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.font-mono {
  font-family: var(--font-mono) !important;
}

.font-bold {
  font-weight: 700;
}

.text-green {
  color: var(--success) !important;
}

.text-amber {
  color: var(--warning) !important;
}

/* Grids */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.25rem; }

/* Login Card */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.logo-box {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-quick-demo {
  margin-top: 1.5rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.divider span {
  padding: 0 0.75rem;
}

.demo-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: #86efac;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-blue { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* Action & Filter Bar */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.action-bar-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-bar-top .search-box {
  flex: 1;
  min-width: 260px;
}

.month-filter-box {
  position: relative;
  display: flex;
  align-items: center;
}

.month-filter-box svg {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.month-filter-box select {
  padding-left: 2.25rem;
  cursor: pointer;
  min-width: 170px;
  background-color: #0b1120;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.875rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.stage-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.chip {
  background: #0b1120;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.chip:hover {
  border-color: var(--border-light);
  color: var(--text-main);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.bar-actions {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

/* Customer Cards Grid */
.customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.customer-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.customer-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.card-code {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.15rem;
}

.country-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.card-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.card-contact-box {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contact-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.contact-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.contact-quick-btns {
  display: flex;
  gap: 0.4rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--border-light);
}

.btn-icon.wa {
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border-color: rgba(37, 211, 102, 0.3);
}

.btn-icon.wa:hover {
  background: #25d366;
  color: #fff;
}

.card-deal-snippet {
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-sub);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.65rem;
}

.card-footer-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.badge-stage {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stage-NEW_HANDOVER { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.stage-CONTACTED { background: rgba(6, 182, 212, 0.2); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.stage-DEMO_SCHEDULED { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.stage-PROPOSAL_SENT { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.stage-NEGOTIATION { background: rgba(249, 115, 22, 0.2); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.stage-DEAL_WON { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.stage-LOST { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  overflow-y: auto;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalEnter 0.2s ease-out;
}

.modal-lg {
  max-width: 900px;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-subtitle {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

/* Detail Summary Card */
.detail-summary-card {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.info-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.info-col {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.info-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 0.15rem;
}

.quick-contact-actions {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

/* Workspace Sections */
.workspace-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Stage Selector Grid */
.stage-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.stage-btn {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.5rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  color: var(--text-sub);
  transition: all 0.15s;
}

.stage-btn:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.stage-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 1px var(--primary);
}

.stage-btn.stage-won.selected {
  background: var(--success-bg);
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.stage-btn.stage-lost.selected {
  background: var(--danger-bg);
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.stage-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stage-btn strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.stage-btn small {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Deal Calculator Bar */
.deal-calculator-bar {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 0.85rem;
}

.calc-item {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.calc-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.calc-val {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

.calc-divider {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Quick Log & Timeline */
.form-grid-log {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.interaction-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 220px;
  overflow-y: auto;
}

.interaction-card {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
}

.int-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.int-by {
  font-weight: 700;
  color: var(--primary);
}

.int-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.int-note {
  color: var(--text-sub);
}

/* Executive Management Table */
.exec-create-box {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.input-with-button {
  display: flex;
  gap: 0.4rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: #0b1120;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
}

/* Empty States & Spinner */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-main);
  margin: 0.75rem 0 0.35rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .info-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid-log {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  .stats-row {
    grid-template-columns: 1fr;
  }
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .customers-grid {
    grid-template-columns: 1fr;
  }
  .deal-calculator-bar {
    flex-direction: column;
    gap: 0.5rem;
  }
  .calc-divider {
    display: none;
  }
  .info-row {
    grid-template-columns: 1fr;
  }
}
