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

.rcm-home {
  --rcm-bg:          #eef0ff;
  --rcm-surface:     #ffffff;
  --rcm-ink:         #1e2245;
  --rcm-ink-soft:    #3b3f6b;
  --rcm-muted:       #8b91b8;
  --rcm-line:        #ebedf8;
  --rcm-line-soft:   #f3f4fc;
  --rcm-accent:      #6366f1;
  --rcm-accent-2:    #4f46e5;
  --rcm-accent-soft: #c7d2fe;
  --rcm-accent-ghost:#eef0ff;
  --rcm-warm:        #f97316;
  --rcm-success:     #10b981;
  --rcm-danger:      #ef4444;
  --rcm-warning:     #f59e0b;
  --rcm-shadow:      0 1px 2px rgba(30,34,69,0.03), 0 4px 14px rgba(99,102,241,0.07);
  --rcm-radius:      16px;
  --rcm-radius-md:   12px;
  --rcm-radius-sm:   8px;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--rcm-ink);
  background: var(--rcm-bg);
  padding: 1.1rem;
  border-radius: var(--rcm-radius);
  font-size: 12.5px;
  line-height: 1.5;
}
.rcm-home *, .rcm-home *::before, .rcm-home *::after { box-sizing: border-box; }
.rcm-home-loading { padding: 1rem; color: var(--rcm-muted); text-align: center; font-size: 0.82rem; }

/* ---------- Hero ---------- */
.rcm-home-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #eef0ff 100%);
  border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--rcm-shadow);
}
.rcm-home-hero-avatar {
  width: 64px; height: 64px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(135deg, #c7d2fe 0%, #6366f1 50%, #f97316 130%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(99,102,241,0.18), 0 4px 14px rgba(249,115,22,0.10);
}
.rcm-home-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rcm-home-hero-initials { color: white; font-weight: 700; font-size: 1.45rem; letter-spacing: 0.04em; }
.rcm-home-hero-text { min-width: 0; }
.rcm-home-hero-greet { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; color: var(--rcm-ink); }
.rcm-home-hero-sub {
  margin: 0.25rem 0 0; color: var(--rcm-muted); font-size: 0.8rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
}
.rcm-home-role-pill {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.1rem 0.55rem; border-radius: 999px; text-transform: uppercase;
}
.rcm-role-owner { background: var(--rcm-warm); color: white; }
.rcm-role-admin { background: var(--rcm-accent); color: white; }
.rcm-role-sales { background: #d1fae5; color: #047857; }
.rcm-home-hero-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

.rcm-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 1rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600;
  font-size: 0.78rem; line-height: 1.2; transition: all 0.18s ease;
  font-family: inherit; background: transparent; color: inherit; text-decoration: none;
}
.rcm-btn-primary {
  background: var(--rcm-accent); color: white; border-color: var(--rcm-accent);
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.rcm-btn-primary:hover { background: var(--rcm-accent-2); transform: translateY(-1px); color: white; }
.rcm-btn-outline { background: white; color: var(--rcm-ink); border-color: var(--rcm-line); }
.rcm-btn-outline:hover { border-color: var(--rcm-accent); color: var(--rcm-accent); }

/* ---------- KPI strip ---------- */
.rcm-home-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.rcm-home-kpi {
  background: var(--rcm-surface); border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius-md); padding: 0.75rem 0.95rem;
  box-shadow: var(--rcm-shadow);
  display: flex; align-items: center; gap: 0.7rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rcm-home-kpi:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.10); }
