:root {
  --bg:          #07070e;
  --surface:     #0e0e1a;
  --surface2:    #141422;
  --surface3:    #1b1b2e;
  --border:      #252540;
  --border2:     #32325a;
  --accent:      #9b72ef;
  --accent2:     #7c3aed;
  --accent-glow: rgba(155,114,239,.28);
  --gold:        #c9a84c;
  --gold2:       #e8c96a;
  --gold3:       #f5e09a;
  --gold-glow:   rgba(201,168,76,.22);
  --gold-dim:    rgba(201,168,76,.08);
  --text:        #ddd8f5;
  --text2:       #b8b3d8;
  --muted:       #7876a0;
  --muted2:      #4e4c72;
  --danger:      #e05555;
  --font-title:  'Cinzel', serif;
  --font-body:   'Crimson Pro', Georgia, serif;
  --font-ui:     'Inter', system-ui, sans-serif;
  --radius-sm:   5px;
  --radius:      9px;
  --radius-lg:   13px;
  --radius-xl:   16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
}

body {
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124,58,237,.15) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M20 0 L40 20 L20 40 L0 20Z' fill='none' stroke='%23ffffff' stroke-width='0.15' stroke-opacity='0.04'/%3E%3C/svg%3E");
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.grim-header {
  background: linear-gradient(180deg, #0c0c1a 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  flex-shrink: 0;
}
.grim-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold2) 50%, var(--gold) 70%, transparent 100%);
  opacity: .6;
}
.grim-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent) 60%, transparent);
  opacity: .3;
}
.logo {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold3) 0%, var(--gold2) 40%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 10px;
  filter: drop-shadow(0 0 12px var(--gold-glow));
}
.logo-back {
  -webkit-text-fill-color: initial;
  color: var(--gold);
  font-size: 1.4rem;
  text-decoration: none;
  line-height: 1;
  opacity: .7;
  transition: opacity .15s;
  margin-right: -4px;
}
.logo-back:hover { opacity: 1; }
.logo-icon {
  -webkit-text-fill-color: initial;
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ── LAYOUT ── */
.grim-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 64px);
}

/* ── BUTTONS ── */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  transition: all .18s;
  font-family: var(--font-ui);
  letter-spacing: .02em;
}
.btn-primary {
  background: linear-gradient(160deg, #6d28d9 0%, var(--accent2) 50%, #9333ea 100%);
  color: #fff;
  padding: 8px 18px;
  border: 1px solid rgba(155,114,239,.4);
  box-shadow: 0 2px 14px rgba(124,58,237,.35), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover {
  background: linear-gradient(160deg, #7c3aed 0%, #9333ea 100%);
  box-shadow: 0 4px 22px rgba(124,58,237,.55);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--gold); background: var(--gold-dim); }
.btn-icon {
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 1rem;
}
.btn-icon:hover { color: var(--gold2); }
.btn-danger {
  background: transparent;
  color: var(--muted2);
  padding: 4px 8px;
  font-size: .75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  opacity: .5;
}
.btn-danger:hover { color: var(--danger); border-color: rgba(224,85,85,.3); background: rgba(224,85,85,.08); opacity: 1; }
.btn-edit {
  background: transparent;
  color: var(--muted2);
  padding: 4px 8px;
  font-size: .8rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  opacity: .5;
}
.btn-edit:hover { color: var(--gold2); border-color: rgba(201,168,76,.3); background: rgba(201,168,76,.08); opacity: 1; }
.btn-sm { padding: 5px 13px; font-size: .76rem; }

/* ── SIDEBAR ── */
.sidebar {
  width: 248px;
  min-width: 180px;
  background: linear-gradient(180deg, #0c0c1a 0%, var(--surface) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-title {
  font-family: var(--font-title);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .7;
  padding: 22px 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-title::before, .sidebar-title::after {
  content: ''; flex: 1; height: 1px; background: var(--gold); opacity: .3;
}
.cat-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .18s;
  user-select: none;
}
.cat-item:hover { background: rgba(255,255,255,.03); }
.cat-item.active { background: rgba(155,114,239,.07); border-left-color: var(--accent); }
.cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.cat-info { flex: 1; min-width: 0; }
.cat-label { font-family: var(--font-ui); font-size: .86rem; font-weight: 600; line-height: 1.3; color: var(--text2); }
.cat-item.active .cat-label { color: var(--text); }
.cat-desc-sidebar {
  font-family: var(--font-body);
  font-size: .77rem;
  color: var(--muted2);
  margin-top: 2px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.cat-edit-btn, .cat-delete-btn {
  display: none;
  padding: 2px 5px;
  font-size: .65rem;
  opacity: .7;
}
.cat-item:hover .cat-edit-btn,
.cat-item:hover .cat-delete-btn { display: block; }
.cat-count {
  font-size: .66rem;
  background: var(--surface3);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  margin-top: 3px;
  border: 1px solid var(--border);
}
.sidebar-add { margin: 14px 14px 18px; width: calc(100% - 28px); }

/* ── MAIN ── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-scroll-area { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
#catBannerArea { padding: 20px 30px 0; }
.main-header {
  padding: 18px 30px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0c0c1a 0%, var(--surface) 100%);
}
.main-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.main-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}
.main-title .badge {
  font-family: var(--font-ui);
  font-size: .65rem;
  font-weight: 600;
  background: var(--surface3);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  text-transform: none;
}
.main-cat-desc {
  font-family: var(--font-body);
  font-size: .92rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.55;
  font-style: italic;
}
.cat-banner {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0,0,0,.18);
}
.cat-banner img {
  max-width: 100%;
  max-height: 300px;
  width: 100%;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-lg);
}
.power-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 20px 0;
  background: rgba(0,0,0,.10);
}
.power-banner img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-lg);
}
.search-bar {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 7px 14px;
  color: var(--text);
  font-size: .82rem;
  width: 220px;
  outline: none;
  transition: .18s;
  font-family: var(--font-ui);
}
.search-bar:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.search-bar::placeholder { color: var(--muted2); }

.powers-list {
  flex: 1;
  padding: 16px 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── POWER CARD ── */
.power-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all .22s;
  position: relative;
  flex-shrink: 0;
}
.power-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat-color, var(--border));
  opacity: 0;
  transition: opacity .22s;
}
.power-card:hover::before, .power-card.open::before { opacity: 1; }
.power-card:hover { box-shadow: 0 8px 40px rgba(0,0,0,.6); border-color: var(--border2); }
.power-card.open { border-color: rgba(155,114,239,.25); }
.power-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
}
.power-header:hover { background: rgba(255,255,255,.02); }
.power-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.06);
}
.power-icon.power-icon-img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  border: none;
  align-self: center;
  cursor: zoom-in;
}

