:root {
  --rs-bg: #f4f7fb;
  --rs-surface: #ffffff;
  --rs-surface-soft: #f8faff;
  --rs-border: #e3eaf5;
  --rs-text: #22304a;
  --rs-muted: #70809b;
  --rs-primary: #4e46e5;
  --rs-primary-2: #198fd9;
  --rs-success: #1ca56b;
  --rs-danger: #d84f67;
  --rs-shadow: 0 18px 45px rgba(35, 56, 108, 0.1);
}

body {
  background:
    radial-gradient(circle at top right, rgba(78, 70, 229, 0.09), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f3f7fb 100%);
  color: var(--rs-text);
}

.redsurf-shell .app-body {
  overflow: visible;
}

.redsurf-shell .main-container {
  align-items: stretch;
}

.redsurf-shell .app-brand {
  min-width: 240px;
}

.rs-header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rs-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(8px);
}

.rs-header-pill-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rs-header-pill strong {
  color: #fff;
  font-size: 14px;
}

.rs-header-pill a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
}

.rs-header-user {
  position: relative;
  margin-left: 14px;
}

.rs-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.rs-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff center center/cover no-repeat;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.rs-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.rs-user-meta small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.rs-user-meta strong {
  color: #fff;
  font-size: 14px;
}

.rs-user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--rs-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--rs-shadow);
  display: none;
  z-index: 1200;
}

.rs-user-dropdown.is-open {
  display: block;
}

.rs-user-dropdown a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--rs-text);
  text-decoration: none;
}

.rs-user-dropdown a:hover {
  background: var(--rs-surface-soft);
  color: var(--rs-primary);
}

.rs-hero-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rs-hero-chip {
  min-width: 148px;
  padding: 12px 16px;
  border: 1px solid var(--rs-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(66, 84, 141, 0.08);
}

.rs-hero-chip span {
  display: block;
  font-size: 12px;
  color: var(--rs-muted);
  margin-bottom: 4px;
}

.rs-hero-chip strong {
  display: block;
  font-size: 16px;
  color: var(--rs-text);
}

.app-body .main,
.app-body .container,
.app-body .container-fluid {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.app-body .page_block2,
.app-body .system_box,
.app-body .site_item,
.app-body .container > .wrap,
.app-body .container > #templ,
.app-body .container > #inputSection,
.app-body .container > #sitesTable,
.app-body .container > .prompt-toolbar,
.app-body .container > .site-prepare-settings {
  border-radius: 24px;
}

.app-body .page_block2,
.app-body .system_box,
.app-body .site_item,
.app-body .header_site_table,
.app-body .container > .wrap,
.app-body .container > #sitesTable,
.app-body .container .templates-panel,
.app-body .container #inputSection,
.app-body .prompt-toolbar,
.app-body .site-prepare-settings {
  background: var(--rs-surface);
  border: 1px solid var(--rs-border);
  box-shadow: var(--rs-shadow);
}

.app-body .page_block2 {
  margin-bottom: 24px;
}

.app-body .system_box {
  padding: 18px;
}

.app-body .header_site_table,
.app-body .site_item_table,
.app-body #sitesTable {
  overflow: hidden;
}

.app-body table tr td,
.app-body table tr th {
  border-color: #ebeff6 !important;
}

.app-body input[type="text"],
.app-body input[type="password"],
.app-body input[type="search"],
.app-body select,
.app-body textarea {
  border: 1px solid var(--rs-border) !important;
  border-radius: 16px !important;
  background: #fbfcff !important;
  color: var(--rs-text) !important;
  box-shadow: inset 0 1px 2px rgba(14, 25, 47, 0.03);
}

.app-body textarea {
  padding: 14px 16px !important;
}

.app-body input[type="text"],
.app-body input[type="password"],
.app-body input[type="search"],
.app-body select {
  min-height: 44px;
  padding: 10px 14px !important;
}

.app-body button,
.app-body .btn_01,
.app-body .btn_03,
.app-body #createButton {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, var(--rs-primary) 0%, var(--rs-primary-2) 100%) !important;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 16px 32px rgba(78, 70, 229, 0.22);
  cursor: pointer;
}

.app-body .btn_red,
.app-body .alert_error {
  background: #fff2f4 !important;
  color: var(--rs-danger) !important;
  border-color: #ffd5dc !important;
  box-shadow: none !important;
}

.app-body .alert_success {
  background: #edf9f3 !important;
  color: #176e4f !important;
  border: 1px solid #cbeedc !important;
  border-radius: 18px;
  padding: 16px 18px;
}

.app-body .warning_page_block {
  border: 1px dashed #d9e3f1;
  border-radius: 18px;
  background: #f8fbff;
}

.app-body .add_top_site_block_a,
.app-body .add_top_site_block_b {
  background: transparent !important;
  padding: 0 !important;
}

