:root {
  color-scheme: dark;
  --rg-bg: #0a0a0d;
  --rg-bg-soft: #101014;
  --rg-surface: #151519;
  --rg-surface-raised: #1b1b20;
  --rg-surface-hover: #222228;
  --rg-text: #f7f5f5;
  --rg-muted: #aaa5aa;
  --rg-subtle: #77727a;
  --rg-line: rgba(255, 255, 255, 0.09);
  --rg-line-strong: rgba(255, 255, 255, 0.15);
  --rg-ruby: #e33d55;
  --rg-ruby-strong: #fa4b62;
  --rg-ruby-soft: rgba(227, 61, 85, 0.13);
  --rg-success: #45c982;
  --rg-warning: #f2b84b;
  --rg-danger: #f26570;
  --rg-discord: #5865f2;
  --rg-radius-sm: 9px;
  --rg-radius: 14px;
  --rg-radius-lg: 22px;
  --rg-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --rg-sidebar: 264px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--rg-bg); scroll-behavior: smooth; }
body.rg-app {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 12% -5%, rgba(227, 61, 85, 0.12), transparent 30rem), var(--rg-bg);
  color: var(--rg-text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 450;
  line-height: 1.55;
}
body.rg-app::before {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 65%);
  mask-image: linear-gradient(to bottom, black, transparent 65%);
  content: "";
}
body.rg-app a { color: inherit; }
body.rg-app button, body.rg-app input, body.rg-app select, body.rg-app textarea { font: inherit; }
body.rg-app button, body.rg-app a { -webkit-tap-highlight-color: transparent; }
body.rg-app :focus-visible { outline: 3px solid rgba(250, 75, 98, 0.42); outline-offset: 2px; }

.rg-skip-link {
  position: fixed; top: .75rem; left: .75rem; z-index: 9999;
  padding: .7rem 1rem; border-radius: var(--rg-radius-sm);
  background: var(--rg-text); color: var(--rg-bg) !important;
  transform: translateY(-160%); transition: transform .15s ease;
}
.rg-skip-link:focus { transform: translateY(0); }
.rg-brand {
  display: inline-flex; align-items: center; gap: .75rem;
  color: var(--rg-text); font-weight: 760; letter-spacing: -.025em; text-decoration: none;
}
.rg-brand img { width: 38px; height: 38px; object-fit: contain; }
.rg-brand-copy { display: grid; line-height: 1.1; }
.rg-brand-copy small {
  margin-top: .2rem; color: var(--rg-muted); font-size: .7rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}

