:root {
  --navy: #0b3a52;
  --navy-dark: #071923;
  --navy-mid: #0d2c3d;
  --accent: #c45c28;
  --amber: #f4b63f;
  --paper: #dedede;
  --white: #ffffff;
  --ink: #163044;
  --muted: #5b7380;
  --line: #c9d5db;
  --teal: #1e5f8a;
  --body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
}

.admin-shell {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

body.classified-mode.admin-shell {
  height: 100vh;
  overflow: hidden;
}

body.classified-mode .shell-main {
  min-height: 0;
}

/* Sidebar — US911S structure, GES colours */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  height: 100%;
  max-height: 100vh;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.12);
  z-index: 40;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1.35rem 1.15rem;
  border-bottom: 1px solid rgba(244, 182, 63, 0.25);
  flex-shrink: 0;
}

.sidebar-mark {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.25;
}

.sidebar-brand p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  opacity: 0.85;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.65rem 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 182, 63, 0.45) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(244, 182, 63, 0.45);
  border-radius: 99px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-label {
  margin: 0.85rem 0.75rem 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  margin: 2px 4px;
  border-radius: 8px;
  border-left: 4px solid transparent;
  position: relative;
}

.sidebar-item-label {
  flex: 1;
  min-width: 0;
}

.sidebar-item i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.sidebar-item:hover {
  background: rgba(226, 117, 56, 0.22);
}

.sidebar-item.active {
  background: rgba(226, 117, 56, 0.32);
  border-left-color: var(--amber);
}

.nav-wip {
  flex: 0 0 auto;
  margin-left: auto;
  color: #f4d03f;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1;
}

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 2px #0f2a38;
  flex-shrink: 0;
}

.nav-badge[hidden] {
  display: none !important;
}

.nav-badge-sm {
  min-width: 1rem;
  height: 1rem;
  font-size: 0.62rem;
  margin-left: 0.25rem;
  box-shadow: none;
  vertical-align: middle;
}

.mail-folder .nav-badge-sm {
  display: inline-grid;
}

.shell-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  background: var(--white);
  border-bottom: 2px solid var(--navy);
  box-shadow: 0 2px 10px rgba(11, 58, 82, 0.08);
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  flex-shrink: 0;
}

.top-bar h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy-dark);
  flex: 0 0 auto;
  white-space: nowrap;
}

.dev-banner {
  display: none;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.dev-banner.is-on {
  display: flex;
}

.dev-banner[hidden] {
  display: none !important;
}

.dev-banner-inner {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: rgba(244, 182, 63, 0.14);
  border: 1px solid rgba(196, 92, 40, 0.4);
  color: var(--navy-dark);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  animation: dev-glow 2.6s ease-in-out infinite;
}

.dev-banner-inner strong {
  color: var(--accent);
  letter-spacing: 0.04em;
  font-weight: 800;
}

@keyframes dev-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(196, 92, 40, 0.22), 0 0 10px rgba(244, 182, 63, 0.18);
    background: rgba(244, 182, 63, 0.1);
  }
  50% {
    box-shadow: 0 0 10px rgba(196, 92, 40, 0.5), 0 0 22px rgba(244, 182, 63, 0.55);
    background: rgba(244, 182, 63, 0.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dev-banner-inner {
    animation: none;
    box-shadow: 0 0 10px rgba(244, 182, 63, 0.42);
    background: rgba(244, 182, 63, 0.22);
  }
}

.impersonate-banner {
  display: none;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 0;
}

.impersonate-banner.is-on {
  display: flex;
}

.impersonate-banner[hidden] {
  display: none !important;
}

.impersonate-banner-inner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  max-width: 100%;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: rgba(30, 95, 138, 0.12);
  border: 1px solid rgba(11, 58, 82, 0.35);
  color: var(--navy-dark);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.impersonate-banner-inner strong {
  color: #0b3a52;
  font-weight: 800;
}

.impersonate-banner-meta {
  color: #4a6678;
  font-weight: 500;
}

.impersonate-banner .admin-btn {
  flex-shrink: 0;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
}

.notify-mute-btn {
  min-width: 2.1rem;
  padding: 0.35rem 0.45rem;
  color: var(--navy);
}

.notify-mute-btn.is-muted {
  color: #8a2a22;
  opacity: 0.9;
}

.ges-notify-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ges-notify-modal[hidden] {
  display: none !important;
}

.ges-notify-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(11, 58, 82, 0.45);
  cursor: pointer;
}

.ges-notify-card {
  position: relative;
  z-index: 1;
  width: min(26rem, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem 1.2rem;
  box-shadow: 0 12px 40px rgba(11, 58, 82, 0.22);
}

.ges-notify-card h3 {
  margin: 0 0 0.45rem;
  color: var(--navy);
  font-size: 1.1rem;
}

.ges-notify-card p {
  margin: 0 0 0.55rem;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.45;
}

.ges-notify-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.top-bar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.world-status-bar {
  background: #f4f7f9;
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 1.25rem;
  flex-shrink: 0;
}

.world-status-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.35rem;
}

.world-status-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8eef2;
  padding: 0.28rem 0.2rem 0.32rem;
  min-width: 0;
}

.world-status-chip .ws-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy-dark);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.flag-img {
  width: 20px;
  height: 14px;
  object-fit: contain;
  object-position: center;
  border-radius: 2px;
  flex: 0 0 auto;
  image-rendering: auto;
  background: #d5dee5;
  box-shadow: 0 0 0 1px rgba(11, 58, 82, 0.12);
}

.world-status-chip .ws-state {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.08rem 0.4rem;
}

.world-status-chip.is-online .ws-state {
  background: #e6f6ec;
  color: #157a3c;
}

.world-status-chip.is-offline .ws-state {
  background: #fde8e8;
  color: #b42318;
}

.world-status-chip.is-offline {
  border-color: #f2b8b5;
  background: #fff7f7;
}

.world-status-chip.is-checking .ws-state {
  background: #eef2f4;
  color: var(--muted);
}
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--navy);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.4rem 1.5rem 2.5rem;
}

.boot-loader {
  min-height: calc(100vh - 5.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: var(--navy);
}
.boot-loader i {
  font-size: 2.4rem;
  color: #1e5f8a;
}
.boot-loader p {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}
.boot-loader[hidden] {
  display: none !important;
}

#app-panel:not([hidden]) {
  display: block;
}

html.is-booting .panel-section {
  display: none !important;
}

.page-intro {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  max-width: 46rem;
}

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  max-width: none;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  background: #e8f2fb;
  border: 1px solid #9ec5e8;
  color: #0b3a52;
}

.info-box-icon {
  flex-shrink: 0;
  margin-top: 0.12rem;
  font-size: 1.05rem;
  color: #1e6fba;
}

.info-box p {
  margin: 0;
  color: #0b3a52;
  max-width: none;
  font-size: 0.92rem;
  line-height: 1.45;
}

.mem-intro {
  align-items: flex-start;
}
.mem-intro-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 16rem;
  flex: 1 1 18rem;
}
.mem-intro-copy .admin-muted {
  margin: 0;
}
.mem-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}
.mem-toolbar #mem-search {
  min-width: 11rem;
  flex: 1 1 11rem;
}

.stat-card {
  background: var(--white);
  border: 2px solid var(--navy);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(11, 58, 82, 0.08);
  padding: 1.15rem 1.25rem 1.3rem;
  margin-bottom: 1rem;
}

.inner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}

.inner-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.inner-tab.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.board-world-tabs {
  flex-wrap: wrap;
  margin: 0.85rem 0;
}

.news-articles {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.news-article {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: #f8fbfd;
}

.news-article h3 {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  color: var(--navy-dark);
}

.news-article p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.news-article-meta {
  margin: 0 0 0.45rem !important;
  color: var(--muted);
  font-size: 0.82rem;
}

.news-public-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  margin-top: 0.85rem;
}

.news-public-label input {
  width: auto;
  margin: 0;
}

.stat-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  color: var(--navy-dark);
}

.stat-card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  color: var(--navy);
}

.stat-card h3 small {
  color: var(--muted);
  font-weight: 500;
}

.admin-muted {
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.45;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.75rem;
}

.notice-fields {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 0.5rem;
}

.notice-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.notice-fields input,
.notice-fields textarea,
.notice-fields select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}

.notice-fields textarea {
  min-height: 10rem;
  resize: vertical;
  line-height: 1.45;
}