/* ── LIGHTBOX ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox.active { display: flex; }
#lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 60px rgba(0,0,0,.8);
  pointer-events: none;
}
.power-info { flex: 1; }
.power-name {
  font-family: var(--font-title);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.power-desc {
  font-family: var(--font-body);
  font-size: .88rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.55;
}
.power-meta { display: flex; align-items: center; gap: 8px; }
.power-edit-btn, .power-delete-btn { display: none; }
.power-header:hover .power-edit-btn,
.power-header:hover .power-delete-btn { display: block; }
.level-badge {
  font-family: var(--font-ui);
  font-size: .65rem;
  background: var(--surface3);
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid var(--border2);
}
.chevron { color: var(--muted2); font-size: .75rem; transition: transform .22s; }
.power-card.open .chevron { transform: rotate(90deg); }
.power-status-badge {
  font-family: var(--font-ui);
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}
.power-status-free  { color: #86efac; border-color: #16a34a; background: rgba(22,163,74,.12); }
.power-status-taken { color: #fca5a5; border-color: #dc2626; background: rgba(220,38,38,.12); }

/* ── LEVELS ── */
.levels-container { border-top: 1px solid var(--border); }
.level-block { border-bottom: 1px solid var(--border); }
.level-block:last-child { border-bottom: none; }
.level-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px 13px 26px;
  cursor: pointer;
  user-select: none;
  background: var(--surface2);
  transition: background .15s;
  position: relative;
}
.level-header::before {
  content: '◆';
  font-size: .4rem;
  color: var(--gold);
  opacity: .4;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}
.level-header:hover { background: var(--surface3); }
.level-header-info { flex: 1; }
.level-num {
  font-family: var(--font-title);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid;
}
.level-desc-inline {
  font-family: var(--font-body);
  font-size: .83rem;
  color: var(--text2);
  margin-top: 4px;
  line-height: 1.45;
  font-style: italic;
}
.level-chevron { color: var(--muted2); font-size: .68rem; flex-shrink: 0; transition: transform .22s; }
.level-block.open .level-chevron { transform: rotate(90deg); }
.level-edit-btn { display: none; }
.level-header:hover .level-edit-btn { display: block; }

/* ── SKILLS ── */
.skills-container {
  padding: 12px 20px 16px 34px;
  background: var(--surface);
}
.skill-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all .18s;
}
.skill-item:hover { border-color: rgba(201,168,76,.2); background: linear-gradient(90deg,rgba(201,168,76,.04),var(--surface2)); }
.skill-item:last-child { margin-bottom: 0; }
.skill-actions { display: none; gap: 4px; flex-shrink: 0; align-items: center; }
.skill-item:hover .skill-actions { display: flex; }
.skill-bullet {
  width: 6px; height: 6px;
  transform: rotate(45deg);
  background: var(--gold);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--gold-glow);
}
.skill-content { flex: 1; }
.skill-name { font-family: var(--font-ui); font-size: .84rem; font-weight: 700; }
.skill-desc { font-family: var(--font-body); font-size: .86rem; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.skills-actions { display: flex; gap: 6px; margin-top: 9px; }
.power-card-actions {
  display: flex;
  gap: 6px;
  padding: 11px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ── EMPTY ── */
.empty, .full-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted2);
  gap: 14px;
  padding: 60px 40px;
  text-align: center;
}
.empty-icon { font-size: 3.5rem; opacity: .15; filter: grayscale(1); }
.empty-title {
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.empty-text { font-family: var(--font-body); font-size: .92rem; line-height: 1.6; font-style: italic; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal, .modal-box {
  background: linear-gradient(160deg, #0f0f1e 0%, #12121f 100%);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 490px;
  box-shadow: 0 30px 90px rgba(0,0,0,.75), 0 0 0 1px rgba(201,168,76,.08);
  position: relative;
  overflow: hidden;
}
.modal::before, .modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 40%, var(--gold2) 60%, transparent);
  opacity: .5;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 {
  font-family: var(--font-title); font-size: .9rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold3), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin: 0;
}
.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: .15s; line-height: 1; flex-shrink: 0;
}
.modal-close:hover { background: rgba(201,168,76,.12); color: var(--gold); }
/* Padding interno do modal quando não há .modal-body */
.modal-box > form { padding: 20px 24px 0; display: flex; flex-direction: column; }
.modal-box > form > .modal-footer { margin: 0 -24px; }
.modal-box > .form-group,
.modal-box > .form-row,
.modal-box > .form-section-label { padding-left: 24px; padding-right: 24px; }
.modal-box > .form-group:first-of-type,
.modal-box > .form-row:first-of-type { padding-top: 20px; }
.modal-box > .modal-divider { margin: 8px 0; }
.modal-title {
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold3), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: rgba(0,0,0,.2);
}
.modal-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0 8px;
}
.form-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}
/* Modal manage-powers */
.mpm-powers-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mpm-power-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.mpm-power-info { display: flex; align-items: center; gap: 6px; }
.mpm-power-name { font-size: .85rem; font-weight: 600; }
label {
  font-family: var(--font-ui);
  font-size: .68rem;
  color: var(--gold);
  opacity: .75;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
input[type=text], textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .86rem;
  padding: 9px 13px;
  outline: none;
  transition: .18s;
  font-family: var(--font-ui);
}
input[type=text]:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
textarea { resize: vertical; min-height: 80px; font-family: var(--font-body); font-size: .9rem; }
input[type=password], input[type=number] {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: .86rem;
  padding: 9px 13px; outline: none; transition: .18s; font-family: var(--font-ui);
}
input[type=password]:focus, input[type=number]:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow);
}
input[type=file] {
  color: var(--text-muted); font-size: .82rem; cursor: pointer;
  padding: 5px 0; background: none; border: none; width: 100%;
}
.form-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: .86rem;
  padding: 9px 13px; outline: none; transition: .18s; font-family: var(--font-ui);
}
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.form-group { margin-bottom: 16px; }