.rg-button, body.rg-app .logout-button, body.rg-app .select-button,
body.rg-app .discord-login, body.rg-app .rg-add-button,
body.rg-app .rg-settings-actions button, body.rg-app #bannerSave, body.rg-app #bannerReset {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: .55rem;
  margin: 0; border: 1px solid var(--rg-line-strong); border-radius: 10px; padding: .62rem .95rem;
  background: var(--rg-surface-raised); color: var(--rg-text); font-weight: 680; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease, opacity .16s ease;
}
.rg-button:hover, body.rg-app .logout-button:hover, body.rg-app .select-button:hover,
body.rg-app .rg-add-button:hover, body.rg-app .rg-settings-actions button:hover,
body.rg-app #bannerSave:hover, body.rg-app #bannerReset:hover {
  border-color: rgba(255,255,255,.24); background: var(--rg-surface-hover); color: var(--rg-text);
  text-decoration: none; transform: translateY(-1px);
}
.rg-button-primary, body.rg-app .select-button, body.rg-app .rg-settings-actions [data-rg-save], body.rg-app #bannerSave {
  border-color: transparent; background: var(--rg-ruby); color: white;
}
.rg-button-primary:hover, body.rg-app .select-button:hover,
body.rg-app .rg-settings-actions [data-rg-save]:hover, body.rg-app #bannerSave:hover { background: var(--rg-ruby-strong); }
.rg-button-quiet { background: transparent; }
.rg-button-danger, body.rg-app .logout-button { border-color: transparent; background: transparent; color: var(--rg-muted); }
.rg-button-danger:hover, body.rg-app .logout-button:hover { background: rgba(242, 101, 112, .1); color: #ff9ca4; }
.rg-icon-button { width: 42px; min-width: 42px; padding: 0; }

/* Login */
.rg-login { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.rg-login-showcase {
  position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between;
  overflow: hidden; padding: clamp(2rem, 5vw, 5rem); border-right: 1px solid var(--rg-line);
  background: linear-gradient(145deg, rgba(227,61,85,.12), transparent 42%), var(--rg-bg-soft);
}
.rg-login-showcase::after {
  position: absolute; right: -12rem; bottom: -15rem; width: 38rem; height: 38rem;
  border: 1px solid rgba(227,61,85,.24); border-radius: 50%;
  box-shadow: 0 0 0 5rem rgba(227,61,85,.025), 0 0 0 10rem rgba(227,61,85,.018); content: "";
}
.rg-login-copy { position: relative; z-index: 1; max-width: 660px; }
.rg-eyebrow {
  display: inline-flex; align-items: center; gap: .45rem; margin: 0 0 1.1rem;
  color: #ff8797; font-size: .78rem; font-weight: 760; letter-spacing: .1em; text-transform: uppercase;
}
.rg-login-copy h1 {
  max-width: 13ch; margin: 0; font-size: clamp(2.7rem, 6vw, 5.8rem); font-weight: 780;
  letter-spacing: -.065em; line-height: .98; text-wrap: balance;
}
.rg-login-copy > p:last-of-type { max-width: 52ch; margin: 1.5rem 0 0; color: var(--rg-muted); font-size: clamp(1rem, 1.6vw, 1.18rem); }
.rg-trust-list {
  position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem;
  margin: 2rem 0 0; padding: 0; color: var(--rg-muted); font-size: .87rem; list-style: none;
}
.rg-trust-list li::before { margin-right: .45rem; color: var(--rg-success); content: "✓"; }
.rg-login-panel { display: grid; min-height: 100vh; place-items: center; padding: 2rem; }
.rg-login-card {
  width: min(100%, 440px); padding: clamp(1.5rem, 4vw, 2.4rem); border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius-lg); background: var(--rg-surface); box-shadow: var(--rg-shadow);
}
.rg-login-card h2 { margin: 2rem 0 .45rem; color: var(--rg-text); font-size: 1.65rem; letter-spacing: -.035em; text-align: left; }
.rg-login-card p { margin: 0; color: var(--rg-muted); }
body.rg-app .discord-login {
  width: 100%; min-height: 50px; margin-top: 1.5rem; border-color: transparent;
  background: var(--rg-discord); color: white;
}
body.rg-app .discord-login:hover { background: #6873f4; color: white; text-decoration: none; transform: translateY(-1px); }
.rg-login-note { display: flex; gap: .65rem; margin-top: 1.25rem !important; padding-top: 1.15rem; border-top: 1px solid var(--rg-line); font-size: .82rem; }

/* Server picker */
.rg-picker-header, .rg-topbar {
  position: sticky; top: 0; z-index: 1000; display: flex; min-height: 68px; align-items: center;
  justify-content: space-between; gap: 1rem; padding: .75rem clamp(1rem, 4vw, 2.25rem);
  border-bottom: 1px solid var(--rg-line); background: rgba(10, 10, 13, .88);
  box-shadow: none; backdrop-filter: blur(16px);
}
.rg-picker-user, .rg-user-menu, .rg-current-guild { display: flex; align-items: center; gap: .7rem; }
.rg-picker-user img, .rg-user-menu img, .rg-avatar {
  width: 36px; height: 36px; border: 1px solid var(--rg-line-strong); border-radius: 50%; object-fit: cover;
}
.rg-picker-main { width: min(1120px, calc(100% - 2rem)); max-width: none; margin: 0 auto; padding: clamp(3rem, 7vw, 6rem) 0; }
.rg-picker-hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.rg-picker-hero h1 { max-width: 16ch; margin: .25rem 0 .75rem; font-size: clamp(2.25rem, 5vw, 4rem); letter-spacing: -.055em; line-height: 1.02; }
.rg-picker-hero p { max-width: 54ch; margin: 0; color: var(--rg-muted); }
.rg-server-count { flex: 0 0 auto; padding: .45rem .7rem; border: 1px solid var(--rg-line); border-radius: 999px; color: var(--rg-muted); font-size: .8rem; }
.rg-search { position: relative; margin-bottom: 1.25rem; }
.rg-search::before { position: absolute; top: 50%; left: 1rem; color: var(--rg-muted); content: "⌕"; font-size: 1.2rem; transform: translateY(-53%); }
body.rg-app .rg-search input {
  width: 100%; min-height: 50px; padding: .75rem 1rem .75rem 2.8rem;
  border: 1px solid var(--rg-line); border-radius: 12px; background: var(--rg-surface); color: var(--rg-text);
}
body.rg-app .rg-search input::placeholder { color: var(--rg-subtle); }
body.rg-app .server-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
body.rg-app .server-card {
  position: relative; display: grid; min-width: 0; grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center; gap: .9rem; padding: 1rem; border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius); background: var(--rg-surface); box-shadow: none; text-align: left;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}
body.rg-app .server-card:hover { border-color: rgba(227,61,85,.42); background: var(--rg-surface-raised); transform: translateY(-2px); }
body.rg-app .server-card .server-icon { width: 54px; height: 54px; border-radius: 15px; object-fit: cover; }
.rg-server-copy { min-width: 0; }
body.rg-app .server-card h2, body.rg-app .server-card h3 {
  overflow: hidden; margin: 0; color: var(--rg-text); font-size: .98rem; text-align: left;
  text-overflow: ellipsis; white-space: nowrap;
}
.rg-server-copy small { display: block; margin-top: .2rem; color: var(--rg-muted); font-size: .76rem; }
body.rg-app .server-card .select-button { width: 38px; min-width: 38px; min-height: 38px; margin: 0; padding: 0; border-radius: 10px; }
.rg-empty-state { padding: 3rem 1.5rem; border: 1px dashed var(--rg-line-strong); border-radius: var(--rg-radius); color: var(--rg-muted); text-align: center; }

/* Dashboard shell */
body.rg-dashboard { overflow-x: hidden; }
.rg-topbar { display: grid; grid-template-columns: var(--rg-sidebar) minmax(0, 1fr) auto; padding: .75rem 1.25rem; }
.rg-topbar-start, .rg-topbar-end { display: flex; align-items: center; gap: .75rem; }
.rg-topbar-end { justify-content: flex-end; }
.rg-current-guild { min-width: 0; justify-self: center; font-weight: 680; }
.rg-current-guild img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.rg-current-guild span { overflow: hidden; max-width: 34vw; text-overflow: ellipsis; white-space: nowrap; }
.rg-back-link { color: var(--rg-muted) !important; text-decoration: none; }
.rg-back-link:hover { color: var(--rg-text) !important; }
.rg-burger { display: none; border: 1px solid var(--rg-line); border-radius: 10px; background: var(--rg-surface); color: var(--rg-text); cursor: pointer; }
body.rg-app .container.rg-shell {
  display: grid; min-height: calc(100vh - 68px); grid-template-columns: var(--rg-sidebar) minmax(0, 1fr);
  gap: 0; padding: 0; background: transparent;
}
body.rg-app .sidebar.rg-sidebar {
  position: sticky; top: 68px; left: auto; z-index: 800; width: auto; height: calc(100vh - 68px);
  padding: 1.25rem .85rem 2rem; border: 0; border-right: 1px solid var(--rg-line); border-radius: 0;
  background: rgba(13,13,16,.78); box-shadow: none; backdrop-filter: blur(12px);
}
body.rg-app .sidebar.rg-sidebar ul { margin: 0; padding: 0; }
body.rg-app .sidebar.rg-sidebar li { margin: .13rem 0; }
body.rg-app .sidebar.rg-sidebar a {
  display: flex; min-height: 42px; align-items: center; justify-content: flex-start; gap: .72rem;
  padding: .58rem .72rem; border-radius: 10px; color: var(--rg-muted); font-size: .91rem;
  font-weight: 620; text-decoration: none; transition: color .15s ease, background-color .15s ease;
}
body.rg-app .sidebar.rg-sidebar a:hover { background: rgba(255,255,255,.045); color: var(--rg-text); }
body.rg-app .sidebar.rg-sidebar a.active { background: var(--rg-ruby-soft); color: #ff8b9a; }
.rg-nav-icon { display: inline-grid; width: 1.45rem; flex: 0 0 1.45rem; place-items: center; font-size: .95rem; filter: saturate(.75); }
.rg-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-nav-section { margin: 1.1rem .7rem .35rem; color: var(--rg-subtle); font-size: .66rem; font-weight: 760; letter-spacing: .11em; text-transform: uppercase; }
.rg-sidebar-footer { margin-top: 1.2rem; padding: .85rem .72rem 0; border-top: 1px solid var(--rg-line); color: var(--rg-subtle); font-size: .72rem; }
body.rg-app main.content.rg-content {
  width: auto; min-width: 0; max-width: 1440px; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem);
  border-radius: 0; background: transparent; box-shadow: none; color: var(--rg-text); font-size: 1rem; overflow: visible;
}
.rg-sidebar-overlay { display: none; }

/* Module surfaces and forms */
body.rg-app h1, body.rg-app h2, body.rg-app h3 { color: var(--rg-text); letter-spacing: -.025em; }
body.rg-app .rg-settings-page { gap: 1.25rem; }
body.rg-app .rg-settings-page > div:first-child > h2 { margin: 0; font-size: 1.75rem; }
body.rg-app .rg-settings-intro, body.rg-app .rg-settings-card p.rg-help, body.rg-app .rg-muted { color: var(--rg-muted); }
body.rg-app .rg-settings-grid { gap: 1rem; }
body.rg-app .rg-settings-card, body.rg-app #antiraid-settings, body.rg-app .server-table-container {
  padding: 1.25rem; border: 1px solid var(--rg-line); border-radius: var(--rg-radius);
  background: var(--rg-surface); box-shadow: none;
}
body.rg-app .rg-settings-card h2, body.rg-app .rg-settings-card h3 { margin: 0 0 .35rem; }
body.rg-app .rg-form-row { grid-template-columns: minmax(135px, .72fr) minmax(180px, 1.28fr); margin: .8rem 0; }
body.rg-app .rg-settings-card input[type="text"], body.rg-app .rg-settings-card input[type="number"],
body.rg-app .rg-settings-card textarea, body.rg-app .rg-settings-card select,
body.rg-app #settings-fields input[type="number"], body.rg-app table input[type="text"],
body.rg-app table input[type="number"], body.rg-app table textarea, body.rg-app table select,
body.rg-app #add-channel-type, body.rg-app #add-filter-channel {
  width: 100%; min-height: 42px; max-width: none; padding: .62rem .72rem;
  border: 1px solid var(--rg-line-strong); border-radius: 9px; background: var(--rg-bg-soft);
  color: var(--rg-text); text-align: left; transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