.rcm-home-kpi-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--rcm-accent-ghost); color: var(--rcm-accent);
  font-size: 0.95rem; flex-shrink: 0;
}
/* Rotate accent colors across KPIs so the row isn't all purple. */
.rcm-home-kpi:nth-child(2n)   .rcm-home-kpi-ico { background: #fff1e6; color: #ea580c; } /* orange */
.rcm-home-kpi:nth-child(4n+3) .rcm-home-kpi-ico { background: #dcfce7; color: #047857; } /* green */
.rcm-home-kpi:nth-child(4n)   .rcm-home-kpi-ico { background: #fef3c7; color: #b45309; } /* amber */
.rcm-home-kpi-text { min-width: 0; }
.rcm-home-kpi-label {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--rcm-muted); font-weight: 600;
}
.rcm-home-kpi-value {
  font-size: 1.15rem; font-weight: 700; color: var(--rcm-ink);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Grid + cards ---------- */
.rcm-home-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.9rem;
}
@media (max-width: 1024px) { .rcm-home-grid { grid-template-columns: 1fr; } }
.rcm-home-col { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.rcm-home-card {
  background: var(--rcm-surface); border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius-md); padding: 1rem 1.15rem;
  box-shadow: var(--rcm-shadow);
}
.rcm-home-card-title {
  font-size: 0.95rem; font-weight: 600; margin: 0 0 0.7rem;
  letter-spacing: -0.01em; color: var(--rcm-ink);
  display: flex; justify-content: space-between; align-items: baseline;
}
.rcm-home-card-link { font-size: 0.7rem; font-weight: 600; color: var(--rcm-accent); text-decoration: none; }
.rcm-home-card-link:hover { color: var(--rcm-accent-2); }

/* ---------- Quick deal search ---------- */
.rcm-home-search {
  position: relative;
  background: var(--rcm-bg);
  border: 1px solid var(--rcm-line-soft);
  border-radius: 999px;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.85rem;
}
.rcm-home-search:focus-within {
  background: white; border-color: var(--rcm-accent-soft);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.10);
}
.rcm-home-search i { color: var(--rcm-muted); font-size: 0.85rem; }
.rcm-home-search input {
  flex: 1; border: none; background: transparent; outline: none;
  padding: 0.55rem 0; font-size: 0.85rem; font-family: inherit; color: var(--rcm-ink);
}
.rcm-home-search-results {
  margin-top: 0.5rem;
  background: white; border: 1px solid var(--rcm-line);
  border-radius: var(--rcm-radius-sm);
  max-height: 360px; overflow-y: auto;
}
.rcm-home-search-row {
  display: block; padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rcm-line-soft);
  text-decoration: none; color: inherit;
}
.rcm-home-search-row:last-child { border-bottom: none; }
.rcm-home-search-row:hover { background: var(--rcm-accent-ghost); }
.rcm-home-search-name { font-size: 0.82rem; font-weight: 600; color: var(--rcm-ink); }
.rcm-home-search-meta { display: flex; gap: 0.55rem; align-items: center; font-size: 0.7rem; color: var(--rcm-muted); margin-top: 0.15rem; }
.rcm-home-search-price { margin-left: auto; font-weight: 600; color: var(--rcm-ink); font-variant-numeric: tabular-nums; }
.rcm-home-search-empty { padding: 0.7rem 0.85rem; font-size: 0.78rem; color: var(--rcm-muted); text-align: center; }

/* ---------- Feature list (active deals / outbound shipments) ---------- */
.rcm-home-feat-list { display: flex; flex-direction: column; gap: 0.4rem; }
.rcm-home-feat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rcm-line-soft); border-radius: var(--rcm-radius-sm);
  background: #fdfdff; text-decoration: none; color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rcm-home-feat-row:hover { border-color: var(--rcm-accent-soft); background: white; }
