/* =====================================================================
   Niazi Tours CRM — Design System
   Colors, Typography, Spacing tokens. Loaded before Vite bundle.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 200; font-display: swap; src: url('/fonts/Poppins-ExtraLight.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 200; font-display: swap; src: url('/fonts/Poppins-ExtraLightItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/Poppins-Light.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 300; font-display: swap; src: url('/fonts/Poppins-LightItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/Poppins-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/Poppins-Italic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/Poppins-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 500; font-display: swap; src: url('/fonts/Poppins-MediumItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/Poppins-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 600; font-display: swap; src: url('/fonts/Poppins-SemiBoldItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/Poppins-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 700; font-display: swap; src: url('/fonts/Poppins-BoldItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/Poppins-ExtraBold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 800; font-display: swap; src: url('/fonts/Poppins-ExtraBoldItalic.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 900; font-display: swap; src: url('/fonts/Poppins-Black.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 900; font-display: swap; src: url('/fonts/Poppins-BlackItalic.ttf') format('truetype'); }

:root {
  /* ---- Brand primitives ---- */
  --niazi-navy-900:  #001A3D;
  --niazi-navy-800:  #002245;
  --niazi-navy-700:  #002F5F;
  --niazi-navy-600:  #0A3F75;
  --niazi-navy-500:  #1F558E;
  --niazi-navy-400:  #4A7AAE;
  --niazi-navy-300:  #8AA8C8;
  --niazi-navy-200:  #C5D5E3;
  --niazi-navy-100:  #E3ECF4;
  --niazi-navy-50:   #F2F6FA;

  --niazi-orange-900: #7A2E00;
  --niazi-orange-800: #9F3D00;
  --niazi-orange-700: #C95400;
  --niazi-orange-600: #E66509;
  --niazi-orange-500: #FB7113;
  --niazi-orange-400: #FF8A3D;
  --niazi-orange-300: #FFA972;
  --niazi-orange-200: #FFCBA3;
  --niazi-orange-100: #FFE4CE;
  --niazi-orange-50:  #FFF4E9;

  --sand-900: #1C1A16; --sand-800: #2B2823; --sand-700: #3F3B33;
  --sand-600: #5C564B; --sand-500: #807868; --sand-400: #A39B89;
  --sand-300: #C9C2B2; --sand-200: #E4DFD2; --sand-100: #F1ECE0;
  --sand-50:  #FAF7EF;

  --grey-900: #0E1116; --grey-800: #1A1F27; --grey-700: #2D343F;
  --grey-600: #4A5260; --grey-500: #6B7380; --grey-400: #97A0AC;
  --grey-300: #C3CAD3; --grey-200: #E1E5EB; --grey-100: #F0F2F5;
  --grey-50:  #F8F9FB; --white: #FFFFFF;

  --success-700: #0F6B43; --success-500: #16A368; --success-300: #66C19B; --success-100: #E1F5EB;
  --warning-700: #92590A; --warning-500: #D9870F; --warning-100: #FCEFD3;
  --danger-700:  #9F1F1F; --danger-500:  #DC2B2B; --danger-100:  #FBE1E1;
  --info-700:    #1B4F8A; --info-500:    #2E78C7; --info-100:    #DDEBF8;

  /* ---- Semantic tokens ---- */
  --bg-app:       var(--sand-50);
  --bg-canvas:    var(--white);
  --bg-raised:    var(--white);
  --bg-sunken:    var(--sand-100);
  --bg-inverse:   var(--niazi-navy-700);
  --bg-tint:      var(--niazi-navy-50);
  --bg-tint-warm: var(--niazi-orange-50);

  --fg-1: var(--niazi-navy-900);
  --fg-2: var(--grey-700);
  --fg-3: var(--grey-500);
  --fg-4: var(--grey-400);
  --fg-on-inverse: var(--white);
  --fg-on-accent:  var(--white);
  --fg-accent:     var(--niazi-orange-600);
  --fg-link:       var(--niazi-navy-600);

  --border-subtle:  var(--grey-200);
  --border-default: var(--grey-300);
  --border-strong:  var(--grey-400);
  --border-brand:   var(--niazi-navy-200);
  --border-focus:   var(--niazi-orange-500);

  --action-primary:        var(--niazi-orange-500);
  --action-primary-hover:  var(--niazi-orange-600);
  --action-primary-active: var(--niazi-orange-700);
  --action-secondary:        var(--niazi-navy-700);
  --action-secondary-hover:  var(--niazi-navy-800);
  --action-secondary-active: var(--niazi-navy-900);

  --status-new:           var(--info-500);      --status-new-bg:       var(--info-100);
  --status-contacted:     var(--niazi-navy-500); --status-contacted-bg: var(--niazi-navy-100);
  --status-quote:         var(--warning-500);   --status-quote-bg:     var(--warning-100);
  --status-confirmed:     var(--success-500);   --status-confirmed-bg: var(--success-100);
  --status-cancelled:     var(--grey-500);      --status-cancelled-bg: var(--grey-100);
  --status-hot:           var(--niazi-orange-500); --status-hot-bg:    var(--niazi-orange-100);
  --status-warm:          var(--warning-500);   --status-warm-bg:      var(--warning-100);
  --status-cold:          var(--info-500);      --status-cold-bg:      var(--info-100);

  /* ---- Typography ---- */
  --font-display: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  --font-sans:    'Poppins', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-2xs: 11px; --text-xs: 12px; --text-sm: 13px; --text-md: 14px;
  --text-lg: 16px;  --text-xl: 18px; --text-2xl: 22px; --text-3xl: 28px;
  --text-4xl: 36px; --text-5xl: 48px; --text-6xl: 64px;

  --w-regular: 400; --w-medium: 500; --w-semibold: 600; --w-bold: 700; --w-heavy: 800;

  --lh-tight: 1.15; --lh-snug: 1.3; --lh-normal: 1.45; --lh-relaxed: 1.6;

  --tracking-tight: -0.02em; --tracking-snug: -0.01em;
  --tracking-normal: 0; --tracking-wide: 0.02em; --tracking-caps: 0.08em;

  /* ---- Spacing (4-pt base) ---- */
  --space-0: 0;   --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 32px;
  --space-8: 40px; --space-9: 56px; --space-10: 72px; --space-11: 96px;

  /* ---- Radii ---- */
  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 10px;
  --radius-lg: 14px; --radius-xl: 20px; --radius-2xl: 28px; --radius-pill: 999px;

  /* ---- Shadows ---- */
  --shadow-xs:  0 1px 1px rgba(0,26,61,.04), 0 0 0 1px rgba(0,26,61,.04);
  --shadow-sm:  0 1px 2px rgba(0,26,61,.06), 0 1px 3px rgba(0,26,61,.06);
  --shadow-md:  0 4px 12px -2px rgba(0,26,61,.08), 0 2px 4px rgba(0,26,61,.04);
  --shadow-lg:  0 12px 28px -6px rgba(0,26,61,.14), 0 6px 12px -3px rgba(0,26,61,.06);
  --shadow-xl:  0 24px 48px -12px rgba(0,26,61,.22), 0 8px 20px -8px rgba(0,26,61,.08);
  --shadow-pop: 0 16px 40px -8px rgba(251,113,19,.25);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(0,26,61,.04);
  --ring-focus: 0 0 0 3px rgba(251,113,19,.32);

  /* ---- Motion ---- */
  --ease-out:    cubic-bezier(0.22,1,0.36,1);
  --ease-in:     cubic-bezier(0.55,0,1,0.45);
  --ease-in-out: cubic-bezier(0.65,0,0.35,1);
  --duration-fast: 120ms;
  --duration-med:  220ms;
  --duration-slow: 380ms;
}

