:root {
  --ras-bg: #edf3fb;
  --ras-card: #ffffff;
  --ras-card-soft: #f7fbff;
  --ras-line: #d7e2f1;
  --ras-text: #0f172a;
  --ras-muted: #475569;
  --ras-primary: #2563eb;
  --ras-primary-dark: #1d4ed8;
  --ras-green: #16a34a;
  --ras-red: #dc2626;
  --ras-orange: #f59e0b;
  --ras-purple: #7c3aed;
  --ras-slate: #475569;
  --ras-shadow: 0 18px 42px rgba(15, 23, 42, .10), 0 2px 4px rgba(15, 23, 42, .06);
}

body {
  background: radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 34%), linear-gradient(180deg, #f8fbff, var(--ras-bg)) !important;
  color: var(--ras-text) !important;
}

.ras-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.ras-hero,
.ras-toolbar,
.ras-status-row {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--ras-line);
  border-radius: 26px;
  box-shadow: var(--ras-shadow);
}

.ras-hero {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.ras-eyebrow {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfd2ff;
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 10px;
}

.ras-hero h1 {
  margin: 0 0 8px;
  color: var(--ras-text) !important;
  font-size: clamp(28px, 4vw, 42px);
}

.ras-hero p {
  margin: 0;
  color: var(--ras-muted) !important;
  line-height: 1.45;
  max-width: 680px;
}

.ras-hero-actions,
.ras-view-buttons,
.ras-search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ras-hero-actions { justify-content: flex-end; }
.ras-search-row { align-items: stretch; }

.ras-action,
.ras-card-link,
.ras-mini-btn,
.ras-chip,
.ras-icon-btn {
  border: 1px solid rgba(255,255,255,.70);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
  user-select: none;
}

.ras-action,
.ras-chip {
  padding: 12px 14px;
  min-height: 44px;
  background: linear-gradient(180deg, #ffffff, #e8eef8);
  color: var(--ras-text);
  box-shadow: 0 5px 0 rgba(148,163,184,.76), 0 12px 20px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.85);
}

.ras-action.primary,
.ras-card-link,
.ras-chip.active {
  background: linear-gradient(180deg, #4ea8ff 0%, var(--ras-primary) 58%, #1e40af 100%);
  color: #fff;
  box-shadow: 0 7px 0 rgba(30,64,175,.78), 0 16px 28px rgba(37,99,235,.24), inset 0 1px 0 rgba(255,255,255,.48);
}

.ras-action.success { background: linear-gradient(180deg, #35dc78, var(--ras-green) 60%, #15803d 100%); color:#fff; box-shadow: 0 7px 0 rgba(21,128,61,.82), 0 16px 28px rgba(22,163,74,.22); }
.ras-action.danger { background: linear-gradient(180deg, #ff6b6b, var(--ras-red) 60%, #991b1b 100%); color:#fff; box-shadow: 0 7px 0 rgba(153,27,27,.82), 0 16px 28px rgba(220,38,38,.22); }
.ras-action.ghost { background: linear-gradient(180deg, #fff, #eef2f7); color: var(--ras-slate); }

.ras-action:hover,
.ras-card-link:hover,
.ras-mini-btn:hover,
.ras-chip:hover,
.ras-icon-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.ras-action:active,
.ras-card-link:active,
.ras-mini-btn:active,
.ras-chip:active,
.ras-icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 4px 10px rgba(15,23,42,.12), inset 0 2px 5px rgba(15,23,42,.14) !important;
}

.ras-toolbar {
  margin: 0 0 18px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(180px, .65fr) auto auto;
  gap: 14px;
  align-items: end;
}

.ras-toolbar label,
.ras-view-box span {
  display: block;
  color: var(--ras-muted) !important;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ras-search-box input,
.ras-filter-box select {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid #cbd5e1 !important;
  background: #fff !important;
  color: var(--ras-text) !important;
  padding: 12px 14px;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.06);
}

.ras-status-row {
  margin-bottom: 18px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ras-muted) !important;
  font-weight: 800;
}

.ras-organizacao-aviso {
  background: linear-gradient(180deg, #fff7df, #fef3c7);
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--ras-shadow);
}

.ras-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.ras-module-card {
  background: linear-gradient(180deg, var(--ras-card), var(--ras-card-soft));
  border: 1px solid var(--ras-line);
  border-radius: 24px;
  box-shadow: var(--ras-shadow);
  padding: 18px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.ras-module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--ras-primary), #0ea5e9, var(--ras-green));
}

.ras-module-card[data-tone="green"]::before { background: linear-gradient(90deg, #16a34a, #22c55e); }
.ras-module-card[data-tone="purple"]::before { background: linear-gradient(90deg, #7c3aed, #a855f7); }
.ras-module-card[data-tone="orange"]::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ras-module-card[data-tone="red"]::before { background: linear-gradient(90deg, #dc2626, #fb7185); }
.ras-module-card[data-tone="slate"]::before { background: linear-gradient(90deg, #475569, #94a3b8); }

.ras-module-card.is-dragging { opacity: .62; transform: scale(.98); }
.ras-module-card.drag-over { outline: 4px solid rgba(37,99,235,.18); }
.ras-module-card.is-hidden-module { opacity: .68; filter: grayscale(.15); }
.ras-module-card.is-hidden-module::after { content: "Oculto"; position: absolute; top: 12px; right: 12px; padding: 5px 9px; border-radius: 999px; background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; font-size: 11px; font-weight: 900; }
.ras-module-card.is-favorite { border-color: #facc15; box-shadow: 0 20px 44px rgba(245,158,11,.15), 0 2px 5px rgba(15,23,42,.08); }
.ras-module-card.is-favorite .ras-card-icon { background: linear-gradient(180deg, #fff7df, #fef3c7); box-shadow: 0 5px 0 rgba(250,204,21,.58), 0 10px 18px rgba(245,158,11,.11); }

.ras-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ras-card-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(180deg, #eaf2ff, #dbeafe); box-shadow: 0 5px 0 rgba(191,210,255,.70), 0 10px 18px rgba(37,99,235,.10); font-size: 24px; flex: 0 0 auto; }
.ras-card-title { flex: 1; min-width: 0; }
.ras-card-title h2 { margin: 0 0 4px; color: var(--ras-text) !important; font-size: 19px; line-height: 1.12; }
.ras-card-category { display: inline-flex; font-size: 11px; font-weight: 900; color: #1d4ed8; background: #dbeafe; border: 1px solid #bfd2ff; padding: 4px 8px; border-radius: 999px; }
.ras-card-tools { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.ras-icon-btn { width: 36px; height: 36px; display: grid; place-items: center; background: linear-gradient(180deg, #fff, #eef2f7); color: var(--ras-text); box-shadow: 0 4px 0 rgba(148,163,184,.62), 0 10px 18px rgba(15,23,42,.10); }
.ras-icon-btn.active { background: linear-gradient(180deg, #fff7df, #facc15); color: #713f12; box-shadow: 0 4px 0 rgba(202,138,4,.58), 0 10px 18px rgba(245,158,11,.14); }

.ras-module-card p { color: var(--ras-muted) !important; line-height: 1.45; margin: 0 0 14px; flex: 1; }
.ras-card-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: auto; }
.ras-card-link { display: inline-flex; align-items: center; justify-content: center; padding: 12px 14px; min-height: 42px; flex: 1; }
.ras-organizer-controls { display: none; gap: 6px; }
.ras-shell.organizando .ras-organizer-controls { display: flex; }
.ras-shell.organizando .ras-module-card { cursor: grab; }
.ras-mini-btn { width: 38px; height: 38px; display: grid; place-items: center; background: linear-gradient(180deg, #ffffff, #e8eef8); color: var(--ras-text); box-shadow: 0 4px 0 rgba(148,163,184,.76), 0 10px 18px rgba(15,23,42,.12); }

.ras-empty-state { grid-column: 1 / -1; background: #fff; border: 1px dashed #cbd5e1; border-radius: 22px; padding: 24px; text-align: center; color: var(--ras-muted); box-shadow: var(--ras-shadow); }

.ras-shell[data-view="lista"] .ras-module-grid { grid-template-columns: 1fr; }
.ras-shell[data-view="lista"] .ras-module-card { min-height: auto; flex-direction: row; align-items: center; gap: 16px; }
.ras-shell[data-view="lista"] .ras-card-top { flex: 1; margin-bottom: 0; }
.ras-shell[data-view="lista"] .ras-module-card p { flex: 1; margin: 0; }
.ras-shell[data-view="lista"] .ras-card-footer { min-width: 240px; margin-top: 0; }

.ras-shell[data-view="compacto"] .ras-module-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ras-shell[data-view="compacto"] .ras-module-card { min-height: 140px; padding: 14px; }
.ras-shell[data-view="compacto"] .ras-card-icon { width: 40px; height: 40px; font-size: 20px; }
.ras-shell[data-view="compacto"] .ras-card-title h2 { font-size: 15px; }
.ras-shell[data-view="compacto"] .ras-module-card p { display: none; }
.ras-shell[data-view="compacto"] .ras-card-link { min-height: 38px; padding: 10px; font-size: 13px; }

@media (max-width: 1060px) {
  .ras-toolbar { grid-template-columns: 1fr 1fr; }
  .ras-shell[data-view="compacto"] .ras-module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .ras-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ras-hero { flex-direction: column; }
  .ras-hero-actions { justify-content: flex-start; }
  .ras-shell[data-view="lista"] .ras-module-card { flex-direction: column; align-items: stretch; }
  .ras-shell[data-view="lista"] .ras-card-footer { min-width: 0; }
}

@media (max-width: 640px) {
  .ras-shell { width: min(100% - 20px, 520px); padding-top: 14px; }
  .ras-toolbar { grid-template-columns: 1fr; border-radius: 22px; }
  .ras-module-grid,
  .ras-shell[data-view="compacto"] .ras-module-grid { grid-template-columns: 1fr; gap: 14px; }
  .ras-hero { padding: 18px; border-radius: 22px; }
  .ras-module-card { min-height: 188px; border-radius: 22px; }
  .ras-status-row { flex-direction: column; border-radius: 18px; }
}