.rcm-home-feat-name { font-size: 0.82rem; font-weight: 600; color: var(--rcm-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcm-home-feat-meta { font-size: 0.68rem; color: var(--rcm-muted); margin-top: 0.1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rcm-home-feat-value { font-size: 0.82rem; font-weight: 700; color: var(--rcm-ink); font-variant-numeric: tabular-nums; }
.rcm-home-pill {
  font-size: 0.58rem; font-weight: 700; padding: 0.08rem 0.45rem;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em;
}
.rcm-home-pill-paid { background: #d1fae5; color: #047857; }
.rcm-home-pill-open { background: #fef3c7; color: #92400e; }
.rcm-home-pill-unknown { background: var(--rcm-bg); color: var(--rcm-muted); }
.rcm-home-empty { padding: 1rem; text-align: center; color: var(--rcm-muted); font-size: 0.82rem; font-style: italic; }

/* ---------- Calendar widget ---------- */
.rcm-home-cal-list { display: flex; flex-direction: column; gap: 0.45rem; }
.rcm-home-cal-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.6rem; align-items: center;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rcm-line-soft); border-radius: var(--rcm-radius-sm);
  background: #fdfdff;
}
.rcm-home-cal-date {
  text-align: center; padding: 0.2rem 0.3rem;
  border-radius: var(--rcm-radius-sm);
  background: var(--rcm-accent-ghost);
}
.rcm-home-cal-day { display: block; font-size: 1.1rem; font-weight: 700; color: var(--rcm-accent-2); line-height: 1; }
.rcm-home-cal-mon { display: block; font-size: 0.55rem; font-weight: 700; color: var(--rcm-accent); text-transform: uppercase; letter-spacing: 0.06em; }
/* Tint the mini-calendar date squares to match each event's type. */
.rcm-home-cal-row:has(.rcm-home-cal-tag-holiday)  .rcm-home-cal-date { background: #fee2e2; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-holiday)  .rcm-home-cal-day  { color: #b91c1c; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-holiday)  .rcm-home-cal-mon  { color: #b91c1c; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-sales)    .rcm-home-cal-date { background: #ede9fe; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-sales)    .rcm-home-cal-day  { color: #6d28d9; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-sales)    .rcm-home-cal-mon  { color: #6d28d9; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-birthday) .rcm-home-cal-date { background: #fce7f3; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-birthday) .rcm-home-cal-day  { color: #be185d; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-birthday) .rcm-home-cal-mon  { color: #be185d; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-pto)      .rcm-home-cal-date { background: #fff1e6; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-pto)      .rcm-home-cal-day  { color: #ea580c; }
.rcm-home-cal-row:has(.rcm-home-cal-tag-pto)      .rcm-home-cal-mon  { color: #ea580c; }
.rcm-home-cal-title { font-size: 0.85rem; font-weight: 600; color: var(--rcm-ink); }
.rcm-home-cal-sub   { font-size: 0.66rem; color: var(--rcm-muted); margin-top: 0.1rem; }
.rcm-home-cal-tag {
  font-size: 0.55rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.rcm-home-cal-tag-holiday       { background: #fee2e2; color: #b91c1c; }
.rcm-home-cal-tag-event         { background: var(--rcm-accent-ghost); color: var(--rcm-accent-2); }
.rcm-home-cal-tag-sales         { background: #ede9fe; color: #6d28d9; }
.rcm-home-cal-tag-birthday      { background: #fce7f3; color: #be185d; }
.rcm-home-cal-tag-pto           { background: #fff1e6; color: #c2410c; }
.rcm-home-cal-tag-training      { background: #cffafe; color: #155e75; }
.rcm-home-cal-tag-office_closed { background: #111827; color: white; }

/* Stack the type-tag and the office-status pill */
.rcm-home-cal-tags { display: flex; flex-direction: column; gap: 0.2rem; align-items: flex-end; }
.rcm-home-office-tag { font-weight: 800; }
.rcm-home-office-closed  { background: #111827; color: white; }
.rcm-home-office-open    { background: #d1fae5; color: #047857; }
.rcm-home-office-half_am { background: #fef3c7; color: #92400e; }
.rcm-home-office-half_pm { background: #fef3c7; color: #92400e; }
.rcm-home-office-half    { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); color: #fff; }
.rcm-home-office-wfh     { background: #ddd6fe; color: #5b21b6; }
.rcm-home-office-on_call { background: #fff1e6; color: #c2410c; }

/* Date-range block (multi-day events) */
.rcm-home-cal-date-range {
  display: flex; align-items: center; gap: 0.25rem;
  background: var(--rcm-accent-ghost);
  padding: 0.18rem 0.4rem;
}
.rcm-home-cal-date-range .rcm-home-cal-day {
  font-size: 0.85rem; line-height: 1.1;
}
.rcm-home-cal-date-range .rcm-home-cal-day small {
  display: block; font-size: 0.5rem; font-weight: 700;
  color: var(--rcm-accent); text-transform: uppercase; letter-spacing: 0.06em;
}
.rcm-home-cal-day-sep { color: var(--rcm-accent); font-weight: 700; }

/* ---------- Pending Approvals (owner only) ---------- */
.rcm-home-card-approvals {
  border-left: 4px solid var(--rcm-warm);
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 60%);
}
.rcm-home-approve-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--rcm-warm); color: white;
  font-size: 0.7rem; font-weight: 800;
}
.rcm-home-approve-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rcm-home-approve-row {
  border: 1px solid #fed7aa; background: white; border-radius: 10px;
  padding: 0.6rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.rcm-home-approve-row-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem;
}
.rcm-home-approve-who {
  font-size: 0.85rem; font-weight: 700; color: var(--rcm-ink);
}
.rcm-home-approve-tag {
  font-size: 0.55rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  background: #fee2e2; color: #b91c1c; text-transform: uppercase;
}
.rcm-home-approve-when {
  font-size: 0.74rem; color: var(--rcm-ink-soft); font-weight: 500;
}
.rcm-home-approve-desc {
  font-size: 0.7rem; color: var(--rcm-muted); font-style: italic;
}
.rcm-home-approve-actions {
  display: flex; gap: 0.35rem; justify-content: flex-end;
}
.rcm-home-approve-btn {
  font-family: inherit; font-size: 0.7rem; font-weight: 700;
  padding: 0.35rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s ease;
}
.rcm-home-approve-btn.approve { background: var(--rcm-success); color: white; border-color: var(--rcm-success); }
.rcm-home-approve-btn.approve:hover { background: #047857; border-color: #047857; }
.rcm-home-approve-btn.deny    { background: white; color: var(--rcm-danger); border-color: #fecaca; }
.rcm-home-approve-btn.deny:hover { background: #fee2e2; }
.rcm-home-approve-empty {
  padding: 0.85rem; text-align: center; color: var(--rcm-muted);
  font-size: 0.78rem; font-style: italic;
}

/* ---------- Quick links ---------- */
.rcm-home-card-quicklinks .rcm-home-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
}
.rcm-home-link {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rcm-line-soft); border-radius: var(--rcm-radius-sm);
  background: #fdfdff; text-decoration: none; color: var(--rcm-ink);
  font-size: 0.78rem; font-weight: 600;
  transition: all 0.15s ease;
}
.rcm-home-link:hover { border-color: var(--rcm-accent-soft); background: var(--rcm-accent-ghost); color: var(--rcm-accent-2); transform: translateY(-1px); }
.rcm-home-link i { color: var(--rcm-accent); font-size: 0.95rem; }
/* Alternate the link icon colors so the column isn't all purple. */
.rcm-home-links .rcm-home-link:nth-child(2n) i { color: #ea580c; }     /* orange */
.rcm-home-links .rcm-home-link:nth-child(4n+3) i { color: #047857; }    /* green */

@media (max-width: 720px) {
  .rcm-home { padding: 0.7rem; }
  .rcm-home-hero { grid-template-columns: 1fr; gap: 0.7rem; padding: 0.85rem; }
  .rcm-home-hero-avatar { width: 52px; height: 52px; }
  .rcm-home-hero-greet { font-size: 1.2rem; }
  .rcm-home-hero-actions { justify-content: stretch; }
  .rcm-home-hero-actions .rcm-btn { flex: 1; justify-content: center; }
  .rcm-home-card-quicklinks .rcm-home-links { grid-template-columns: 1fr; }
}