/* ---- Global resets ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--font-sans); color: var(--fg-1); background: var(--bg-app); }
body { font-size: var(--text-md); line-height: var(--lh-normal); margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---- CRM Shell ---- */
.crm-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}
.crm-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--niazi-navy-900);
  color: white;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
}
.crm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.crm-topbar {
  height: 64px;
  flex-shrink: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.crm-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---- Nav ---- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 0;
  background: transparent;
  color: var(--niazi-navy-200);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--niazi-navy-800); color: white; font-weight: 600; }
.nav-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--niazi-navy-600);
  color: white;
  margin-left: auto;
}
.nav-item.active .nav-badge { background: var(--niazi-orange-500); }

/* ---- Card ---- */
.card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-body { padding: 20px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-1);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Pill / Badge ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 2px;
}
.pill-new        { background: var(--status-new-bg);       color: var(--status-new); }
.pill-contacted  { background: var(--status-contacted-bg); color: var(--status-contacted); }
.pill-quote      { background: var(--status-quote-bg);     color: var(--status-quote); }
.pill-confirmed  { background: var(--status-confirmed-bg); color: var(--status-confirmed); }
.pill-cancelled  { background: var(--status-cancelled-bg); color: var(--status-cancelled); }
.pill-hot        { background: var(--status-hot-bg);       color: var(--status-hot); text-transform: uppercase; letter-spacing: 0.06em; }
.pill-warm       { background: var(--status-warm-bg);      color: var(--status-warm); }
.pill-cold       { background: var(--status-cold-bg);      color: var(--status-cold); }
.pill-navy       { background: var(--niazi-navy-700);      color: white; }
.pill-orange     { background: var(--niazi-orange-500);    color: white; }
.pill-success    { background: var(--success-100);         color: var(--success-700); }
.pill-danger     { background: var(--danger-100);          color: var(--danger-700); }
.pill-info       { background: var(--info-100);            color: var(--info-700); }
.pill-neutral    { background: var(--bg-sunken);           color: var(--fg-2); }
.pill-outline    { background: white; color: var(--fg-1); border: 1px solid var(--border-default); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), transform 80ms var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: var(--action-primary);   color: white; box-shadow: var(--shadow-pop); }
.btn-primary:hover  { background: var(--action-primary-hover); }
.btn-primary:active { background: var(--action-primary-active); transform: translateY(0.5px); }
.btn-secondary { background: var(--action-secondary); color: white; }
.btn-secondary:hover { background: var(--action-secondary-hover); }
.btn-ghost  { background: transparent; color: var(--fg-1); border: 1px solid var(--border-default); }
.btn-ghost:hover { background: var(--bg-sunken); }
.btn-text   { background: transparent; color: var(--fg-2); border: none; padding: 0 8px; }
.btn-text:hover { color: var(--fg-1); }
.btn-danger { background: var(--danger-500); color: white; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; border-radius: 12px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--fg-2); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.btn-icon:hover { background: var(--bg-sunken); color: var(--fg-1); }

