/* =====================================================================
   Components — cards, KPIs, badges, buttons, feed, charts, toasts…
   ===================================================================== */

/* ------------------------------- Card ------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t), background var(--t);
}
.card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-link { font-size: 12.5px; font-weight: 600; color: var(--brand-gold); display: inline-flex; align-items: center; gap: 4px; }
.card-link .icn { width: 15px; height: 15px; }
.card-link:hover { filter: brightness(1.12); }

/* ------------------------------- KPI ------------------------------- */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0; background: var(--grad-gold-soft); opacity: 0; transition: opacity var(--t); pointer-events: none; }
.kpi.hoverable:hover::after { opacity: 1; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--grad-gold-soft); color: var(--brand-gold);
}
.kpi-icon .icn { width: 19px; height: 19px; }
.kpi-value { font-family: var(--font-display); font-size: 25px; font-weight: 700; letter-spacing: -.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.kpi-spark { width: 100%; height: 22px; display: block; margin-top: 10px; opacity: .95; }

/* Trend pill */
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-pill); }
.trend .icn { width: 12px; height: 12px; }
.trend.up { color: var(--success); background: var(--success-tint); }
.trend.down { color: var(--error); background: var(--error-tint); }
.trend.warn { color: var(--warning); background: var(--warning-tint); }
.trend.flat { color: var(--text-2); background: var(--border-soft); }

/* ------------------------------- Badges ------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  padding: 2px 10px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--success); background: var(--success-tint); }
.badge.amber { color: var(--warning); background: var(--warning-tint); }
.badge.red   { color: var(--error);   background: var(--error-tint); }
.badge.blue  { color: var(--info);    background: var(--info-tint); }
.badge.gray  { color: var(--text-2);  background: var(--border-soft); }
.badge.gold  { color: var(--brand-bronze); background: var(--grad-gold-soft); }
.badge.plain::before { display: none; }

/* ------------------------------- Buttons ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--r-btn);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: all var(--t-fast);
}
.btn .icn { width: 16px; height: 16px; }
.btn-gold {
  background: var(--grad-gold); color: var(--brand-brown);
  border-color: rgba(106, 58, 16, .22);                    /* uniform warm edge on any background */
  box-shadow: inset 0 1px 0 rgba(255, 248, 228, .45),      /* glossy top highlight */
              0 4px 12px -2px rgba(193, 105, 45, .35);     /* tight, tinted glow */
}
.btn-gold:hover {
  filter: brightness(1.04); transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 248, 228, .5),
              0 8px 20px -4px rgba(193, 105, 45, .45);
}
.btn-outline { border-color: var(--border); color: var(--text); background: var(--card); }
.btn-outline:hover { border-color: var(--brand-gold); color: var(--brand-gold); background: var(--nav-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--nav-hover); color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* Icon button (topbar) */
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); border: 1px solid var(--border-soft);
  background: var(--card); position: relative; transition: all var(--t-fast);
}
.icon-btn .icn { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--brand-gold); border-color: var(--brand-gold); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--error); border: 2px solid var(--card); }
.menu-btn { display: none; }

/* ------------------------------- Search ------------------------------- */
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--r-input); padding: 0 12px; height: 40px; width: 300px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-box:focus-within { border-color: var(--brand-gold); box-shadow: var(--ring); }
.search-box .icn { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.search-box input { border: none; outline: none; background: none; width: 100%; font-size: 13.5px; }
.search-box input::placeholder { color: var(--text-3); }
.search-box kbd { font-family: var(--font-body); font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

/* ------------------------------- User chip ------------------------------- */
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 4px; border-radius: var(--r-pill); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--brand-brown); background: var(--grad-gold); flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11.5px; color: var(--text-3); }

/* ------------------------------- Activity feed ------------------------------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border-bottom: none; padding-bottom: 0; }
.feed-item:first-child { padding-top: 0; }
.feed-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.feed-icon .icn { width: 16px; height: 16px; }
.feed-icon.green { color: var(--success); background: var(--success-tint); }
.feed-icon.amber { color: var(--warning); background: var(--warning-tint); }
.feed-icon.red   { color: var(--error);   background: var(--error-tint); }
.feed-icon.blue  { color: var(--info);    background: var(--info-tint); }
.feed-icon.gold  { color: var(--brand-bronze); background: var(--grad-gold-soft); }
.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: 12.75px; line-height: 1.45; }
.feed-text b { font-weight: 600; }
.feed-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------- Events list ------------------------------- */
.event-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.event-item:last-child { border-bottom: none; padding-bottom: 0; }
.event-date { width: 46px; height: 50px; border-radius: 11px; background: var(--card-2); border: 1px solid var(--border-soft); display: grid; place-items: center; flex-shrink: 0; text-align: center; }
.event-date .d { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1; }
.event-date .m { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
.event-info { flex: 1; min-width: 0; }
.event-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------- Progress ------------------------------- */
.progress-row { margin-bottom: 16px; }
.progress-row:last-child { margin-bottom: 0; }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; }
.progress-top b { font-family: var(--font-display); font-weight: 600; }
.progress-track { height: 9px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--grad-gold); width: 0; transition: width 1s var(--ease); }
.progress-fill.alt { background: linear-gradient(135deg, var(--brand-bronze), #8a4a1f); }

/* ------------------------------- Charts ------------------------------- */
.chart-box { position: relative; height: 250px; }
.chart-box.sm { height: 208px; }
.donut-wrap { position: relative; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.donut-total { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-label { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.legend { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-item .val { font-variant-numeric: tabular-nums; }
.legend-dot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }
.legend-item .val { margin-inline-start: auto; font-family: var(--font-display); font-weight: 600; color: var(--text); }

/* ------------------------------- Placeholder (unbuilt screens) ------------------------------- */
.placeholder { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 40px; }
.ph-inner { max-width: 440px; }
.ph-icon { width: 88px; height: 88px; border-radius: 24px; background: var(--grad-gold-soft); color: var(--brand-gold); display: grid; place-items: center; margin: 0 auto 22px; }
.ph-icon .icn { width: 42px; height: 42px; }
.ph-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.ph-text { color: var(--text-2); margin: 10px 0 22px; font-size: 14px; }
.ph-badge { display: inline-flex; margin-bottom: 18px; }

/* ------------------------------- Toast ------------------------------- */
.toast-wrap { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 500; min-width: 240px;
  transform: translateY(16px); opacity: 0; transition: all var(--t);
}
.toast.show { transform: none; opacity: 1; }
.toast .icn { width: 19px; height: 19px; color: var(--brand-gold); flex-shrink: 0; }

/* small helper — default size is a safety net; context rules / inline styles override it */
.icn { display: inline-block; vertical-align: middle; width: 18px; height: 18px; flex-shrink: 0; }
.divider { height: 1px; background: var(--border-soft); margin: 16px 0; }
