.gm-modal-overlay {
  position: fixed;
  inset: 0;
  padding-top: calc(clamp(14px, 2.2vw, 24px) * 2 + 48px);
  padding-left: 16px;
  padding-right: 16px;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.gm-modal-overlay.is-open {
  display: flex;
}

body.gm-modal-open {
  overflow: hidden;
}

.gm-modal {
  background: var(--panel);
  border-radius: 10px;
  border: 1px solid var(--border);
  width: min(720px, 94vw);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.gm-modal__header {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.gm-modal__title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  align-items: center;
  text-align: center;
}

.gm-modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.gm-modal__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: none;
}

.gm-modal__close {
  flex-shrink: 0;
  display: none;
}

.gm-modal__body {
  padding: 16px 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.gm-modal__footer {
  padding: 20px 16px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: nowrap;
}

/* Stacked footer layout (used for What's New modal) */
.gm-modal__footer--stacked {
  flex-direction: column;
}

.gm-modal__view {
  flex: 1;
  display: none;
  min-height: 0;
}

.gm-modal__view--active {
  display: flex;
}

.gm-modal__releases-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 18px;
}

.gm-modal__release-current {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gm-modal__release-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.gm-modal__release-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.gm-modal__release-date {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.gm-modal__arrow-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}

.gm-modal__arrow-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.gm-modal__arrow-list li::before {
  content: "→";
  color: var(--muted);
  margin-top: 2px;
  flex-shrink: 0;
}

.gm-modal__history-link {
  text-decoration: none;
}

/* ──────────────── ULTRA‑SMALL MOBILE FIXES ──────────────── */

.label-short {
  display: none;
}

@media (max-width: 360px) {
  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .release-history-subtitle {
    display: none;
  }

  .release-history-header {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .release-history-title {
    text-align: center;
  }
}

@media (max-width: 860px) {
  .gm-modal {
    max-height: min(75vh, 620px);
  }
}

/* ──────────────── GUILD NEWS EDITOR MODAL ──────────────── */

.guild-news-modal__body {
  flex-direction: column;
  padding: 14px 16px;
}

.guild-news-modal__textarea {
  flex: 1;
  width: 100%;
  min-height: 180px;
  resize: vertical;
  background: var(--surface, rgba(255, 255, 255, 0.03));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  font-family: inherit;
  box-sizing: border-box;
}

.guild-news-modal__textarea:focus {
  outline: 2px solid var(--accent, #5865f2);
  outline-offset: 1px;
}

.guild-news-modal__counter {
  font-size: 0.8rem;
  color: var(--muted, #888);
  text-align: right;
  margin-top: 4px;
}

.guild-news-modal__counter--warn {
  color: #facc15;
}

.guild-news-modal__counter--over {
  color: #c24b4b;
  font-weight: 600;
}

.guild-news-modal__error {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: #f87171;
}

.rival-reports-modal__body {
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.rival-reports-modal__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.rival-reports-modal__content {
  padding: 14px 16px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rival-reports-modal__placeholder,
.rival-reports-modal__empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin: auto;
}

.rival-reports-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface, rgba(255,255,255,0.03));
}

.rival-reports-item__title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.rival-reports-item__row {
  font-size: 0.88rem;
  color: var(--text);
}

.rival-reports-item__row span {
  color: var(--muted);
  margin-right: 4px;
}

/* ── Progression & Trends – week-by-week bar charts ── */

.rival-reports-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rival-reports-chart__week {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface, rgba(255,255,255,0.03));
}

.rival-reports-chart__week-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rival-reports-chart__trend {
  font-size: 0.85rem;
  font-weight: 400;
}

.rival-reports-chart__trend--up { color: #4caf50; }
.rival-reports-chart__trend--down { color: #ef5350; }
.rival-reports-chart__trend--stable { color: var(--muted); }

.rival-reports-chart__bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rival-reports-chart__bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.rival-reports-chart__bar-label {
  min-width: 90px;
  color: var(--muted);
  flex-shrink: 0;
  text-align: right;
}

.rival-reports-chart__bar-track {
  flex: 1;
  height: 16px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.rival-reports-chart__bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .rival-reports-chart__bar-fill {
    transition: none;
  }
}

.rival-reports-chart__bar-fill--participation { background: #42a5f5; }
.rival-reports-chart__bar-fill--perfect { background: #66bb6a; }
.rival-reports-chart__bar-fill--attacked { background: #ffa726; }
.rival-reports-chart__bar-fill--afk { background: #ef5350; }

.rival-reports-chart__bar-value {
  min-width: 42px;
  font-size: 0.82rem;
  color: var(--text);
  flex-shrink: 0;
}

.rival-reports-chart__summary {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Insights & Alerts – section styling ── */

.rival-reports-insights__section {
  margin-bottom: 14px;
}

.rival-reports-insights__heading {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rival-reports-insights__row {
  font-size: 0.88rem;
  color: var(--text);
  padding: 4px 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rival-reports-insights__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.rival-reports-insights__badge--danger { background: rgba(239,83,80,0.18); color: #ef5350; }
.rival-reports-insights__badge--warning { background: rgba(255,167,38,0.18); color: #ffa726; }
.rival-reports-insights__badge--success { background: rgba(76,175,80,0.18); color: #4caf50; }

/* ──────────────── WIDE MODAL VARIANT (notification log, etc.) ──────────────── */

.gm-modal--wide {
  width: min(960px, 96vw);
  max-height: min(80vh, 640px);
}

/* ──────────────── NOTIFICATION LOG TABLE ──────────────── */

.notif-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.notif-log-table th,
.notif-log-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border, #333);
  white-space: nowrap;
}

.notif-log-table th {
  font-weight: 600;
  opacity: 0.8;
  position: sticky;
  top: 0;
  background: var(--panel, #1a1a2e);
}

.notif-log-table .status-sent {
  color: #4caf50;
}

.notif-log-table .status-failed {
  color: #f44336;
}

/* ──────────────── NOTIFICATION PREVIEW & PREFERENCES ──────────────── */

.notif-preview-lang {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border, #333);
}

.notif-preview-lang__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.notif-preview-lang__select {
  padding: 5px 10px;
  border: 1px solid var(--border, #444);
  border-radius: 5px;
  background: var(--panel, #1a1a2e);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.notif-preview-lang__hint {
  font-size: 0.75rem;
  color: var(--muted, #888);
}

.notif-preview-list {
  display: grid;
  gap: 12px;
}

.notif-preview-card {
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface, rgba(255, 255, 255, 0.03));
}

.notif-preview-card__name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.notif-preview-card__details {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.notif-preview-card__row {
  font-size: 0.82rem;
  color: var(--muted, #888);
  display: flex;
  gap: 6px;
}

.notif-preview-card__row strong {
  color: var(--text);
  min-width: 100px;
  flex-shrink: 0;
}

.notif-preview-card__example {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, #333);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ──────────────── CUSTOM NOTIFICATIONS SECTION ──────────────── */

.custom-notif-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #333);
}

.custom-notif-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.custom-notif-section__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.custom-notif-section__count {
  font-size: 0.78rem;
  color: var(--muted, #888);
  font-weight: 600;
}

.custom-notif-section__desc {
  font-size: 0.78rem;
  color: var(--muted, #888);
  margin: 0 0 12px;
}

.custom-notif-section__actions {
  margin-top: 10px;
}

/* ── Custom notification preview card header with delete ── */

.notif-preview-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.notif-preview-card__header .notif-preview-card__name {
  flex: 1;
  min-width: 0;
}

.notif-preview-card__delete {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 4px;
  color: #f87171;
  font-size: 0.72rem;
  padding: 2px 8px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.notif-preview-card__delete:hover {
  opacity: 1;
  background: rgba(220, 38, 38, 0.12);
}

.notif-preview-card--custom {
  border-color: rgba(88, 101, 242, 0.3);
}

/* ── Custom notification form ── */

.custom-notif-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  background: var(--surface, rgba(255, 255, 255, 0.03));
}

.custom-notif-form__field {
  margin-bottom: 12px;
}

.custom-notif-form__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.custom-notif-form__optional {
  font-weight: 400;
  color: var(--muted, #888);
  font-size: 0.78rem;
}

.custom-notif-form__input,
.custom-notif-form__select,
.custom-notif-form__textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border, #444);
  border-radius: 5px;
  background: var(--panel, #1a1a2e);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
}

.custom-notif-form__input--short {
  width: auto;
  min-width: 140px;
}

.custom-notif-form__textarea {
  resize: vertical;
  min-height: 48px;
}

.custom-notif-form__hint {
  display: block;
  font-size: 0.72rem;
  color: var(--muted, #888);
  margin-top: 2px;
}

.custom-notif-form__counter {
  display: block;
  font-size: 0.72rem;
  color: var(--muted, #888);
  text-align: right;
  margin-top: 2px;
}

.custom-notif-form__counter--warn {
  color: #facc15;
}

.custom-notif-form__counter--over {
  color: #c24b4b;
  font-weight: 600;
}

.custom-notif-form__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.custom-notif-empty {
  font-size: 0.82rem;
  color: var(--muted, #888);
  text-align: center;
  padding: 10px 0;
}