.app-body .add_top_site_block_left {
  width: 100%;
  padding: 28px 30px;
  border-radius: 26px;
  background: linear-gradient(135deg, #4e46e5 0%, #198fd9 100%);
  color: #fff;
  box-shadow: 0 20px 40px rgba(78, 70, 229, 0.2);
}

.app-body .add_top_site_block_left a {
  color: #fff;
}

.app-body .add_top_site_block_text {
  color: #fff !important;
}

.app-body .site_item {
  margin-bottom: 18px;
  padding: 10px 14px;
}

.app-body .bulk_actions {
  padding: 8px 0 28px 0;
}

.app-body .owner_filter_link {
  min-height: 40px;
  line-height: 40px;
  border-radius: 999px;
  background: #eef2ff;
  color: #45546f;
}

.app-body .owner_filter_link.active {
  background: linear-gradient(135deg, var(--rs-primary) 0%, var(--rs-primary-2) 100%);
}

.container .wrap {
  gap: 24px !important;
  align-items: stretch !important;
}

.container .wrap-left,
.container .wrap-right {
  min-width: 0;
}

.container #inputSection,
.container .templates-panel,
.container #sitesTable {
  padding: 24px;
}

.container #sitesInput {
  min-height: 420px;
  font-family: Consolas, monospace;
}

.container .blueTitle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px 0;
  font-size: 28px;
  color: var(--rs-text);
}

.container .avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.prompt-toolbar,
.site-prepare-settings {
  margin-top: 18px;
}

.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.rs-modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.6);
  z-index: 2100;
}

.rs-modal-backdrop.is-open {
  display: flex;
}

.rs-modal-dialog {
  position: relative;
  width: min(1080px, 100%);
  height: min(760px, calc(100vh - 48px));
  border-radius: 28px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(17, 24, 39, 0.28);
}

.rs-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
  z-index: 3;
}

.rs-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 991.98px) {
  .rs-header-stats {
    display: none;
  }

  .rs-user-meta {
    display: none;
  }

  .rs-hero-summary {
    width: 100%;
  }

  .container .wrap {
    flex-direction: column;
  }
}

/* Shared application shell. It intentionally restyles legacy page markup without
   changing the forms, URLs, actions, or generation scripts that use it. */
body.rs-app-shell {
  --rs-violet: #673de6;
  --rs-violet-dark: #4c22cf;
  --rs-cyan: #21a6c6;
  margin: 0 !important;
  min-height: 100vh;
  padding: 102px 30px 42px 292px !important;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 95% 0%, rgba(103, 61, 230, .13), transparent 28rem),
    #f5f6fb !important;
  color: #25324a;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  transition: padding-left .22s ease;
}

.rs-app-header {
  position: fixed;
  z-index: 5000;
  top: 0;
  right: 0;
  left: 0;
  height: 78px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  box-sizing: border-box;
  background: linear-gradient(108deg, #592fd9 0%, #743fe9 58%, #5931d3 100%);
  box-shadow: 0 10px 26px rgba(72, 39, 173, .22);
}

.rs-sidebar-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .15);
  cursor: pointer;
}