.message-option-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.message-option-current {
  margin-top: 0.35rem;
}

.message-option-chip.is-admins {
  background: #fff3d6;
  color: #8a5a00;
}

.message-option-chip.is-members {
  background: #d7ebf7;
  color: var(--teal);
}

.message-option-chip.is-unknown {
  background: #e8eef2;
  color: var(--muted);
}

@media (max-width: 720px) {
  .message-option-fields {
    grid-template-columns: 1fr;
  }
}

.field-hint {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-stack {
  display: grid;
  gap: 1.15rem;
}

.version-saves {
  display: grid;
  grid-template-columns: minmax(12rem, 1.4fr) minmax(10rem, 1fr);
  gap: 0.75rem;
  margin: 0 0 0.5rem;
}

.version-saves label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.version-saves select,
.version-saves input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}

#pretext-save-hint,
#rules-save-hint {
  margin-bottom: 0.85rem;
}

@media (max-width: 720px) {
  .version-saves {
    grid-template-columns: 1fr;
  }
}

.admin-btn {
  appearance: none;
  border: 1px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.admin-btn:hover {
  background: #eef5f8;
}

.admin-btn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.admin-btn.primary:hover {
  background: var(--navy-mid);
}

.admin-btn.ghost {
  background: transparent;
  border-color: var(--line);
}

.admin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.infra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.infra-table th,
.infra-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.infra-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card input[type="file"] {
  width: 100%;
}

.admin-avatar-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

#avatar-preview {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--navy);
}

.branding-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.85rem;
  margin: 0.25rem 0 0.5rem;
}

.branding-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem;
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
}

.branding-card:hover {
  border-color: var(--teal);
}

.branding-card.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 95, 138, 0.22);
}

.branding-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  display: block;
}

.branding-card-label {
  font-weight: 600;
  font-size: 0.88rem;
}

.branding-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.push-progress {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: #f4f7f9;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.push-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.push-progress-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.push-progress-pct {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.push-progress-track {
  height: 12px;
  background: #d7e2e8;
  border-radius: 999px;
  overflow: hidden;
}

.push-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), #2d7aad);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.push-progress-worlds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.push-world {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #e8eef2;
  color: var(--muted);
}

.push-world.is-running {
  background: #d7ebf7;
  color: var(--teal);
}

.push-world.is-ok {
  background: #d7f0e0;
  color: #1b6b3a;
}

.push-world.is-queued,
.push-world.is-retrying {
  background: #fff3d6;
  color: #8a5a00;
}

.push-world.is-failed,
.push-world.is-gave_up {
  background: #f8d7d7;
  color: #a32626;
}

.admin-status,
.push-log {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #f4f7f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  color: var(--ink);
}

.admin-error {
  color: #a32626;
  margin-top: 0.75rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}
#log-kpi-row {
  margin-top: -0.25rem;
}

.kpi-card {
  background: var(--white);
  border: 2px solid var(--navy);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  box-shadow: 0 4px 15px rgba(11, 58, 82, 0.08);
}

.kpi-card .kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-card .kpi-value {
  margin: 0.4rem 0 0;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
}

.kpi-card.is-warn {
  border-color: var(--accent);
}
.kpi-card.is-warn .kpi-value {
  color: var(--accent);
}
.kpi-card.is-drop {
  border-color: #a32626;
}
.kpi-card.is-drop .kpi-value {
  color: #a32626;
}
.kpi-card.is-btn,
button.kpi-card {
  cursor: pointer;
  text-align: left;
  font: inherit;
  width: 100%;
}
button.kpi-card.is-active {
  background: #eef5f8;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.report-grid-wide {
  margin-bottom: 0.85rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-head h3 { margin: 0; }

.chart-world {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-world select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.msg-sig {
  margin: 0.45rem 0 0.55rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed #9bb0bc;
  border-radius: 8px;
  background: #eef3f6;
}

.msg-sig-label {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5a6f7a;
}

.msg-sig-body {
  margin: 0;
  font: 0.82rem/1.35 Consolas, "Courier New", monospace;
  color: var(--navy);
  white-space: pre-wrap;
  user-select: none;
  pointer-events: none;
}

.msg-sent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-bottom: 0.2rem;
}

.msg-sent-head em {
  margin-left: auto;
  font-style: normal;
  color: var(--muted);
  font-size: 0.75rem;
}

.msg-sent-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.msg-sent-body {
  margin: 0.35rem 0 0.4rem;
  white-space: pre-wrap;
  font-size: 0.82rem;
  color: var(--navy);
}

.msg-sent-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.msg-sent-badge.is-ok {
  background: #d7f0e0;
  color: #146338;
}

.msg-sent-badge.is-recalled {
  background: #ece7d8;
  color: #7a5b12;
}

.msg-sent-badge.is-fail {
  background: #ead7d4;
  color: #8a2a22;
}

.msg-recall-btn {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
}

.compose-grid input,
#msg-new-body,
#msg-reply,
#msg-to,
#msg-subject {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.compose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.compose-grid label:first-child {
  grid-column: 1 / -1;
}

.compose-grid select {
  font: inherit;
  font-weight: 550;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mail-scan-status {
  margin-left: auto;
  font-size: 0.75rem;
}

.msg-item-world {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.msg-item-world .flag-img {
  vertical-align: middle;
}

.compose-grid label,
.mail-body-label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.compose-grid input,
#msg-new-body,
#msg-reply {
  width: 100%;
}

/* In-game messages — mail client */
body.mail-mode .world-status-bar {
  display: none !important;
}

body.mail-mode .content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 1rem 1rem;
}

body.mail-mode #app-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.mail-mode #section-messages:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.mail-shell {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
}

.mail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  flex-shrink: 0;
}

.mail-world {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--navy);
}

.mail-unread-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: #9a3412;
}

.mail-unread-hint button {
  margin: 0 0.15rem;
  padding: 0.12rem 0.4rem;
  border: 0;
  border-radius: 4px;
  background: #fde68a;
  color: #7c2d12;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.mail-world select {
  font: inherit;
  font-weight: 550;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mail-hint {
  margin-left: auto;
  font-size: 0.76rem;
}

.mail-client {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  flex: 1;
  min-height: min(68vh, 640px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(11, 58, 82, 0.04);
}

body.mail-mode .mail-client {
  min-height: 0;
}

.mail-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #f3f7f9;
}

.mail-sidebar [hidden] {
  display: none !important;
}

.mail-folders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.mail-folder {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #5a6b75;
  cursor: pointer;
}

.mail-folder:hover {
  background: #e8eef2;
}

.mail-folder.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(11, 58, 82, 0.06);
}

.msg-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.2rem 0;
}

.msg-list.msg-sent-list {
  max-height: none;
}

.msg-item {
  appearance: none;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e6eef2;
  background: transparent;
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
}

.msg-item:last-child {
  border-bottom: 0;
}

.msg-item:hover {
  background: #eef4f7;
}

.msg-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #d7e4ec;
  color: #0b3a52;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.msg-item-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.msg-item strong {
  color: var(--navy);
  font-size: 0.86rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-item span,
.msg-item em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-item.unread {
  background: #fff8f0;
}

.msg-item.unread .msg-avatar {
  background: #f0c9a0;
}

.msg-item.unread strong {
  font-weight: 800;
}

.msg-new-tag {
  color: #c0392b !important;
  font-weight: 750 !important;
  font-size: 0.68rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.msg-item.active {
  background: #e4eef4;
  box-shadow: inset 3px 0 0 var(--navy);
}

.msg-item.is-recalled {
  opacity: 0.65;
}

.mail-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.mail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.mail-pane[hidden] {
  display: none !important;
}

.mail-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: #fafcfd;
}

.mail-pane-head h3 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--navy);
}

.msg-thread {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  background:
    linear-gradient(180deg, #f7fafb 0%, #fff 48px);
}

.mail-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
  max-width: 16rem;
  line-height: 1.45;
}

.msg-bubble {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  max-width: min(42rem, 100%);
  align-self: flex-start;
}

.msg-bubble.is-mine {
  background: #e8f1f6;
  border-color: #c5d6e0;
  align-self: flex-end;
}

.msg-bubble pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.4;
}

.msg-meta {
  margin: 0 0 0.28rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 650;
}

.mail-compose-footer {
  border-top: 1px solid var(--line);
  padding: 0.65rem 1rem 0.75rem;
  background: #f5f8fa;
  flex-shrink: 0;
}

