
:root {
  --royal: #4169E1;
  --ink: #0f172a;
  --bg: #f8fafc;
  --card: #ffffff;
  --muted: #64748b;
}
* { box-sizing: border-box; }
body { margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; background: var(--bg); color: var(--ink); }
.topbar { display:flex; align-items:center; justify-content:space-between; padding:12px 20px; background: var(--card); border-bottom: 3px solid var(--royal); }
.brand { font-weight: 800; font-size: 20px; } .brand .plus { color: var(--royal); }
nav a { margin-left:12px; text-decoration:none; color: var(--ink); padding:6px 10px; border-radius: 10px; }
nav a:hover { background: #eef2ff; }
.container { max-width: 1080px; margin: 20px auto; padding: 0 16px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.06); margin-bottom: 16px; }
.grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat .k { color: var(--muted); font-size: 12px; } .stat .v { font-size: 36px; font-weight: 800; }
.table-wrapper { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tbl { width:100%; border-collapse: separate; border-spacing: 0 8px; min-width: 800px; }
.tbl th { text-align:left; padding:12px 16px; border-bottom: 2px solid #e2e8f0; background: #f8fafc; white-space: nowrap; }
.tbl td { text-align:left; padding:14px 16px; }
.tbl tbody tr { border-radius: 12px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.tbl tbody tr:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
form label { display:block; margin: 10px 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select { width:100%; padding:10px; border: 1px solid #e2e8f0; border-radius: 10px; font-family: inherit; font-size: inherit; }
textarea { resize: vertical; min-height: 80px; }
input[type="file"] { padding:8px; background:#fff; border-radius: 10px; border:1px solid #e2e8f0; }
button { background: var(--royal); color:#fff; border:0; padding:10px 14px; border-radius: 12px; cursor:pointer; }
.client-link { color: var(--royal); text-decoration: none; font-weight: 700; padding: 6px 12px; border-radius: 8px; background: rgba(79, 70, 229, 0.15); transition: all 0.2s ease; display: inline-block; font-size: 15px; }
.client-link:hover { background: rgba(79, 70, 229, 0.25); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2); }
.btn { color: white; background: linear-gradient(135deg, var(--royal) 0%, #6366f1 100%); text-decoration: none; padding: 6px 14px; border-radius: 10px; font-weight: 500; font-size: 13px; transition: all 0.2s ease; display: inline-block; box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); }
.flashes { list-style:none; padding:0; }
.flash { padding:10px; border-radius: 10px; margin: 10px 0; }
.f-success { background:#dcfce7; } .f-error { background:#fee2e2; } .f-info { background:#dbeafe; }
.tip { color: var(--muted); font-size: 13px; }

/* Stage color coding - light shades */
.stage-uncontacted { background-color: #fee2e2; }
.stage-quoted { background-color: #fee2e2; }
.stage-awaiting-terms { background-color: #fef3c7; }
.stage-pre-rnl-sent { background-color: #dbeafe; }
.stage-sent-to-insurer { background-color: #e0e7ff; }
.stage-awaiting-client-declaration { background-color: #fce7f3; }
.stage-more-info-required { background-color: #fed7aa; }
.stage-in-progress---referred { background-color: #fef3c7; }
.stage-in-progress---one-half { background-color: #d1fae5; }
.stage-in-progress---remarket { background-color: #ddd6fe; }
.stage-ready-for-processing { background-color: #dcfce7; }
.stage-completed { background-color: #d1d5db; }
.stage-badge { font-size: 11px; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,0.05); font-weight: 500; }

/* Gantt Chart Styles */
.gantt-container { margin-top: 20px; }
.gantt-header, .gantt-row { display: grid; grid-template-columns: 200px 1fr; border-bottom: 1px solid #e2e8f0; }
.gantt-header { font-weight: 600; background: #f1f5f9; padding: 10px 0; position: sticky; top: 0; z-index: 10; }
.gantt-row { min-height: 60px; align-items: center; }
.gantt-labels { padding: 8px 12px; border-right: 2px solid #e2e8f0; }
.gantt-timeline { position: relative; padding: 8px 12px; }
.gantt-bar { position: absolute; top: 50%; transform: translateY(-50%); width: 4px; height: 30px; background: var(--royal); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.gantt-bar:hover { transform: translateY(-50%) scale(1.2); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.gantt-event { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: all 0.2s; }
.event-marker { font-size: 24px; line-height: 1; }
.event-info { display: none; position: absolute; top: 100%; margin-top: 8px; background: white; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); white-space: nowrap; z-index: 20; }
.gantt-event:hover .event-info { display: flex; flex-direction: column; gap: 4px; }
.event-info span { font-size: 12px; }
.event-date { font-weight: 600; color: var(--royal); }
.event-note { color: #64748b; font-style: italic; }
.event-row { background: #fafafa; }
.bar-link { text-decoration: none; color: inherit; display: block; }
.bar-content { position: absolute; left: 6px; top: 0; white-space: nowrap; font-size: 11px; }
.bar-date { font-weight: 600; }
.bar-days { margin-left: 8px; color: var(--muted); }
.today-marker { position: absolute; top: -10px; bottom: -10px; width: 2px; background: #ef4444; z-index: 5; }
.today-label { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 600; color: #ef4444; white-space: nowrap; }
.date-markers { position: absolute; top: -8px; left: 0; right: 0; font-size: 11px; color: var(--muted); }
.date-markers span { position: absolute; }
.policy-info { font-size: 13px; }
.policy-num { font-size: 11px; color: var(--muted); }
.policy-class { font-size: 11px; color: var(--royal); font-weight: 600; }
.legend-item { padding: 6px 12px; border-radius: 6px; font-size: 12px; display: inline-block; }

/* Archive Income Comparison Styles */
.archive-tbl .num { text-align: right; }
.delta-pos { color: #16a34a; font-weight: 600; }
.delta-neg { color: #dc2626; font-weight: 600; }
.delta-neu { color: #6b7280; }
.delta-pct { font-size: 11px; font-weight: 400; margin-left: 4px; }
.status-badge { font-size: 11px; padding: 5px 10px; border-radius: 6px; font-weight: 600; display: inline-block; }
.status-renewed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-new-business { background: #dbeafe; color: #1e40af; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Helper styles */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.row.space-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #e0e7ff; color: #4338ca; display: inline-block; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.num { text-align: right; }

/* Kanban Board Styles */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.kanban .col { background: #f8fafc; border-radius: 12px; display: flex; flex-direction: column; }
.col-head { padding: 12px; border-bottom: 2px solid #e2e8f0; }
.col-head .title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.col-head .total { color: var(--royal); font-weight: 600; font-size: 13px; }
.col-body { padding: 8px; flex: 1; min-height: 400px; }
.card-kanban { background: white; padding: 12px; border-radius: 10px; margin-bottom: 8px; cursor: grab; box-shadow: 0 2px 4px rgba(0,0,0,0.08); transition: all 0.2s; }
.card-kanban:active { cursor: grabbing; }
.card-kanban:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.kclient { font-weight: 700; color: var(--royal); margin-bottom: 6px; font-size: 13px; }
.ktext { font-size: 12px; margin-bottom: 8px; color: var(--ink); }
.kmeta { font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.empty { text-align: center; color: var(--muted); padding: 20px; font-size: 12px; }

/* Incumbent Quote Styling */
.incumbent-quote { background-color: #fffbeb !important; border-left: 4px solid #f59e0b; }
.incumbent-quote td { font-weight: 500; }

/* Renewals Table Compact Styling */
.renewals-tbl td { padding: 10px 12px; font-size: 13px; }
.renewals-tbl th { padding: 10px 12px; font-size: 12px; }
.renewals-tbl .client-link { font-size: 13px; padding: 3px 8px; }

/* Loading Spinner */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--royal);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sticky Return Button */
.return-btn-wrapper {
  position: sticky;
  top: 20px;
  z-index: 100;
  margin-bottom: 12px;
}

.return-btn {
  background: #64748b !important;
  display: inline-block;
}

/* Colorful Edit/Delete Buttons */
.btn-edit {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%) !important;
  color: white;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-delete {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%) !important;
  color: white;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Dropdown Navigation Styles */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  margin-left: 12px;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown-toggle:hover {
  background: #eef2ff;
}

.nav-dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 200px;
  padding: 8px 0;
  margin-top: 4px;
  z-index: 1000;
  display: none;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--ink);
  text-decoration: none;
  margin: 0;
  transition: background 0.15s ease;
}

.nav-dropdown-menu a:hover {
  background: #eef2ff;
}

.nav-dropdown-separator {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}