body.rg-app textarea::placeholder, body.rg-app input::placeholder { color: var(--rg-subtle); }
body.rg-app select:hover, body.rg-app textarea:hover, body.rg-app input:hover { border-color: rgba(255,255,255,.24); }
body.rg-app select:disabled, body.rg-app textarea:disabled, body.rg-app input:disabled, .rg-dependent-fields.is-disabled { opacity: .48; }
body.rg-app .rg-settings-card textarea { min-height: 108px; resize: vertical; }
body.rg-app .rg-settings-actions {
  position: sticky; bottom: .8rem; z-index: 20; margin: 1.25rem -.35rem -.35rem; padding: .7rem;
  border: 1px solid var(--rg-line); border-radius: 12px; background: rgba(18,18,22,.92);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); backdrop-filter: blur(12px);
}
body.rg-app .rg-settings-form:not(.is-dirty) .rg-settings-actions {
  position: static; border-color: transparent; background: transparent; box-shadow: none;
}
body.rg-app .rg-settings-form:not(.is-dirty) [data-rg-reset] { opacity: .55; }
body.rg-app .rg-settings-status { color: var(--rg-success); }
body.rg-app .rg-settings-status.is-error { color: var(--rg-danger); }
body.rg-app .rg-add-button { width: auto !important; margin-top: .8rem !important; background: var(--rg-ruby-soft); color: #ff9ba8; }
body.rg-app .rg-remove-button, body.rg-app .remove-button,
body.rg-app table td > button:not([data-rg-save]):not([data-rg-reset]) {
  min-width: 38px; min-height: 38px; border: 1px solid transparent; border-radius: 9px;
  background: rgba(242,101,112,.1); color: #ff9ca4; cursor: pointer;
}
body.rg-app .rg-remove-button:hover, body.rg-app .remove-button:hover { border-color: rgba(242,101,112,.3); }
body.rg-app table {
  width: 100%; margin-top: 1rem; border: 1px solid var(--rg-line); border-collapse: separate;
  border-spacing: 0; border-radius: 12px; background: transparent; color: var(--rg-text); overflow: hidden;
}
body.rg-app table thead { background: rgba(255,255,255,.035); }
body.rg-app table th, body.rg-app table td { padding: .72rem; border: 0; border-bottom: 1px solid var(--rg-line); background: transparent; text-align: left; }
body.rg-app table tbody tr:last-child td { border-bottom: 0; }
body.rg-app table tbody tr:hover td { background: rgba(255,255,255,.018); }
body.rg-app .rg-settings-table { display: table; }
body.rg-app code { padding: .12rem .32rem; border-radius: 5px; background: rgba(255,255,255,.06); color: #ffc0c8; font-size: .88em; }
body.rg-app .form-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 1rem; border-bottom: 1px solid var(--rg-line); background: transparent; font-weight: 700; }
body.rg-app #settings-fields { padding: .5rem 0 0; box-shadow: none; }
body.rg-app #settings-fields label { justify-content: flex-start; margin: 0; }
body.rg-app #log-changes-info {
  left: 50%; right: auto; bottom: 1rem; display: none; width: min(620px, calc(100% - 2rem));
  min-height: 62px; align-items: center; justify-content: flex-end; gap: .65rem; padding: .65rem;
  border: 1px solid var(--rg-line-strong); border-radius: 14px; background: rgba(21,21,25,.94);
  color: var(--rg-text); box-shadow: var(--rg-shadow); backdrop-filter: blur(14px); transform: translateX(-50%);
}
body.rg-app #log-changes-info strong { margin-right: auto; padding-left: .4rem; font-size: .9rem; }