/* color/icon pickers */
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all .15s;
}
.color-opt.selected { border-color: var(--gold2); transform: scale(1.18); box-shadow: 0 0 10px var(--gold-glow); }
.color-opt:hover { transform: scale(1.1); }
.icon-opt { border-radius: 8px !important; }

/* ── GLOBAL SEARCH RESULTS ── */
.sr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  flex-shrink: 0;
}
.sr-header-title {
  font-family: var(--font-ui);
  font-size: .82rem;
  color: var(--muted);
}
.sr-header-title em { color: var(--gold2); font-style: normal; font-weight: 600; }
.sr-header-count {
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted2);
  background: var(--surface3);
  border: 1px solid var(--border2);
  padding: 2px 10px;
  border-radius: 20px;
}
.sr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sr-color, var(--accent));
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all .18s;
  flex-shrink: 0;
}
.sr-card:hover {
  border-color: var(--border2);
  border-left-color: var(--sr-color);
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
  transform: translateY(-1px);
}
.sr-trail {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.sr-crumb {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
}
.sr-crumb-cat { font-weight: 700; }
.sr-sep { color: var(--muted2); font-size: .6rem; }
.sr-body { display: flex; flex-direction: column; gap: 5px; }
.sr-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 20px;
  width: fit-content;
  margin-bottom: 3px;
}
.sr-badge-category { background: rgba(155,114,239,.14); color: var(--accent); border: 1px solid rgba(155,114,239,.25); }
.sr-badge-power    { background: rgba(217,119,6,.14);   color: #d97706; border: 1px solid rgba(217,119,6,.25); }
.sr-badge-level    { background: rgba(8,145,178,.14);   color: #0891b2; border: 1px solid rgba(8,145,178,.25); }
.sr-badge-skill    { background: rgba(22,163,74,.14);   color: #16a34a; border: 1px solid rgba(22,163,74,.25); }
.sr-name {
  font-family: var(--font-title);
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text);
}
.sr-desc {
  font-family: var(--font-body);
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sr-acts { display: flex; gap: 8px; }
.search-bar { width: 280px; }

/* scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* toast */
.toast {
  position: fixed;
  bottom: 26px; right: 26px;
  background: var(--surface3);
  border: 1px solid var(--gold);
  color: var(--gold2);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .82rem;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: .04em;
  box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 20px var(--gold-glow);
  opacity: 0;
  transform: translateY(10px);
  transition: .25s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 640px) {
  .powers-list { padding: 14px 16px; }
}

/* ══════════════════════════════════════════
   GRIMÓRIO — sidebar Players section
══════════════════════════════════════════ */
.sidebar-players {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}
.players-coming {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  opacity: .6;
  cursor: default;
  user-select: none;
}
.players-coming-icon { font-size: 1.1rem; }
.players-coming-info { flex: 1; }
.players-coming-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text2);
}
.players-coming-sub {
  font-size: .68rem;
  color: var(--muted2);
  margin-top: 1px;
}
.players-coming-badge {
  font-size: .6rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: 20px;
  padding: 2px 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════ */
.dash-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.dash-topbar {
  position: relative;
  background: linear-gradient(180deg, #08081a 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.dash-topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold2) 50%, var(--gold) 70%, transparent 100%);
  opacity: .6;
}
.dash-topbar-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.dash-logo { display: flex; align-items: center; gap: 16px; }
.dash-logo-rune {
  font-size: 2rem;
  filter: drop-shadow(0 0 16px var(--gold-glow));
  line-height: 1;
}
.dash-logo-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold3) 0%, var(--gold2) 40%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dash-logo-sub {
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 2px;
}
.dash-topnav {
  display: flex;
  gap: 8px;
}
.dash-topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: .18s;
  position: relative;
}
.dash-topnav-players {
  background: rgba(225,29,72,.12);
  color: #fda4af;
  border-color: rgba(225,29,72,.3);
}
.dash-topnav-players:hover {
  background: rgba(225,29,72,.22);
  border-color: rgba(225,29,72,.6);
  box-shadow: 0 0 16px rgba(225,29,72,.25);
}
.dash-topnav-missions {
  background: rgba(8,145,178,.1);
  color: #67e8f9;
  border-color: rgba(8,145,178,.3);
}
.dash-topnav-missions:hover {
  background: rgba(8,145,178,.2);
  border-color: rgba(8,145,178,.6);
  box-shadow: 0 0 16px rgba(8,145,178,.2);
}
.dash-topnav-grimorio {
  background: linear-gradient(160deg, rgba(109,40,217,.3), rgba(147,51,234,.2));
  color: #c4b5fd;
  border-color: rgba(155,114,239,.4);
  box-shadow: 0 2px 16px rgba(124,58,237,.2);
}
.dash-topnav-grimorio:hover {
  background: linear-gradient(160deg, rgba(109,40,217,.45), rgba(147,51,234,.35));
  box-shadow: 0 4px 24px rgba(124,58,237,.4);
}
.dash-topnav-oraculo {
  background: linear-gradient(160deg, rgba(201,168,76,.15), rgba(201,168,76,.08));
  color: var(--gold2);
  border-color: rgba(201,168,76,.3);
}
.dash-topnav-oraculo:hover {
  background: linear-gradient(160deg, rgba(201,168,76,.28), rgba(201,168,76,.15));
  border-color: rgba(201,168,76,.6);
  box-shadow: 0 0 16px rgba(201,168,76,.22);
}
.dash-topnav-locais {
  background: rgba(16,185,129,.1);
  color: #6ee7b7;
  border-color: rgba(16,185,129,.3);
}
.dash-topnav-locais:hover {
  background: rgba(16,185,129,.2);
  border-color: rgba(16,185,129,.6);
  box-shadow: 0 0 16px rgba(16,185,129,.2);
}
.dash-topnav-historia {
  background: rgba(201,168,76,.1);
  color: var(--gold3);
  border-color: rgba(201,168,76,.25);
}
.dash-topnav-historia:hover {
  background: rgba(201,168,76,.2);
  border-color: rgba(201,168,76,.55);
  box-shadow: 0 0 16px rgba(201,168,76,.18);
}
.dash-topnav-equipes {
  background: rgba(220,38,38,.1);
  color: #f87171;
  border-color: rgba(220,38,38,.25);
}
.dash-topnav-equipes:hover {
  background: rgba(220,38,38,.2);
  border-color: rgba(220,38,38,.5);
  box-shadow: 0 0 16px rgba(220,38,38,.18);
}
.dash-topnav-casas {
  background: rgba(201,168,76,.1);
  color: #d4a94a;
  border-color: rgba(201,168,76,.25);
}
.dash-topnav-casas:hover {
  background: rgba(201,168,76,.2);
  border-color: rgba(201,168,76,.5);
  box-shadow: 0 0 16px rgba(201,168,76,.2);
}
.dash-topnav-badge {
  font-size: .68rem;
  font-weight: 700;
  background: rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.dash-topnav-badge.badge-active {
  background: rgba(225,29,72,.3);
  color: #fda4af;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* ── Stats bar ── */
.dash-statsbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 14px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 32px;
}
.dash-stat-val {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.dash-stat-lbl {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 3px;
}
.dash-stat-div {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Main content ── */
.dash-content {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 40px 40px;
  align-items: start;
  flex: 1;
}

/* ── Panels ── */
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dash-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.dash-panel-header h2 {
  font-family: var(--font-title);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.dash-panel-link {
  font-size: .72rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.dash-panel-link:hover { color: var(--accent); }
.dash-panel-footer-btn {
  display: block;
  text-align: center;
  padding: 12px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-top: 1px solid var(--border);
  background: rgba(155,114,239,.04);
  transition: background .15s;
}
.dash-panel-footer-btn:hover { background: rgba(155,114,239,.1); }

/* Players list */
.dash-panel-players { border-left: 3px solid #e11d48; }
.dash-players-list { display: flex; flex-direction: column; }
.dash-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.dash-player-row:last-child { border-bottom: none; }
.dash-player-row:hover { background: rgba(225,29,72,.06); }
.dash-player-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.dash-player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dash-player-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dash-player-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-player-chars { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.dash-player-arrow { color: var(--muted); font-size: 1.1rem; flex-shrink: 0; }

/* Right column */
.dash-col-right { display: flex; flex-direction: column; gap: 20px; }

/* Grimório */
.dash-panel-grimorio { border-left: 3px solid var(--accent); }
.dash-cats-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
}
.dash-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 2px solid var(--cc);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  font-size: .8rem;
  transition: .15s;
}
.dash-cat-chip:hover { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 8%, var(--bg)); }
.dash-cat-chip-name { font-weight: 600; }
.dash-cat-chip-count {
  font-size: .68rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 20px;
  padding: 1px 6px;
}

/* Missions */
.dash-panel-missions { border-left: 3px solid #0891b2; }
.dash-missions-list { display: flex; flex-direction: column; }
.dash-mission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.dash-mission-row:last-child { border-bottom: none; }
.dash-mission-row:hover { background: rgba(8,145,178,.06); }
.dash-mission-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0891b2;
  flex-shrink: 0;
  box-shadow: 0 0 6px #0891b2;
}
.dash-mission-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dash-mission-name {
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-mission-meta { font-size: .72rem; color: var(--muted); margin-top: 1px; }

/* empty + btn-sm */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
  color: var(--muted);
  font-size: .85rem;
  font-style: italic;
}
.btn-dash-sm {
  display: inline-block;
  padding: 7px 16px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(155,114,239,.35);
  border-radius: var(--radius);
  text-decoration: none;
  background: rgba(155,114,239,.08);
  transition: .15s;
  font-style: normal;
}
.btn-dash-sm:hover { background: rgba(155,114,239,.18); }

/* ── Painel de Avisos ── */
.dash-panel-notices { border-left: 3px solid #d97706; }

.dash-notices-list { display: flex; flex-direction: column; gap: 8px; }

.dash-notice-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
.dash-notice-item.dash-notice-important {
  background: rgba(217,119,6,.08);
  border-color: rgba(217,119,6,.3);
}
.dash-notice-body { flex: 1; min-width: 0; }
.dash-notice-title { font-weight: 600; font-size: .88rem; display: block; }
.dash-notice-content { font-size: .82rem; color: var(--text-muted); margin: 4px 0 0; }
.dash-notice-actions { display: flex; gap: 4px; flex-shrink: 0; }

@media (max-width: 960px) {
  .dash-content { grid-template-columns: 1fr; padding: 20px; }
  .dash-topbar-inner { padding: 16px 20px; flex-wrap: wrap; gap: 12px; }
  .dash-statsbar { padding: 10px 20px; }
  .dash-stat { padding: 4px 16px; }
}
@media (max-width: 600px) {
  .dash-topnav { flex-wrap: wrap; gap: 6px; }
  .dash-topnav-item { padding: 8px 14px; font-size: .78rem; }
  .dash-stat-div { display: none; }
}

/* ══════════════════════════════════════════════════════════
   QUICK NAV (mantido para compatibilidade)
══════════════════════════════════════════════════════════ */
.dash-quick-nav {
  display: flex;
  gap: 16px;
  padding: 24px 40px 40px;
  flex-wrap: wrap;
}
.dash-nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.dash-nav-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(155,114,239,.18);
  transform: translateY(-2px);
}
.dash-nav-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}
.dash-nav-title {
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.dash-nav-sub {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.dash-nav-arrow {
  margin-left: auto;
  color: var(--accent);
  font-size: 1.2rem;
  opacity: .7;
}

/* ══════════════════════════════════════════════════════════
   GLOBAL PAGE LAYOUT
══════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.btn-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .82rem;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color .15s, border-color .15s;
}
.btn-back:hover { color: var(--accent); border-color: var(--accent); }
.section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
  padding: 0 40px;
}
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px;
  color: var(--text-muted);
  font-size: .9rem;
}
.empty-text {
  color: var(--text-muted);
  font-size: .85rem;
  font-style: italic;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   CARDS GRID (Players / Characters)
══════════════════════════════════════════════════════════ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 0 40px 32px;
}
.player-card,
.character-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, box-shadow .2s;
}
.player-card:hover,
.character-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(155,114,239,.15);
}
.player-card-photo,
.character-card-photo {
  height: 140px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.player-card-photo img,
.character-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-placeholder {
  font-size: 3rem;
  opacity: .4;
}
.photo-placeholder.large { font-size: 5rem; }
.player-card-info,
.character-card-info {
  padding: 14px 16px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.player-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
.player-meta {
  font-size: .76rem;
  color: var(--text-muted);
}
.points-badge {
  color: var(--gold) !important;
  font-weight: 600;
}
.player-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px 12px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   PLAYER ACCESS PANEL
══════════════════════════════════════════════════════════ */
.player-access-panel {
  background: rgba(15,10,30,0.7);
  border: 1px solid rgba(180,140,60,0.25);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.access-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.access-panel-icon { font-size: 1rem; }
.access-panel-title {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.07em;
  color: rgba(200,180,140,0.8);
}
.access-badge {
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}
.access-badge-active {
  background: rgba(60,180,100,0.15);
  border: 1px solid rgba(60,180,100,0.4);
  color: #6ecf8f;
}
.access-badge-none {
  background: rgba(180,60,60,0.12);
  border: 1px solid rgba(180,60,60,0.3);
  color: rgba(220,140,140,0.7);
}
.access-user-info {
  font-size: 0.85rem;
  color: rgba(200,180,140,0.7);
  margin: 0;
}
.access-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   PLAYER DETAIL
══════════════════════════════════════════════════════════ */
.player-detail-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 40px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.player-detail-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.player-detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-detail-info h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  margin: 0 0 6px;
}
.player-detail-info p {
  font-size: .84rem;
  color: var(--text-muted);
  margin: 2px 0;
}

/* ══════════════════════════════════════════════════════════
   CHARACTER DETAIL
══════════════════════════════════════════════════════════ */
.character-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 0 40px 40px;
  align-items: start;
}
.char-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.char-photo-wrap {
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-photo { width: 100%; height: 100%; object-fit: cover; }
.char-info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.char-info-block h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin: 0 0 6px;
}
.char-info-block p { font-size: .82rem; color: var(--text-muted); margin: 2px 0; }
.char-player-link a { color: var(--accent); text-decoration: none; }
.avatar-in-use {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.avatar-in-use-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  opacity: .7;
}
.avatar-in-use-value {
  font-size: .82rem;
  color: var(--text);
  font-style: italic;
}
.points-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.points-panel h3 {
  font-family: 'Cinzel', serif;
  font-size: .9rem;
  margin: 0 0 12px;
  color: var(--gold);
}
.points-row {
  display: flex;
  justify-content: space-between;
  font-size: .84rem;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.points-row:last-of-type { border-bottom: none; }
.points-available { color: var(--gold) !important; }
.points-actions { margin-top: 12px; }
.char-content { display: flex; flex-direction: column; gap: 24px; }
.char-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.char-section .section-title { padding: 0; margin-bottom: 14px; }
.char-section .section-header-row { padding: 0; }
.char-field label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 4px;
  display: block;
}
.char-field p { font-size: .88rem; color: var(--text-muted); margin: 0 0 12px; line-height: 1.6; }

/* Powers list */
.powers-list { display: flex; flex-direction: column; gap: 8px; }
.power-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.power-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.power-item-info { display: flex; align-items: center; gap: 8px; }
.power-icon { font-size: 1.1rem; }
.power-name { font-size: .9rem; font-weight: 600; color: var(--text); }
.power-level-badge {
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(155,114,239,.12);
  border: 1px solid rgba(155,114,239,.25);
  border-radius: 20px;
  padding: 2px 8px;
}
.power-item-points { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pts-label { font-size: .78rem; color: var(--gold); }
/* Skills panel inside power card */
.power-skills-panel {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-level-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.skill-level-name {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 80px;
  padding-top: 4px;
  white-space: nowrap;
}
.skill-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.skill-tag {
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.skill-tag:hover { border-color: var(--accent); color: var(--text); }
.skill-tag.skill-trained {
  background: rgba(155,114,239,.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.skill-tag.skill-locked {
  opacity: .35;
  cursor: default;
  pointer-events: none;
  border-style: dashed;
}
.skill-level-locked .skill-level-name { opacity: .4; }

/* Missions in character */
.mission-group { margin-bottom: 14px; }
.mission-group h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 8px; }
.mission-tag {
  display: inline-block;
  margin: 3px 4px 3px 0;
  font-size: .82rem;
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color .15s;
}
.mission-tag:hover { border-color: var(--accent); }
.mission-tag.in-progress { border-color: #0891b2; color: #67e8f9; }
.mission-tag.completed { border-color: #16a34a; color: #86efac; }
.mission-pts { font-size: .72rem; color: var(--gold); }

/* Achievements */
.achievements-list { display: flex; flex-direction: column; gap: 8px; }
.achievement-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
}
.achievement-item strong { font-size: .88rem; color: var(--gold); display: block; margin-bottom: 2px; }
.achievement-item p { font-size: .8rem; color: var(--text-muted); margin: 0; }

/* Relations */
.relations-list { display: flex; flex-direction: column; gap: 8px; }
.relation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
  font-size: .86rem;
}
.relation-type {
  font-weight: 700;
  color: var(--accent);
  margin-right: 6px;
}
.relation-item a { color: var(--text); text-decoration: none; }
.relation-item a:hover { color: var(--accent); }
.relation-desc { color: var(--text-muted); font-size: .8rem; }
.npc-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 3px;
}
.radio-toggle-group {
  display: flex;
  gap: 16px;
}
.radio-toggle-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: .9rem;
}

/* Custom fields */
.custom-field-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.custom-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(155,114,239,.06);
}
.custom-field-header h4 {
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  margin: 0;
  color: var(--accent);
}
.custom-field-content {
  padding: 12px 14px;
  font-size: .86rem;
  color: var(--text-muted);
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   MISSIONS
══════════════════════════════════════════════════════════ */
.missions-list { padding: 0 40px; display: flex; flex-direction: column; gap: 10px; }
.mission-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .2s;
}
.mission-row:hover { border-color: var(--accent); }
.mission-row-completed { opacity: .75; }
.mission-row-name {
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.mission-row-name:hover { color: var(--accent); }
.mission-row-desc {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.mission-participant-count {
  font-size: .76rem;
  color: var(--text-muted);
  display: block;
  margin-top: 6px;
}
.mission-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mission-description-block {
  margin: 0 40px 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.status-badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid;
}
.status-inprogress { color: #67e8f9; border-color: #0891b2; background: rgba(8,145,178,.1); }
.status-completed  { color: #86efac; border-color: #16a34a; background: rgba(22,163,74,.1); }

/* ── Mission Cards (Index) ── */
.mission-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, transform .15s;
  position: relative;
}
.mission-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mission-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  gap: 8px;
}
.mission-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.mission-card-icon { font-size: 1.4rem; }
.mission-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-inprogress { background: #0891b2; box-shadow: 0 0 6px rgba(8,145,178,.6); }
.dot-completed  { background: #16a34a; }
.mission-card-name {
  font-family: var(--font-title);
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.mission-card-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.mission-card-footer {
  margin-top: auto;
  padding-top: 8px;
}
.mission-card-actions {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ── Mission Detail Layout ── */
.mission-detail-layout {
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mission-info-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.mission-info-section:last-child { border-bottom: none; }
.mission-info-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 10px;
}
.mission-info-text {
  font-size: .92rem;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 0;
}
.mission-info-empty {
  font-size: .88rem;
  color: var(--muted);
  margin: 0;
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: var(--gold); }

/* ── Modal sizes ── */
.modal-lg  { max-width: 640px !important; }
.modal-xl  { max-width: 760px !important; }

/* ── Modal section divider ── */
.modal-section-divider {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin: 8px 0 14px;
  padding-top: 14px;
}

/* ── Mission Type Badge ── */
.mission-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}
.type-free    { color: var(--gold);   border-color: var(--gold);   background: rgba(201,168,76,.08); }
.type-hero    { color: #67e8f9;       border-color: #0891b2;       background: rgba(8,145,178,.08); }
.type-villain { color: #fca5a5;       border-color: #dc2626;       background: rgba(220,38,38,.08); }
.type-weekly  { color: #a78bfa;       border-color: #7c3aed;       background: rgba(124,58,237,.08); }

/* ── Sides Preview (mission card) ── */
.mission-sides-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.side-preview {
  font-size: .75rem;
  padding: 3px 8px;
  border-radius: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-preview-hero    { color: #67e8f9; background: rgba(8,145,178,.1); }
.side-preview-villain { color: #fca5a5; background: rgba(220,38,38,.1); }

/* ── Weekly Card variant ── */
.mission-card-weekly { border-color: rgba(124,58,237,.3); }
.mission-card-weekly:hover { border-color: #7c3aed; }

/* ── Mission Row title line (past missions) ── */
.mission-row-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Detail: Sides Grid ── */
.mission-sides-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}
.mission-side {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.mission-side-hero    { border-color: rgba(8,145,178,.4);  background: rgba(8,145,178,.04); }
.mission-side-villain { border-color: rgba(220,38,38,.4);  background: rgba(220,38,38,.04); }
.mission-side-header {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.mission-side-hero    .mission-side-header { color: #67e8f9; }
.mission-side-villain .mission-side-header { color: #fca5a5; }

/* ── Participant Side Badge ── */
.participant-side-badge {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
  margin-top: 2px;
}
.side-hero    { color: #67e8f9; border-color: #0891b2; background: rgba(8,145,178,.1); }
.side-villain { color: #fca5a5; border-color: #dc2626; background: rgba(220,38,38,.1); }
.side-free    { color: var(--gold); border-color: var(--gold); background: rgba(201,168,76,.08); }

/* ── Participant Side Groups ── */
.participant-side-group {
  margin-bottom: 20px;
}
.participant-side-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
  padding: 4px 0;
}
.participant-side-label.side-hero    { color: #67e8f9; }
.participant-side-label.side-villain { color: #fca5a5; }
.participant-side-label.side-free    { color: var(--gold); }

/* ── Weekly Join Section ── */
.mission-weekly-join {
  background: rgba(124,58,237,.06);
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid rgba(124,58,237,.25);
  margin-bottom: 0;
}

/* ── Past Mission Section ── */
.mission-past-section {
  background: rgba(255,255,255,.02);
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

/* ── Events / Consequences List ── */
.mission-events-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mission-events-list li {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.6;
  padding-left: 18px;
  position: relative;
}
.mission-events-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── Player missions block ── */
.mission-groups-block { padding: 0 40px; }
.mission-char-meta { font-style: italic; }

/* ── Responsive: sides grid ── */
@media (max-width: 640px) {
  .mission-sides-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   FORM HELPERS
══════════════════════════════════════════════════════════ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-hint {
  font-size: .8rem;
  color: var(--muted2);
  margin: 4px 0 0;
  line-height: 1.4;
}
.modal-subtitle {
  font-size: .88rem;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 600;
}
.modal-sm { max-width: 400px !important; }

/* Buttons extra sizes */
.btn-xs {
  font-size: .72rem !important;
  padding: 3px 8px !important;
  border-radius: 5px !important;
}

/* Toast error */
.toast-error { background: #7f1d1d; border-color: #ef4444; color: #fca5a5; }

@media (max-width: 860px) {
  .character-detail-layout { grid-template-columns: 1fr; }
  .char-sidebar { position: static; }
  .page-header, .cards-grid, .missions-list, .section-title, .mission-description-block { padding-left: 20px; padding-right: 20px; }
  .dash-quick-nav { padding: 16px 20px 32px; }
  .player-detail-header { padding-left: 20px; padding-right: 20px; }
}

/* ══════════════════════════════════════════════════════════
   FUNDO ATMOSFÉRICO GLOBAL
══════════════════════════════════════════════════════════ */

/* Garante que o conteúdo fique acima dos elementos de fundo (z-index:0) */
.page-root {
  position: relative;
  z-index: 1;
}

/* Anéis giratórios */
.gbg-rings {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.gbg-ring {
  position: absolute;
  border-radius: 50%;
  top: 50%; left: 50%;
}
.gbg-ring-a {
  width: min(900px, 140vw); height: min(900px, 140vw);
  border: 1px solid transparent;
  border-top-color:    rgba(201,168,76,.13);
  border-right-color:  rgba(155,114,239,.05);
  border-bottom-color: rgba(201,168,76,.08);
  border-left-color:   rgba(155,114,239,.04);
  transform: translate(-50%,-50%);
  animation: gbg-spin 75s linear infinite;
}
.gbg-ring-a::before {
  content: '';
  position: absolute; top: -3px; left: 50%;
  width: 5px; height: 5px; margin-left: -2.5px;
  background: var(--gold); border-radius: 50%;
  box-shadow: 0 0 10px var(--gold), 0 0 22px rgba(201,168,76,.45);
}
.gbg-ring-b {
  width: min(620px, 100vw); height: min(620px, 100vw);
  border: 1px solid transparent;
  border-top-color:    rgba(155,114,239,.12);
  border-right-color:  rgba(201,168,76,.04);
  border-bottom-color: rgba(155,114,239,.07);
  border-left-color:   rgba(201,168,76,.06);
  transform: translate(-50%,-50%);
  animation: gbg-spin 48s linear infinite reverse;
}
.gbg-ring-b::before {
  content: '';
  position: absolute; top: -2.5px; left: 50%;
  width: 4px; height: 4px; margin-left: -2px;
  background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 8px var(--accent), 0 0 16px rgba(155,114,239,.4);
}
.gbg-ring-c {
  width: min(380px, 65vw); height: min(380px, 65vw);
  border: 1px dashed rgba(201,168,76,.06);
  transform: translate(-50%,-50%);
  animation: gbg-spin 32s linear infinite;
}
@keyframes gbg-spin {
  to { transform: translate(-50%,-50%) rotate(360deg); }
}

/* Runas flutuantes */
.gbg-runes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.gbg-rune {
  position: absolute;
  font-family: serif;
  opacity: 0;
  user-select: none;
  animation: gbg-float var(--dur,14s) var(--del,0s) ease-in-out infinite;
}
@keyframes gbg-float {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  15%  { opacity: var(--op,.05); }
  85%  { opacity: var(--op,.05); }
  100% { opacity: 0; transform: translateY(-70px) rotate(12deg); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MELHORIAS MOBILE
══════════════════════════════════════════════════════════ */

/* ── Botão hamburger (visível só no mobile) ── */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 7px 11px;
  font-size: 1rem;
  border-radius: var(--radius);
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s;
}
.sidebar-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* ── Backdrop do sidebar (mobile) ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 49;
  cursor: pointer;
}
.sidebar-backdrop.visible { display: block; }

/* ── Touch: botões de ação sempre visíveis ── */
@media (hover: none) and (pointer: coarse) {
  .power-edit-btn, .power-delete-btn { display: block; }
  .cat-edit-btn, .cat-delete-btn { display: block; }
  .level-edit-btn { display: block; }
  .skill-actions { display: flex; }
  .btn-danger, .btn-edit { opacity: 1; }
  /* Área de toque mínima */
  .cat-edit-btn, .cat-delete-btn,
  .power-edit-btn, .power-delete-btn,
  .level-edit-btn { min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center; }
}

/* ── Grimório: sidebar vira drawer no mobile ── */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: 260px !important;
    min-width: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }

  .grim-header { padding: 0 16px; gap: 8px; }
  .search-bar { width: 100%; flex: 1; min-width: 0; }
  .header-actions { flex: 1; min-width: 0; }
  .powers-list { padding: 14px 12px; gap: 10px; }

  /* Header da categoria: slim no mobile */
  .main-header { padding: 10px 12px 8px; }
  .main-header-top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .main-title { font-size: .92rem; letter-spacing: .04em; gap: 8px; }
  #catBannerArea { padding: 12px 12px 0; }
  #catBannerArea img { max-height: 200px; }

  /* ── Power card: reestrutura para mobile ── */
  .power-header {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 4px 10px;
    padding: 12px 12px;
    align-items: start;
  }
  .power-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    margin-top: 1px;
    border-radius: var(--radius);
    grid-row: 1;
    align-self: start;
  }
  .power-icon.power-icon-img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    align-self: center;
  }
  .power-header:has(.power-icon-img) {
    grid-template-columns: 64px 1fr auto;
  }
  .power-info { min-width: 0; }
  .power-name {
    font-size: .78rem;
    letter-spacing: .03em;
    line-height: 1.35;
  }
  .power-desc {
    font-size: .76rem;
    margin-top: 3px;
    line-height: 1.4;
  }
  /* Meta: empilha verticalmente à direita; chevron no topo */
  .power-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
  }
  .chevron { order: -1; font-size: .8rem; }
  .level-badge { font-size: .58rem; padding: 2px 6px; order: 0; }
  .power-status-badge { font-size: .55rem; padding: 2px 6px; order: -1; }
  .power-edit-btn  { order: 1; }
  .power-delete-btn { order: 2; }

  /* Level: menos indent */
  .level-header { padding: 10px 12px 10px 18px; gap: 8px; }
  .level-header::before { left: 7px; }
  .level-num { font-size: .6rem; padding: 2px 9px; letter-spacing: .08em; }
  .level-desc-inline { font-size: .77rem; margin-top: 3px; }

  /* Skills: remove indent excessivo */
  .skills-container { padding: 10px 12px 12px 16px; }
  .skill-item { padding: 9px 10px; gap: 9px; }
  .skill-name { font-size: .79rem; }
  .skill-desc { font-size: .78rem; }

  /* Empty state */
  .empty, .full-empty { padding: 40px 20px; gap: 10px; }
  .empty-icon { font-size: 2.5rem; }
  .empty-title { font-size: .8rem; letter-spacing: .08em; }
  .empty-text { font-size: .82rem; }

  /* Search results */
  .sr-name { font-size: .8rem; letter-spacing: .03em; }
  .sr-desc { font-size: .8rem; }
  .sr-card { padding: 12px 14px; }
}

/* ── Grimório: telas muito pequenas ── */
@media (max-width: 480px) {
  .logo { font-size: 1.05rem; }
  .logo-icon { font-size: 1.05rem; }
  .search-bar { font-size: .78rem; }
  .power-card-actions { padding: 9px 14px; }
  .skills-actions { flex-wrap: wrap; }
}

/* ── Dashboard: telas < 480px ── */
@media (max-width: 480px) {
  .dash-topbar-inner { padding: 12px 16px; gap: 8px; }
  .dash-logo-rune { font-size: 1.5rem; }
  .dash-logo-title { font-size: 1.1rem; }
  .dash-logo-sub { display: none; }
  .dash-topnav { flex-wrap: wrap; gap: 4px; }
  .dash-topnav-item { padding: 7px 10px; font-size: .76rem; gap: 4px; }
  .dash-statsbar { padding: 8px 12px; }
  .dash-stat { padding: 4px 10px; }
  .dash-stat-val { font-size: 1.15rem; }
  .dash-content { padding: 14px; gap: 14px; }

  /* Páginas gerais */
  .page-header { padding: 16px 16px 12px; }
  .page-title { font-size: 1.25rem; }
  .cards-grid { padding: 0 16px 24px; grid-template-columns: 1fr; }
  .missions-list { padding: 0 16px; }
  .mission-description-block { margin: 0 16px 20px; }
  .mission-groups-block { padding: 0 16px; }
  .section-title { padding: 0 16px; }
  .mission-detail-layout { padding: 0 16px; }
  .character-detail-layout { padding: 0 16px 32px; }
  .player-detail-header { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }

  /* Modal — full-screen no mobile com footer fixo */
  .modal-overlay { align-items: flex-start; padding: 0; }
  .modal, .modal-box {
    max-width: 100% !important;
    border-radius: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }
  .modal-body { padding: 16px; gap: 12px; }
  .modal-header { padding: 14px 16px; flex-shrink: 0; }
  .modal-footer {
    padding: 12px 16px;
    position: sticky;
    bottom: 0;
    background: #0f0f1e;
    z-index: 1;
    flex-shrink: 0;
    margin-top: auto;
  }

  /* Form row: 1 coluna no mobile */
  .form-row { grid-template-columns: 1fr; }
}

/* ── Mission row: empilha ações no mobile ── */
@media (max-width: 600px) {
  .mission-row { flex-wrap: wrap; }
  .mission-row-actions { width: 100%; justify-content: flex-end; }
}

/* ── Núcleos ── */
.nucleo-location-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,.3);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.nucleo-location-badge-lg {
  font-size: .82rem;
  padding: 3px 10px;
  border-color: rgba(201,168,76,.45);
  background: rgba(201,168,76,.1);
}
.nucleo-badge-missing {
  color: #e09a30;
  background: rgba(224,154,48,.08);
  border-color: rgba(224,154,48,.3);
}

.nucleo-active-banner {
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, rgba(201,168,76,.08) 0%, rgba(155,114,239,.06) 100%);
  border: 1px solid rgba(201,168,76,.3);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.nucleo-active-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.nucleo-active-icon { font-size: 1.8rem; line-height: 1; }
.nucleo-active-label {
  font-size: .72rem;
  font-family: var(--font-ui);
  color: var(--gold);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.nucleo-active-name {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--gold2);
  letter-spacing: .05em;
}
.nucleo-active-desc {
  font-size: .85rem;
  color: var(--text2);
  margin-top: 4px;
}

.nucleo-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  transition: border-color .2s;
}
.nucleo-card:hover { border-color: var(--border2); }
.nucleo-card-active {
  border-color: rgba(201,168,76,.45);
  background: linear-gradient(135deg, rgba(201,168,76,.05) 0%, var(--surface2) 100%);
}
.nucleo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.nucleo-card-name {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--text);
  letter-spacing: .04em;
}
.nucleo-badge-active {
  font-size: .7rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--gold2);
  background: rgba(201,168,76,.12);
  border: 1px solid rgba(201,168,76,.35);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.nucleo-card-desc {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.5;
}
.nucleo-card-stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.nucleo-stat {
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--font-ui);
}
.nucleo-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}

/* ── Localidades dentro do card de núcleo ── */
.localidades-list {
  border-top: 1px solid var(--border);
  margin-top: .5rem;
  padding-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.localidade-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
}
.localidade-item:hover { background: rgba(255,255,255,.05); }
.localidade-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.localidade-item-name {
  font-size: .85rem;
  color: var(--gold);
  font-family: var(--font-ui);
  font-weight: 600;
}
.localidade-item-desc {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.localidade-item-actions {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}

/* ── Residência ── */
.residence-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.residence-cover {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  flex-shrink: 0;
}
.residence-cover-placeholder {
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
  color: var(--muted);
}
.residence-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.residence-header-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.residence-header-row h4 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--gold2);
}
.residence-type-badge {
  font-size: .7rem;
  font-family: var(--font-ui);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(155,114,239,.18);
  color: var(--accent);
  border: 1px solid rgba(155,114,239,.3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.residence-location {
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--font-ui);
}
.residence-desc {
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.55;
  white-space: pre-wrap;
}
.residence-notes {
  margin-top: .25rem;
  border-top: 1px solid var(--border);
  padding-top: .5rem;
}
.residence-notes-label {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .3rem;
  font-family: var(--font-ui);
}
.residence-notes p {
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Galeria */
.residence-gallery-wrap {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.residence-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .6rem;
}
.residence-gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
  background: var(--surface3);
}
.residence-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.residence-gallery-item:hover img { transform: scale(1.04); }
.residence-gallery-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(7,7,14,.75);
  color: var(--text2);
  font-size: .7rem;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-ui);
}
.residence-gallery-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(224,85,85,.85);
  color: #fff;
  font-size: .65rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.residence-gallery-item:hover .residence-gallery-remove { display: flex; }
.residence-add-photo-btn { align-self: flex-start; }

@media (max-width: 520px) {
  .residence-card { flex-direction: column; }
  .residence-cover, .residence-cover-placeholder { width: 100%; height: 180px; }
}

/* ── Lightbox ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 10, .96);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1.25rem 4rem;
}
.lightbox-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  max-width: min(92vw, 1100px);
  width: 100%;
}
.lightbox-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lightbox-counter {
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--font-ui);
  min-width: 52px;
}
.lightbox-topbar-actions {
  display: flex;
  gap: .35rem;
}
.lightbox-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: .3rem .75rem;
  font-size: .76rem;
  font-family: var(--font-ui);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.lightbox-action-btn:hover { background: rgba(255,255,255,.14); color: var(--text); }
.lightbox-img-wrap {
  overflow: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(90vh - 100px);
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
#lb-img {
  max-width: min(90vw, 1100px);
  max-height: calc(90vh - 100px);
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: transform .3s cubic-bezier(.25,.46,.45,.94);
  transform-origin: center;
  border-radius: var(--radius);
}
#lb-img.zoomed {
  transform: scale(2.6);
  cursor: zoom-out;
}
.lightbox-caption-bar {
  width: 100%;
  text-align: center;
  padding: .25rem 0;
}
#lb-caption {
  font-size: .85rem;
  color: var(--text2);
  font-family: var(--font-ui);
  line-height: 1.45;
}
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
  z-index: 2001;
  line-height: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,.16); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
/* A foto de capa da residência vira clicável */
.residence-cover { cursor: pointer; transition: opacity .15s; }
.residence-cover:hover { opacity: .88; }

/* Dashboard: stat com link de núcleo */
.dash-stat-nucleo {
  text-decoration: none;
  cursor: pointer;
  transition: opacity .2s;
}
.dash-stat-nucleo:hover { opacity: .8; }
.dash-stat-val-sm { font-size: 1.1rem !important; }

/* Oculta o botão Sair enquanto qualquer modal estiver aberto */
body.modal-open #sair-form { display: none; }
