/*
 * Rentari modernization kit
 * ---------------------------------------------------------------
 * Reusable patterns that match the new gradient-bordered header /
 * sim-chip / lease-maturity treatment. Class names are prefixed
 * `m-*` so they sit alongside Tailwind utilities without colliding.
 *
 * Brand vars come from the three app shells (dashboard_base,
 * tenant_base, vendor_base). Fallbacks are inlined so this file
 * still renders correctly if loaded before the shell's :root block.
 *
 * Preview & audit: see _modernization_kit_preview.html at repo root.
 */

/* ============================================================
   BUTTONS
   ============================================================ */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 600;
  border-radius: 10px; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease,
              border-color .15s ease, background .15s ease;
  border: 1px solid transparent;
  line-height: 1;
}
.m-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(140, 108, 255, .18),
    0 0 0 6px rgba(72, 226, 217, .12);
}

.m-btn-primary {
  color: #fff;
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-blue, #6A9EFF) 55%,
    var(--sl-brand-teal, #48E2D9));
  box-shadow: 0 6px 16px -8px rgba(140, 108, 255, .55);
}
.m-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(140, 108, 255, .65);
}

.m-btn-ghost {
  color: #1e2b3d; background: #fff;
  border-color: #e2e8f0;
}
.m-btn-ghost:hover {
  transform: translateY(-1px);
  border-color: transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg,
      var(--sl-brand-purple, #8C6CFF),
      var(--sl-brand-blue, #6A9EFF) 50%,
      var(--sl-brand-teal, #48E2D9)) border-box;
}

.m-btn-danger {
  color: #be123c; background: #fff;
  border-color: #fecdd3;
}
.m-btn-danger:hover {
  transform: translateY(-1px);
  background: #ffeaec; border-color: #fb7185;
}

.m-btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 10px; display: grid; place-items: center;
  color: #293649; background: #fff; border-color: #e2e8f0;
}
.m-btn-icon:hover {
  color: #0f172a; background: #f8fafc;
  border-color: #cbd5e1; transform: translateY(-1px);
}

/* ============================================================
   CARDS
   ============================================================ */
.m-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, .02),
    0 8px 24px -16px rgba(15, 23, 42, .10);
  overflow: hidden;
}
.m-card-hero {
  position: relative;
  border-radius: 22px;
  border: 1px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg,
      rgba(140, 108, 255, .55),
      rgba(106, 158, 255, .45) 50%,
      rgba(72, 226, 217, .55)) border-box;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, .02),
    0 18px 40px -20px rgba(140, 108, 255, .30);
}
.m-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(226, 232, 240, .7);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.m-card-body { padding: 18px 20px; }

.m-section-orb {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-blue, #6A9EFF) 55%,
    var(--sl-brand-teal, #48E2D9));
  box-shadow: 0 4px 12px -4px rgba(140, 108, 255, .55);
  flex-shrink: 0; font-size: 13px;
}

/* ============================================================
   STAT TILES
   ============================================================ */
.m-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 18px;
  transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease;
  cursor: default;
}
.m-stat:hover {
  transform: translateY(-2px);
  border-color: transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg,
      var(--sl-brand-purple, #8C6CFF),
      var(--sl-brand-blue, #6A9EFF) 50%,
      var(--sl-brand-teal, #48E2D9)) border-box;
  box-shadow: 0 16px 32px -20px rgba(140, 108, 255, .35);
}
.m-stat-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: #354358;
}
.m-stat-value {
  font-size: 24px; font-weight: 800;
  letter-spacing: -.02em; color: #0f172a;
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.m-stat-trend {
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.m-stat-trend.up   { color: #059669; }
.m-stat-trend.down { color: #e11d48; }
.m-stat-trend.flat { color: #354358; }
.m-stat-sub { font-size: 11px; color: #354358; margin-top: 2px; }

/* ============================================================
   PILLS
   ============================================================ */
.m-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.m-pill .dot { width: 6px; height: 6px; border-radius: 999px; }

.m-pill-success { color: #047857; background: #defcee; border-color: #a7f3d0; }
.m-pill-success .dot { background: #10b981; }
.m-pill-warn    { color: #b45309; background: #fff7d9; border-color: #fde68a; }
.m-pill-warn    .dot { background: #f59e0b; }
.m-pill-danger  { color: #be123c; background: #ffeaec; border-color: #fecdd3; }
.m-pill-danger  .dot { background: #f43f5e; }
.m-pill-neutral { color: #293649; background: #f1f5f9; border-color: #e2e8f0; }
.m-pill-neutral .dot { background: #94a3b8; }

.m-pill-brand {
  color: #0f172a;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg,
      var(--sl-brand-purple, #8C6CFF),
      var(--sl-brand-blue, #6A9EFF) 55%,
      var(--sl-brand-teal, #48E2D9)) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 6px 18px -10px rgba(140, 108, 255, .5);
}
.m-pill-brand .dot {
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-teal, #48E2D9));
  animation: m-pulse 2.4s ease-out infinite;
}
@keyframes m-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 108, 255, .45); }
  50%      { box-shadow: 0 0 0 6px rgba(140, 108, 255, 0); }
}

.m-pill-ai {
  color: #fff;
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-blue, #6A9EFF));
  box-shadow: 0 3px 8px -3px rgba(140, 108, 255, .6);
  border-color: transparent;
}

/* ============================================================
   TABLES
   ============================================================ */
.m-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; color: #0f172a;
}
.m-table thead th {
  text-align: left; font-weight: 700;
  font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: #354358;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 1;
}
.m-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.m-table tbody tr { transition: background .12s ease; }
.m-table tbody tr:hover { background: #f8fafc; }
.m-table tbody tr:last-child td { border-bottom: 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.m-empty {
  text-align: center; padding: 36px 24px; color: #354358;
}
.m-empty-orb {
  margin: 0 auto 14px;
  width: 56px; height: 56px;
  border-radius: 16px; display: grid; place-items: center;
  color: #fff; font-size: 20px;
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-blue, #6A9EFF) 55%,
    var(--sl-brand-teal, #48E2D9));
  box-shadow: 0 8px 24px -8px rgba(140, 108, 255, .55);
}
.m-empty-title { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.m-empty-sub   {
  font-size: 12px; color: #354358;
  max-width: 32rem; margin: 0 auto 14px;
  line-height: 1.5;
}

/* ============================================================
   TOGGLE
   ============================================================ */
.m-switch {
  position: relative;
  width: 40px; height: 22px;
  background: #cbd5e1; border-radius: 999px;
  cursor: pointer; flex-shrink: 0;
  transition: background .2s ease;
}
.m-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 999px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
  transition: left .2s ease;
}
.m-switch.on {
  background: linear-gradient(135deg,
    var(--sl-brand-purple, #8C6CFF),
    var(--sl-brand-blue, #6A9EFF) 60%,
    var(--sl-brand-teal, #48E2D9));
}
.m-switch.on::after { left: 20px; }

/* ============================================================
   TABS
   ============================================================ */
.m-tabs {
  display: inline-flex; gap: 4px;
  padding: 4px; background: #f1f5f9;
  border-radius: 12px;
}
.m-tab {
  padding: 7px 12px;
  font-size: 12px; font-weight: 600; color: #354358;
  background: transparent; border-radius: 8px;
  cursor: pointer; border: 0;
  transition: color .12s ease, background .12s ease;
}
.m-tab:hover { color: #0f172a; }
.m-tab.active {
  color: #0f172a; background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
