:root {
  --navy: #1a2744;
  --navy-light: #243258;
  --gold: #c9a84c;
  --gold-light: #e2c47a;
  --red: #c0392b;
  --green: #27ae60;
  --yellow: #f39c12;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --white: #ffffff;
  --sidebar-width: 220px;
  --header-height: 60px;
  --module-nav-height: 44px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  padding-top: var(--module-nav-height);
}

/* ── Module Nav ── */
.module-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--module-nav-height);
  background: #0d1526;
  display: flex; align-items: center;
  z-index: 300;
  padding: 0 16px;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.module-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800;
  color: white; letter-spacing: -0.3px;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.12);
  margin-right: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.module-tabs { display: flex; align-items: center; height: 100%; gap: 0; }

.module-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  height: 100%;
  font-size: 12.5px; font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  border-top: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.module-tab:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.05); }
.module-tab.mod-mp.active      { color: var(--gold);  border-bottom-color: var(--gold); }
.module-tab.mod-standards.active { color: #c084fc; border-bottom-color: #a855f7; }
.module-tab.mod-crm.active     { color: #60a5fa; border-bottom-color: #3b82f6; }
.module-tab.mod-quoting.active { color: #4ade80; border-bottom-color: #16a34a; }

/* Module accent on sidebar active item */
.module-mp       .nav-item.active { color: var(--gold);  border-left-color: var(--gold);  background: rgba(201,168,76,0.12); }
.module-standards .nav-item.active { color: #c084fc; border-left-color: #a855f7; background: rgba(168,85,247,0.12); }
.module-crm      .nav-item.active { color: #60a5fa; border-left-color: #3b82f6; background: rgba(59,130,246,0.12); }
.module-quoting  .nav-item.active { color: #4ade80; border-left-color: #16a34a; background: rgba(22,163,74,0.12); }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  color: var(--white);
  position: fixed;
  top: var(--module-nav-height); left: 0;
  height: calc(100vh - var(--module-nav-height));
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .company { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.sidebar-brand .app-name { font-size: 17px; font-weight: 700; color: var(--white); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,0.4);
  padding: 12px 18px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-item.active { background: rgba(201,168,76,0.15); color: var(--gold); border-left-color: var(--gold); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item.nav-parent { cursor: default; pointer-events: none; }
.nav-sub-item { padding: 7px 18px 7px 42px; font-size: 13px; }
.nav-sub-item::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.35); flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 11px; color: rgba(255,255,255,0.4);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
/* remove old nav-item.active default so module classes take over */
.nav-item.active { background: rgba(201,168,76,0.15); color: var(--gold); border-left-color: var(--gold); }

.top-bar h1 { font-size: 18px; font-weight: 700; color: var(--navy); }
.top-bar .meta { font-size: 13px; color: var(--gray-600); }

.page-body { padding: 28px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}

.card-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-subtitle { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

/* ── Stat tiles ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-tile {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.stat-tile .value { font-size: 32px; font-weight: 800; color: var(--navy); }
.stat-tile .label { font-size: 12px; color: var(--gray-600); margin-top: 4px; font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-light); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #a93226; }
.btn-ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}

.badge-red { background: #fde8e8; color: var(--red); }
.badge-green { background: #e8f8ee; color: var(--green); }
.badge-yellow { background: #fef9e7; color: #b7770d; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-navy { background: #e8ecf5; color: var(--navy); }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #f0edff; color: #6d28d9; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,39,68,0.08); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--gray-600); padding: 10px 14px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); text-align: left; }
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%; max-width: 520px;
  padding: 28px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-600); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--gray-100); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--gray-900); color: var(--white);
  padding: 12px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  animation: fadeInUp 0.2s ease;
  max-width: 300px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes fadeInUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── L10 specific ── */
.l10-segment {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.l10-segment:hover { border-color: var(--navy); }
.l10-segment.active { border-color: var(--gold); background: rgba(201,168,76,0.06); }
.l10-segment.done { border-color: var(--green); background: rgba(39,174,96,0.05); opacity: 0.7; }

.l10-segment-header { display: flex; align-items: center; justify-content: space-between; }
.l10-segment-name { font-weight: 700; font-size: 15px; color: var(--navy); }
.l10-segment-time { font-size: 13px; color: var(--gray-600); font-weight: 600; }

.l10-timer {
  font-size: 52px; font-weight: 800;
  color: var(--navy);
  text-align: center;
  letter-spacing: -2px;
  line-height: 1;
  padding: 20px 0;
}
.l10-timer.warning { color: var(--yellow); }
.l10-timer.over { color: var(--red); }

.timer-controls { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

.progress-bar-wrap { background: var(--gray-200); border-radius: 20px; height: 8px; overflow: hidden; margin: 10px 0; }
.progress-bar-fill { height: 100%; background: var(--gold); border-radius: 20px; transition: width 1s linear; }
.progress-bar-fill.warning { background: var(--yellow); }
.progress-bar-fill.over { background: var(--red); width: 100% !important; }

.checklist { list-style: none; }
.checklist li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { margin-top: 2px; accent-color: var(--navy); width: 16px; height: 16px; flex-shrink: 0; }
.checklist label { font-size: 14px; cursor: pointer; line-height: 1.4; }
.checklist li.checked label { text-decoration: line-through; color: var(--gray-600); }

.ids-queue { display: flex; flex-direction: column; gap: 8px; }
.ids-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 8px; padding: 10px 14px;
}
.ids-item.current { background: rgba(201,168,76,0.1); border-color: var(--gold); }
.ids-item .ids-rank { font-size: 12px; color: var(--gray-600); width: 20px; flex-shrink: 0; }
.ids-item .ids-text { flex: 1; font-size: 14px; }
.ids-item .ids-time { font-size: 12px; color: var(--gray-600); }

/* ── Dashboard grid ── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── Meeting card ── */
.meeting-card {
  display: flex; gap: 16px;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  margin-bottom: 10px;
  align-items: flex-start;
}
.meeting-date-block { text-align: center; min-width: 52px; }
.meeting-date-block .month { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--gold); letter-spacing: 1px; }
.meeting-date-block .day { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; }
.meeting-info { flex: 1; }
.meeting-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.meeting-meta { font-size: 12px; color: var(--gray-600); margin-top: 3px; }
.meeting-actions { display: flex; gap: 8px; align-items: center; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .sidebar { width: 60px; }
  .sidebar-brand .app-name, .sidebar-brand .company, .nav-section-label, .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .main-content { margin-left: 60px; }
  .module-tab { padding: 0 8px; font-size: 11px; }
  .module-brand { padding-right: 10px; font-size: 12px; }
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-600); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ── Rating stars ── */
.rating { display: flex; gap: 8px; justify-content: center; }
.rating-btn {
  width: 40px; height: 40px;
  border-radius: 50%; border: 2px solid var(--gray-300);
  background: var(--white); cursor: pointer;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.rating-btn:hover, .rating-btn.selected { background: var(--navy); color: var(--white); border-color: var(--navy); }

.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