/* ---- Avatar ---- */
.avatar {
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  font-family: var(--font-sans);
}
.avatar-navy   { background: linear-gradient(135deg, var(--niazi-navy-500),   var(--niazi-navy-800)); }
.avatar-orange { background: linear-gradient(135deg, var(--niazi-orange-400), var(--niazi-orange-700)); }
.avatar-green  { background: linear-gradient(135deg, var(--success-500),      var(--success-700)); }
.avatar-blue   { background: linear-gradient(135deg, var(--info-500),         var(--info-700)); }
.avatar-sand   { background: linear-gradient(135deg, var(--sand-500),         var(--sand-700)); }

/* ---- Form controls ---- */
.form-input, .form-select {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: white;
  font-size: 13px;
  font-family: inherit;
  color: var(--fg-1);
  width: 100%;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--ring-focus);
}
.form-select {
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236B7380' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }

/* ---- Table ---- */
.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table thead tr { background: var(--bg-sunken); }
.crm-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.crm-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.crm-table tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.crm-table tbody tr:hover { background: var(--bg-tint); }
.crm-table tbody tr:last-child td { border-bottom: none; }

/* ---- KPI card ---- */
.kpi-card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg-1);
}
.kpi-sub { font-size: 12px; font-weight: 600; }

/* ---- Pipeline ---- */
.pipeline-stage {
  flex: 1;
  padding: 14px 16px;
  border-right: 1px solid var(--border-subtle);
}
.pipeline-stage:last-child { border-right: none; }

/* ---- Status tabs ---- */
.tab-bar { display: flex; gap: 4px; }
.tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--duration-fast) var(--ease-out);
}
.tab-btn:hover { background: var(--bg-sunken); }
.tab-btn.active {
  background: var(--niazi-navy-50);
  color: var(--niazi-navy-700);
  font-weight: 600;
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}
.tab-btn.active .tab-count { color: var(--niazi-orange-600); }

/* ---- Workflow tracker ---- */
.workflow-step { display: flex; gap: 12px; align-items: flex-start; position: relative; }
.workflow-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-dot.done    { background: var(--success-500); }
.workflow-dot.pending { background: white; border: 2px dashed var(--border-default); }
.workflow-dot.active  { background: var(--niazi-orange-500); }
.workflow-line {
  width: 2px;
  flex: 1;
  min-height: 14px;
  margin-top: 2px;
}
.workflow-line.done    { background: var(--success-500); }
.workflow-line.pending { background: var(--border-subtle); }

/* ---- Chat bubble ---- */
.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 70%;
}
.chat-bubble.mine {
  background: var(--niazi-navy-700);
  color: white;
  border-top-right-radius: 4px;
}
.chat-bubble.theirs {
  background: white;
  color: var(--fg-1);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  border-top-left-radius: 4px;
}

/* ---- Overlapping avatars ---- */
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid white; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---- Meeting tile ---- */
.meeting-tile-client     { background: var(--niazi-orange-100); border: 1px solid var(--niazi-orange-300); border-left: 3px solid var(--niazi-orange-700); }
.meeting-tile-internal   { background: var(--niazi-navy-50);    border: 1px solid var(--niazi-navy-200);   border-left: 3px solid var(--niazi-navy-700); }
.meeting-tile-leadership { background: var(--success-100);      border: 1px solid #9ED6BA;                  border-left: 3px solid var(--success-700); }

/* ---- Mono / num utilities ---- */
.t-mono { font-family: var(--font-mono); }
.t-num  { font-variant-numeric: tabular-nums; }
.t-overline {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3);
}
.t-muted { color: var(--fg-3); }
.t-em    { color: var(--fg-1); font-weight: 600; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-400); }

/* ---- Transitions / Livewire ---- */
[wire\:loading] { opacity: 0.6; pointer-events: none; }