.mail-compose-footer .msg-sig {
  margin: 0.4rem 0 0.45rem;
  padding: 0.35rem 0.55rem;
}

.mail-compose-footer .msg-sig-body {
  font-size: 0.74rem;
  line-height: 1.3;
  max-height: 2.6rem;
  overflow: hidden;
}

.mail-compose-body {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
}

.mail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .mail-client {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mail-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 280px;
  }

  .mail-hint {
    margin-left: 0;
    width: 100%;
  }
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap-tall { height: 280px; }

.stat-card > label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.log-feed {
  display: grid;
  gap: 0.45rem;
  max-height: 22rem;
  overflow: auto;
}
.log-feed-row {
  display: grid;
  grid-template-columns: 2.4rem 6.2rem 1fr;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid #eef3f6;
  padding-top: 0.4rem;
}
.log-feed-row:first-child { border-top: 0; padding-top: 0; }
.log-feed-world {
  font-weight: 700;
  color: var(--navy);
}
.log-feed-body b { color: var(--ink); }

.app-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid #eef3f6;
  padding-top: 0.35rem;
}
.app-summary {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
}

.msg-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 0.85rem;
  align-items: stretch;
}

.msg-layout .msg-list {
  max-height: 520px;
  display: grid;
  gap: 0.35rem;
  padding: 0;
}

.msg-layout .msg-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  border-bottom: 1px solid var(--line);
}

.msg-layout .msg-item.active {
  box-shadow: none;
  border-color: var(--navy);
  background: #f4f8fb;
}

.msg-layout .msg-thread {
  max-height: 420px;
  display: grid;
}

.mem-kpis {
  grid-template-columns: repeat(6, 1fr);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

#funds-ledger {
  overflow-x: auto;
  margin-top: 0.6rem;
}

#funds-ledger h4 {
  margin: 0.9rem 0 0.35rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid #e6eef2;
  vertical-align: top;
}

.data-table th { color: var(--muted); font-weight: 600; }

.credits-table .credits-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.credits-table td .flag-img {
  vertical-align: -3px;
  margin-right: 0.35rem;
}

.discord-col {
  width: 2.4rem;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}
.seen-col {
  width: 6.5rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.seen-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.seen-ago {
  font-size: 0.75rem;
  color: var(--muted);
}
.seen-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  image-rendering: pixelated;
}
.discord-mark,
.discord-logo {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  object-fit: contain;
}
.discord-logo {
  display: block;
  margin: 0 auto;
}
.data-table .admin-muted {
  display: block;
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
}

.world-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.12rem 0.28rem;
  margin: 0.12rem 0.12rem 0.12rem 0;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.world-chip.is-more {
  background: #1e5f8a;
  min-width: auto;
  padding: 0.12rem 0.45rem;
}

