:root {
  --rd-primary: #4f46e5;
  --rd-primary-dark: #4338ca;
  --rd-accent: #06b6d4;
  --rd-bg: #f5f6fb;
  --rd-card: #ffffff;
  --rd-border: #e5e7eb;
  --rd-text: #111827;
  --rd-muted: #6b7280;
  --rd-sidebar: #111827;
  --rd-sidebar-active: #4f46e5;
  --rd-radius: 12px;
  --rd-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  background: var(--rd-bg);
  color: var(--rd-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a { color: var(--rd-primary); text-decoration: none; }
a:hover { color: var(--rd-primary-dark); }

/* ---------- public site ---------- */

.rd-nav {
  background: #fff;
  border-bottom: 1px solid var(--rd-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.rd-brand {
  font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em;
  display: inline-flex; align-items: center; gap: .5rem; color: var(--rd-text);
}
.rd-brand .rd-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--rd-primary), var(--rd-accent)); color: #fff;
}

.rd-hero {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(79, 70, 229, .18), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(6, 182, 212, .16), transparent 55%),
    #fff;
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px solid var(--rd-border);
}
.rd-hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.03em; }
.rd-hero .lead { color: var(--rd-muted); font-size: 1.1rem; max-width: 640px; }

.rd-card {
  background: var(--rd-card); border: 1px solid var(--rd-border);
  border-radius: var(--rd-radius); box-shadow: var(--rd-shadow);
}

.rd-searchbar {
  display: flex; gap: .5rem; background: #fff; padding: .5rem;
  border-radius: 14px; border: 1px solid var(--rd-border); box-shadow: var(--rd-shadow);
}
.rd-searchbar input { border: 0; outline: 0; font-size: 1rem; padding: .6rem .8rem; flex: 1; }

.rd-feature { padding: 1.25rem; height: 100%; }
.rd-feature .bi { font-size: 1.5rem; color: var(--rd-primary); }
.rd-feature h3 { font-size: 1rem; font-weight: 700; margin: .5rem 0 .25rem; }
.rd-feature p { color: var(--rd-muted); font-size: .9rem; margin: 0; }