.rg-preset-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0 1rem; }
.rg-preset { min-height: 34px; padding: .4rem .65rem; border: 1px solid var(--rg-line); border-radius: 999px; background: var(--rg-bg-soft); color: var(--rg-muted); cursor: pointer; }
.rg-preset:hover, .rg-preset.is-active { border-color: rgba(227,61,85,.4); background: var(--rg-ruby-soft); color: #ff9ba8; }
.rg-multi-dropdown { position: relative; width: 100%; min-width: 0; }
.rg-single-dropdown { position: relative; width: 100%; min-width: 0; }
.rg-multi-trigger, .rg-single-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  width: 100%; min-height: 44px; padding: .38rem .55rem .38rem .62rem;
  border: 1px solid var(--rg-line-strong); border-radius: 10px;
  background: var(--rg-bg-soft); color: var(--rg-text); cursor: pointer; text-align: left;
}
.rg-multi-trigger:hover, .rg-multi-dropdown.is-open .rg-multi-trigger,
.rg-single-trigger:hover, .rg-single-dropdown.is-open .rg-single-trigger { border-color: rgba(227,61,85,.46); }
.rg-multi-trigger:focus-visible, .rg-single-trigger:focus-visible { outline: 2px solid rgba(227,61,85,.48); outline-offset: 2px; }
.rg-single-summary { min-width: 0; overflow: hidden; color: var(--rg-text); font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.rg-single-summary.is-placeholder { color: var(--rg-subtle); }
.rg-multi-summary { display: flex; align-items: center; gap: .34rem; min-width: 0; overflow: hidden; }
.rg-multi-chip, .rg-multi-more {
  flex: 0 1 auto; min-width: 0; max-width: 150px; padding: .24rem .48rem;
  overflow: hidden; border: 1px solid rgba(227,61,85,.32); border-radius: 999px;
  background: var(--rg-ruby-soft); color: #ffabb6; font-size: .78rem;
  text-overflow: ellipsis; white-space: nowrap;
}
.rg-multi-more { flex: 0 0 auto; }
.rg-multi-placeholder { color: var(--rg-subtle); font-size: .86rem; }
.rg-multi-chevron { flex: 0 0 auto; color: var(--rg-subtle); font-size: 1.1rem; transition: transform .16s ease; }
.rg-multi-dropdown.is-open .rg-multi-chevron, .rg-single-dropdown.is-open .rg-multi-chevron { transform: rotate(180deg); }
.rg-multi-panel {
  position: absolute; z-index: 80; top: calc(100% + .42rem); right: 0; left: 0;
  min-width: min(320px, 88vw); padding: .55rem;
  border: 1px solid var(--rg-line-strong); border-radius: 12px;
  background: #20191b; box-shadow: 0 18px 44px rgba(0,0,0,.46);
}
.rg-multi-panel[hidden] { display: none; }
.rg-multi-dropdown.opens-up .rg-multi-panel, .rg-single-dropdown.opens-up .rg-multi-panel { top: auto; bottom: calc(100% + .42rem); }
body.rg-app .rg-multi-search {
  width: 100%; min-height: 39px; margin: 0 0 .45rem; padding: .52rem .64rem;
  border: 1px solid var(--rg-line); border-radius: 8px;
  background: var(--rg-bg-soft); color: var(--rg-text);
}
.rg-multi-options { display: flex; flex-direction: column; gap: .2rem; max-height: 250px; overflow-y: auto; overscroll-behavior: contain; }
.rg-multi-option {
  display: flex; align-items: center; gap: .58rem; width: 100%; min-height: 38px;
  padding: .45rem .5rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--rg-muted); cursor: pointer; text-align: left;
}
.rg-multi-option[hidden] { display: none; }
.rg-multi-option:hover, .rg-multi-option:focus-visible { background: rgba(255,255,255,.055); color: var(--rg-text); outline: none; }
.rg-multi-option.is-selected { background: var(--rg-ruby-soft); color: #ffabb6; }
.rg-multi-check {
  display: inline-flex; flex: 0 0 19px; align-items: center; justify-content: center;
  width: 19px; height: 19px; border: 1px solid var(--rg-line-strong); border-radius: 5px;
  color: #fff; font-size: .75rem;
}
.rg-multi-option.is-selected .rg-multi-check { border-color: var(--rg-ruby); background: var(--rg-ruby); }
.rg-multi-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-multi-footer { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-top: .45rem; padding: .48rem .2rem 0; border-top: 1px solid var(--rg-line); }
.rg-multi-count { color: var(--rg-subtle); font-size: .75rem; }
.rg-multi-clear { padding: .3rem .45rem; border: 0; background: transparent; color: #ff9ba8; cursor: pointer; font: inherit; font-size: .78rem; }
.rg-multi-clear:disabled { color: var(--rg-subtle); cursor: default; opacity: .55; }
.rg-multi-dropdown.is-disabled, .rg-single-dropdown.is-disabled { opacity: .48; }
.rg-multi-trigger:disabled, .rg-single-trigger:disabled { cursor: not-allowed; }
.add_button > .rg-single-dropdown { width: min(20rem, 100%); margin-top: 1rem; }
.rg-visually-hidden-select { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; }
.rg-template-picker { margin-bottom: .65rem; }
.rg-field-hint { display: block; margin-top: .4rem; color: var(--rg-subtle); font-size: .77rem; }
.rg-rr-pair-list { display: grid; gap: .5rem; min-width: 290px; }
.rg-rr-pair { display: grid; grid-template-columns: 66px minmax(160px,1fr) 36px; gap: .45rem; }
.rg-rr-pair .rr-emoji { text-align: center; }
.rg-rr-add-pair { justify-self: start; min-height: 34px; border: 1px solid var(--rg-line); border-radius: 8px; padding: .4rem .65rem; background: var(--rg-bg-soft); color: var(--rg-muted); cursor: pointer; }

/* Support & security workflows */
.rg-workflow-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.rg-workflow-metrics > div {
  display: grid; gap: .25rem; padding: 1.1rem 1.2rem; border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius); background: var(--rg-surface);
}
.rg-workflow-metrics strong { color: var(--rg-text); font-size: 1.7rem; letter-spacing: -.04em; }
.rg-workflow-metrics span { color: var(--rg-muted); font-size: .8rem; }
.rg-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.rg-card-heading .switch { flex: 0 0 auto; }
.rg-command-hint { margin: .9rem 0 0; color: var(--rg-subtle); font-size: .8rem; }
.rg-table-scroll { max-width: 100%; overflow-x: auto; }
.rg-status-pill { display: inline-flex; padding: .2rem .48rem; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--rg-muted); font-size: .72rem; }
.rg-status-open, .rg-status-verified { background: rgba(50,190,120,.12); color: #80d9a8; }
.rg-status-closed, .rg-status-revoked { background: rgba(255,255,255,.07); color: var(--rg-muted); }
.rg-status-blocked { background: rgba(242,101,112,.12); color: #ff9ca4; }
.rg-ticket-history-button {
  min-width: 76px !important; min-height: 34px !important; padding: .38rem .65rem !important;
  border: 1px solid var(--rg-line-strong) !important; background: var(--rg-bg-soft) !important;
  color: var(--rg-text) !important; white-space: nowrap;
}
.rg-ticket-history-button:hover { border-color: rgba(227,61,85,.45) !important; background: var(--rg-ruby-soft) !important; color: #ff9ba8 !important; }
.rg-ticket-dialog {
  position: fixed; inset: 50% auto auto 50%; width: min(780px, calc(100vw - 2rem)); max-width: none;
  margin: 0; padding: 0; border: 1px solid var(--rg-line-strong); transform: translate(-50%, -50%);
  border-radius: 18px; background: #111115; color: var(--rg-text); box-shadow: 0 28px 90px rgba(0,0,0,.62);
}
.rg-ticket-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.rg-ticket-dialog-shell { display: grid; max-height: min(850px, 88vh); grid-template-rows: auto minmax(260px, 1fr); overflow: hidden; }
.rg-ticket-dialog-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--rg-line); background: rgba(255,255,255,.018);
}
.rg-ticket-dialog-header h3 { margin: .16rem 0 .28rem; font-size: 1.12rem; }
.rg-ticket-dialog-header p { margin: 0; color: var(--rg-muted); font-size: .76rem; }
.rg-ticket-dialog-kicker { color: #ff8493; font-size: .68rem; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.rg-ticket-dialog-close {
  display: inline-grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; padding: 0;
  border: 1px solid var(--rg-line); border-radius: 9px; background: var(--rg-bg-soft); color: var(--rg-muted); cursor: pointer;
}
.rg-ticket-dialog-close:hover { color: var(--rg-text); }
.rg-ticket-chat {
  display: flex; min-height: 340px; flex-direction: column; gap: .85rem; padding: 1.25rem;
  overflow-y: auto; background: radial-gradient(circle at 50% 0, rgba(227,61,85,.045), transparent 42%), #0c0c0f;
}
.rg-chat-loading, .rg-chat-empty { display: grid; min-height: 260px; place-content: center; justify-items: center; gap: .8rem; color: var(--rg-muted); text-align: center; }
.rg-chat-empty.is-error { color: var(--rg-danger); }
.rg-chat-message { display: flex; max-width: min(82%, 610px); align-items: flex-end; gap: .65rem; }
.rg-chat-message.is-opener { align-self: flex-end; flex-direction: row-reverse; }
.rg-chat-message.is-team { align-self: flex-start; }
.rg-chat-avatar { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--rg-line-strong); border-radius: 50%; object-fit: cover; background: var(--rg-surface); }
.rg-chat-message-body { min-width: 0; }
.rg-chat-message.is-opener .rg-chat-message-body { display: grid; justify-items: end; }
.rg-chat-message-head { display: flex; align-items: baseline; gap: .55rem; margin: 0 .25rem .3rem; }
.rg-chat-message.is-opener .rg-chat-message-head { flex-direction: row-reverse; }
.rg-chat-message-head strong { overflow: hidden; max-width: 260px; color: var(--rg-text); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.rg-chat-message-head time { color: var(--rg-subtle); font-size: .66rem; white-space: nowrap; }
.rg-chat-bubble { padding: .68rem .82rem; border: 1px solid var(--rg-line); border-radius: 5px 15px 15px 15px; background: var(--rg-surface-raised); }
.rg-chat-message.is-opener .rg-chat-bubble { border-color: rgba(227,61,85,.32); border-radius: 15px 5px 15px 15px; background: linear-gradient(145deg, rgba(227,61,85,.32), rgba(167,31,54,.25)); }
.rg-chat-bubble p { margin: 0; color: var(--rg-text); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.rg-chat-mention {
  display: inline; padding: .08rem .3rem; border-radius: 5px; background: rgba(88,101,242,.2);
  color: #aeb6ff; font-weight: 700; white-space: nowrap; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.rg-chat-message.is-opener .rg-chat-mention { background: rgba(255,255,255,.16); color: #fff; }
.rg-chat-attachments { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.rg-chat-attachments a { padding: .28rem .48rem; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; color: #ffb3bd; font-size: .72rem; text-decoration: none; }
.rg-chat-attachments a:hover { border-color: rgba(227,61,85,.4); background: rgba(0,0,0,.12); }

/* Stats and loading */
body.rg-app .rg-module-loading { min-height: 60vh; }
body.rg-app .rg-spinner { border-color: rgba(255,255,255,.13); border-top-color: var(--rg-ruby); }
.rg-login-portal-link { display:block; margin-top:.9rem; color:#d9bdc2; text-align:center; font-size:.84rem; }
.rg-login-portal-link:hover { color:#ff8b99; }
body.rg-app .rg-axis-chart, body.rg-app .chart-box, body.rg-app .table-box {
  padding: 1rem; border: 1px solid var(--rg-line); border-radius: var(--rg-radius); background: var(--rg-surface);
}
body.rg-app .rg-axis-chart { height: 380px; margin-bottom: 1.5rem; }
body.rg-app .chart-section { display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(320px, .85fr); gap: 1rem; align-items: stretch; margin: 1.5rem 0; }
body.rg-app .chart-box, body.rg-app .table-box { min-width: 0; }
body.rg-app .pie-chart { min-width: 0; height: 430px; }
body.rg-app .rg-donut-layout { display: grid; height: 100%; grid-template-columns: minmax(240px, 1fr) minmax(190px, .7fr); gap: 1rem; }
body.rg-app .rg-donut-canvas-wrap { width: 100%; height: 100%; min-height: 300px; }
body.rg-app .rg-chart-legend { grid-template-columns: 1fr; align-content: center; max-height: 360px; }
body.rg-app .scroll-table { max-height: 430px; overflow: auto; }
.rg-module-error { padding: 2rem; border: 1px solid rgba(242,101,112,.24); border-radius: var(--rg-radius); background: rgba(242,101,112,.06); }

@media (max-width: 1100px) {
  body.rg-app .server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rg-topbar { grid-template-columns: auto minmax(0,1fr) auto; }
  body.rg-app .chart-section { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .rg-login { display: block; }
  .rg-login-showcase { min-height: auto; padding: 2rem 1.25rem 4rem; border-right: 0; border-bottom: 1px solid var(--rg-line); }
  .rg-login-copy { margin-top: 4rem; }
  .rg-login-panel { min-height: auto; padding: 2rem 1rem 4rem; }
  .rg-topbar { min-height: 64px; grid-template-columns: auto minmax(0,1fr) auto; }
  .rg-topbar .rg-brand-copy, .rg-user-menu > span, .rg-topbar .rg-back-link { display: none; }
  .rg-burger { display: inline-grid; place-items: center; }
  body.rg-app .container.rg-shell { display: block; }
  body.rg-app .sidebar.rg-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1400; width: min(310px, 88vw); height: 100vh;
    padding-top: 1rem; border-right: 1px solid var(--rg-line-strong); background: #111115;
    transform: translateX(-105%); transition: transform .2s ease;
  }
  body.rg-app .sidebar.rg-sidebar.open { transform: translateX(0); }
  .rg-sidebar-overlay {
    position: fixed; inset: 0; z-index: 1300; display: block; border: 0; background: rgba(0,0,0,.62);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .rg-sidebar-overlay.is-visible { opacity: 1; pointer-events: auto; }
  body.rg-app main.content.rg-content { padding: 1.25rem 1rem 5rem; }
}
@media (max-width: 650px) {
  body.rg-app .server-grid { grid-template-columns: 1fr; }
  .rg-picker-header .rg-brand-copy, .rg-picker-user > span { display: none; }
  .rg-picker-main { width: calc(100% - 2rem); }
  .rg-picker-hero { display: block; }
  .rg-server-count { display: inline-flex; margin-top: 1.1rem; }
  body.rg-app .rg-settings-grid, body.rg-app .rg-module-groups { grid-template-columns: 1fr; }
  .rg-workflow-metrics { grid-template-columns: 1fr; }
  .rg-ticket-dialog { width: calc(100vw - 1rem); }
  .rg-ticket-dialog-shell { max-height: 92vh; }
  .rg-ticket-chat { padding: 1rem .75rem; }
  .rg-chat-message { max-width: 92%; }
  body.rg-app .rg-form-row { grid-template-columns: 1fr; gap: .38rem; }
  body.rg-app .rg-settings-card { padding: 1rem; }
  body.rg-app .rg-settings-table, body.rg-app table { display: block; overflow-x: auto; }
  body.rg-app .rg-settings-actions { flex-wrap: wrap; }
  body.rg-app .rg-settings-status { width: 100%; }
  body.rg-app #log-changes-info { flex-wrap: wrap; }
  body.rg-app #log-changes-info strong { width: 100%; }
  body.rg-app .rg-donut-layout { display: flex; }
  body.rg-app .rg-donut-canvas-wrap { min-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