.rs-sidebar-toggle span { display: block; height: 2px; border-radius: 2px; background: #fff; }
.rs-app-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.rs-app-brand:hover { color: #fff; }
.rs-brand-mark { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 13px; background: #fff; color: var(--rs-violet); font-size: 13px; font-weight: 900; letter-spacing: -1px; }
.rs-header-spacer { flex: 1 1 auto; }
.rs-header-stats { gap: 8px; flex-wrap: nowrap; }
.rs-header-pill { min-height: 38px; padding: 7px 11px; border-radius: 12px; text-decoration: none; }
.rs-header-pill span { display: none; }
.rs-header-pill strong { font-size: 13px; }
.rs-header-balance { background: rgba(20, 184, 166, .22); }
.rs-header-user { margin-left: 4px; }
.rs-user-trigger { min-height: 46px; padding: 4px 8px; cursor: pointer; }
.rs-user-avatar { width: 34px; height: 34px; }
.rs-user-dropdown { top: calc(100% + 10px); }
.rs-user-dropdown .rs-user-logout { color: #c53a56; }

.rs-sidebar {
  position: fixed;
  z-index: 4900;
  top: 78px;
  bottom: 0;
  left: 0;
  width: 256px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 26px 14px 16px;
  border-right: 1px solid #e8e8f1;
  background: #fff;
  box-shadow: 8px 0 26px rgba(41, 50, 93, .045);
  transition: width .22s ease, transform .22s ease;
}

.rs-sidebar-heading { padding: 0 13px 20px; color: #2b3651; }
.rs-sidebar-heading span, .rs-sidebar-heading small { display: block; }
.rs-sidebar-heading span { font-size: 12px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.rs-sidebar-heading small { margin-top: 6px; color: #8690a7; font-size: 12px; line-height: 1.4; }
.rs-sidebar-nav { display: grid; gap: 6px; }
.rs-sidebar-link { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 11px; border-radius: 15px; color: #65708a; text-decoration: none; transition: background .18s ease, color .18s ease, transform .18s ease; }
.rs-sidebar-link:hover { color: var(--rs-violet); background: #f4f1ff; transform: translateX(2px); }
.rs-sidebar-link.is-active { color: #fff; background: linear-gradient(120deg, var(--rs-violet) 0%, #9b75ed 100%); box-shadow: 0 12px 24px rgba(103, 61, 230, .22); }
.rs-nav-icon { flex: 0 0 32px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 10px; font-size: 12px; font-weight: 800; }
.rs-nav-copy { min-width: 0; display: grid; gap: 2px; }
.rs-nav-copy strong { font-size: 14px; line-height: 1.15; }
.rs-nav-copy small { color: inherit; opacity: .68; font-size: 11px; }
.rs-sidebar-bottom { margin-top: auto; display: grid; gap: 9px; padding: 18px 5px 0; border-top: 1px solid #edf0f7; }
.rs-sidebar-create, .rs-sidebar-secondary { display: block; padding: 11px 12px; border-radius: 12px; text-align: center; font-size: 12px; font-weight: 800; text-decoration: none; }
.rs-sidebar-create { color: #fff; background: linear-gradient(120deg, var(--rs-violet) 0%, #8d62ef 100%); }
.rs-sidebar-secondary { color: #6654a0; background: #f4f1ff; }

body.rs-app-shell .main,
body.rs-app-shell .container,
body.rs-app-shell .container-fluid {
  width: 100% !important;
  max-width: 1420px !important;
  margin-right: auto !important;
  margin-left: auto !important;
  box-sizing: border-box;
}

body.rs-app-shell .main_menu,
body.rs-app-shell .header { display: none !important; }
body.rs-app-shell .add_top_site_block_a { margin-bottom: 22px; background: transparent !important; }
body.rs-app-shell .add_top_site_block_left { border-radius: 24px; }
body.rs-app-shell .page_block2,
body.rs-app-shell .system_box,
body.rs-app-shell .site_item,
body.rs-app-shell .site_item_table,
body.rs-app-shell .header_site_table,
body.rs-app-shell .rs-card,
body.rs-app-shell .rs-list-card { border-color: #e4e8f2 !important; box-shadow: 0 12px 30px rgba(41, 50, 93, .07) !important; }
body.rs-app-shell .system_box { margin-top: 0; }
body.rs-app-shell .btn_01.btn_green { background: #18a765 !important; }
body.rs-app-shell .rs_support_page { padding-top: 16px; }
body.rs-app-shell .rs_support_text { color: #2d3650; font-size: clamp(24px, 3vw, 38px); line-height: 1.25; text-transform: none; }

body.rs-app-shell.rs-sidebar-collapsed { padding-left: 108px !important; }
body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar { width: 72px; padding-right: 10px; padding-left: 10px; }
body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-heading,
body.rs-app-shell.rs-sidebar-collapsed .rs-nav-copy,
body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-bottom { display: none; }
body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-link { justify-content: center; padding: 8px; }

body.rs-app-shell .rs_modal_backdrop { position: fixed; inset: 0; z-index: 6000; display: none; padding: 24px; background: rgba(20, 24, 45, .58); }
body.rs-app-shell .rs_modal_backdrop.rs_open { display: flex; align-items: center; justify-content: center; }
body.rs-app-shell .rs_modal_dialog { position: relative; width: min(960px, 100%); height: min(720px, calc(100vh - 48px)); margin: 0; overflow: hidden; border-radius: 22px; background: #fff; box-shadow: 0 24px 80px rgba(20, 24, 45, .32); }
body.rs-app-shell .rs_modal_close { right: 12px; top: 12px; border-radius: 50%; background: #f3f4f9; color: #353e55; }

@media (max-width: 900px) {
  body.rs-app-shell { padding: 94px 16px 26px !important; }
  .rs-app-header { height: 70px; padding: 0 14px; }
  .rs-brand-name { font-size: 18px; }
  .rs-header-stats { display: none; }
  .rs-sidebar { top: 70px; width: 256px; transform: translateX(-105%); box-shadow: 12px 0 34px rgba(41, 50, 93, .16); }
  body.rs-app-shell.rs-sidebar-open .rs-sidebar { transform: translateX(0); }
  body.rs-app-shell.rs-sidebar-collapsed { padding-left: 16px !important; }
  body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar { width: 256px; padding: 26px 14px 16px; }
  body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-heading,
  body.rs-app-shell.rs-sidebar-collapsed .rs-nav-copy,
  body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-bottom { display: initial; }
  body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-nav { display: grid; }
  body.rs-app-shell.rs-sidebar-collapsed .rs-sidebar-link { justify-content: flex-start; padding: 8px 11px; }
}