.rd-footer { background: #0b1220; color: #94a3b8; padding: 3rem 0 2rem; margin-top: 4rem; }
.rd-footer h6 { color: #e2e8f0; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
.rd-footer a { color: #94a3b8; }
.rd-footer a:hover { color: #fff; }

.rd-article { font-size: 1.02rem; line-height: 1.75; }
.rd-article h2 { margin-top: 2rem; font-weight: 700; letter-spacing: -.01em; }
.rd-article h3 { margin-top: 1.5rem; font-weight: 700; }
.rd-article pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 10px; overflow: auto; }
.rd-article code { background: #f1f5f9; padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
.rd-article pre code { background: none; padding: 0; color: inherit; }

/* ---------- console ---------- */

.rd-shell { display: flex; min-height: 100vh; }

.rd-sidebar {
  width: 250px; flex: 0 0 250px; background: var(--rd-sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rd-sidebar .rd-brand { color: #fff; padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(148, 163, 184, .15); }
.rd-sidebar .rd-brand .rd-logo { width: 30px; height: 30px; }
.rd-nav-group { padding: 1rem .6rem .25rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #64748b; font-weight: 700; }
.rd-side-link {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; margin: .1rem .35rem;
  border-radius: 9px; color: #cbd5e1; font-size: .9rem; font-weight: 500;
}
.rd-side-link:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.rd-side-link.active { background: var(--rd-sidebar-active); color: #fff; }
.rd-side-link .bi { font-size: 1.05rem; }
.rd-side-badge {
  margin-left: auto; background: rgba(248, 113, 113, .9); color: #fff; font-size: .68rem;
  padding: .05rem .4rem; border-radius: 999px; font-weight: 700;
}

.rd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.rd-topbar {
  background: #fff; border-bottom: 1px solid var(--rd-border); padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20;
}
.rd-topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.rd-topbar .rd-sub { color: var(--rd-muted); font-size: .82rem; }
.rd-content { padding: 1.25rem; flex: 1; }

.rd-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--rd-primary), var(--rd-accent));
  color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700;
}

.rd-stat { background: #fff; border: 1px solid var(--rd-border); border-radius: var(--rd-radius); padding: 1.1rem 1.25rem; box-shadow: var(--rd-shadow); }
.rd-stat .rd-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--rd-muted); font-weight: 700; }
.rd-stat .rd-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin-top: .2rem; }
.rd-stat .rd-icon { float: right; font-size: 1.5rem; opacity: .28; }

.rd-table { background: #fff; border: 1px solid var(--rd-border); border-radius: var(--rd-radius); overflow: hidden; box-shadow: var(--rd-shadow); }
.rd-table table { margin: 0; width: 100%; }
.rd-table thead th { background: #fafbfc; border-bottom: 1px solid var(--rd-border); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rd-muted); font-weight: 700; padding: .7rem .9rem; white-space: nowrap; }
.rd-table tbody td { padding: .7rem .9rem; vertical-align: middle; border-bottom: 1px solid #f1f3f5; font-size: .89rem; }
.rd-table tbody tr:last-child td { border-bottom: 0; }
.rd-table tbody tr:hover { background: #fafbff; }

.rd-pill { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .01em; }
.status-new { background: #e0e7ff; color: #3730a3; }
.status-open { background: #dbeafe; color: #1d4ed8; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-resolved { background: #d1fae5; color: #047857; }
.status-closed { background: #e5e7eb; color: #374151; }
.status-reopened { background: #fee2e2; color: #b91c1c; }
.status-spam { background: #f3e8ff; color: #7e22ce; }
.priority-urgent { background: #fee2e2; color: #b91c1c; }
.priority-high { background: #ffedd5; color: #c2410c; }
.priority-normal { background: #e0e7ff; color: #3730a3; }
.priority-low { background: #f1f5f9; color: #475569; }

.rd-timeline { position: relative; padding-left: 1.4rem; }
.rd-timeline::before { content: ""; position: absolute; left: .4rem; top: .4rem; bottom: .4rem; width: 2px; background: var(--rd-border); }
.rd-timeline-item { position: relative; padding-bottom: 1rem; }
.rd-timeline-item::before {
  content: ""; position: absolute; left: -1.1rem; top: .35rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--rd-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--rd-primary);
}
.rd-timeline-item.is-internal::before { background: #f59e0b; box-shadow: 0 0 0 2px #f59e0b; }

.rd-msg { border: 1px solid var(--rd-border); border-radius: 10px; padding: .9rem 1rem; margin-bottom: .8rem; background: #fff; }
.rd-msg.is-internal { background: #fffbeb; border-color: #fcd34d; }
.rd-msg .rd-meta { font-size: .78rem; color: var(--rd-muted); }

.rd-chart { background: #fff; border: 1px solid var(--rd-border); border-radius: var(--rd-radius); padding: 1.1rem 1.25rem; box-shadow: var(--rd-shadow); }
.rd-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.rd-bars .rd-bar { flex: 1; background: linear-gradient(180deg, var(--rd-primary), #818cf8); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.rd-bars .rd-bar:hover::after {
  content: attr(data-label); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; font-size: .7rem; padding: .15rem .4rem; border-radius: 5px; white-space: nowrap;
}

.rd-empty { text-align: center; padding: 3rem 1rem; color: var(--rd-muted); }
.rd-empty .bi { font-size: 2.5rem; opacity: .3; display: block; margin-bottom: .5rem; }

.rd-filterbar { background: #fff; border: 1px solid var(--rd-border); border-radius: var(--rd-radius); padding: .85rem 1rem; margin-bottom: 1rem; box-shadow: var(--rd-shadow); }
.rd-filterbar .form-control, .rd-filterbar .form-select { font-size: .86rem; }

.rd-kb-item { padding: .9rem 0; border-bottom: 1px solid #f1f3f5; }
.rd-kb-item:last-child { border-bottom: 0; }
.rd-kb-item h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .2rem; }

.rd-toast-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 1080; }
.rd-toast { background: #111827; color: #fff; padding: .7rem 1rem; border-radius: 10px; font-size: .87rem; box-shadow: var(--rd-shadow); margin-bottom: .5rem; }
.rd-toast.err { background: #b91c1c; }

.rd-widget-btn {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1050;
  background: var(--rd-primary); color: #fff; border: 0; border-radius: 999px;
  padding: .7rem 1.1rem; font-weight: 600; box-shadow: 0 10px 30px rgba(79, 70, 229, .35);
}

@media (max-width: 992px) {
  .rd-sidebar { position: fixed; left: -260px; transition: left .2s ease; z-index: 1040; }
  .rd-sidebar.open { left: 0; }
  .rd-shell { flex-direction: column; }
}

/* Small utilities, so the templates hold no inline style. */
.rd-hide { display: none !important; }
.rd-max-140 { max-width: 140px; }
.rd-max-280 { max-width: 280px; }
.rd-max-320 { max-width: 320px; }
.rd-max-420 { max-width: 420px; }
.rd-max-560 { max-width: 560px; }
.rd-w-auto { width: auto; }
.rd-flex-1 { flex: 1; }
.rd-name { font-size: .85rem; font-weight: 600; }
.rd-big-check { font-size: 3rem; }