.world-chip.dot-online { background: #22a45a; }
.world-chip.dot-d7 { background: #6b7280; }
.world-chip.dot-d30 { background: #2b6cb0; }
.world-chip.dot-d60 { background: #d4a017; color: #1a1404; }
.world-chip.dot-red { background: #c53030; }
.world-chip.mismatch { outline: 2px solid #c53030; outline-offset: 1px; }

.chip-cell { max-width: 28rem; }
.role-pill {
  display: inline-block;
  margin: 0 0.25rem 0.2rem 0;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e8eef2;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 600;
}
.role-pill.is-chief {
  background: #f4e4b0;
  color: #6b5208;
}
.role-pill.is-command {
  background: #d6e4ee;
  color: #0b3a52;
}
.role-pill.is-operations {
  background: #c5d8e8;
  color: #1b3f58;
}
.role-pill.is-treasurer {
  background: #efe0b8;
  color: #6b5208;
}
.role-pill.is-education {
  background: #cde8e6;
  color: #0e4f4a;
}
.role-pill.is-logistics {
  background: #dceee4;
  color: #1b5c38;
}
.role-pill.is-reception {
  background: #e8e0f2;
  color: #4a2d73;
}
.role-pill.is-dispatcher {
  background: #dde3f5;
  color: #2c3a7a;
}
.role-pill.is-excepted {
  background: #f4e4b0;
  color: #6b5208;
}
.except-btn {
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
}
.warn { color: #a32626; font-weight: 700; }
.data-table td strong { display: block; color: var(--navy); }
.data-table td:last-child {
  white-space: nowrap;
}
#mem-search, #mem-filter, #mem-world {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font: inherit;
}

.vbar {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 180px;
  overflow-x: auto;
}

.vbar-col {
  flex: 1 0 1.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 1.6rem;
  height: 180px;
  justify-content: flex-end;
}

.vbar-fill {
  width: 100%;
  max-width: 22px;
  background: linear-gradient(180deg, var(--amber), var(--accent));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.vbar-col.alt .vbar-fill {
  background: linear-gradient(180deg, #59c6ba, var(--teal));
}

.vbar-label {
  margin-top: 0.3rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.hbar {
  display: grid;
  gap: 0.55rem;
}

.hbar-row .hbar-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
}

.hbar-track {
  height: 8px;
  border-radius: 99px;
  background: #e6eef2;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--navy);
}

.rank-board-card {
  max-width: none;
}

.rank-board .rank-chase {
  padding: 0.55rem 0 0.65rem;
  border-bottom: 1px solid var(--line);
}

.rank-board .rank-chase:last-child {
  border-bottom: 0;
}

.rank-board .rank-chase-line {
  font-size: 0.82rem;
}

.rank-eta {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(30, 111, 186, 0.12);
  color: #0b3a52;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.rank-eta.is-muted {
  background: rgba(74, 102, 120, 0.12);
  color: #4a6678;
  font-weight: 600;
}

.rank-eta.is-warn {
  background: rgba(181, 71, 8, 0.14);
  color: #8a3b08;
}

.rank-chase {
  padding-bottom: 0.15rem;
}

.rank-chase.is-drop .hbar-fill {
  background: #b42318;
}

.rank-chase.is-drop .hbar-meta {
  color: #b42318;
  font-weight: 700;
}

.rank-chase.is-slip .hbar-fill {
  background: #b54708;
}

.rank-chase-line {
  margin: 0.2rem 0 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.rank-race-tag {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5a6f7a;
  min-width: 3.6rem;
}

.rank-chase-rival {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-chase-rival.is-gaining {
  color: #17663a;
  font-weight: 600;
}

.rank-chase-rival.is-holding {
  color: #a15c07;
  font-weight: 600;
}

.rank-chase-rival.is-slipping {
  color: #b42318;
  font-weight: 600;
}

.rank-chase-sep {
  flex: 0 0 auto;
  width: 1px;
  align-self: stretch;
  min-height: 0.95em;
  background: #8aa0ab;
}

.rank-chase-pace {
  flex: 0 0 auto;
  white-space: nowrap;
}

.rank-chase-pace.is-gaining {
  color: #17663a;
  font-weight: 600;
}

.rank-chase-pace.is-slipping,
.rank-chase.is-drop .rank-chase-pace.is-slipping {
  color: #b42318;
  font-weight: 600;
}

.infra-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.infra-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  background: #f7fafb;
}

.infra-tile b {
  display: block;
  color: var(--navy);
  font-size: 1.1rem;
}

.infra-tile span {
  color: var(--muted);
  font-size: 0.75rem;
}

.empty-chart {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.bb-editor {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin: 0.35rem 0;
}

.bb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  background: #f4f7f9;
}

.bb-toolbar-group {
  display: flex;
  gap: 0.25rem;
  padding-right: 0.45rem;
  border-right: 1px solid var(--line);
}

.bb-toolbar-spacer { flex: 1; }

.bb-toolbar button,
.bb-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.28rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.bb-mode {
  font-size: 0.75rem;
  color: var(--muted);
}

.bb-surface {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  padding: 0.85rem 1rem;
  outline: none;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
}

.bb-surface a { color: var(--teal); }

.bb-code {
  width: 100%;
  min-height: 220px;
  border: 0;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88rem;
  resize: vertical;
  color: var(--ink);
  background: #f8fafb;
}

/* Login */
.login-page {
  background: #1a1f24;
  color: #fff;
}

.portal-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.portal-login-card {
  width: 100%;
  max-width: 24rem;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  border-top: 4px solid var(--amber);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.login-brand img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
}

.login-eyebrow {
  text-align: center;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-title {
  text-align: center;
  margin: 0 0 0.65rem;
  font-size: 1.7rem;
  color: var(--navy-dark);
}

.login-access {
  text-align: center;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.login-meta {
  margin: 1.1rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid #d8dee3;
  display: grid;
  gap: 0.28rem;
}

.login-meta > div {
  display: grid;
  grid-template-columns: 6.75rem 1fr;
  gap: 0.65rem;
  align-items: baseline;
  font-size: 0.8rem;
  line-height: 1.35;
}

.login-meta dt {
  margin: 0;
  color: #3a4650;
  font-weight: 700;
}

.login-meta dd {
  margin: 0;
  color: #4a5560;
  word-break: break-word;
}

.portal-login-card label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-login-card input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7fafb;
  color: var(--ink);
  font: inherit;
}

.login-submit { width: 100%; }

.login-foot {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.login-foot a { color: var(--muted); }

/* Wynyard-style split gate (login only) */
.login-gate-page {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.login-gate {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 0;
  background: #eceff1;
  color: #1a1f24;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  border: 1px solid #0d1216;
  overflow: hidden;
}

.login-gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.35rem 1rem;
  text-align: center;
  color: #fff;
  background:
    linear-gradient(155deg, rgba(7, 25, 35, 0.35), rgba(7, 25, 35, 0.55)),
    repeating-linear-gradient(
      135deg,
      #0a4a58 0 10px,
      #0c5565 10px 20px
    );
  border-right: 1px solid #072028;
}

.login-gate-logo {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(244, 182, 63, 0.65);
}

.login-gate-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.login-gate-short {
  margin: 0;
  color: var(--amber);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.login-gate-panel {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.25rem 0;
  background: #f3f5f6;
  min-width: 0;
}

.login-gate-head,
.login-gate-form,
.login-gate-error,
.login-gate-info,
.login-gate .login-meta {
  max-width: none;
  width: 100%;
}

.login-gate-head {
  margin-bottom: 0.85rem;
}

.login-gate-head h1 {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1f24;
  letter-spacing: -0.01em;
}

.login-gate-sub {
  margin: 0.2rem 0 0;
  color: #9a7b3a;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-gate-error {
  margin: 0 0 0.55rem;
}

.login-gate-form label {
  display: block;
  margin: 0 0 0.2rem;
  color: #3a4650;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-gate-form input {
  width: 100%;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0;
  border: 1px solid #b7c0c7;
  background: #fff;
  color: #1a1f24;
  font: inherit;
  font-size: 0.92rem;
}

.login-gate-form input:focus {
  outline: 2px solid rgba(244, 182, 63, 0.55);
  outline-offset: 1px;
  border-color: #8a7040;
}

.login-gate-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin: 0.05rem 0 0.15rem;
}

.login-gate-actions .login-gate-forgot {
  margin-right: auto;
}

.login-gate-abort,
.login-gate-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5rem;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.login-gate-abort {
  background: #6b757c;
  color: #fff;
}

.login-gate-abort:hover {
  background: #5a6369;
}

.login-gate-ok {
  background: #c9a227;
  color: #1a1f24;
}

.login-gate-ok:hover {
  background: #d4ae32;
}

.login-gate-ok:disabled {
  opacity: 0.65;
  cursor: wait;
}

.login-invite-hint {
  margin: 0.35rem 0 0;
  color: #6b757c;
  font-size: 0.72rem;
  line-height: 1.35;
}

.login-gate-forgot {
  border: 0;
  background: transparent;
  color: #6b757c;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  min-width: 0;
}

.login-gate-forgot:hover {
  color: #1a1f24;
}

.login-forgot-copy {
  margin: 0 0 0.65rem;
  color: #4a5560;
  font-size: 0.8rem;
  line-height: 1.35;
}

.login-gate-info {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.6rem;
  background: #e8f5ec;
  color: #1f5c38;
  font-size: 0.82rem;
  line-height: 1.3;
}

.login-gate .login-meta {
  margin-top: 0.85rem;
  border-top: 1px solid #d0d6db;
  padding-top: 0.55rem;
  margin-bottom: 0.65rem;
  gap: 0.18rem;
}

.login-gate .login-meta > div {
  grid-template-columns: 6.25rem 1fr;
  font-size: 0.76rem;
}

.login-gate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1.25rem;
  padding: 0.35rem 0.75rem;
  background: #3a4248;
  color: #c5cbd0;
}

.login-gate-clock {
  display: inline-block;
  min-width: 5.6rem;
  padding: 0.2rem 0.45rem;
  background: #050607;
  color: #39ff6a;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.login-gate-bar-brand {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #c5cbd0;
}

.login-gate-bar-brand a {
  color: #9ec8ff;
  text-decoration: underline;
  text-transform: lowercase;
}

.login-gate-bar-brand a:hover {
  color: #cfe4ff;
}

@media (max-width: 720px) {
  .login-gate {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-gate-brand {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    border-right: 0;
    border-bottom: 1px solid #072028;
  }

  .login-gate-logo {
    width: 56px;
    height: 56px;
  }

  .login-gate-name {
    font-size: 0.72rem;
    text-align: left;
    line-height: 1.25;
  }

  .login-gate-name br { display: none; }

  .login-gate-short {
    margin-left: auto;
    font-size: 1rem;
  }

  .login-gate-panel {
    padding: 1.25rem 1.15rem 0;
  }

  .login-gate-bar {
    margin: 0 -1.15rem;
  }

  .login-gate-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .login-gate-actions .login-gate-forgot {
    flex: 1 0 100%;
    margin: 0 0 0.35rem;
    text-align: left;
  }

  .login-gate-abort,
  .login-gate-ok {
    flex: 1;
  }
}

.account-card {
  margin-bottom: 0.65rem;
  padding: 0.85rem 1rem;
}

#section-account .page-intro,
#section-account .account-intro {
  margin-bottom: 0.55rem;
}

#section-account .info-box {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  gap: 0.5rem;
}

#section-account .info-box p {
  font-size: 0.86rem;
  line-height: 1.35;
}

.account-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.account-field {
  display: block;
  margin: 0.35rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.account-display-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.85rem;
}

.account-display-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.55rem;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.account-select,
.account-card input[type="text"],
.account-card input[type="password"] {
  width: 100%;
  max-width: none;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
}

.account-date-preview {
  margin: 0;
  font-size: 0.8rem;
}

.account-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.account-grid .admin-btn {
  margin-top: 0.45rem;
}

.account-ip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.account-ip-head h2 {
  margin: 0;
}

.account-ip-hint {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
}

.account-ip-table {
  width: 100%;
}

#section-account .admin-muted[hidden],
#section-account .admin-error[hidden] {
  display: none;
}

.roster-panel-card {
  padding: 0;
  overflow: hidden;
}
.roster-frame {
  display: block;
  width: 100%;
  min-height: min(78vh, 920px);
  border: 0;
  background: transparent;
}

.admin-roster-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.admin-roster-label {
  margin: 0;
  min-width: 10rem;
  text-align: center;
  font-size: 1.15rem;
  color: var(--ink);
}
.admin-roster-live,
.admin-roster-staff {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.admin-roster-live-card,
.admin-roster-pill {
  background: #f4f7f9;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  padding: 0.65rem 0.75rem;
  min-width: 10.5rem;
  color: var(--ink);
}
.admin-roster-live-card strong,
.admin-roster-pill strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}
.admin-roster-live-card span,
.admin-roster-pill span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.admin-roster-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.admin-roster-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.admin-roster-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aadb6;
}
.admin-roster-dot.on { color: var(--ink) }
.admin-roster-dot.panel.on::before { background: #c45c28 }
.admin-roster-dot.game.on::before { background: #1e8a6a }

.admin-roster-grid-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  border: 1px solid var(--line);
  background: #fff;
}
.admin-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(104px, 1fr));
  min-width: 760px;
}
.admin-month-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.5rem 0.35rem;
  background: #e8eef2;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.admin-month-day {
  min-height: 104px;
  padding: 0.4rem;
  border-right: 1px solid #e4ebef;
  border-bottom: 1px solid #e4ebef;
  background: #fff;
  color: var(--ink);
}
.admin-month-day.is-pad {
  background: #f3f6f8;
  min-height: 72px;
}
.admin-month-day.is-today {
  background: #fff8ee;
  box-shadow: inset 0 0 0 2px var(--amber);
}
.admin-month-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.admin-month-events {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.admin-roster-chip {
  display: block;
  padding: 0.22rem 0.32rem;
  font-size: 0.68rem;
  line-height: 1.25;
  border-left: 3px solid transparent;
  color: #102433;
}
.admin-roster-chip b { display: block; font-weight: 700 }
.admin-roster-chip em {
  display: block;
  font-style: normal;
  color: #355064;
  font-size: 0.64rem;
}
.admin-roster-chip.kind-free { background: #e4f4ea; border-color: #2f8a55 }
.admin-roster-chip.kind-away { background: #f7ecdc; border-color: #b7792f }
.admin-roster-chip.kind-holiday { background: #e4eef8; border-color: #3d6f9e }
.admin-roster-chip.kind-on_call { background: #efe8f8; border-color: #6b4c9a }
.admin-roster-chip.kind-unavailable { background: #f6e4e4; border-color: #a84a4a }
.admin-month-more {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 700;
}
.admin-roster-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.admin-roster-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.admin-roster-lg {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-left: 3px solid;
}
.admin-roster-lg.lg-free { border-color: #2f8a55; background: #e4f4ea }
.admin-roster-lg.lg-away { border-color: #b7792f; background: #f7ecdc }
.admin-roster-lg.lg-holiday { border-color: #3d6f9e; background: #e4eef8 }
.admin-roster-lg.lg-on_call { border-color: #6b4c9a; background: #efe8f8 }
.admin-roster-lg.lg-unavailable { border-color: #a84a4a; background: #f6e4e4 }

#section-account #account-prefs-status,
#section-account #account-creds-status,
#section-account #account-ip-status {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
}

.duty-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.duty-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding-top: 1.55rem;
}
.duty-block-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.duty-block-row:last-child { border-bottom: 0 }
.duty-block-row .admin-muted { display: block; margin-top: 0.2rem; font-size: 0.82rem }
.duty-block-row .duty-note { display: block; margin-top: 0.25rem; font-size: 0.85rem }
.duty-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}
.duty-block-row.is-past {
  opacity: 0.72;
}
.duty-past-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  vertical-align: middle;
}
.duty-past-panel {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.duty-past-panel > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.duty-past-panel > summary::-webkit-details-marker { display: none }
.duty-past-panel > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.duty-past-panel[open] > summary::before { content: "▾ " }
.duty-past-count {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
  background: #e8eef2;
  color: var(--muted);
  border-radius: 999px;
}
.duty-past-hint {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.82rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
.profile-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 460px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.profile-side-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}
.profile-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.profile-badge-card {
  padding: 0.85rem;
  background: #e8eef2;
  margin: 0;
}
.ges-id-badge {
  width: 100%;
  background: #fff;
  border: 1px solid #c5d2da;
  box-shadow: 0 10px 28px rgba(7, 25, 35, 0.12);
  overflow: hidden;
  color: #122838;
}
.ges-id-badge.is-landscape {
  max-width: none;
  margin: 0;
}
.ges-id-badge-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: #0b3a52;
  color: #f2f6f7;
}
.ges-id-badge-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.ges-id-badge-org {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ges-id-badge-tag {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  opacity: 0.8;
}
.ges-id-badge-main {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
.ges-id-badge-photo-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  background: #edf2f5;
  border-right: 4px solid #1e5f8a;
  overflow: hidden;
  flex-shrink: 0;
  align-self: start;
}
.ges-id-badge[data-rank="chief"] .ges-id-badge-photo-wrap { border-right-color: #c45c28 }
.ges-id-badge[data-rank="command"] .ges-id-badge-photo-wrap { border-right-color: #1e5f8a }
.ges-id-badge[data-rank="education"] .ges-id-badge-photo-wrap { border-right-color: #2f7a4e }
.ges-id-badge[data-rank="operations"] .ges-id-badge-photo-wrap { border-right-color: #6b4c9a }
.ges-id-badge-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: none;
  position: absolute;
  inset: 0;
  background: #edf2f5;
}
.ges-id-badge-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #6a8290;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #edf2f5;
  z-index: 1;
}
.ges-id-badge[data-has-photo="1"] .ges-id-badge-photo {
  display: block;
  z-index: 2;
}
.ges-id-badge[data-has-photo="1"] .ges-id-badge-placeholder {
  display: none;
}
.ges-id-badge-placeholder i {
  font-size: 2.4rem;
  opacity: 0.55;
}
.ges-id-badge-body {
  padding: 0.75rem 0.9rem 0.65rem;
  min-width: 0;
}
.ges-id-badge-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  color: #0d2433;
}
.ges-id-badge-title {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #4d6573;
  font-weight: 600;
}
.ges-id-badge-rank {
  margin: 0.4rem 0 0.65rem;
  display: inline-block;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #e8eef2;
  color: #1e5f8a;
}
.ges-id-badge[data-rank="chief"] .ges-id-badge-rank { background: #f7e8df; color: #c45c28 }
.ges-id-badge[data-rank="education"] .ges-id-badge-rank { background: #e4f1e8; color: #2f7a4e }
.ges-id-badge[data-rank="operations"] .ges-id-badge-rank { background: #efe8f8; color: #6b4c9a }
.ges-id-badge-meta,
.ges-id-badge-extra {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.ges-id-badge-extra {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid #e4ebef;
}
.ges-id-badge-meta div,
.ges-id-badge-extra div {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.35rem;
  align-items: baseline;
}
.ges-id-badge-meta dt,
.ges-id-badge-extra dt {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a8290;
}
.ges-id-badge-meta dd,
.ges-id-badge-extra dd {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #163044;
  word-break: break-word;
}
.ges-id-badge-foot {
  padding: 0.4rem 0.9rem 0.5rem;
  border-top: 1px solid #e0e8ed;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a8290;
  background: #f7f9fb;
}
.profile-extra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0 0.35rem;
}
.profile-extra-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.profile-extra-list {
  display: grid;
  gap: 0.45rem;
}
.profile-extra-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 0.4rem;
  align-items: center;
}
.profile-extra-row input {
  width: 100%;
}
.admin-month-day.is-clickable {
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
}
.admin-month-day.is-clickable:hover {
  background: #f3f8fb;
}
.roster-day-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.roster-day-modal[hidden] { display: none !important }
.roster-day-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(7, 25, 35, 0.45);
  cursor: pointer;
}
.roster-day-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 22px 55px rgba(7, 25, 35, 0.28);
  padding: 1rem 1.1rem 1.2rem;
}
.roster-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.roster-day-head h3 { margin: 0 }
.roster-day-body {
  display: grid;
  gap: 0.9rem;
}
.roster-day-badge { max-width: none }
.roster-day-events {
  list-style: none;
  margin: 0;
  padding: 0.55rem 0.85rem 0.75rem;
  border-top: 1px solid #e4ebef;
  display: grid;
  gap: 0.35rem;
}
.roster-day-event {
  padding: 0.35rem 0.45rem;
  border-left: 3px solid #9aadb6;
  background: #f4f7f9;
  font-size: 0.82rem;
}
.roster-day-event strong { display: block }
.roster-day-event span,
.roster-day-event em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 0.75rem;
}
.roster-day-event.kind-free { border-color: #2f8a55; background: #e4f4ea }
.roster-day-event.kind-away { border-color: #b7792f; background: #f7ecdc }
.roster-day-event.kind-holiday { border-color: #3d6f9e; background: #e4eef8 }
.roster-day-event.kind-on_call { border-color: #6b4c9a; background: #efe8f8 }
.roster-day-event.kind-unavailable { border-color: #a84a4a; background: #f6e4e4 }
.roster-day-none {
  margin: 0;
  padding: 0.55rem 0.85rem 0.75rem;
  border-top: 1px solid #e4ebef;
}
@media (max-width: 900px) {
  .profile-workspace { grid-template-columns: 1fr }
}
@media (max-width: 720px) {
  .profile-edit-grid { grid-template-columns: 1fr }
  .ges-id-badge-main { grid-template-columns: 120px minmax(0, 1fr) }
  .ges-id-badge-photo-wrap { width: 120px; height: 120px }
  .profile-extra-row { grid-template-columns: 1fr }
}

.duty-kind-free { border-left: 3px solid #5fd08a; padding-left: 0.65rem }
.duty-kind-away { border-left: 3px solid #e0a45a; padding-left: 0.65rem }
.duty-kind-holiday { border-left: 3px solid #7eb0e0; padding-left: 0.65rem }
.duty-kind-on_call { border-left: 3px solid #b794f6; padding-left: 0.65rem }
.duty-kind-unavailable { border-left: 3px solid #e08080; padding-left: 0.65rem }
#section-duty .account-card input[type="datetime-local"],
#section-duty .account-card input[type="time"],
#section-duty .account-card input[type="text"] {
  width: 100%;
}
@media (max-width: 720px) {
  .duty-form-grid { grid-template-columns: 1fr }
  .duty-mode-row { padding-top: 0 }
}

@media (max-width: 720px) {
  .account-grid,
  .account-display-grid {
    grid-template-columns: 1fr;
  }
}
.users-panel {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(11, 58, 82, 0.08);
  overflow: hidden;
}
.users-table-wrap {
  overflow-x: auto;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.users-table thead th {
  background: #1e5f8a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.75rem 0.85rem;
  white-space: nowrap;
}
.users-table tbody td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #e6eef2;
  vertical-align: middle;
}
.users-table tbody tr:hover {
  background: #f5f9fb;
}
.users-table tbody tr.is-revoked,
.users-table tbody tr.is-deactivated {
  background: #fbf6f6;
}
.users-table tbody tr.is-not_granted {
  background: #fffaf3;
}
.users-table .mono-cell {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.8rem;
}
.users-table td strong {
  display: block;
  color: var(--navy);
}
.pw-mask {
  width: 7.2rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f9;
  color: var(--muted);
  padding: 0.28rem 0.5rem;
  letter-spacing: 0.16em;
  font: inherit;
  font-size: 0.85rem;
}
.user-actions {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
}
.app-action-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.app-history-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}
.app-accepted {
  font-weight: 700;
  color: #146338;
}
.app-denied {
  font-weight: 700;
  color: #8a2a22;
}

/* Alliance applications — compact inbox */
body.apps-mode .world-status-bar {
  display: none !important;
}

body.apps-mode .content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 1rem 1rem;
}

body.apps-mode #app-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.apps-mode #section-applications:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.apps-shell {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
}

.apps-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  flex-shrink: 0;
}

.apps-folders {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f3f7f9;
}

.apps-folder {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  padding: 0.38rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6b75;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.apps-folder:hover {
  background: #e8eef2;
}

.apps-folder.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(11, 58, 82, 0.06);
}

.apps-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 750;
}

.apps-folder.is-active .apps-count {
  color: var(--navy);
}

.apps-status {
  margin-left: auto;
  font-size: 0.8rem;
}

.apps-hint {
  margin: 0;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.apps-client {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(11, 58, 82, 0.04);
}

.apps-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.apps-list[hidden] {
  display: none !important;
}

.apps-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2.5rem 1rem;
  line-height: 1.45;
}

.apps-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e8eef2;
}

.apps-row:last-child {
  border-bottom: 0;
}

.apps-row.is-pending {
  background: #fffdf8;
}

.apps-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
}

.apps-flag-fallback {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--navy);
}

.apps-row-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.apps-row-copy strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.apps-row-copy span {
  color: var(--muted);
  font-size: 0.75rem;
}

.apps-row-actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.apps-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-align: right;
}

.apps-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.apps-status-pill.is-accepted {
  background: #d7f0e0;
  color: #146338;
}

.apps-status-pill.is-denied {
  background: #ead7d4;
  color: #8a2a22;
}

@media (max-width: 720px) {
  .apps-row {
    grid-template-columns: auto 1fr;
  }

  .apps-row-actions,
  .apps-row-meta {
    grid-column: 2;
    align-items: flex-start;
    text-align: left;
  }

  .apps-status {
    margin-left: 0;
    width: 100%;
  }
}

.staff-app-status {
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.staff-app-status.is-pending { color: #1e5f8a; }
.staff-app-status.is-deferred { color: #c45c28; }
.staff-app-status.is-offered { color: #9a6b12; }
.staff-app-status.is-approved { color: #146338; }
.staff-app-status.is-denied,
.staff-app-status.is-expired { color: #8a2a22; }
.staff-app-flags { color: #8a5a12; margin: 0.4rem 0 0; padding-left: 1.1rem; }

.staff-recruit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  padding: 0.55rem 0.85rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f7f9;
}

.staff-recruit-bar.is-open {
  background: #e8f5ee;
  border-color: #b7d9c4;
}

.staff-recruit-bar.is-closed {
  background: #f5f6f7;
}

.staff-recruit-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  min-width: 0;
}

.staff-recruit-copy strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.staff-recruit-state {
  font-size: 0.82rem;
  font-weight: 650;
  color: #5a6b75;
}

.staff-recruit-state.is-open {
  color: #146338;
}

.staff-recruit-state.is-closed {
  color: #7a5b12;
}

.staff-recruit-actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
}

.staff-recruit-flash {
  font-size: 0.78rem;
  font-weight: 600;
  color: #146338;
}

.staff-recruit-bar.is-closed .staff-recruit-flash {
  color: #8a2a22;
}

.staff-recruit-btn-open {
  background: #1f9d55 !important;
  border-color: #1f9d55 !important;
  color: #fff !important;
}

.staff-recruit-btn-open:hover {
  background: #188a49 !important;
  border-color: #188a49 !important;
}

.staff-recruit-btn-close {
  background: #e74c3c !important;
  border-color: #e74c3c !important;
  color: #fff !important;
}

.staff-recruit-btn-close:hover {
  background: #c0392b !important;
  border-color: #c0392b !important;
}

.staff-invite-bar {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f4ee;
}
.staff-invite-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.65rem;
}
.staff-invite-copy strong { color: var(--navy); font-size: 0.92rem; }
.staff-invite-issue {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.45rem 0.6rem;
}
.staff-invite-issue label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 1 1 12rem;
}
.staff-invite-issue input {
  font-size: 0.95rem;
  padding: 0.4rem 0.5rem;
}
.staff-invite-code {
  margin: 0.7rem 0 0;
  padding: 0.65rem 0.75rem;
  background: #1c2428;
  color: #f4b63f;
  font: 1.15rem/1.4 ui-monospace, Consolas, monospace;
  letter-spacing: 0.08em;
}
.staff-invite-list {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.staff-invite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.staff-invite-row button { margin-left: auto; }
  background: #c9392b !important;
  border-color: #c9392b !important;
}

.staff-mail-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 0.85rem;
  align-items: stretch;
}
@media (max-width: 900px) {
  .staff-mail-layout { grid-template-columns: 1fr; }
}

.staff-mail-folders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.staff-folder {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  align-items: center;
}
.staff-folder span {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 700;
}
.staff-folder.is-active {
  border-color: var(--navy);
  background: #f4f8fb;
}

.staff-mail-search {
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.staff-mail-list {
  max-height: 620px;
  overflow: auto;
  display: grid;
  gap: 0.35rem;
}

.staff-mail-item {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
}
.staff-mail-item strong { color: var(--navy); font-size: 0.88rem; }
.staff-mail-item span { color: var(--muted); font-size: 0.75rem; }
.staff-mail-item.active { border-color: var(--navy); background: #f4f8fb; }
.staff-mail-item.is-offered { border-left: 4px solid #c9a227; }
.staff-mail-item.is-pending { border-left: 4px solid #1e5f8a; }
.staff-mail-item.is-deferred { border-left: 4px solid #c45c28; }

.staff-mail-preview {
  min-height: 420px;
}
.staff-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
.staff-preview-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy);
}
.staff-preview-meta {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  font-size: 0.86rem;
}
.staff-preview-block {
  margin: 0 0 0.85rem;
}
.staff-preview-block h3 {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.staff-preview-block p { margin: 0; white-space: pre-wrap; }

.staff-decide {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.85rem;
}
.staff-decide h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--navy);
}
.staff-decide-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.staff-decide-row {
  display: grid;
  gap: 0.45rem;
}
.staff-decide-row label {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--navy);
}
.staff-decide-row input,
.staff-decide-row select,
.staff-decide-row textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.staff-decide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.staff-decide-actions .admin-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.staff-action-note {
  flex: 1 1 100%;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
.admin-ok {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #e8f6ee;
  color: #146338;
  border: 1px solid #b7dfc6;
  font-size: 0.88rem;
}
.user-action {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.15rem;
  line-height: 1;
}
.user-action.is-grant { color: #1e6fba; }
.user-action.is-grant:hover { color: #0b3a52; }
.user-action.is-reset { color: #1e5f8a; }
.user-action.is-reset:hover { color: #0b3a52; }
.user-action.is-revoke { color: #c53030; }
.user-action.is-revoke:hover { color: #8a1c1c; }
.user-action.is-impersonate { color: #6b4f2a; }
.user-action.is-impersonate:hover { color: #3d2c14; }
.user-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.status-pill {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.is-active {
  background: #d7f0e0;
  color: #1b6b3a;
}
.status-pill.is-pending {
  background: #fde9c9;
  color: #8a5a12;
}
.status-pill.is-revoked {
  background: #f8d7d7;
  color: #a32626;
}
.status-pill.is-deactivated {
  background: #e8eef2;
  color: #4b6270;
}
.status-pill.is-owner {
  background: #f4e4b0;
  color: #6b5208;
}

.ges-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.ges-lightbox[hidden] {
  display: none !important;
}
.ges-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(7, 25, 35, 0.58);
  cursor: pointer;
}
.ges-lightbox-card {
  position: relative;
  z-index: 1;
  width: min(26.5rem, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.7rem 1.45rem 1.3rem;
  box-shadow: 0 22px 55px rgba(7, 25, 35, 0.3);
  text-align: center;
}
.ges-lightbox-mark {
  width: 3.35rem;
  height: 3.35rem;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}
.ges-lightbox-mark.is-send {
  background: #e8f2fb;
  color: #1e6fba;
}
.ges-lightbox-mark.is-ok {
  background: #e6f6ec;
  color: #157a3c;
}
.ges-lightbox-mark.is-warn {
  background: #fff4e5;
  color: #c45c28;
}
.ges-lightbox-mark.is-send i {
  animation: ges-fly 1.1s ease-in-out infinite;
}
@keyframes ges-fly {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(3px, -3px); }
}
.ges-lightbox-card h3 {
  margin: 0 0 0.45rem;
  color: var(--navy-dark);
  font-size: 1.15rem;
}
.ges-lightbox-card p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}
.ges-lightbox-extra {
  margin: -0.35rem 0 1.1rem;
  text-align: left;
}
.ges-lightbox-link {
  width: 100%;
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
  color: var(--navy-dark);
  font-size: 0.78rem;
  word-break: break-all;
}
.ges-lightbox.is-busy .ges-lightbox-backdrop,
.ges-lightbox.is-busy #ges-lightbox-ok {
  pointer-events: none;
}
.ges-lightbox.is-busy #ges-lightbox-ok {
  opacity: 0.45;
}

html:not(.is-booting) [data-perm][hidden] {
  display: none !important;
}

.perm-roles {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.perm-role {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.perm-role-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.05rem;
  border: 0;
  background: var(--navy-dark);
  color: #fff;
  cursor: pointer;
  text-align: left;
}
.perm-role-head strong {
  display: block;
  font-size: 1rem;
}
.perm-role-head em {
  font-style: normal;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
}
.perm-role-head i {
  transition: transform 0.15s ease;
}
.perm-role.is-open .perm-role-head i {
  transform: rotate(180deg);
}
.perm-role-body {
  display: none;
  padding: 1rem 1.05rem 1.15rem;
}
.perm-role.is-open .perm-role-body {
  display: block;
}
.perm-group {
  margin-bottom: 1.05rem;
}
.perm-group h4 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.5rem;
}
.perm-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f7f8;
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1.25;
  color: var(--ink);
}
.perm-tile input {
  margin-top: 0.12rem;
  accent-color: var(--accent);
}
.perm-tile.is-on {
  background: #fff7ee;
  border-color: #e0b48a;
}
.perm-tile.is-locked {
  opacity: 0.72;
  cursor: default;
}
.perm-role-actions {
  margin-top: 0.35rem;
}

@media (max-width: 980px) {
  .kpi-grid,
  .report-grid,
  .msg-layout,
  .compose-grid,
  .mem-kpis,
  .users-kpis {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    max-height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .admin-shell.nav-open .sidebar {
    transform: none;
  }
  .menu-btn { display: inline-flex; }
  .top-bar {
    flex-wrap: wrap;
    row-gap: 0.4rem;
    padding: 0.55rem 1rem;
  }
  .dev-banner {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
  }
  .dev-banner-inner {
    font-size: 0.72rem;
  }
  .impersonate-banner {
    order: 4;
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .world-status-bar {
    padding: 0.4rem 0.85rem 0.5rem;
  }
  .world-status-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

body.classified-mode .world-status-bar {
  display: none !important;
}

body.classified-mode .content {
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

body.classified-mode #app-panel,
body.classified-mode .classified-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.classified-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.45rem 0.75rem;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.classified-status-text {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: auto;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classified-toolbar .admin-btn {
  flex: 0 0 auto;
}

.classified-error {
  margin: 0;
  padding: 0.4rem 0.75rem;
}

.classified-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 5.6rem;
  min-height: 2.1rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #d7e2e8;
  color: var(--navy);
}

.classified-pill[data-state="running"],
.classified-pill[data-state="starting"] {
  background: #d7f0e0;
  color: #146338;
}

.classified-pill[data-state="disabled"],
.classified-pill[data-state="stopped"],
.classified-pill[data-state="offline"],
.classified-pill[data-state="unknown"] {
  background: #ead7d4;
  color: #8a2a22;
}

.classified-frame {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #071923;
}

/* GES Handbook — book reader */
body.handbook-mode .content {
  padding: 0.75rem 1rem 1rem;
  min-height: 0;
}

body.handbook-mode .shell-main {
  min-height: 0;
}

body.handbook-mode #app-panel,
body.handbook-mode #section-handbook {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.handbook-shell {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 8.5rem);
}

.handbook-toc-panel {
  background: linear-gradient(180deg, #102a3a 0%, #071923 100%);
  color: #eef4f7;
  border-radius: 12px;
  padding: 1rem 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(244, 182, 63, 0.18);
  overflow: auto;
  max-height: calc(100vh - 8.5rem);
}

.handbook-toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--amber);
}

.handbook-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.handbook-toc-chapter {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 182, 63, 0.85);
}

.handbook-toc-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #dce8ee;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.handbook-toc-link:hover,
.handbook-toc-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.handbook-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - 8.5rem);
}

.handbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.handbook-jump-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.handbook-jump {
  min-width: 16rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.handbook-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.handbook-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(7, 25, 35, 0.25);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.handbook-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.handbook-spread {
  display: grid;
  grid-template-columns: 1fr 10px 1fr;
  gap: 0;
  width: min(100%, 980px);
  min-height: 520px;
  filter: drop-shadow(0 18px 28px rgba(7, 25, 35, 0.22));
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.handbook-spread.is-turning {
  transform: rotateY(-4deg) translateX(-4px);
  opacity: 0.92;
}

.handbook-spread.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.handbook-spread.is-single .handbook-spine,
.handbook-spread.is-single #handbook-page-right {
  display: none;
}

.handbook-spine {
  background: linear-gradient(90deg, #5a3d22 0%, #2f1d10 45%, #120a05 50%, #2f1d10 55%, #5a3d22 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}

.handbook-page {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.05)),
    linear-gradient(180deg, #faf6eb 0%, #f3ead6 100%);
  border: 1px solid #d8ccb0;
  border-radius: 4px 10px 10px 4px;
  padding: 1.35rem 1.5rem 1rem;
  color: #2b2418;
  font-family: Georgia, "Times New Roman", serif;
  overflow: auto;
  position: relative;
}

.handbook-page-left.is-clickable {
  cursor: w-resize;
}

.handbook-page-right.is-clickable {
  cursor: e-resize;
}

#handbook-page-right {
  border-radius: 10px 4px 4px 10px;
}

.handbook-page[data-kind="cover"] {
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(244, 182, 63, 0.16), transparent 52%),
    linear-gradient(180deg, #102a3a 0%, #071923 100%);
  color: #f7f2e8;
  border-color: rgba(244, 182, 63, 0.35);
}

.handbook-page[data-kind="cover"] .handbook-page-head {
  display: none;
}

.handbook-cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.handbook-cover-mark {
  width: min(220px, 58%);
  height: auto;
  aspect-ratio: 1;
  margin: 0 0 1.15rem;
  border-radius: 50%;
  border: 2px solid rgba(244, 182, 63, 0.55);
  background: #071923;
  object-fit: cover;
}

.handbook-cover-inner h1 {
  margin: 0.5rem 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--amber);
}

.handbook-cover-kicker,
.handbook-cover-sub,
.handbook-cover-note {
  margin: 0.35rem 0;
}

.handbook-cover-kicker {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  opacity: 0.85;
}

.handbook-cover-note {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  opacity: 0.75;
}

.handbook-page-head {
  border-bottom: 1px solid rgba(43, 36, 24, 0.12);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.handbook-page-chapter {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6548;
}

.handbook-page-title {
  margin: 0.25rem 0 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.handbook-page-body {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.55;
}

.handbook-page-body h2,
.handbook-page-body h3 {
  margin: 1rem 0 0.5rem;
  line-height: 1.25;
}

.handbook-page-body p {
  margin: 0.55rem 0;
}

.handbook-page-body ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.handbook-page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.86rem;
}

.handbook-page-body th,
.handbook-page-body td {
  border: 1px solid rgba(43, 36, 24, 0.18);
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.handbook-page-body th {
  background: rgba(11, 58, 82, 0.08);
}

.handbook-page-body code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: rgba(11, 58, 82, 0.08);
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
}

.handbook-page-body a {
  color: var(--teal);
}

.handbook-draft {
  color: #c62828;
  font-weight: 600;
}

.handbook-page-body .handbook-draft code {
  color: #c62828;
  background: rgba(198, 40, 40, 0.08);
}

.handbook-page-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #7a6548;
}

.handbook-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 0.85rem;
}

.handbook-page-label {
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

.handbook-hint {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 979px) {
  .handbook-shell {
    grid-template-columns: 1fr;
  }

  .handbook-toc-panel {
    max-height: 220px;
  }
}

@media (max-width: 720px) {
  .handbook-footer {
    grid-template-columns: 1fr 1fr;
  }

  .handbook-page-label {
    grid-column: 1 / -1;
  }

  .handbook-nav {
    width: 100%;
  }

  .handbook-page {
    padding: 1rem;
    min-height: 420px;
  }
}

/* Education setup flow — compact single-stage wizard */
.edu-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.edu-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.edu-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.edu-path-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.28rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6a7a84;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
}

.edu-path-step:disabled {
  opacity: 0.45;
  cursor: default;
}

.edu-path-step.is-active {
  background: #0b3a52;
  color: #fff;
}

.edu-path-step.is-done {
  color: #0b3a52;
}

.edu-path-n {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(11, 58, 82, 0.12);
  font-size: 0.7rem;
  font-weight: 800;
}

.edu-path-step.is-active .edu-path-n {
  background: rgba(255, 255, 255, 0.22);
}

.edu-path-sep {
  width: 1rem;
  height: 1px;
  background: #c5d0d7;
}

.edu-top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.edu-crumb {
  font-size: 0.82rem;
  color: #5a6b75;
  font-weight: 600;
}

.edu-defaults-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f8;
}

.edu-defaults-label {
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6b75;
  margin-right: 0.15rem;
}

.edu-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #3d4f59;
}

.edu-inline input,
.edu-inline select {
  width: auto;
  min-width: 0;
  font: inherit;
  font-weight: 550;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--navy-dark);
}

.edu-inline input[type="number"] {
  width: 3.4rem;
}

.edu-defaults-meta {
  font-size: 0.74rem;
  color: #5a6b75;
  margin-left: auto;
}

.edu-flash {
  margin: 0;
}

.edu-stage {
  padding: 0.15rem 0 0;
}

.edu-stage-bar {
  margin: 0 0 0.65rem;
}

.edu-world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.4rem;
}

.edu-kind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.edu-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  color: var(--navy-dark);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.edu-pick:hover:not(:disabled) {
  border-color: #7aa0b4;
  background: #f4f8fa;
}

.edu-pick.is-selected {
  border-color: #0b3a52;
  background: #e8f0f5;
  box-shadow: inset 0 0 0 1px #0b3a52;
}

.edu-pick:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.edu-world.is-empty {
  opacity: 0.5;
}

.edu-world-flag {
  display: block;
  line-height: 0;
}

.edu-world-code {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.edu-world-meta,
.edu-kind-meta {
  font-size: 0.68rem;
  color: #5a6b75;
}

.edu-kind-label {
  font-weight: 750;
  font-size: 0.95rem;
}

.edu-building-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.edu-building {
  width: auto;
  flex-direction: row;
  align-items: center;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 650;
}

.edu-course-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.edu-course-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.edu-course-table-wrap {
  overflow-x: auto;
}

.edu-course-table code {
  font-size: 0.78rem;
}

.edu-custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.edu-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--navy-dark);
}

.edu-field input,
.edu-field select {
  font: inherit;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--navy-dark);
}

.edu-start-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
}

/* —— Alliance chat (homepage-style world tabs) —— */
body.achat-mode .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.achat-mode #app-panel:not([hidden]),
body.achat-mode #section-alliance_chat:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.achat-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #0a1f2b;
  border: 1px solid #163044;
  overflow: hidden;
}

.achat-tabs {
  display: grid;
  grid-template-columns: repeat(25, minmax(0, 1fr));
  gap: 0;
  background: #081a24;
  border-bottom: 1px solid #163044;
  overflow-x: auto;
}

.achat-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  margin: 0;
  min-width: 2.4rem;
  border: 0;
  border-right: 1px solid #163044;
  background: #0a1f2b;
  color: #8aa3ab;
  padding: 0.65rem 0.12rem 0.72rem;
  font: 700 0.68rem/1 var(--body);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.achat-tab:last-child { border-right: 0; }
.achat-tab img { width: 24px; height: 16px; object-fit: cover; display: block; }
.achat-tab .achat-tab-mark { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.achat-tab:hover { color: #e8eef0; background: #0c2734; }
.achat-tab.is-on {
  background: #0d2c3d;
  color: #e8eef0;
  box-shadow: inset 0 -3px 0 #2bb7a9;
}

.achat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #dedede;
  color: var(--ink);
}

.achat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
  background: #e8ecee;
  border-bottom: 1px solid var(--line);
}

.achat-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.achat-head-copy .admin-muted {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
}

.achat-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.achat-live.is-live { color: #1a7a4c; font-weight: 650; }

.achat-banner {
  margin: 0.5rem 0.85rem 0;
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  background: #d9edf7;
  border: 1px solid #bce8f1;
  color: #31708f;
  font-size: 0.84rem;
}

.achat-compose {
  display: flex;
  margin: 0.5rem 0.85rem 0;
  border: 1px solid #9ec5d8;
  background: #fff;
}

.achat-compose-label {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  background: #eee;
  border-right: 1px solid #ccc;
  font-size: 0.8rem;
  color: #555;
}

.achat-compose input {
  flex: 1;
  border: 0;
  padding: 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
}

.achat-compose input:disabled {
  background: #f7f7f7;
  color: #888;
}

.achat-messages {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0.15rem 0.75rem 0.85rem;
  overflow: auto;
  flex: 1;
  min-height: 12rem;
  background: #fff;
}

.achat-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.12rem 0;
  font-size: 0.86rem;
  line-height: 1.3;
  border-bottom: 0;
}

.achat-time {
  flex: 0 0 auto;
  color: #555;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}
.achat-world {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1e5f8a;
  background: #e6f0f5;
  padding: 0.02rem 0.28rem;
  border-radius: 2px;
}
.achat-user {
  flex: 0 0 auto;
  display: inline-block;
  padding: 0.02rem 0.32rem;
  border-radius: 2px;
  background: #5bc0de;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
}
.achat-body {
  flex: 1 1 auto;
  min-width: 0;
  color: #222;
  word-break: break-word;
}
.achat-body.is-en { color: #163044; }
.achat-xlate {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #1e5f8a;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.achat-xlate:hover { color: #0b3a52; }
.achat-xlate:disabled { opacity: 0.5; cursor: wait; text-decoration: none; }
.achat-deleted { color: #808080; font-style: italic; }
.achat-empty { padding: 0.75rem 0.85rem; font-size: 0.88rem; }

@media (max-width: 900px) {
  .achat-tabs { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .achat-row { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .edu-course-head {
    flex-direction: column;
  }

  .edu-defaults-meta {
    margin-left: 0;
    width: 100%;
  }
}

