/* ============================================================
   RIDKK app panel — custom component styles (.rdk-*).
   Loaded via a HEAD_END render hook (AppPanelProvider), because
   Filament's compiled CSS only ships utilities its own components
   use — custom blades must bring their own styles.
   ============================================================ */

/* ---------- Social sign-in (login / register pages) ---------- */
.rdk-social { display: grid; gap: 18px; margin-bottom: 22px; }
.rdk-social-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.rdk-social[data-count="1"] .rdk-social-row { grid-template-columns: 1fr; }
.rdk-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
}
.rdk-social-btn svg { width: 18px; height: 18px; flex: none; }
.rdk-social-btn:hover {
  border-color: #c7d2fe;
  background: #fafaff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .10);
  transform: translateY(-1px);
}
.rdk-social-btn:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.dark .rdk-social-btn {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .12);
  color: #f3f4f6;
  box-shadow: none;
}
.dark .rdk-social-btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); }
.rdk-social-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
  font-size: 12px;
  letter-spacing: .01em;
}
.rdk-social-or::before, .rdk-social-or::after { content: ""; flex: 1; height: 1px; background: #e5e7eb; }
.dark .rdk-social-or { color: #9ca3af; }
.dark .rdk-social-or::before, .dark .rdk-social-or::after { background: rgba(255, 255, 255, .12); }

/* ---------- Card pickers (channel type / email provider) ---------- */
.rdk-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 680px) {
  .rdk-picker { grid-template-columns: 1fr; }
}

.rdk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.rdk-card--row { flex-direction: row; align-items: center; padding: 14px; }
.rdk-card:hover:not(:disabled) {
  border-color: #c7d2fe;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .10);
  transform: translateY(-1px);
}
.rdk-card[data-selected="true"] {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5, 0 6px 16px rgba(79, 70, 229, .12);
  background: #fbfbff;
}
.rdk-card:disabled { cursor: default; }
.rdk-card:disabled:not([data-selected="true"]) { opacity: .45; }

.rdk-card-body { min-width: 0; }
.rdk-card-title {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -.01em;
}
.rdk-card-desc {
  display: block;
  margin-top: 3px;
  font-size: .78rem;
  line-height: 1.5;
  color: #6b7280;
}
.rdk-card-check {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 20px;
  height: 20px;
  color: #4f46e5;
  display: none;
}
.rdk-card[data-selected="true"] .rdk-card-check { display: block; }
.rdk-brand { flex-shrink: 0; }
.rdk-brand svg { display: block; }

.dark .rdk-card { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }
.dark .rdk-card[data-selected="true"] { background: rgba(99, 102, 241, .10); }
.dark .rdk-card-title { color: #f4f4f5; }
.dark .rdk-card-desc { color: #a1a1aa; }
.dark .rdk-card-check { color: #a5b4fc; }

/* ---------- Channel table column (brand + label + detail) ---------- */
.rdk-chan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}
.rdk-chan-label {
  font-size: .875rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rdk-chan-detail {
  margin-top: 1px;
  font-size: .75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rdk-chan-meta { min-width: 0; }
.dark .rdk-chan-label { color: #f4f4f5; }
.dark .rdk-chan-detail { color: #a1a1aa; }

/* ---------- Billing page ---------- */
.rdk-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.dark .rdk-panel { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }

.rdk-bill-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.rdk-bill-kicker { font-size: .8rem; font-weight: 600; color: #6b7280; }
.rdk-bill-plan { margin-top: 4px; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; color: #111827; }
.rdk-bill-plan small { font-size: .95rem; font-weight: 600; color: #6b7280; margin-inline-start: 8px; }
.rdk-bill-note { margin-top: 8px; font-size: .875rem; color: #4b5563; max-width: 60ch; }
.rdk-bill-note strong { color: #111827; }
.rdk-bill-side { display: flex; align-items: center; gap: 14px; }
.dark .rdk-bill-plan { color: #f4f4f5; }
.dark .rdk-bill-note { color: #d4d4d8; }
.dark .rdk-bill-note strong { color: #fff; }

.rdk-link-danger {
  font-size: .82rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: 0;
  cursor: pointer;
}
.rdk-link-danger:hover { color: #dc2626; }
.rdk-link-primary {
  font-weight: 600;
  color: #4f46e5;
  background: none;
  border: 0;
  cursor: pointer;
}
.rdk-link-primary:hover { text-decoration: underline; }
.dark .rdk-link-primary { color: #a5b4fc; }

.rdk-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .rdk-plans { grid-template-columns: 1fr; }
}
.rdk-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.rdk-plan--current { border-color: #4f46e5; box-shadow: 0 0 0 1px #4f46e5; }
.dark .rdk-plan { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }
.dark .rdk-plan--current { border-color: #6366f1; box-shadow: 0 0 0 1px #6366f1; }

.rdk-plan-flag {
  position: absolute;
  top: -11px;
  inset-inline-start: 20px;
  background: #4f46e5;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.rdk-plan-name { font-size: 1.05rem; font-weight: 700; color: #111827; }
.rdk-plan-tagline { margin-top: 2px; font-size: .82rem; color: #6b7280; }
.rdk-plan-price { margin-top: 14px; display: flex; align-items: baseline; gap: 4px; }
.rdk-plan-price strong { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; color: #111827; }
.rdk-plan-price span { font-size: .82rem; color: #6b7280; }
.dark .rdk-plan-name, .dark .rdk-plan-price strong { color: #f4f4f5; }

.rdk-mods { list-style: none; margin: 16px 0 0; padding: 0; flex: 1; }
.rdk-mods li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .84rem;
  color: #374151;
  padding: 4px 0;
}
.rdk-mods svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: #10b981; }
.dark .rdk-mods li { color: #d4d4d8; }

.rdk-plan-cta { margin-top: 18px; }
.rdk-plan-cta .fi-btn { width: 100%; justify-content: center; }
.rdk-plan-cta .rdk-link-danger { display: block; width: 100%; text-align: center; padding: .5rem; }

/* Four plans + add-on bundle card. */
@media (min-width: 1280px) { .rdk-plans { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rdk-plan--bundle { background: linear-gradient(168deg, #37309b 0%, #251f6b 55%, #1c1655 100%); border-color: transparent; }
.rdk-plan--bundle .rdk-plan-name, .rdk-plan--bundle .rdk-plan-price strong { color: #fff; }
.rdk-plan--bundle .rdk-plan-tagline, .rdk-plan--bundle .rdk-plan-price span { color: #c7d2fe; }
.rdk-plan--bundle .rdk-plan-flag { background: #22c55e; }
.rdk-plan--bundle .rdk-plan-tagline { flex: 1; margin-top: 12px; }

.rdk-bill-foot {
  margin-top: 22px;
  text-align: center;
  font-size: .82rem;
  color: #6b7280;
}
.rdk-bill-foot a { color: #4f46e5; font-weight: 500; }
.rdk-bill-foot a:hover { text-decoration: underline; }
.dark .rdk-bill-foot a { color: #a5b4fc; }

/* ---------- Industry templates page ---------- */
.rdk-templates-intro {
  font-size: .9rem;
  color: #4b5563;
  max-width: 72ch;
}
.dark .rdk-templates-intro { color: #d4d4d8; }

.rdk-templates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 1100px) { .rdk-templates { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .rdk-templates { grid-template-columns: 1fr; } }

.rdk-template {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: box-shadow .15s ease, transform .15s ease;
}
.rdk-template:hover { box-shadow: 0 8px 22px rgba(16, 24, 40, .08); transform: translateY(-2px); }
.dark .rdk-template { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); }

.rdk-template-head { display: flex; align-items: center; gap: 12px; }
.rdk-template-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  font-size: 24px;
  background: #eef2ff;
  border-radius: 12px;
  flex-shrink: 0;
}
.dark .rdk-template-emoji { background: rgba(99, 102, 241, .15); }
.rdk-template-name { font-size: 1rem; font-weight: 700; color: #111827; letter-spacing: -.01em; }
.rdk-template-name-ar { font-size: .78rem; color: #6b7280; margin-top: 1px; }
.dark .rdk-template-name { color: #f4f4f5; }

.rdk-template-tagline {
  margin-top: 12px;
  font-size: .84rem;
  line-height: 1.55;
  color: #4b5563;
}
.dark .rdk-template-tagline { color: #d4d4d8; }

.rdk-template-contents { list-style: none; margin: 14px 0 0; padding: 0; flex: 1; }
.rdk-template-contents li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .8rem;
  color: #374151;
  padding: 3px 0;
}
.rdk-template-contents svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: #6366f1; }
.dark .rdk-template-contents li { color: #d4d4d8; }

.rdk-template-cta { margin-top: 16px; }
.rdk-template-cta .fi-btn { width: 100%; justify-content: center; }

/* ---------- VAT summary ---------- */
.rdk-vat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.rdk-month-input {
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: .9rem;
  color: #111827;
  background: #fff;
}
.dark .rdk-month-input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.15); color: #f4f4f5; }
.rdk-vat-count { font-size: .82rem; color: #6b7280; }

.rdk-vat-empty { font-size: .88rem; color: #6b7280; padding: 18px 0 6px; }

.rdk-vat-table, .rdk-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.rdk-vat-table th, .rdk-table th {
  text-align: start;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}
.rdk-vat-table td, .rdk-table td {
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}
.rdk-vat-table tfoot td, .rdk-table tfoot td {
  font-weight: 700;
  border-top: 2px solid #e5e7eb;
  border-bottom: none;
}
.rdk-vat-table .rdk-num, .rdk-table .rdk-num { text-align: end; font-variant-numeric: tabular-nums; }
.dark .rdk-vat-table td, .dark .rdk-table td { color: #f4f4f5; border-color: rgba(255,255,255,.07); }
.dark .rdk-vat-table th, .dark .rdk-table th { border-color: rgba(255,255,255,.12); }
.dark .rdk-vat-table tfoot td, .dark .rdk-table tfoot td { border-color: rgba(255,255,255,.12); }

.rdk-vat-note { margin-top: 14px; font-size: .78rem; color: #6b7280; }

/* ---------- Group executive overview ---------- */
.rdk-group-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.rdk-group-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.rdk-group-kpi.is-warn { border-color: #fcd34d; background: #fffbeb; }
.rdk-group-kpi-label { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.rdk-group-kpi-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; color: #111827; line-height: 1.1; }
.rdk-group-kpi-sub { font-size: .78rem; color: #6b7280; }
.dark .rdk-group-kpi { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }
.dark .rdk-group-kpi.is-warn { background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .4); }
.dark .rdk-group-kpi-value { color: #f4f4f5; }

.rdk-group-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.rdk-group-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; color: #111827; }
.dark .rdk-group-title { color: #f4f4f5; }
.rdk-table-wrap { overflow-x: auto; }
.rdk-table .rdk-warn { color: #b45309; font-weight: 700; }

.rdk-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
}
.rdk-pill.is-ok { background: #ecfdf5; color: #047857; }
.rdk-pill.is-info { background: #eef2ff; color: #4338ca; }
.rdk-pill.is-muted { background: #f3f4f6; color: #6b7280; }
.rdk-pill.is-bad { background: #fef2f2; color: #b91c1c; }
.dark .rdk-pill { background: rgba(255,255,255,.08); color: #e4e4e7; }
.dark .rdk-pill.is-ok { background: rgba(16,185,129,.15); color: #6ee7b7; }
.dark .rdk-pill.is-info { background: rgba(99,102,241,.18); color: #c7d2fe; }
