:root {
    --bg: #0a0b0f;
    --bg-elevated: #12141a;
    --surface: #16181f;
    --surface-hover: #1c1f28;
    --border: #2a2d38;
    --text: #f0f2f7;
    --muted: #8b92a5;
    --text-muted: #8b92a5;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-soft: rgba(249, 115, 22, 0.14);
    --accent-glow: rgba(249, 115, 22, 0.35);
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --sidebar-collapsed: 64px;
    --sidebar-expanded: 210px;
    --topbar-height: 64px;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* App shell */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.has-sidebar .app-shell {
    margin-left: var(--sidebar-collapsed);
    transition: margin-left 0.25s ease;
}

.has-sidebar.sidebar-open .app-shell,
.has-sidebar .sidebar:hover + .sidebar-backdrop + .app-shell {
    margin-left: var(--sidebar-expanded);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-collapsed);
    background: #0d0e12;
    border-right: 1px solid var(--border);
    z-index: 200;
    transition: width 0.22s ease, box-shadow 0.22s ease;
    overflow: hidden;
}

.sidebar:hover,
.sidebar.is-open {
    width: var(--sidebar-expanded);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.55);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.45rem 0.4rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.2rem 0.25rem;
    margin-bottom: 0.45rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-mark {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #fb923c);
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.8rem;
    color: #111;
    margin: 0 auto;
}

.brand-logo {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 10px;
    margin: 0 auto;
    display: block;
}

.sidebar .brand-logo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}

.brand-logo--auth {
    width: 56px;
    height: 56px;
}

.sidebar:hover .brand-mark,
.sidebar.is-open .brand-mark,
.sidebar:hover .brand-logo,
.sidebar.is-open .brand-logo {
    margin: 0;
}

.brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s, width 0.2s;
}

.sidebar:hover .brand-text,
.sidebar.is-open .brand-text {
    opacity: 1;
    width: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.sidebar-section + .sidebar-section {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(42, 45, 56, 0.65);
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 0.45rem 0.15rem;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s, height 0.2s;
}

.sidebar:hover .sidebar-section-title,
.sidebar.is-open .sidebar-section-title {
    opacity: 1;
    height: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.12rem 0.28rem;
    border-radius: 10px;
    color: #6b7288;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.sidebar-link:hover {
    color: var(--accent);
}

.sidebar-link.active {
    color: var(--accent);
}

.sidebar-icon-wrap {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.sidebar-icon-wrap svg {
    width: 19px;
    height: 19px;
}

.sidebar-link:hover .sidebar-icon-wrap {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent);
}

.sidebar-link.active .sidebar-icon-wrap {
    background: linear-gradient(135deg, var(--accent) 0%, #fb923c 100%);
    color: #111;
    box-shadow: 0 4px 18px var(--accent-glow);
}

.sidebar-link.active .sidebar-icon-wrap svg {
    stroke: #111;
}

.sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    font-size: 0.84rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.sidebar:hover .sidebar-label,
.sidebar.is-open .sidebar-label {
    opacity: 1;
    width: auto;
}

.sidebar-footer {
    border-top: 1px solid rgba(42, 45, 56, 0.65);
    padding-top: 0.35rem;
    margin-top: 0.2rem;
}

.admin-area .sidebar-link.active .sidebar-icon-wrap {
    background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(10, 11, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-spacer { flex: 1; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius);
    transition: background 0.15s ease;
}

.topbar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.topbar-name { font-size: 0.9rem; color: var(--muted); }

/* Language switcher (flag dropdown) */
.lang-switcher {
    position: relative;
}

.lang-switcher-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    color: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.lang-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

.lang-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 400;
}

.lang-switcher-menu li {
    margin: 0;
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
}

.lang-switcher-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.lang-switcher-option.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.lang-name {
    flex: 1;
}

.lang-switcher-auth-wrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
}

.public-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Google Translate (hidden widget; flag picker drives language) */
.goog-te-banner-frame,
.skiptranslate,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-menu-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

.goog-te-gadget {
    font-size: 0 !important;
}

.google-translate-host {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #fdba74);
    color: #111;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    object-fit: cover;
}

.avatar--img {
    display: block;
    border: 1px solid var(--border);
}

.icon-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.icon-btn svg { width: 20px; height: 20px; }

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
    max-width: 1400px;
    width: 100%;
}

/* Typography */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header .lead,
.lead {
    margin: 0;
    color: var(--muted);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Dashboard stat cards — exclude player profile stat grids */
.stat-grid .stat-card,
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.stat-grid .stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-grid .stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.stat-grid--dashboard .stat-card--dashboard {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
}

.stat-grid--dashboard .stat-card__icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.stat-grid--dashboard .stat-card__icon svg {
    width: 22px;
    height: 22px;
}

.stat-grid--dashboard .stat-card__body {
    min-width: 0;
}

.stat-grid--dashboard .stat-card__body .stat-label {
    margin-top: 0.15rem;
}

.stat-card-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.stat-card-link:hover .stat-label {
    color: var(--accent);
}

.stat-card-link--stacked {
    display: block;
    color: inherit;
    text-decoration: none;
}

.stat-card-link--stacked:hover .stat-label {
    color: var(--accent);
}

.stat-card--fort-killer:has(.stat-card-link:hover) {
    border-color: rgba(34, 197, 94, 0.35);
}

.stat-card--governors .stat-card__icon {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.22);
}

.stat-card--power .stat-card__icon {
    color: #fb923c;
    background: rgba(249, 115, 22, 0.14);
    border-color: rgba(249, 115, 22, 0.24);
}

.stat-card--kp .stat-card__icon {
    color: #f87171;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.22);
}

.stat-card--deads .stat-card__icon {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.22);
}

.stat-card--fort-killer .stat-card__icon {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.22);
}

.stat-grid--dashboard .stat-value--name {
    font-size: 1.15rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.card h2, .card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.panel { margin-bottom: 1.5rem; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h2 { margin: 0; font-size: 1.1rem; }

/* Hero banner */
.hero-banner {
    background: linear-gradient(135deg, #1a1510 0%, var(--surface) 50%, #14161f 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.hero-banner h1 { margin: 0 0 0.5rem; font-size: 2rem; }
.hero-banner .version { color: var(--accent); font-size: 0.9rem; font-weight: 600; }

.hero-banner--dashboard {
    padding: 1.5rem 2rem;
}

.dashboard-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.dashboard-hero-welcome {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
    flex: 1 1 280px;
}

.dashboard-hero-scan {
    text-align: right;
    flex-shrink: 0;
    min-width: 0;
}

.dashboard-hero-scan-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.2rem;
}

.dashboard-hero-scan-date {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text, #e8ecf1);
    line-height: 1.3;
}

.dashboard-hero-scan-date--empty {
    font-size: 0.95rem;
    font-weight: 500;
}

.dashboard-hero-scan-name {
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.dashboard-hero-scan-new {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #22c55e;
    letter-spacing: 0.02em;
}

@media (max-width: 640px) {
    .dashboard-hero-scan {
        text-align: left;
        width: 100%;
        padding-top: 0.25rem;
        border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    }
}

.dashboard-hero-avatar-wrap {
    flex-shrink: 0;
}

.dashboard-hero-avatar,
.dashboard-hero-avatar-wrap .avatar,
.dashboard-hero-avatar-wrap .dashboard-hero-avatar.avatar--img {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
}

.dashboard-hero-text {
    min-width: 0;
}

.dashboard-hero-text h1 {
    margin-bottom: 0.35rem;
}

.dashboard-hero-text .lead {
    margin: 0;
}

.dashboard-week-events .panel-header {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.dashboard-events-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.dashboard-events-row > .panel {
    height: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-fav-tools .panel-header {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.dashboard-fav-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    flex: 1 1 auto;
    align-content: start;
}

.dashboard-fav-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.65rem 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    background: var(--surface-2, rgba(255, 255, 255, 0.03));
    color: inherit;
    text-decoration: none;
    text-align: center;
    min-height: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dashboard-fav-tool:hover {
    border-color: var(--accent, #3a94ee);
    background: var(--accent-soft, rgba(58, 148, 238, 0.12));
    color: inherit;
}

.dashboard-fav-tool__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.dashboard-fav-tool__icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.dashboard-fav-tool__label {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-muted, #9aa3b2);
}

.dashboard-fav-tool:hover .dashboard-fav-tool__label {
    color: var(--text, #e8ecf1);
}

@media (max-width: 900px) {
    .dashboard-events-row {
        grid-template-columns: 1fr;
    }

    .dashboard-fav-tools-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-fav-tools-grid .dashboard-fav-tool:nth-child(n + 9) {
        display: none;
    }
}

@media (max-width: 480px) {
    .dashboard-fav-tools-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.dashboard-week-events__range {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-week-events-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dashboard-week-event {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: var(--surface-2, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.dashboard-week-event__dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--event-color, #3a94ee);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--event-color, #3a94ee) 35%, transparent);
}

.dashboard-week-event__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.dashboard-week-event__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.dashboard-week-event__dates {
    font-size: 0.85rem;
    color: var(--text-muted, #9aa3b2);
}

.dashboard-week-event__desc {
    font-size: 0.85rem;
    line-height: 1.35;
}

.dashboard-leaderboards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

.dashboard-dkp-period,
.dashboard-dkp-foot {
    font-size: 0.85rem;
}

.dashboard-dkp-foot {
    margin: 0.75rem 0 0;
}

@media (max-width: 900px) {
    .dashboard-leaderboards {
        grid-template-columns: 1fr;
    }
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #111;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #111;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Forms */
.form-card label,
.form-group label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.form-card input,
.form-card select,
.form-card textarea,
.form-group input,
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tr:hover td { background: var(--surface-hover); }

/* Badges & alerts */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-r4 { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-member { background: rgba(139, 146, 165, 0.15); color: var(--muted); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-disabled { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.badge-user { background: rgba(139, 146, 165, 0.15); color: var(--muted); }

.inline-role-form select {
    min-width: 6.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: rgba(34, 197, 94, 0.12); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.25); }
.alert-error { background: rgba(239, 68, 68, 0.12); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.25); }
.alert-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.25); }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(249, 115, 22, 0.25); }

.hint { color: var(--muted); font-size: 0.85rem; }

/* Auth pages */
.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(249, 115, 22, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(249, 115, 22, 0.05), transparent 50%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-idea-btn {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.footer-idea-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.footer-idea-icon {
    height: 1em;
    width: auto;
    display: block;
}

.footer-click-shield {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: transparent;
    cursor: not-allowed;
}

.footer-scare-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    margin: 0;
    padding: 0;
    border: 0;
    background: #000;
    cursor: pointer;
}

.footer-scare-overlay img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.footer-scare-open {
    overflow: hidden;
}

.footer-links a { color: var(--muted); margin-left: 1rem; }
.footer-links a:hover { color: var(--accent); }

/* Placeholder sections */
.coming-soon {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.coming-soon h2 { color: var(--text); margin-bottom: 0.5rem; }

/* Camp scan admin */
.scan-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scan-lk-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--accent-soft);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: var(--radius);
}

.scan-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin: 0;
}

.scan-fieldset legend {
    padding: 0 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.scan-mode-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
}

.source-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.source-options label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.kingdom-picker {
    margin-top: 0.75rem;
}

.kingdom-picker-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

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

.kingdom-chip {
    display: block;
    cursor: pointer;
}

.kingdom-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kingdom-chip-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 0.15s, background 0.15s;
}

.kingdom-chip input:checked + .kingdom-chip-body {
    border-color: rgba(249, 115, 22, 0.55);
    background: var(--accent-soft);
}

.kingdom-chip:hover .kingdom-chip-body {
    border-color: rgba(249, 115, 22, 0.35);
}

.scan-credentials {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
}

.scan-credentials summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
}

.scan-credentials-open {
    background: rgba(249, 115, 22, 0.04);
}

.scan-auth-alert {
    margin-bottom: 1rem;
}

.scan-auth-steps {
    margin: 0.35rem 0 0.75rem;
    line-height: 1.55;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.recent-runs-scroll {
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overflow-x: auto;
    margin: 0 0 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.recent-runs-scroll .data-table {
    margin: 0;
}

.recent-runs-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-elevated, var(--surface));
    box-shadow: 0 1px 0 var(--border);
}

.data-table-compact th,
.data-table-compact td {
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
}

.scan-help-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* KvK portal */
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.breadcrumb {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.search-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.search-bar label { flex: 1; min-width: 200px; }

/* KvK overview — grouped by story, then LK cards */
.kvk-story-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.kvk-story-jump__link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.kvk-story-jump__link:hover {
    border-color: rgba(249, 115, 22, 0.45);
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.kvk-story-jump__chapter {
    color: var(--muted);
    font-weight: 500;
}

.kvk-story-jump__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.14);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
}

.kvk-story-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.kvk-story-section {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem 1.25rem;
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.06) 0%, var(--surface) 28%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
}

.kvk-story-section--has-cover {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.9) 55%, var(--surface) 100%),
        var(--story-cover) center / cover no-repeat;
    border-color: rgba(255, 255, 255, 0.12);
}

.kvk-story-section--has-cover .kvk-story-section__title {
    color: #f8fafc;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.kvk-story-section--has-cover .kvk-story-section__meta {
    color: rgba(248, 250, 252, 0.82);
}

.kvk-story-section--has-cover .kvk-story-section__chapter {
    color: #f8fafc;
}

.kvk-story-section--has-cover .kvk-story-section__header {
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

.kvk-story-section--sid-20 {
    border-color: rgba(249, 115, 22, 0.28);
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.1) 0%, var(--surface) 32%);
}

.kvk-story-section--sid-20.kvk-story-section--has-cover {
    border-color: rgba(249, 115, 22, 0.45);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.68) 0%, rgba(120, 53, 15, 0.55) 40%, rgba(15, 23, 42, 0.92) 100%),
        var(--story-cover) center / cover no-repeat;
}

.kvk-story-section__header {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.kvk-story-section__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.kvk-story-section__meta {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.kvk-story-section__chapter {
    font-weight: 600;
    color: var(--text);
}

.kvk-story-section__dot {
    margin: 0 0.2rem;
    opacity: 0.55;
}

.kvk-story-section__live {
    color: #4ade80;
    font-weight: 600;
}

.kvk-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.kvk-hero-grid--nested {
    gap: 1rem;
}

.kvk-hero-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.15rem 1.2rem 1.2rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.kvk-hero-card:hover {
    border-color: rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

.kvk-hero-card--scanned {
    border-color: rgba(249, 115, 22, 0.22);
}

.kvk-hero-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.kvk-hero-card__code {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.kvk-hero-card__subtitle {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.kvk-hero-card__dot {
    margin: 0 0.15rem;
    opacity: 0.65;
}

.kvk-hero-card__header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
}

.kvk-hero-card__dash-btn {
    border-color: rgba(249, 115, 22, 0.45);
    color: var(--accent);
    background: transparent;
}

.kvk-hero-card__dash-btn:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.kvk-hero-status {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.kvk-hero-status--ongoing {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.kvk-hero-status--upcoming {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.kvk-hero-status--ended {
    background: rgba(139, 146, 165, 0.12);
    color: var(--muted);
    border: 1px solid var(--border);
}

.kvk-hero-card__progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kvk-hero-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.kvk-hero-progress__bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-hover), var(--accent));
    box-shadow: 0 0 12px var(--accent-glow);
    transition: width 0.35s ease;
}

.kvk-hero-progress__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--muted);
}

.kvk-hero-card__summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.15rem;
}

.kvk-hero-card__summary-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.86rem;
    color: var(--text);
}

.kvk-hero-card__scan-meta {
    font-size: 0.76rem;
    color: var(--muted);
}

.kvk-hero-card__summary-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.kvk-hero-card__view-link {
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
}

.kvk-hero-card__view-link:hover {
    color: var(--accent);
}

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

.kvk-camp-tile {
    --camp-accent: var(--accent);
    position: relative;
    padding: 0.65rem 0.7rem 0.7rem 0.85rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.kvk-camp-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--camp-accent);
    border-radius: 3px 0 0 3px;
}

.kvk-camp-tile--aeolia { --camp-accent: #e2e8f0; }
.kvk-camp-tile--dardania { --camp-accent: #f472b6; }
.kvk-camp-tile--lycia { --camp-accent: #c084fc; }
.kvk-camp-tile--mycenae { --camp-accent: #4ade80; }
.kvk-camp-tile--fire { --camp-accent: #fb923c; }
.kvk-camp-tile--earth { --camp-accent: #a3e635; }
.kvk-camp-tile--water { --camp-accent: #38bdf8; }
.kvk-camp-tile--wind { --camp-accent: #94a3b8; }

.kvk-camp-tile__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}

.kvk-camp-tile__name {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.kvk-camp-tile__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--camp-accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--camp-accent) 55%, transparent);
}

.kvk-camp-tile__count {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.kvk-camp-tile__kingdoms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.kvk-kd-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.14rem 0.4rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.kvk-kd-tag--more {
    color: var(--muted);
    font-style: italic;
    border-style: dashed;
}

@media (max-width: 520px) {
    .kvk-hero-grid {
        grid-template-columns: 1fr;
    }

    .kvk-hero-card__header {
        flex-direction: column;
    }

    .kvk-hero-card__header-actions {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }

    .kvk-hero-card__summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

.kvk-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.camp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.camp-summary-card {
    display: block;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.camp-summary-card:hover,
.camp-summary-card.is-active {
    border-color: rgba(249, 115, 22, 0.5);
    background: var(--accent-soft);
    color: var(--text);
}

.camp-summary-card h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.camp-summary-stats {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.camp-summary-stats strong { color: var(--text); }

.camp-summary-delta { margin-top: 0.45rem; font-size: 0.8rem; }

.kingdom-rank-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kingdom-rank-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.kingdom-rank-item:hover,
.kingdom-rank-item.is-active {
    border-color: rgba(249, 115, 22, 0.45);
    background: var(--accent-soft);
}

.kingdom-rank-id { font-weight: 700; }
.kingdom-rank-camp { color: var(--muted); }
.kingdom-rank-kp { font-weight: 600; color: var(--accent); }

.delta {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.delta-up { color: var(--success); }
.delta-down { color: var(--error); }
.delta-zero { color: var(--muted); }
.delta-na { color: var(--muted); }

.stat-delta { margin-top: 0.25rem; font-size: 0.85rem; }

.governor-stats-dl .status-row dd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .kvk-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Admin dashboard */
.admin-tabs {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 1rem;
    padding: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.admin-tab {
    padding: 0.38rem 0.65rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.admin-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.admin-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.admin-hero .hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    text-align: right;
}

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.65rem;
}

.admin-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.admin-tool-card:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: inherit;
}

.admin-tool-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.admin-tool-icon--img {
    width: 3rem;
    height: 3rem;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-tool-icon--img img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.portal-leadership-tools-grid .portal-tool-card .admin-tool-icon--img {
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-tool-body strong {
    display: block;
    font-size: 0.92rem;
}

.admin-tool-body .hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.82rem;
}

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

@media (max-width: 640px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.panel-header-split {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.user-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.user-search-form input[type="search"] {
    min-width: min(220px, 100%);
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.88rem;
}

.user-search-meta {
    padding: 0 1rem;
    margin: -0.25rem 0 0.5rem;
}

.user-manager-table .user-actions {
    text-align: right;
    white-space: nowrap;
}

.passcode-display {
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
}

.numbered-hint {
    padding-left: 1.2rem;
    line-height: 1.6;
    margin: 0;
}

.role-guide .status-row dd {
    text-align: left;
    flex: 1;
}

.user-stat-grid {
    margin-bottom: 1.5rem;
}

.scan-rename-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}

.scan-rename-form input[type="text"] {
    flex: 1 1 12rem;
    min-width: 0;
    max-width: 100%;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.88rem;
}

.scan-manager-panel {
    margin-bottom: 1.5rem;
}

.scan-about-panel {
    margin-bottom: 1.5rem;
}

.scan-about-panel h3 {
    margin: 0 0 0.5rem;
}

.avatar-update-panel {
    margin-bottom: 1rem;
}

.avatar-update-panel .panel-header {
    margin-bottom: 0.5rem;
}

.avatar-update-form {
    margin-top: 0.75rem;
}

.avatar-update-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.75rem;
    margin-bottom: 0.35rem;
    cursor: pointer;
}

.avatar-update-max {
    max-width: 8rem;
    display: inline-block;
    margin-right: 0.5rem;
}

.scan-manager-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.scan-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.scan-pagination--foot {
    margin-top: 1rem;
    margin-bottom: 0;
}

.scan-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.scan-manager-table {
    table-layout: fixed;
    width: 100%;
    min-width: 720px;
    margin: 0;
}

.scan-manager-table col.scan-col-name { width: 34%; }
.scan-manager-table col.scan-col-date { width: 14%; }
.scan-manager-table col.scan-col-count { width: 10%; }
.scan-manager-table col.scan-col-uploaded { width: 14%; }
.scan-manager-table col.scan-col-actions { width: 28%; }

.scan-manager-table th,
.scan-manager-table td {
    vertical-align: middle;
}

.scan-name-cell {
    min-width: 0;
}

.scan-name-link {
    display: inline-block;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.scan-name-link:hover {
    color: var(--accent);
}

.scan-source-file {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-actions-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.scan-actions-inner form {
    margin: 0;
    display: inline-flex;
}

.scan-source-cell {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    .scan-manager-table {
        min-width: 640px;
    }

    .scan-manager-table col.scan-col-actions {
        width: 32%;
    }
}

.admin-stat-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.presence-online-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
    vertical-align: middle;
}

.presence-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.presence-period-tabs .btn.is-active {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.12);
    color: var(--accent);
}

.presence-period-note {
    margin: 0 0 1rem;
}

.stat-card-accent {
    border-color: rgba(249, 115, 22, 0.35);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), var(--surface));
}

.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.alert-banner-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-banner-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.alert-banner-body .hint {
    color: rgba(245, 158, 11, 0.85);
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.admin-main,
.admin-aside {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-list {
    margin: 0;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row dt {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-row dd {
    margin: 0;
    text-align: right;
    font-size: 0.9rem;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    flex-shrink: 0;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.action-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: inherit;
}

.action-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.action-item strong {
    display: block;
    font-size: 0.92rem;
}

.action-item .hint {
    display: block;
    margin-top: 0.1rem;
}

.promo-panel {
    background: linear-gradient(135deg, #1a1510 0%, var(--surface) 100%);
    border-color: rgba(249, 115, 22, 0.25);
}

.promo-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.promo-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    text-align: center;
}

.promo-stats strong {
    display: block;
    font-size: 1.35rem;
    color: var(--accent);
}

.promo-stats span {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.profile-card {
    text-align: center;
    padding: 1.5rem 1.25rem;
}

.profile-card__avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.profile-avatar,
.profile-card__avatar-wrap .avatar,
.profile-card__avatar-wrap .profile-avatar {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}

.profile-card__name {
    margin: 0;
    font-size: 1.25rem;
}

.profile-card__meta {
    margin: 0.35rem 0 0;
}

.profile-card__ids {
    margin: 1rem 0 0;
    text-align: left;
    font-size: 0.9rem;
}

.profile-card__ids div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--border);
}

.profile-card__ids dt {
    color: var(--muted);
    margin: 0;
}

.profile-card__ids dd {
    margin: 0;
    font-weight: 600;
}

.profile-form .scan-fieldset {
    margin-bottom: 1.25rem;
}

.profile-avatar-upload input[type="file"] {
    margin-top: 0.35rem;
}

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 900px) {
    .has-sidebar .app-shell { margin-left: 0; }
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-expanded);
    }
    .sidebar.is-open {
        transform: translateX(0);
        width: var(--sidebar-expanded);
    }
    .sidebar .brand-text,
    .sidebar .sidebar-label { opacity: 1; }
    .main-content { padding: 1rem; }
}

/* Portal tab navigation */
.portal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0 0 1rem;
    padding: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.portal-tabs--stats {
    position: sticky;
    top: calc(var(--topbar-height) + 0.5rem);
    z-index: 20;
}
.main-content .player-page {
    margin-top: 0;
}
.portal-tab {
    padding: 0.38rem 0.65rem;
    border-radius: calc(var(--radius) - 2px);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.portal-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}
.portal-tab--active {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.35);
}
.portal-kd-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1rem;
}
.portal-kd-pill {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.portal-kd-pill.active,
.portal-kd-pill--home.active {
    border-color: rgba(249, 115, 22, 0.5);
    color: var(--text);
    background: rgba(249, 115, 22, 0.12);
}
.rank-delta {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.15rem;
}
.rank-delta--up { color: #4ade80; }
.rank-delta--down { color: #f87171; }
.portal-toolbar {
    align-items: flex-end;
    gap: 1rem;
}

/* DKP form (compact weight grid like legacy site) */
.dkp-form {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.dkp-form .dkp-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.dkp-form .dkp-row label {
    flex: 1;
    min-width: 200px;
}
.dkp-form label span {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.dkp-form select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}
.dkp-weights { margin: 0.5rem 0 1rem; }
.dkp-weights h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.dkp-form .weight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    max-width: 960px;
}
.dkp-form .weight-grid label { min-width: auto; }
.dkp-form .weight-grid input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}
.dkp-form button {
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}
.dkp-form button:hover { filter: brightness(1.08); }
.dkp-summary { margin-bottom: 1rem; color: var(--text-muted); }
.dkp-pagination {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}
.dkp-pagination a { color: var(--accent); text-decoration: none; }
.dkp-pagination a:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .dkp-form .dkp-row { flex-direction: column; }
    .dkp-form .dkp-row label { min-width: 0; }
    .dkp-form .weight-grid { grid-template-columns: repeat(2, 1fr); }
    .dkp-form button { width: 100%; }
}

/* Player pages inside portal shell */
.main-content .player-page {
    max-width: 100%;
}

/* Players page (legacy layout, portal colours) */
.page-header--compact {
    margin-bottom: 0.75rem;
}
.trade-ratio-explainer {
    margin: 0.75rem 0 1rem;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.trade-ratio-explainer h2 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    text-wrap: balance;
}
.trade-ratio-explainer > p {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-size: 0.9rem;
    text-wrap: pretty;
}
.trade-ratio-explainer > p strong {
    color: var(--text);
    font-weight: 600;
}
.trade-ratio-explainer__formula {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.8rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.trade-ratio-explainer__formula-fallback {
    color: var(--muted);
    font-size: 0.8rem;
}
.trade-ratio-explainer__grades {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.trade-ratio-explainer__grade {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.45rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--muted);
}
.trade-ratio-explainer__grade-range {
    font-variant-numeric: tabular-nums;
}
.trade-ratio-explainer__grade-title {
    color: var(--text);
    font-weight: 600;
}
.trade-ratio-explainer__grade--1 .trade-ratio-explainer__grade-title { color: #fecaca; }
.trade-ratio-explainer__grade--2 .trade-ratio-explainer__grade-title { color: #fed7aa; }
.trade-ratio-explainer__grade--3 .trade-ratio-explainer__grade-title { color: #bae6fd; }
.trade-ratio-explainer__grade--4 .trade-ratio-explainer__grade-title { color: #e9d5ff; }
.trade-ratio-explainer__grade--5 .trade-ratio-explainer__grade-title { color: #fde68a; }

.players-page {
    margin-top: 0.25rem;
}
.players-page .toolbar {
    margin-bottom: 1rem;
}
.players-page .players-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}
.players-page .players-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    margin-left: auto;
}
.players-page .players-search-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.players-page .players-search-label input[type="search"] {
    min-width: 14rem;
    padding: 0.5rem 0.65rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}
.players-page .players-search-summary {
    margin: -0.35rem 0 0.85rem;
}
.players-page .players-empty-search {
    text-align: center;
    padding: 1.25rem;
}
.players-page .scan-select label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.players-page .scan-select select {
    padding: 0.5rem 2rem 0.5rem 0.65rem;
    min-width: 14rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23f97316' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
}
.players-page .scan-select select option {
    background: var(--bg-elevated);
    color: var(--text);
}

.players-page .pagination-card {
    margin: 1rem 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.players-page .pagination-card .pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    background: var(--accent-soft);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
}
.players-page .pagination-card .pagination-btn:hover {
    background: rgba(249, 115, 22, 0.22);
    color: var(--accent-hover);
}
.players-page .pagination-card .per-page-select {
    margin-right: 1rem;
}
.players-page .pagination-card .per-page-select label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.players-page .pagination-card .per-page-select select {
    padding: 0.35rem 1.75rem 0.35rem 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23f97316' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}
.players-page .pagination-card .pagination-info {
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.power-up { color: var(--success) !important; }
.power-down { color: var(--error) !important; }

/* Player stats tables */
.players-page .stats-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.players-page .stats-table,
.stats-table-wrap .stats-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.players-page .stats-table th,
.players-page .stats-table td,
.stats-table-wrap .stats-table th,
.stats-table-wrap .stats-table td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(249, 115, 22, 0.08);
    text-align: left;
}
.players-page .stats-table th.stats-th,
.stats-table-wrap .stats-table th.stats-th {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-bottom-color: rgba(249, 115, 22, 0.15);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.4rem 0.55rem;
    white-space: nowrap;
}
.players-page .stats-table thead th.stats-th:first-child,
.stats-table-wrap .stats-table thead th.stats-th:first-child {
    border-top-left-radius: 10px;
}
.players-page .stats-table thead th.stats-th:last-child,
.stats-table-wrap .stats-table thead th.stats-th:last-child {
    border-top-right-radius: 10px;
}
.players-page .stats-table tbody tr:hover {
    background: rgba(249, 115, 22, 0.04);
}
.stats-table th.stats-th a {
    color: inherit;
    text-decoration: none;
}
.stats-table th.stats-th a:hover {
    opacity: 0.85;
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-th-rank { border-color: rgba(249, 115, 22, 0.35); color: var(--accent); }
.stats-th-name { border-color: rgba(249, 115, 22, 0.25); color: var(--text); }
.stats-th-alliance,
.stats-th-gov { border-color: rgba(139, 146, 165, 0.35); color: var(--muted); }
.stats-th-ch { border-color: rgba(249, 115, 22, 0.3); color: var(--accent); }
.stats-th-power { border-color: rgba(245, 158, 11, 0.35); color: #f59e0b; }
.stats-th-kp { border-color: rgba(249, 115, 22, 0.4); color: var(--accent); }
.stats-th-acclaim { border-color: rgba(245, 158, 11, 0.45); color: #fbbf24; }
.stats-th-ratio { border-color: rgba(34, 197, 94, 0.4); color: var(--success); }
.stats-th-dead { border-color: rgba(239, 68, 68, 0.35); color: var(--error); }
.stats-th-rss { border-color: rgba(249, 115, 22, 0.35); color: #fb923c; }
.stats-th-t4 { border-color: rgba(59, 130, 246, 0.35); color: #60a5fa; }
.stats-th-t5 { border-color: rgba(234, 179, 8, 0.35); color: #eab308; }
.stats-th-helps { border-color: rgba(236, 72, 153, 0.35); color: #f472b6; }
.stats-th-healed { border-color: rgba(34, 197, 94, 0.35); color: var(--success); }
.stats-th-scout { border-color: rgba(139, 146, 165, 0.35); color: var(--muted); }
.stats-th-dkp { border-color: rgba(59, 130, 246, 0.4); color: #60a5fa; }
.stats-th-kd { border-color: rgba(34, 197, 94, 0.35); color: var(--success); }
.stats-rank {
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    text-align: center;
    width: 3rem;
}
.stats-player a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.stats-player a:hover { color: var(--accent); }
.stats-player-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 10rem;
}
.stats-player-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stats-player-avatar-wrap {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    overflow: hidden;
}
.stats-player-avatar-wrap > .stats-player-avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.stats-player-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.35);
}
.stats-player-avatar--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #e9d5ff;
    background: linear-gradient(135deg, rgba(126, 34, 206, 0.55), rgba(30, 27, 75, 0.8));
}
.stats-player-avatar--fallback[hidden] {
    display: none !important;
}
.stats-alliance,
.stats-ch,
.stats-camp { color: var(--muted); font-size: 0.85rem; }
.stats-kd-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
    text-decoration: none;
}
.stats-metric { min-width: 5.5rem; }
.stats-metric-value {
    display: block;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}
.stats-metric-ratio { min-width: 6.75rem; }
.stats-ratio-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}
.tr-grade-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    line-height: 1.1;
}
.tr-grade-badge--table {
    margin-top: 0;
    margin-left: auto;
    padding: 0.15rem 0.4rem;
    min-width: 1.65rem;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: center;
}
.tr-grade-num { font-size: 0.82rem; font-weight: 800; }
.tr-grade-badge--table .tr-grade-num { font-size: 0.82rem; }
.tr-grade-1 { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.tr-grade-2 { background: rgba(249, 115, 22, 0.15); border-color: rgba(249, 115, 22, 0.35); color: #fed7aa; }
.tr-grade-3 { background: rgba(56, 189, 248, 0.15); border-color: rgba(56, 189, 248, 0.35); color: #bae6fd; }
.tr-grade-4 { background: rgba(168, 85, 247, 0.15); border-color: rgba(168, 85, 247, 0.35); color: #e9d5ff; }
.tr-grade-5 { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.stats-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}
.stats-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}
.stats-metric-power .stats-metric-value { color: #f59e0b; }
.stats-metric-power .stats-bar-fill { background: #f59e0b; }
.stats-metric-kp .stats-metric-value { color: var(--accent); }
.stats-metric-kp .stats-bar-fill { background: var(--accent); }
.stats-metric-acclaim .stats-metric-value { color: #fbbf24; }
.stats-metric-acclaim .stats-bar-fill { background: #fbbf24; }
.stats-metric-dead .stats-metric-value { color: var(--error); }
.stats-metric-dead .stats-bar-fill { background: var(--error); }
.stats-metric-rss .stats-metric-value { color: #fb923c; }
.stats-metric-rss .stats-bar-fill { background: #fb923c; }
.stats-metric-ratio .stats-ratio-value {
    font-weight: 700;
    color: var(--success);
}
.stats-ratio-wrap--tip { position: relative; }
.stats-ratio-tip-trigger {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: inherit;
}
button.stats-ratio-value.stats-ratio-tip-trigger {
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 0.9rem;
}
.stats-ratio-tip-trigger:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.65);
    outline-offset: 2px;
    border-radius: 4px;
}
button.tr-grade-badge.stats-ratio-tip-trigger {
    cursor: pointer;
}
.stats-ratio-popover {
    min-width: 12rem;
    max-width: 16rem;
    padding: 0.55rem 0.65rem;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: left;
}
.stats-ratio-popover.is-floating {
    position: fixed;
    z-index: 9999;
}
.stats-ratio-popover[hidden] { display: none !important; }
.stats-ratio-popover-title { display: block; font-weight: 700; color: #f1f5f9; margin-bottom: 0.2rem; }
.stats-ratio-popover-range { display: block; color: #94a3b8; font-size: 0.68rem; margin-bottom: 0.35rem; }
.stats-ratio-popover-meaning { margin: 0; color: #cbd5e1; }
.stats-metric-ratio--grade-1 .stats-ratio-value { color: #fecaca; }
.stats-metric-ratio--grade-2 .stats-ratio-value { color: #fed7aa; }
.stats-metric-ratio--grade-3 .stats-ratio-value { color: #bae6fd; }
.stats-metric-ratio--grade-4 .stats-ratio-value { color: #e9d5ff; }
.stats-metric-ratio--grade-5 .stats-ratio-value { color: #fde68a; }

@media (max-width: 900px) {
    .trade-ratio-explainer {
        padding: 0.85rem 0.95rem;
    }
    .players-page .players-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .players-page .players-search-form {
        margin-left: 0;
        width: 100%;
    }
    .players-page .players-search-label input[type="search"] {
        width: 100%;
        min-width: 0;
    }
    .players-page .scan-select label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .players-page .scan-select select {
        width: 100%;
        max-width: 100%;
    }
    .players-page .pagination-card {
        flex-direction: column;
        align-items: stretch;
    }
    .players-page .pagination-card .per-page-select {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    .players-page .pagination-card .pagination-info {
        text-align: center;
        order: -1;
        margin: 0;
    }
    .players-page .stats-table-wrap {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
}

.player-avatar-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.player-avatar-wrap--sm { width: 40px; height: 40px; }
.player-avatar-wrap--lg { width: 120px; height: 120px; }
.player-avatar-circle {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
}
.player-avatar-initials {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}
.player-avatar-wrap--lg .player-avatar-initials { font-size: 2rem; }
.player-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.player-avatar-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}
.stats-avatar-cell { width: 48px; padding-right: 0.25rem; }

/* v2 portal extras */
.sidebar-link-btn {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.pwa-install-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.pwa-install-modal[hidden] {
    display: none;
}
.pwa-install-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}
.pwa-install-modal-panel {
    position: relative;
    width: min(100%, 26rem);
    padding: 1.25rem 1.35rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.pwa-install-modal-title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}
.pwa-install-steps {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
}
.pwa-install-steps ol {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.2rem;
}
.pwa-install-steps li + li {
    margin-top: 0.45rem;
}
.pwa-install-share-icon {
    display: inline-block;
    font-size: 1.1rem;
    vertical-align: middle;
}
.pwa-install-note {
    margin-top: 0.75rem;
}
body.pwa-install-modal-open {
    overflow: hidden;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    font-size: 1.75rem;
}

@media (max-width: 900px) {
    .has-sidebar .app-shell {
        margin-left: 0 !important;
    }
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-expanded);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }
    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.55);
    }
    .has-sidebar.sidebar-open .app-shell {
        margin-left: 0 !important;
    }
    .main-content {
        padding: 1rem 1rem 1.5rem;
    }
    .profile-layout {
        grid-template-columns: 1fr;
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .hero-banner h1 {
        font-size: 1.5rem;
    }
    .topbar-name {
        display: none;
    }
}
.governor-header {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.25rem;
}
.governor-header-main { margin: 0; }

/* Public landing page */
.public-page {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 11, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.public-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.public-brand:hover { color: var(--accent); }

.public-brand-text {
    font-size: 1.05rem;
}

.brand-logo--public {
    width: 40px;
    height: 40px;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.public-nav a:not(.btn) {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.public-nav a:not(.btn):hover,
.public-nav a:not(.btn).is-active {
    color: var(--accent);
}

.public-page-intro {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 0;
}

.public-back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.public-back-link:hover {
    color: var(--accent);
}

.public-hero {
    position: relative;
    min-height: clamp(320px, 52vh, 560px);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 70% 20%, rgba(249, 115, 22, 0.18), transparent 55%),
        linear-gradient(180deg, #1a1510 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.public-hero__media {
    position: absolute;
    inset: 0;
}

.public-hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
}

.public-hero__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(10, 11, 15, 0.35) 0%, rgba(10, 11, 15, 0.75) 55%, rgba(10, 11, 15, 0.95) 100%),
        linear-gradient(90deg, rgba(10, 11, 15, 0.85) 0%, transparent 45%);
    pointer-events: none;
}

.public-hero--has-image .public-hero__overlay {
    background:
        linear-gradient(180deg, rgba(10, 11, 15, 0.2) 0%, rgba(10, 11, 15, 0.7) 50%, rgba(10, 11, 15, 0.98) 100%),
        linear-gradient(90deg, rgba(10, 11, 15, 0.75) 0%, transparent 50%);
}

.public-hero__content {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 2.75rem;
}

.public-hero__eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.public-hero__title {
    margin: 0 0 0.65rem;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    line-height: 1.05;
    max-width: 14ch;
}

.public-hero__tagline {
    margin: 0;
    max-width: 36rem;
    color: rgba(240, 242, 247, 0.82);
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    line-height: 1.55;
}

.public-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.public-manifesto {
    padding: 0;
    min-width: 0;
}

.public-main {
    padding: 3rem 1.5rem 4rem;
}

.public-main-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 2.5rem;
    align-items: start;
}

.public-manifesto-inner {
    max-width: none;
    margin: 0;
}

.public-sidebar {
    position: sticky;
    top: calc(4.5rem + 1px);
}

.public-login-card {
    max-width: none;
    margin: 0;
}

.public-login-card .auth-brand {
    margin-bottom: 1.25rem;
}

.public-login-title {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.public-login-form {
    margin-top: 0.25rem;
}

.public-login-submit {
    width: 100%;
    margin-top: 0.5rem;
}

.public-login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.public-login-actions .public-login-submit {
    margin-top: 0;
}

.public-login-hint {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.5;
}

.public-manifesto-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.public-manifesto-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.public-manifesto-body p {
    margin: 0 0 1.35rem;
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(240, 242, 247, 0.92);
}

.public-manifesto-body p:last-child {
    margin-bottom: 0;
}

.public-manifesto-closer {
    margin-top: 1.75rem !important;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(249, 115, 22, 0.25);
    color: var(--accent) !important;
    font-weight: 600;
    font-style: italic;
}

.public-manifesto-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.public-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.public-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.85rem;
}

.public-footer-links a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 1rem;
}

.public-footer-links a:hover {
    color: var(--accent);
}

@media (max-width: 900px) {
    .public-main-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .public-sidebar {
        position: static;
        order: -1;
        max-width: 420px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .public-header-inner,
    .public-hero__content,
    .public-main,
    .public-footer-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .public-sidebar {
        max-width: none;
    }

    .public-header-actions {
        min-width: 0;
        flex: 1 1 auto;
        justify-content: flex-end;
    }

    .public-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        scrollbar-width: none;
        gap: 0.65rem;
        padding-bottom: 0.15rem;
    }

    .public-nav::-webkit-scrollbar {
        display: none;
    }

    .public-nav a:not(.btn) {
        display: inline;
        white-space: nowrap;
        font-size: 0.82rem;
    }

    .public-hero {
        min-height: 360px;
    }
}

/* Migration application */
.public-migration {
    padding: 1.25rem 1.5rem 4rem;
}

.public-migration-inner {
    max-width: 920px;
    margin: 0 auto;
}

.public-migration-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.public-migration-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
}

.migration-form.panel {
    padding: 1.5rem;
}

.migration-fieldset {
    border: none;
    margin: 0 0 1.75rem;
    padding: 0 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

.migration-fieldset:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.migration-fieldset legend {
    padding: 0;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

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

.form-group-span {
    grid-column: 1 / -1;
}

.migration-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.migration-garrison-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.migration-garrison-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.migration-admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.detail-dl {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) 1fr;
    gap: 0.65rem 1rem;
    margin: 0;
}

.detail-dl dt {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.detail-dl dd {
    margin: 0;
}

.detail-dl-block {
    grid-template-columns: 1fr;
}

.detail-dl-block dt {
    margin-top: 0.75rem;
}

.detail-dl-block dt:first-child {
    margin-top: 0;
}

.migration-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.migration-file-thumb {
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.migration-file-thumb img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.migration-delete-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .public-migration,
    .public-page-intro {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .migration-form-grid,
    .migration-admin-grid {
        grid-template-columns: 1fr;
    }

    .detail-dl {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

/* Fort leaderboards */
.fort-card-grid {
    margin-top: 0;
}

.fort-overall-section {
    margin-bottom: 1.5rem;
}

.fort-overall-section__head,
.fort-uploads-section__head {
    margin-bottom: 1rem;
}

.fort-overall-section__head h2,
.fort-uploads-section__head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.fort-uploads-section {
    margin-top: 0.5rem;
}

.fort-card h3 {
    margin: 0 0 0.5rem;
    color: var(--accent);
}

.fort-card .card-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--accent);
    font-size: 0.9rem;
}

.fort-upload-form {
    max-width: 36rem;
}

.fort-leaderboard-stats .stat-value-sm {
    font-size: 1.35rem;
}

.fort-top-stat .stat-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fort-rank-gold {
    color: #d4af37;
    font-weight: 700;
}

.fort-rank-silver {
    color: #b8b8b8;
    font-weight: 700;
}

.fort-rank-bronze {
    color: #cd7f32;
    font-weight: 700;
}

.fort-sortable {
    cursor: pointer;
    user-select: none;
}

.fort-sortable:hover {
    color: var(--accent);
}

.fort-sortable.is-asc::after {
    content: ' ▲';
    font-size: 0.75em;
    color: var(--accent);
}

.fort-sortable.is-desc::after {
    content: ' ▼';
    font-size: 0.75em;
    color: var(--accent);
}

.fort-leaderboard-foot {
    margin: 1rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.fort-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.fort-chart-wrap--tall {
    height: 340px;
}

@media (max-width: 768px) {
    .fort-charts-grid {
        grid-template-columns: 1fr;
    }

    .fort-chart-wrap,
    .fort-chart-wrap--tall {
        height: 300px;
    }
}

.page-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

/* MGE */
.mge-policy-note {
    margin-bottom: 1rem;
}

.mge-event-panel {
    margin-top: 0;
}

.mge-event-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.mge-event-header h2 {
    margin: 0;
}

.mge-commander-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.mge-leaderboard th:first-child,
.mge-leaderboard td:first-child {
    width: 4rem;
}

.mge-status-panel {
    margin-top: 1.5rem;
}

.mge-status-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.mge-admin-action {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.detail-list {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-list dd {
    margin: 0;
}

/* RoK events calendar */
.rok-cal-related {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rok-cal-related:hover {
    border-color: rgba(249, 115, 22, 0.35);
    background: rgba(249, 115, 22, 0.06);
}

.rok-cal-related-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
}

.rok-cal-related-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.rok-cal-related-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.rok-cal-related-body strong {
    font-size: 0.95rem;
}

.rok-cal-related-body .hint {
    font-size: 0.84rem;
    line-height: 1.4;
}

.rok-cal-related-cta {
    flex-shrink: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--accent);
}

.rok-calendar {
    padding: 1rem;
}

.rok-cal-toolbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.rok-cal-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rok-cal-toolbar-center {
    justify-content: center;
}

.rok-cal-toolbar-group:last-child {
    justify-content: flex-end;
}

.rok-cal-year,
.rok-cal-month {
    margin: 0;
    font-size: 1.1rem;
    min-width: 7rem;
    text-align: center;
}

.rok-cal-utc {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.35rem 0.65rem;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.rok-cal-mobile-hint {
    display: none;
    text-align: center;
    margin-bottom: 0.75rem;
}

.rok-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.35rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.rok-cal-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rok-cal-week {
    position: relative;
}

.rok-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.rok-cal-day {
    min-height: 4.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    color: inherit;
    padding: 0.35rem;
    text-align: left;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.rok-cal-day-has-events {
    cursor: pointer;
}

.rok-cal-day-has-events:hover {
    background: rgba(255, 255, 255, 0.06);
}

.rok-cal-day-today {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(255, 140, 0, 0.35);
}

.rok-cal-day-out {
    opacity: 0.35;
}

.rok-cal-day-num {
    font-size: 0.85rem;
    font-weight: 700;
}

.rok-cal-day-dots {
    display: none;
    flex-wrap: wrap;
    gap: 0.15rem;
    margin-top: auto;
}

.rok-cal-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
}

.rok-cal-bars {
    display: none;
    position: absolute;
    inset: 1.4rem 0.15rem 0.15rem;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
    pointer-events: none;
}

.rok-cal-bar {
    font-size: 0.65rem;
    line-height: 1.2;
    padding: 0.15rem 0.35rem;
    border-radius: 0.35rem;
    border: 1px solid;
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rok-cal-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.rok-cal-modal-backdrop[hidden] {
    display: none;
}

.rok-cal-modal {
    width: min(100%, 28rem);
    max-height: 80vh;
    overflow: auto;
}

.rok-cal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.rok-cal-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.rok-cal-modal-event {
    border-left: 4px solid var(--accent);
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.35rem;
    margin-bottom: 0.65rem;
}

.rok-cal-modal-event h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.rok-cal-modal-event p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.rok-cal-help,
.rok-cal-explain {
    margin-top: 1.25rem;
}

.rok-cal-help-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
}

.rok-cal-explain-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.rok-cal-explain-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 1rem;
}

.rok-cal-explain-card h3 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: var(--accent);
}

.rok-cal-explain-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.rok-cal-color-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 0.2rem;
    margin-right: 0.35rem;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.rok-cal-modal-event h3 .badge {
    font-size: 0.65rem;
    vertical-align: middle;
    margin-left: 0.35rem;
}

@media (min-width: 768px) {
    .rok-cal-day {
        min-height: 6.5rem;
    }

    .rok-cal-bars {
        display: grid;
    }

    .rok-cal-day-dots {
        display: none;
    }
}

@media (max-width: 767px) {
    .rok-cal-toolbar {
        grid-template-columns: 1fr;
    }

    .rok-cal-toolbar-group:last-child {
        justify-content: center;
    }

    .rok-cal-mobile-hint {
        display: block;
    }

    .rok-cal-day-dots {
        display: flex;
    }

    .rok-cal-day {
        min-height: 3.5rem;
    }
}

/* Kingdom alliances (leadership) */
.alliance-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.alliance-edit-table thead th {
    white-space: nowrap;
    font-size: 0.78rem;
}

.alliance-row-cell {
    padding: 0.75rem !important;
    background: var(--bg);
}

.alliance-row-grid {
    display: grid;
    grid-template-columns: 7rem 1fr 1fr 5.5rem minmax(10rem, 1.4fr) minmax(10rem, 1.4fr) 6.5rem 6.5rem auto;
    gap: 0.75rem;
    align-items: start;
}

.alliance-row-grid--add {
    margin-bottom: 1rem;
}

.alliance-field label,
.alliance-field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.alliance-field input[type="text"],
.alliance-field select,
.alliance-contact-row input[type="text"] {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
}

.alliance-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.alliance-contact-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.roster-player-row {
    flex-wrap: nowrap;
}

.roster-player-row input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
}

.btn-xs {
    padding: 0.3rem 0.55rem;
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: nowrap;
}

.alliance-contact-row input[type="text"] {
    flex: 1 1 8rem;
    min-width: 0;
}

.alliance-contact-field .hint {
    margin-top: 0.25rem;
    font-size: 0.78rem;
}

.alliance-player-picker {
    margin-top: 0.35rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.alliance-player-search {
    width: 100%;
    margin-bottom: 0.35rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}

.alliance-player-results {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 14rem;
    overflow-y: auto;
}

.alliance-player-option,
.alliance-player-empty {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.alliance-player-option:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.alliance-player-empty {
    color: var(--muted);
    cursor: default;
}

.alliance-action-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding-top: 1.35rem;
}

.roster-label-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.roster-row-compact {
    align-items: end;
    gap: 0.45rem;
}

.roster-row-compact .alliance-field-label:not(.roster-label-sr) {
    margin-bottom: 0.25rem;
}

.roster-row-compact .alliance-field input[type="text"],
.roster-row-compact .alliance-contact-row input[type="text"] {
    padding: 0.38rem 0.5rem;
    font-size: 0.84rem;
}

.roster-row-compact .alliance-action-buttons {
    padding-top: 0;
}

.census-edit-table .alliance-row-cell {
    padding: 0.5rem !important;
}

.roster-profile-link {
    margin-top: 0.2rem;
    font-size: 0.74rem;
    line-height: 1.2;
}

.roster-profile-link a {
    color: var(--accent);
    text-decoration: none;
}

.roster-profile-link a:hover {
    text-decoration: underline;
}

.census-player-field {
    min-width: 0;
}

@media (max-width: 1100px) {
    .alliance-row-grid,
    .alliance-row-grid--add {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .alliance-field--wide {
        grid-column: 1 / -1;
    }

    .alliance-field--actions {
        grid-column: 1 / -1;
    }

    .alliance-action-buttons {
        padding-top: 0;
    }
}

@media (max-width: 640px) {
    .alliance-row-grid,
    .alliance-row-grid--add {
        grid-template-columns: 1fr;
    }
}

/* Fillers roster (leadership) */
.filler-row-grid {
    grid-template-columns:
        minmax(10rem, 1.05fr)
        minmax(4.5rem, 0.65fr)
        minmax(4rem, 0.5fr)
        minmax(5.5rem, 0.75fr)
        5.75rem
        6.5rem
        5.75rem
        minmax(max-content, auto);
    align-items: end;
}

.filler-row-grid .alliance-field--yn {
    max-width: 6.5rem;
}

.filler-row-grid .alliance-field--yn-wide {
    max-width: 7rem;
}

.filler-row-grid .alliance-field--yn select {
    width: 100%;
    min-width: 0;
}

.filler-row-grid .alliance-field--actions {
    min-width: max-content;
    white-space: nowrap;
}

.filler-row-grid .alliance-action-buttons {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
}

@media (max-width: 1100px) {
    .filler-row-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filler-row-grid .alliance-field--yn,
    .filler-row-grid .alliance-field--yn-wide {
        max-width: none;
    }

    .filler-row-grid .alliance-field--actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .filler-row-grid {
        grid-template-columns: 1fr;
    }
}

.census-name-link {
    display: none;
}

.census-row-grid {
    grid-template-columns: minmax(12rem, 1.15fr) minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(6.5rem, 0.85fr) minmax(8rem, 1fr) 3.5rem 4.5rem 3.5rem minmax(7rem, 0.9fr) auto;
    align-items: end;
}

@media (max-width: 1100px) {
    .census-row-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .census-row-grid {
        grid-template-columns: 1fr;
    }
}

/* Fillers read view (leadership) */
.fillers-panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.fillers-capture-head {
    display: none;
    margin-bottom: 0.35rem;
}

.fillers-capture--export .fillers-capture-head {
    display: block;
}

.fillers-capture-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.fillers-capture-meta {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
}

.fillers-capture--export {
    padding: 1rem;
    background: #12141a;
    border-radius: 10px;
}

.fillers-capture--export .fillers-dkp-hint a {
    color: #93c5fd;
}

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

.deadweights-period-panel {
    margin-bottom: 1rem;
}

.deadweights-period-form {
    margin-bottom: 0.35rem;
}

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

.deadweights-min-dkp-field {
    min-width: 8rem;
}

.deadweights-min-dkp-input {
    width: 5.5rem;
    max-width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.deadweights-scan-hint {
    margin: 0 0 0.75rem;
}

.deadweights-capture-head {
    display: none;
    margin-bottom: 0.35rem;
}

.deadweights-capture--export .deadweights-capture-head {
    display: block;
}

.deadweights-capture-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.deadweights-capture-meta {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
}

.deadweights-capture--export {
    padding: 1rem;
    background: #12141a;
    border-radius: 10px;
}

.deadweights-stat-grid {
    margin-bottom: 0.75rem;
}

.deadweights-capture--export .deadweights-stat-grid {
    margin-bottom: 1rem;
}

.deadweights-capture--export .deadweights-stat-grid .stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.deadweights-scan-hint--capture {
    display: none;
    margin: 0 0 0.75rem;
}

.deadweights-capture--export .deadweights-scan-hint--capture {
    display: block;
}

.deadweights-read-table .deadweights-read-row.is-editing {
    background: rgba(249, 115, 22, 0.06);
}

.deadweights-read-table .deadweights-read-row.deadweights-read-row--vacation td {
    background: rgba(34, 197, 94, 0.14);
}

.deadweights-read-table .deadweights-read-row.deadweights-read-row--vacation:hover td {
    background: rgba(34, 197, 94, 0.22);
}

.deadweights-read-table .deadweights-read-row.deadweights-read-row--sleep td {
    background: rgba(250, 204, 21, 0.18);
}

.deadweights-read-table .deadweights-read-row.deadweights-read-row--sleep:hover td {
    background: rgba(250, 204, 21, 0.26);
}

.deadweights-sleep {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.deadweights-sleep--yes {
    color: #facc15;
}

.deadweights-sleep--no {
    color: var(--muted);
    font-weight: 600;
}

.deadweights-read-table .deadweights-th-actions,
.deadweights-read-table .deadweights-actions-cell {
    width: 5.5rem;
    text-align: right;
    white-space: nowrap;
}

.deadweights-edit-row td.deadweights-edit-cell {
    padding: 0.75rem !important;
    background: var(--bg);
    border-bottom: 1px solid rgba(249, 115, 22, 0.15);
}

.deadweights-edit-form-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
}

.deadweights-edit-form-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.15rem;
}

.deadweights-edit-actions {
    display: inline-flex;
    gap: 0.35rem;
}

.deadweights-page {
    padding: 0 0 0.25rem;
}

.deadweights-name-cell {
    min-width: 9rem;
}

.deadweights-name-cell .deadweights-gov-id {
    display: block;
    font-size: 0.74rem;
    margin-top: 0.1rem;
}

.deadweights-read-table .deadweights-read-row td {
    vertical-align: middle;
}

.fillers-page {
    padding: 0 0 0.25rem;
}

.fillers-read-table .fillers-read-row.is-editing {
    background: rgba(249, 115, 22, 0.06);
}

.fillers-read-table .fillers-th-actions,
.fillers-read-table .fillers-actions-cell {
    width: 5.5rem;
    text-align: right;
    white-space: nowrap;
}

.fillers-name-cell {
    min-width: 9rem;
}

.fillers-name-cell .fillers-gov-id {
    display: block;
    font-size: 0.74rem;
    margin-top: 0.1rem;
}

.fillers-note-cell {
    max-width: 14rem;
    font-size: 0.84rem;
    line-height: 1.35;
}

.fillers-read-table .fillers-read-row.fillers-read-row--alert td {
    background: rgba(248, 113, 113, 0.2);
}

.fillers-read-table .fillers-read-row.fillers-read-row--alert:hover td {
    background: rgba(248, 113, 113, 0.28);
}

.fillers-read-table .fillers-read-row.is-editing.fillers-read-row--alert td {
    background: rgba(248, 113, 113, 0.14);
}

.fillers-read-table .fillers-read-row.fillers-read-row--asleep td {
    background: rgba(250, 204, 21, 0.18);
}

.fillers-read-table .fillers-read-row.fillers-read-row--asleep:hover td {
    background: rgba(250, 204, 21, 0.26);
}

.fillers-read-table .fillers-read-row.is-editing.fillers-read-row--asleep td {
    background: rgba(250, 204, 21, 0.14);
}

.fillers-read-table .fillers-read-row.fillers-read-row--vacation td {
    background: rgba(34, 197, 94, 0.14);
}

.fillers-read-table .fillers-read-row.fillers-read-row--vacation:hover td {
    background: rgba(34, 197, 94, 0.22);
}

.fillers-read-table .fillers-read-row.is-editing.fillers-read-row--vacation td {
    background: rgba(34, 197, 94, 0.14);
}

.fillers-vacation {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.fillers-vacation--yes {
    color: #86efac;
}

.fillers-helps-build {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.fillers-helps-build--no {
    color: #f87171;
    font-weight: 700;
}

.fillers-sleep {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.fillers-sleep--yes {
    color: #86efac;
    font-weight: 700;
}

.fillers-sleep--asleep {
    color: #facc15;
    font-weight: 700;
}

.fillers-sleep--no {
    color: var(--muted);
}

.fillers-vacation--no {
    color: var(--muted);
}

.fillers-dkp-hint {
    margin: 0 0 0.75rem;
}

.fillers-empty {
    color: var(--muted);
}

.fillers-edit-row td.fillers-edit-cell {
    padding: 0.75rem !important;
    background: var(--bg);
    border-bottom: 1px solid rgba(249, 115, 22, 0.15);
    overflow-x: auto;
}

.fillers-edit-form-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.fillers-add-panel[hidden] {
    display: none;
}

/* Shared leadership roster read/edit (fillers, census, alliances) */
.roster-page {
    padding: 0 0 0.25rem;
}

.roster-read-table .roster-read-row.is-editing,
.fillers-read-table .fillers-read-row.is-editing {
    background: rgba(249, 115, 22, 0.06);
}

.roster-read-table .roster-th-actions,
.roster-read-table .roster-actions-cell,
.fillers-read-table .fillers-th-actions,
.fillers-read-table .fillers-actions-cell {
    width: 5.5rem;
    text-align: right;
    white-space: nowrap;
}

.roster-name-cell,
.fillers-name-cell {
    min-width: 9rem;
}

.roster-name-cell .roster-gov-id,
.fillers-name-cell .fillers-gov-id {
    display: block;
    font-size: 0.74rem;
    margin-top: 0.1rem;
}

.roster-note-cell,
.fillers-note-cell {
    max-width: 14rem;
    font-size: 0.84rem;
    line-height: 1.35;
}

.roster-tag-cell {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.roster-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.roster-badge--yes {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
}

.roster-badge--no {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

.roster-empty,
.fillers-empty {
    color: var(--muted);
}

.roster-edit-row td.roster-edit-cell,
.fillers-edit-row td.fillers-edit-cell {
    padding: 0.75rem !important;
    background: var(--bg);
    border-bottom: 1px solid rgba(249, 115, 22, 0.15);
    overflow-x: auto;
}

.roster-edit-form-head,
.fillers-edit-form-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.roster-add-panel[hidden],
.fillers-add-panel[hidden] {
    display: none;
}

.alliances-read-table .roster-contact-cell {
    min-width: 7rem;
    font-size: 0.84rem;
}

/* Alliance mail generator (leadership) */
.mail-generator-page {
    max-width: 1200px;
}

body.mail-generator-wide-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

body.mail-generator-wide-page .mail-generator-page {
    max-width: none;
    width: 100%;
}

body.portal-users-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

body.admin-area .kvk-upload-page,
body.admin-area .upload-page {
    max-width: none;
}

.kvk-upload-form select,
.kvk-upload-form input[type="text"],
.kvk-upload-form input[type="date"],
.kvk-upload-form input[type="number"],
.kvk-upload-form input[type="url"],
.kvk-upload-form input[type="file"] {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

.kvk-upload-form label span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.kvk-upload-form .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 1rem 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.kvk-upload-form .kvk-upload-file {
    grid-column: 1 / -1;
}

.kvk-existing-uploads h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.kvk-existing-uploads ul {
    margin: 0;
    padding-left: 1.25rem;
}

.kvk-breadcrumb {
    margin-top: 1rem;
}

.mail-generator-panel {
    padding: 1rem 1.25rem 1.25rem;
}

.mail-generator-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.mail-generator-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.mail-generator-toolbar-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9aa3b2);
    margin-right: 0.15rem;
}

.mail-gen-color-btn {
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem 0.35rem 0.55rem;
}

.mail-gen-color-btn::before {
    content: '';
    flex-shrink: 0;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 2px;
    background: var(--swatch, #fff);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.mail-gen-color-picker-label {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.mail-gen-color-picker-label input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.mail-gen-gradient-field {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.mail-gen-gradient-field input[type="color"] {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.mail-gen-gradient-field input[type="range"] {
    width: 4.5rem;
}

.mail-generator-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 960px) {
    .mail-generator-workspace {
        grid-template-columns: 1fr;
    }
}

.mail-generator-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted, #9aa3b2);
}

.mail-generator-source {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.mail-generator-editor-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
    font-size: 0.78rem;
}

.mail-generator-counter.is-warning {
    color: #f0ad4e;
    font-weight: 600;
}

.mail-generator-counter.is-over {
    color: #e74c3c;
    font-weight: 700;
}

.mail-generator-preview-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.mail-generator-preview-tab {
    appearance: none;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.mail-generator-preview-tab.is-active {
    background: var(--accent, #3b82f6);
    border-color: transparent;
    color: #fff;
}

.mail-generator-preview-pane {
    min-height: 280px;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.mail-generator-preview-mail {
    background: rgba(255, 255, 255, 0.04);
}

.mail-generator-preview-board {
    background: linear-gradient(90deg, rgb(8, 85, 123), rgb(8, 101, 140), rgb(8, 85, 123));
    color: #fff;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 600;
}

.mail-generator-preview-empty {
    opacity: 0.65;
}

.mail-generator-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.mail-generator-status.is-error {
    color: #e74c3c;
}

.mail-generator-help {
    margin-top: 1rem;
    font-size: 0.84rem;
    color: var(--text-muted, #9aa3b2);
}

.mail-generator-help summary {
    cursor: pointer;
    font-weight: 600;
    color: inherit;
}

.mail-generator-help ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.mail-gen-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mail-gen-modal[hidden] {
    display: none;
}

.mail-gen-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.mail-gen-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 320px);
    padding: 1rem;
    border-radius: 10px;
    background: var(--panel-bg, #151820);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.mail-gen-modal-dialog h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.mail-gen-modal-dialog input[type="number"] {
    width: 100%;
    margin-bottom: 0.75rem;
}

.mail-gen-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.mail-generator-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.mail-generator-mode-tab {
    appearance: none;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
    cursor: pointer;
}

.mail-generator-mode-tab.is-active {
    background: var(--accent, #3b82f6);
    border-color: transparent;
    color: #fff;
}

.mail-gen-tab-count {
    opacity: 0.85;
    font-size: 0.75rem;
}

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

.mail-template-panel {
    padding: 1rem 1.25rem 1.25rem;
}

.mail-template-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 280px;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .mail-template-layout {
        grid-template-columns: 1fr;
    }
}

.mail-template-filters h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.mail-template-filter-group {
    margin-top: 1rem;
}

.mail-template-filter-group h3 {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9aa3b2);
}

.mail-template-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.mail-template-filter-btn {
    appearance: none;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    cursor: pointer;
}

.mail-template-filter-btn.is-active {
    background: var(--accent, #3b82f6);
    border-color: transparent;
    color: #fff;
}

.mail-template-gallery-credit {
    margin-top: 1.25rem;
    font-size: 0.74rem;
}

.mail-template-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mail-template-search {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
}

.mail-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    max-height: 70vh;
    overflow: auto;
    padding-right: 0.25rem;
}

.mail-template-card {
    appearance: none;
    text-align: left;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.18);
    color: inherit;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    position: relative;
}

.mail-template-card.is-selected {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 1px var(--accent, #3b82f6);
}

.mail-template-card-title {
    display: block;
    font-size: 0.84rem;
    margin-bottom: 0.25rem;
}

.mail-template-card-tags {
    display: block;
    font-size: 0.72rem;
    line-height: 1.35;
}

.mail-template-card-warn {
    position: absolute;
    top: 0.4rem;
    right: 0.45rem;
    font-size: 0.65rem;
    color: #f0ad4e;
    font-weight: 600;
}

.mail-template-preview-aside {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.12);
    position: sticky;
    top: 1rem;
}

.mail-template-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.mail-template-preview-eyebrow {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9aa3b2);
}

.mail-template-preview-head h3 {
    margin: 0.15rem 0 0;
    font-size: 0.95rem;
}

.mail-template-preview-image-wrap {
    margin-bottom: 0.65rem;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.mail-template-preview-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
}

.mail-template-preview-body {
    min-height: 160px;
    max-height: 320px;
    overflow: auto;
    padding: 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.mail-template-preview-meta {
    margin: 0.5rem 0 0;
    font-size: 0.74rem;
}

.mail-template-saved-header h2 {
    margin: 0 0 0.25rem;
}

.mail-template-saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.mail-template-saved-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
}

.mail-template-saved-body {
    flex: 1;
    min-width: min(100%, 280px);
}

.mail-template-saved-title {
    display: block;
    margin-bottom: 0.15rem;
}

.mail-template-saved-meta {
    display: block;
    margin-bottom: 0.5rem;
}

.mail-template-saved-preview {
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    max-height: 120px;
    overflow: hidden;
}

.mail-template-saved-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.mail-template-empty {
    padding: 1rem 0;
}

#mailGenSaveModal input[type="text"] {
    width: 100%;
    margin-bottom: 0.35rem;
}

/* Member tools */
.hero-link {
    color: inherit;
    text-decoration: none;
    opacity: 0.85;
}

.hero-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.portal-tools-grid {
    margin-top: 0.5rem;
}

.portal-tool-card .portal-tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
}

.portal-tool-card .portal-tool-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.portal-tool-page {
    max-width: 720px;
}

.calculator-panel {
    padding: 1.25rem;
}

.calculator-island.compact {
    max-width: 100%;
}

.vip-token-grid-container {
    display: none;
    margin: 0.75rem 0 1rem;
}

.vip-token-grid-container.visible {
    display: block;
}

.mge-training-panel {
    padding: 1.25rem;
}

.mge-training-app {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mge-speed-bonus-field input {
    max-width: 12rem;
}

.mge-training-totals {
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
}

.mge-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.mge-total-card {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.mge-total-card--primary {
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.12);
}

.mge-total-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.25rem;
}

.mge-total-value {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

.mge-rss-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.mge-rss-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.92rem;
}

.mge-rss-item img {
    object-fit: contain;
}

.mge-training-sections {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mge-tier-panel {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
    padding: 0 0.85rem 0.85rem;
}

.mge-tier-summary {
    cursor: pointer;
    padding: 0.85rem 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
}

.mge-tier-summary::-webkit-details-marker {
    display: none;
}

.mge-tier-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.mge-tier-hint {
    font-size: 0.82rem;
    color: var(--text-muted, #9aa3b2);
}

.mge-lane {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.mge-lane-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    margin-bottom: 0.5rem;
}

.mge-lane-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.mge-lane-meta {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.mge-troop-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.mge-troop-cell label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.3rem;
}

.mge-troop-input {
    width: 100%;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .mge-troop-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.hoh-panel {
    padding: 1.25rem;
}

.hoh-return-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.hoh-return-option {
    margin: 0;
}

.hoh-return-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hoh-return-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hoh-return-sublabel {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted, #9aa3b2);
    margin-top: 0.15rem;
}

.hoh-return-option input:checked + .hoh-return-btn {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.15);
}

.hoh-return-option input:focus-visible + .hoh-return-btn {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
}

.hoh-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.hoh-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.hoh-item img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.hoh-item label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #9aa3b2);
}

.hoh-troop-input {
    width: 100%;
    text-align: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.healing-panel {
    padding: 1.25rem;
}

.healing-app {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.healing-options-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

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

.healing-actions {
    display: flex;
    justify-content: flex-end;
}

.healing-totals {
    margin-top: 0.25rem;
}

.healing-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.healing-total-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.healing-total-card--primary {
    border-color: rgba(251, 146, 60, 0.45);
    background: rgba(251, 146, 60, 0.08);
}

.healing-total-label {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.healing-total-value {
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.healing-total-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
}

.healing-tier-sections {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.healing-tier-panel {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    padding: 0.5rem 0.85rem 0.85rem;
}

.healing-tier-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 0;
    list-style: none;
}

.healing-tier-summary::-webkit-details-marker {
    display: none;
}

.healing-tier-title {
    font-weight: 700;
}

.healing-tier-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #9aa3b2);
}

.healing-troop-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.healing-troop-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.healing-troop-cell img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.healing-troop-cell label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #9aa3b2);
}

.healing-troop-input {
    width: 100%;
    text-align: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.healing-tier-breakdown {
    margin-top: 0.5rem;
}

.healing-breakdown-table {
    font-size: 0.88rem;
}

@media (max-width: 900px) {
    .healing-options-grid,
    .healing-speedups-row {
        grid-template-columns: 1fr;
    }

    .healing-troop-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.commander-calc-panel {
    padding: 1.25rem;
}

.commander-calc-app {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.commander-calc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.commander-rarity-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.commander-rarity-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
}

.commander-rarity-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.commander-rarity-option img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.commander-rarity-option input:checked + img,
.commander-rarity-option input:checked ~ span {
    filter: none;
}

.commander-rarity-option input:checked ~ span,
.commander-rarity-option:has(input:checked) {
    border-color: rgba(251, 146, 60, 0.55);
    background: rgba(251, 146, 60, 0.1);
}

.commander-rarity-option--legendary:has(input:checked) {
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.1);
}

.commander-rarity-option--epic:has(input:checked) {
    border-color: rgba(168, 85, 247, 0.55);
    background: rgba(168, 85, 247, 0.1);
}

.commander-rarity-option--elite:has(input:checked) {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.1);
}

.commander-rarity-option--advanced:has(input:checked) {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.1);
}

.commander-calc-section {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.commander-calc-section-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.commander-level-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.commander-tome-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.commander-tome-item label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted, #9aa3b2);
}

.commander-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.commander-result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(255, 255, 255, 0.03);
    min-width: 160px;
    text-align: center;
}

.commander-result-card--primary {
    border-color: rgba(251, 146, 60, 0.45);
    background: rgba(251, 146, 60, 0.08);
}

.commander-result-label {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.commander-result-value {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

.commander-result-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
}

.commander-skill-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    max-width: 520px;
}

.commander-skill-col h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted, #9aa3b2);
}

.commander-skill-select {
    width: 100%;
    max-width: 8rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: var(--bg-elevated, rgba(255, 255, 255, 0.04));
    color: inherit;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.commander-skill-select:focus {
    outline: none;
    border-color: rgba(251, 146, 60, 0.55);
    box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.15);
}

@media (max-width: 900px) {
    .commander-level-row,
    .commander-tome-grid,
    .commander-skill-grid {
        grid-template-columns: 1fr;
    }
}

/* EXP calculator (tomes inventory total) */
.exp-calc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.exp-calc-section-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.exp-tome-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.exp-tome-item label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted, #9aa3b2);
}

.exp-results {
    margin-top: 1rem;
}

.exp-result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(251, 146, 60, 0.45);
    background: rgba(251, 146, 60, 0.08);
    min-width: 200px;
    text-align: center;
}

.exp-result-label {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.exp-result-value {
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
}

.exp-result-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
}

.exp-calc-link {
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .exp-tome-grid {
        grid-template-columns: 1fr;
    }
}

.star-level-panel {
    padding: 1.25rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.star-rarity-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.star-rarity-option {
    margin: 0;
}

.star-rarity-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.star-rarity-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 5.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.star-rarity-btn img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.star-rarity-option input:checked + .star-rarity-btn {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.15);
}

.star-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.star-inventory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
    text-align: center;
}

.star-inventory-item img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.star-inventory-info {
    width: 100%;
}

.star-inventory-info label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.3rem;
}

.star-count-input {
    width: 100%;
    text-align: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.star-stat {
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
}

.star-tip-box {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 193, 7, 0.25);
    background: rgba(255, 193, 7, 0.08);
    font-size: 0.88rem;
}

.star-tip-box p {
    margin: 0.35rem 0 0;
    color: var(--text-muted, #9aa3b2);
}

.star-result-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
}

.star-result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    font-weight: 600;
}

.star-exp-needed {
    color: var(--text-muted, #9aa3b2);
    font-size: 0.92rem;
}

.star-recommended {
    font-size: 0.9rem;
}

.star-rec-label {
    color: var(--text-muted, #9aa3b2);
    margin-right: 0.35rem;
}

.star-result-table {
    display: grid;
    gap: 0.45rem;
}

.star-result-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
}

.star-row-desc {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.star-row-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.star-attempts {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.star-insufficient {
    color: #e74c3c;
}

.star-shortfall {
    font-size: 0.88rem;
    color: var(--text-muted, #9aa3b2);
}

.skill-upgrades-panel {
    padding: 1.25rem;
}

.skill-level-input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.12em;
    text-align: center;
}

.skill-level-input.input-error {
    border-color: rgba(231, 76, 60, 0.55);
}

.skill-upgrades-help {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--text-muted, #9aa3b2);
}

.equipment-builds-panel {
    padding: 1.25rem;
}

.equip-build-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
}

.equip-build-tab {
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted, #9aa3b2);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.equip-build-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
}

.equip-build-tab.is-active.equip-tab-infantry {
    background: #2563eb;
    color: #fff;
}

.equip-build-tab.is-active.equip-tab-cavalry {
    background: #16a34a;
    color: #fff;
}

.equip-build-tab.is-active.equip-tab-archer {
    background: #dc2626;
    color: #fff;
}

.equip-build-tab.is-active.equip-tab-siege {
    background: #9333ea;
    color: #fff;
}

.equip-builds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.equip-build-card {
    border-radius: 14px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 0.85rem 1.1rem;
}

.equip-build-card-header {
    margin-bottom: 0.75rem;
    text-align: center;
}

.equip-build-card-title h3 {
    margin: 0;
    font-size: 1.05rem;
}

.equip-build-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.equip-gear-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.equip-gear-row {
    display: flex;
    justify-content: center;
}

.equip-gear-row--pair {
    gap: 2.25rem;
}

.equip-gear-row:nth-child(2) {
    margin-top: 0.15rem;
    margin-bottom: -1.75rem;
}

.equip-gear-row:nth-child(4) {
    margin-top: -1.75rem;
}

.equip-gear-row:nth-child(5) {
    margin-top: -1.75rem;
    margin-bottom: -1.75rem;
}

.equip-slot-wrap {
    width: 4rem;
    height: 4rem;
}

.equip-slot {
    position: relative;
    width: 4rem;
    height: 4rem;
}

.equip-slot-frame {
    width: 4rem;
    height: 4rem;
    border-width: 2px;
    border-style: solid;
    border-radius: 8px;
    transform: rotate(45deg);
    box-sizing: border-box;
}

.equip-border-gray-400 { border-color: #9ca3af; }
.equip-border-gray-500 { border-color: #6b7280; }
.equip-border-green-400 { border-color: #4ade80; }
.equip-border-blue-400 { border-color: #60a5fa; }
.equip-border-purple-400 { border-color: #c084fc; }
.equip-border-orange-400 { border-color: #fb923c; }

.equip-slot-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.equip-slot-icon img {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    opacity: 0.88;
}

.equip-slot-tooltip {
    position: absolute;
    bottom: calc(100% + 0.35rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.72rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 5;
}

.equip-slot:hover .equip-slot-tooltip {
    opacity: 1;
}

.equip-builds-intro {
    margin-top: 0.5rem;
    padding: 1.1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.equip-builds-intro h2 {
    margin: 0 0 0.65rem;
    font-size: 1.15rem;
}

.equip-builds-intro p {
    margin: 0 0 0.5rem;
    color: var(--text-muted, #9aa3b2);
    font-size: 0.92rem;
    line-height: 1.5;
}

.equip-builds-hint {
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(234, 179, 8, 0.25);
    background: rgba(234, 179, 8, 0.08);
    color: inherit;
}

/* Equipment crafting calculator */
.portal-tool-page.portal-tool-page--wide.portal-tool-page--equipment {
    max-width: 56rem;
}

/* Talent trees — native builder + kingdom library */
.portal-tool-page.portal-tool-page--wide.portal-tool-page--talent-trees {
    max-width: 80rem;
}

.talent-trees-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.talent-trees-builder-panel {
    padding: 1rem 1rem 1.1rem;
    min-width: 0;
    overflow: hidden;
}

.talent-trees-builder-panel .talent-builder-canvas {
    position: relative;
    isolation: isolate;
    z-index: 0;
}

.talent-trees-builder-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.talent-trees-builder-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.talent-builder-summary {
    margin: 0.15rem 0 0;
    font-size: 0.86rem;
    color: var(--accent);
}

.talent-trees-builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.talent-builder-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.talent-builder-commander-wrap {
    flex: 1 1 14rem;
    margin: 0;
}

.talent-builder-commander {
    width: 100%;
}

.talent-builder-points {
    margin: 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #4ade80;
    white-space: nowrap;
}

.talent-builder-tooltip {
    margin: 0.25rem 0 0.5rem;
    color: #fbbf24;
}

.talent-node-tooltip {
    position: fixed;
    z-index: 1200;
    width: min(16rem, calc(100vw - 1.5rem));
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    line-height: 1.35;
}

.talent-node-tooltip-name {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
    color: #fff;
}

.talent-node-tooltip-desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: 0.35rem;
}

.talent-node-tooltip-level {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

.talent-builder-canvas {
    margin-top: 0.35rem;
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
}

.talent-builder-empty {
    padding: 2rem 1rem;
    text-align: center;
}

/* Single combined tree — in-game layout (red top, yellow bottom-left, blue bottom-right) */
.talent-tree-unified {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
}

.talent-tree-square {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    overflow: hidden;
    container-type: size;
    background:
        radial-gradient(circle at 50% 45%, rgba(40, 28, 18, 0.35), rgba(0, 0, 0, 0.25) 70%),
        url('../img/talents/talentBG.png') center / cover no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.talent-tree-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.talent-tree-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.talent-tree-nodes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
}

/* Center hub — commander portrait + tree totals */
.talent-tree-hex {
    position: absolute;
    width: 17%;
    height: 17%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    pointer-events: none;
}

.talent-tree-hex-bg {
    position: absolute;
    height: 100%;
    width: auto;
    max-width: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
}

.talent-tree-hex-commander {
    position: absolute;
    height: 44%;
    width: 44%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -57%);
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.75));
}

.talent-tree-hex-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -57%);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #f5e6c8;
    background: rgba(0, 0, 0, 0.55);
}

.talent-tree-hex-labels {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.talent-tree-hex-label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-weight: 700;
    font-size: clamp(0.55rem, 1.5cqw, 0.8rem);
    line-height: 1.05;
    text-align: center;
    color: #fff;
    mix-blend-mode: multiply;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.talent-tree-hex-points {
    display: block;
    font-size: 1.2em;
    line-height: 1;
    color: #fff;
}

.talent-tree-hex-tree {
    display: block;
    font-size: 0.92em;
    line-height: 1.05;
}

.talent-tree-hex-label--red {
    width: 40%;
    bottom: 75%;
    left: 50%;
    transform: translateX(-50%);
}

.talent-tree-hex-label--red .talent-tree-hex-tree {
    color: #5c1a0a;
}

.talent-tree-hex-label--yellow {
    width: 38%;
    bottom: 21%;
    left: 19%;
    transform: translateX(calc(-50% + 4px));
}

.talent-tree-hex-label--yellow .talent-tree-hex-tree {
    color: #4a2800;
}

.talent-tree-hex-label--blue {
    width: 38%;
    bottom: 21%;
    left: 62%;
    transform: translateX(calc(-50% + 4px));
}

.talent-tree-hex-label--blue .talent-tree-hex-tree {
    color: #0a2540;
}

.talent-tree-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 0.3;
    vector-effect: non-scaling-stroke;
    transition: stroke 0.15s ease, stroke-width 0.15s ease, filter 0.15s ease;
}

.talent-tree-line.is-active.talent-tree-line--red {
    stroke: #ff5a4a;
    stroke-width: 1.1;
    filter: drop-shadow(0 0 3px rgba(255, 90, 74, 0.95)) drop-shadow(0 0 8px rgba(255, 60, 40, 0.55));
}

.talent-tree-line.is-active.talent-tree-line--yellow {
    stroke: #f5d020;
    stroke-width: 1.1;
    filter: drop-shadow(0 0 3px rgba(245, 208, 32, 0.95)) drop-shadow(0 0 8px rgba(212, 172, 13, 0.55));
}

.talent-tree-line.is-active.talent-tree-line--blue {
    stroke: #4eb3ff;
    stroke-width: 1.1;
    filter: drop-shadow(0 0 3px rgba(78, 179, 255, 0.95)) drop-shadow(0 0 8px rgba(36, 113, 163, 0.55));
}

.talent-builder-canvas .talent-node {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(20, 20, 24, 0.92);
    color: #e8e8e8;
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
    z-index: 10;
    transition: filter 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.talent-node--small {
    width: 2%;
    height: 2%;
    min-width: 1.1rem;
    min-height: 1.25rem;
}

.talent-node--large {
    width: 3%;
    height: 3%;
    min-width: 1.5rem;
    min-height: 1.7rem;
    border-width: 2px;
}

.talent-node--red.is-active {
    border-color: #ff6b5a;
    background: rgba(192, 57, 43, 0.55);
    filter:
        drop-shadow(0 0 4px rgba(255, 90, 74, 1))
        drop-shadow(0 0 10px rgba(231, 76, 60, 0.75))
        drop-shadow(0 0 18px rgba(192, 57, 43, 0.45));
    z-index: 12;
}

.talent-node--yellow.is-active {
    border-color: #ffe066;
    background: rgba(212, 172, 13, 0.45);
    filter:
        drop-shadow(0 0 4px rgba(255, 224, 102, 1))
        drop-shadow(0 0 10px rgba(241, 196, 15, 0.75))
        drop-shadow(0 0 18px rgba(212, 172, 13, 0.45));
    z-index: 12;
}

.talent-node--blue.is-active {
    border-color: #5dade2;
    background: rgba(36, 113, 163, 0.5);
    filter:
        drop-shadow(0 0 4px rgba(93, 173, 226, 1))
        drop-shadow(0 0 10px rgba(52, 152, 219, 0.75))
        drop-shadow(0 0 18px rgba(36, 113, 163, 0.45));
    z-index: 12;
}

.talent-node:not(.is-active) {
    opacity: 0.72;
}

.talent-node-value {
    font-size: clamp(0.45rem, 35%, 0.58rem);
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 1079px) {
    .talent-node--small {
        width: 2.4%;
        height: 2.4%;
    }

    .talent-node--large {
        width: 3.6%;
        height: 3.6%;
    }
}

.talent-save-preview {
    margin: 0;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.86rem;
}

.talent-trees-side {
    padding: 0.85rem 1rem 1rem;
    min-width: 0;
}

@media (min-width: 640px) {
    .talent-trees-filters {
        grid-template-columns: minmax(0, 1.4fr) minmax(10rem, 0.75fr) auto;
        align-items: end;
    }
}

.talent-trees-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.talent-trees-tab {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.talent-trees-tab.is-active {
    border-color: rgba(201, 162, 39, 0.55);
    background: rgba(201, 162, 39, 0.12);
}

.talent-trees-filters {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.talent-trees-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.86rem;
}

.talent-trees-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .talent-trees-list {
        grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    }
}

.talent-trees-card {
    display: grid;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.14);
}

.talent-trees-card-title {
    font-weight: 600;
    line-height: 1.25;
}

.talent-trees-card-commander {
    font-size: 0.86rem;
    color: var(--accent);
}

.talent-trees-points {
    margin-left: 0.35rem;
    color: rgba(255, 255, 255, 0.65);
}

.talent-trees-card-notes {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
}

.talent-trees-card-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

.talent-trees-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.talent-trees-save-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.talent-trees-status.is-error {
    color: #f87171;
}

.talent-trees-empty {
    margin-top: 0.35rem;
}

.equipment-calc-panel {
    padding: 1.25rem;
}

.equipment-calc-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.equipment-calc-section {
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
    min-width: 0;
}

.equipment-calc-section--craft {
    grid-column: 1 / -1;
}

.equipment-calc-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.equipment-calc-section-head h2 {
    margin: 0;
    font-size: 1rem;
}

.equipment-calc-inventory {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.equipment-calc-inv-row {
    display: grid;
    grid-template-columns: minmax(4.75rem, 0.9fr) repeat(5, minmax(0, 1fr));
    gap: 0.4rem;
    align-items: center;
}

.equipment-calc-inv-head {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted, #9aa3b2);
}

.equipment-calc-inv-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equipment-calc-inv-label {
    font-size: 0.84rem;
    font-weight: 600;
}

.equipment-calc-inv-input {
    width: 100%;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font-size: 0.82rem;
}

.equipment-calc-slot-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.equipment-calc-slot-tab {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-muted, #9aa3b2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.equipment-calc-slot-tab.is-active {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.4);
    color: inherit;
}

.equipment-calc-picker-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.equipment-calc-select {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
}

.equipment-calc-craft-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.equipment-calc-craft-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.equipment-calc-craft-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.equipment-calc-craft-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.equipment-calc-craft-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.equipment-calc-craft-body strong {
    font-size: 0.9rem;
}

.equipment-calc-results {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.equipment-calc-results-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.equipment-calc-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.65rem;
}

.equipment-calc-result-stat {
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.equipment-calc-result-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.15rem;
}

.equipment-calc-result-value {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.equipment-calc-result-stat--gold .equipment-calc-result-value {
    color: #fbbf24;
}

.equipment-calc-result-stat--time .equipment-calc-result-value {
    color: #60a5fa;
}

.equipment-calc-actions {
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .equipment-calc-layout {
        grid-template-columns: minmax(0, 1.85fr) minmax(11rem, 0.65fr);
        align-items: start;
    }
}

/* Trading post calculator */
.portal-tool-page.portal-tool-page--wide.portal-tool-page--trading-post {
    width: 100%;
    max-width: 80rem;
}

.trading-post-panel {
    padding: 1.25rem;
}

.trading-post-app {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.trading-post-level-row {
    max-width: 22rem;
}

.trading-post-level-select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font-size: 0.92rem;
}

.trading-post-forms {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.trading-post-section {
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
    min-width: 0;
}

.trading-post-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.trading-post-section-head h2 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.35;
}

.trading-post-table.resource-table {
    margin-top: 0.75rem;
    overflow: visible;
}

.trading-post-table .resource-table-header,
.trading-post-table .resource-table-row {
    grid-template-columns: minmax(4.75rem, 0.8fr) minmax(6.25rem, 1.15fr) minmax(3.75rem, 0.7fr) minmax(5.75rem, 1fr);
    gap: 0.55rem;
}

.trading-post-table .resource-table-header {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.trading-post-table .resource-table-header span {
    min-width: 0;
    line-height: 1.25;
    white-space: normal;
}

.trading-post-table .trading-post-col-tax,
.trading-post-table .trading-post-col-result {
    text-align: right;
}

.trading-post-resource-label {
    font-weight: 600;
    font-size: 0.84rem;
}

.trading-post-input {
    width: 100%;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.trading-post-value {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.trading-post-value--tax {
    color: #f87171;
}

.trading-post-value--result {
    color: #4ade80;
}

.trading-post-actions {
    margin-top: 0.25rem;
}

@media (min-width: 1040px) {
    .trading-post-forms {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (max-width: 640px) {
    .trading-post-table .resource-table-header {
        display: none;
    }

    .trading-post-table .resource-table-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.45rem 0.65rem;
        padding: 0.75rem 0.65rem;
    }

    .trading-post-table .trading-post-col-resource {
        grid-column: 1 / -1;
    }

    .trading-post-table .trading-post-col-input::before,
    .trading-post-table .trading-post-col-tax::before,
    .trading-post-table .trading-post-col-result::before {
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--text-muted, #9aa3b2);
    }

    .trading-post-table .trading-post-col-input::before {
        content: 'Amount';
    }

    .trading-post-table .trading-post-col-tax::before {
        content: 'Tax';
    }

    .trading-post-table .trading-post-col-result::before {
        content: 'Result';
    }

    .trading-post-table .trading-post-col-tax,
    .trading-post-table .trading-post-col-result {
        text-align: left;
    }
}

/* Peerless Scholar helper */
.portal-tool-page--peerless {
    max-width: 52rem;
}

.peerless-panel {
    padding: 1rem 1.25rem 1.25rem;
}

.peerless-search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.35rem;
    position: sticky;
    top: 0.5rem;
    z-index: 2;
    background: var(--panel-bg, rgba(18, 22, 32, 0.95));
    padding: 0.35rem 0;
}

.peerless-search-input {
    flex: 1;
    font-size: 1.15rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid rgba(59, 130, 246, 0.35);
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.peerless-search-input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.peerless-hint {
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.peerless-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
}

.peerless-hero {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 2px solid rgba(74, 222, 128, 0.35);
    background: rgba(34, 197, 94, 0.1);
}

.peerless-hero-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.35rem;
}

.peerless-hero-answer {
    font-size: clamp(1.35rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    color: #4ade80;
}

.peerless-hero-question {
    font-size: 0.88rem;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.65rem;
    line-height: 1.4;
}

.peerless-hero-question mark,
.peerless-result-question mark {
    background: rgba(250, 204, 21, 0.25);
    color: inherit;
    padding: 0 0.1em;
    border-radius: 2px;
}

.peerless-copied {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: #4ade80;
}

.peerless-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.peerless-result {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.peerless-result:hover,
.peerless-result.is-selected {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}

.peerless-result-answer {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.peerless-result-question {
    font-size: 0.8rem;
    color: var(--text-muted, #9aa3b2);
    line-height: 1.35;
}

.hero-banner--compact {
    margin-bottom: 0.75rem;
}

.hero-banner--compact h1 {
    font-size: 1.5rem;
}

.hero-banner--compact .lead {
    font-size: 0.92rem;
}

/* Ark of Osiris command centre */
.aoo-event-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.75rem;
}

.aoo-event-card {
    display: block;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: inherit;
}

.aoo-event-card:hover {
    border-color: rgba(59, 130, 246, 0.35);
}

.aoo-event-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.aoo-event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.aoo-event-description,
.aoo-strategy-notes {
    margin: 0.75rem 0;
    line-height: 1.5;
}

.aoo-admin-tabs {
    margin-bottom: 1rem;
}

.aoo-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
}

.aoo-share-panel {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.08);
}

.aoo-share-row {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.aoo-share-link {
    font-size: 0.86rem;
}

.aoo-team-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.aoo-team-column {
    padding: 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

.aoo-team-column--red {
    border-color: rgba(239, 68, 68, 0.25);
}

.aoo-team-column--blue {
    border-color: rgba(59, 130, 246, 0.25);
}

.aoo-team-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.aoo-team-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.aoo-team-role {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted, #9aa3b2);
}

.aoo-inline-reg-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 10rem;
}

.aoo-answers-cell {
    font-size: 0.82rem;
    max-width: 16rem;
}

.aoo-strategy-list {
    margin: 0.75rem 0 0;
    padding-left: 1.1rem;
}

.aoo-strategy-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.aoo-form-builder-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.aoo-governor-id-input {
    max-width: 8rem;
}

.aoo-regenerate-form {
    margin: 0 0 1.25rem;
}

.aoo-public-register {
    max-width: 40rem;
    margin: 0 auto;
}

@media (max-width: 720px) {
    .aoo-share-row {
        flex-direction: column;
    }
}

.bundles-panel {
    padding: 1.25rem;
}

.bundles-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.bundles-view-tab {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted, #9aa3b2);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.bundles-view-tab.is-active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.45);
    color: inherit;
}

.bundles-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.85rem;
}

.bundles-period-tab {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: transparent;
    color: var(--text-muted, #9aa3b2);
    font-size: 0.82rem;
    cursor: pointer;
}

.bundles-period-tab.is-active {
    color: inherit;
    border-color: rgba(234, 88, 12, 0.45);
    background: rgba(234, 88, 12, 0.12);
}

/* Event Values (gem efficiency) */
.event-values-panel {
    padding: 1.25rem;
}

.event-values-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.event-values-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted, #9aa3b2);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.event-values-tab-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.event-values-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.event-values-tier {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-muted, #9aa3b2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.event-values-tier.is-active {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.4);
    color: inherit;
}

.event-values-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.event-values-stat {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.event-values-stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.event-values-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
    line-height: 1.2;
}

.event-values-stat-value {
    font-size: 0.92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-values-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.event-values-meters {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.event-values-meter {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.event-values-meter-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.event-values-meter-label {
    font-size: 0.84rem;
    font-weight: 600;
}

.event-values-meter-value {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-values-meter-bar {
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.event-values-meter-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.55);
}

.event-values-meter--good .event-values-meter-bar span,
.event-values-meter--excellent .event-values-meter-bar span {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.85), rgba(249, 115, 22, 0.45));
}

.event-values-meter--excellent .event-values-meter-value {
    color: #fb923c;
}

.event-values-meter-sub {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
}

.event-values-free-banner {
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(22, 101, 52, 0.2);
    color: #4ade80;
    font-size: 0.88rem;
}

.event-values-chart-panel {
    margin: 0 0 1rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

.event-values-chart-title {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, #9aa3b2);
}

.event-values-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-values-chart-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
}

.event-values-chart-label {
    font-size: 0.8rem;
}

.event-values-chart-bar-wrap {
    position: relative;
    height: 1.35rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.event-values-chart-bar {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.55), rgba(59, 130, 246, 0.25));
}

.event-values-chart-bar--good {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.75), rgba(249, 115, 22, 0.3));
}

.event-values-chart-value {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-values-footnote,
.event-values-note-block {
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.12);
}

.event-values-row-active td {
    background: rgba(249, 115, 22, 0.08);
}

.event-values-th-highlight img,
.event-values-td-highlight img {
    vertical-align: -4px;
    margin-right: 0.25rem;
}

.event-values-tab.is-active {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.45);
    color: inherit;
}

.event-values-section-head h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.event-values-baseline {
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(249, 115, 22, 0.25);
    background: rgba(249, 115, 22, 0.08);
}

.event-values-table {
    font-size: 0.84rem;
}

.event-values-th-highlight,
.event-values-td-highlight {
    background: rgba(249, 115, 22, 0.06);
}

.event-values-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.event-values-note {
    display: block;
    max-width: 22rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted, #9aa3b2);
}

.event-values-rankings {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.event-values-rank-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
}

.event-values-rank-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.84rem;
}

.event-values-rank-idx {
    display: inline-grid;
    place-items: center;
    min-width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted, #9aa3b2);
}

.event-values-rank-bar-wrap {
    position: relative;
    height: 1.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.event-values-rank-bar {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.55), rgba(59, 130, 246, 0.25));
}

.event-values-rank-bar--good {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.75), rgba(249, 115, 22, 0.3));
}

.event-values-rank-value {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-values-link {
    margin-top: 1rem;
}

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

    .event-values-chart-row {
        grid-template-columns: 1fr;
    }
}

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

.bundles-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.bundles-filters label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.bundles-filters select {
    min-width: 10rem;
}

.bundles-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.bundles-icon-size-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.bundles-catalog,
.bundles-compare-grid {
    display: grid;
    gap: 1rem;
}

.bundles-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.bundles-mini-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.bundles-mini-card strong {
    font-size: 0.92rem;
}

.bundles-mini-card span {
    font-size: 0.75rem;
    color: var(--text-muted, #9aa3b2);
}

.bundles-card-detail.hidden {
    display: none;
}

.bundle-card {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.bundle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #fff;
}

.bundle-card-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.bundle-card-header p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    opacity: 0.85;
}

.bundle-compare-check {
    font-size: 0.78rem;
    white-space: nowrap;
}

.bundle-plan-row {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bundle-plan-row label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
}

.bundle-table-wrap {
    overflow-x: auto;
}

.bundle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.bundle-table th,
.bundle-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    vertical-align: middle;
}

.bundle-table th:first-child,
.bundle-table td.bundle-row-label {
    text-align: left;
}

.bundle-col-head {
    min-width: 4.5rem;
}

.bundle-col-head img {
    display: block;
    margin: 0 auto 0.2rem;
}

.bundle-col-price {
    display: block;
    font-size: 0.72rem;
    opacity: 0.85;
}

.bundle-row-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 10rem;
}

.bundle-row-icon {
    object-fit: contain;
    flex-shrink: 0;
}

.bundle-row-total {
    font-weight: 600;
    white-space: nowrap;
}

.bundle-row-even {
    background: rgba(255, 255, 255, 0.02);
}

.bundles-empty,
.bundles-lead {
    color: var(--text-muted, #9aa3b2);
    font-size: 0.92rem;
}

.bundles-plan-summary {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.bundles-plan-summary ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.bundles-plan-total {
    font-size: 1rem;
}

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

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

.bundles-spending-table th,
.bundles-spending-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.budget-planner-panel {
    padding: 1.25rem;
}

.budget-intro {
    margin: 0 0 1rem;
    color: var(--text-muted, #9aa3b2);
    font-size: 0.92rem;
}

.budget-planner-form {
    margin-bottom: 1.25rem;
}

.budget-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 1rem;
}

.budget-mode-tab {
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: transparent;
    color: var(--text-muted, #9aa3b2);
    font-size: 0.88rem;
    cursor: pointer;
}

.budget-mode-tab.is-active {
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(234, 88, 12, 0.45);
    background: rgba(234, 88, 12, 0.12);
}

.budget-reset-btn {
    margin-left: auto;
}

.budget-panel[hidden] {
    display: none !important;
}

.budget-result {
    display: grid;
    gap: 1rem;
}

.budget-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
}

.budget-summary-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
    margin-bottom: 0.2rem;
}

.budget-summary-value {
    font-size: 1.35rem;
}

.budget-warnings {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(234, 179, 8, 0.25);
    background: rgba(234, 179, 8, 0.08);
    font-size: 0.88rem;
}

.budget-warnings p {
    margin: 0;
}

.budget-section h2 {
    margin: 0 0 0.65rem;
    font-size: 1rem;
}

.budget-plan-list {
    display: grid;
    gap: 0.75rem;
}

.budget-plan-item {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.budget-plan-item--once {
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(168, 85, 247, 0.06);
}

.budget-plan-item--popup {
    border-color: rgba(234, 179, 8, 0.35);
    background: rgba(234, 179, 8, 0.06);
}

.budget-plan-item-head {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.budget-plan-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.2);
    color: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.budget-plan-item h3 {
    margin: 0;
    font-size: 1rem;
}

.budget-plan-meta {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.budget-plan-costs {
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.budget-plan-costs strong {
    display: block;
    font-size: 1.05rem;
}

.budget-plan-costs span,
.budget-plan-costs small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted, #9aa3b2);
}

.budget-plan-reason {
    margin: 0.55rem 0 0;
    font-size: 0.88rem;
}

.budget-plan-highlights {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.82rem;
    color: var(--text-muted, #9aa3b2);
}

.budget-plan-note {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.budget-footer-link {
    margin: 0;
    font-size: 0.88rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

.btn.mail-gen-color-btn {
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem 0.35rem 0.55rem;
}

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

    .star-result-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .star-row-value {
        text-align: left;
    }
}

.ap-calc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ap-potion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.ap-potion-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.ap-potion-item img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.ap-potion-info {
    width: 100%;
    text-align: center;
}

.ap-potion-info label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted, #9aa3b2);
}

.ap-potion-input {
    width: 100%;
    text-align: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.calc-result {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.2);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
}

.calc-result.result-success {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.12);
}

.calc-result.error {
    border-color: rgba(231, 76, 60, 0.45);
    color: #e74c3c;
}

.ap-result-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.calculator-panel .btn-primary {
    margin-top: 0.75rem;
}

.calculator-panel .form-group label {
    font-weight: 600;
}

.portal-tool-page--wide {
    max-width: 640px;
}

.portal-tool-page--crystal-tech {
    max-width: 100%;
}

.portal-tool-page--event-values {
    max-width: 100%;
}

body.crystal-tech-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

body.event-values-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

body.crystal-tech-page .portal-tool-page--crystal-tech {
    max-width: none;
    width: 100%;
}

body.event-values-page .portal-tool-page--event-values {
    max-width: none;
    width: 100%;
}

body.event-values-page .event-values-panel {
    width: 100%;
}

body.crystal-tech-page .crystal-tech-panel {
    width: 100%;
}

body.crystal-tech-page .ct-grid-wrap {
    width: 100%;
}

.label-with-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.calc-toggle-inline {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.form-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.75rem 0 0.25rem;
}

.toggle-label {
    font-size: 0.84rem;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.5rem;
    height: 1.35rem;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 999px;
    transition: background 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 1rem;
    width: 1rem;
    left: 0.15rem;
    bottom: 0.12rem;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent, #3b82f6);
    border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(1.1rem);
}

.toggle-switch.is-disabled,
.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.45;
    cursor: not-allowed;
}

.toggle-slider[data-on]::after,
.toggle-slider[data-off]::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

.toggle-slider[data-off]::after {
    content: attr(data-off);
    right: 0.35rem;
}

.toggle-slider[data-on]::after {
    content: attr(data-on);
    left: 0.35rem;
    opacity: 0;
}

.toggle-switch input:checked + .toggle-slider[data-on]::after {
    opacity: 1;
}

.toggle-switch input:checked + .toggle-slider[data-off]::after {
    opacity: 0;
}

.calc-date-input {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.calc-field-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
}

.calc-result-breakdown {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.calc-result-breakdown span {
    display: block;
}

.calc-breakdown-tip {
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
}

.calc-delta-negative {
    color: #e74c3c;
}

.calc-delta-positive {
    color: #4ade80;
}

.calc-success-msg {
    color: #4ade80;
    font-weight: 600;
}

.cost-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.cost-line + .cost-line {
    margin-top: 0.35rem;
}

.calc-cost-details {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa3b2);
    line-height: 1.4;
}

.optimal-purchase-highlight {
    font-weight: 600;
    color: inherit;
}

.calc-result-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.calculator-panel input[type="text"]:not(.ap-potion-input) {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.input-shake {
    animation: calc-input-shake 0.45s ease;
}

@keyframes calc-input-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* KvK time tracking (timers) */
.portal-tool-page--wide.timers-page,
.portal-tool-page.portal-tool-page--wide {
    max-width: 720px;
}

.timers-container {
    margin-top: 0.25rem;
}

.timer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.timer-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.timer-tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

.timer-tab.is-active {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.timer-panel .panel-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.timer-panel .panel-header h3 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
}

.timer-panel .panel-header p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted, #9aa3b2);
    line-height: 1.4;
}

.panel-icon {
    font-size: 1.35rem;
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.panel-icon.burn { color: #f97316; }
.panel-icon.shield { color: #60a5fa; }
.panel-icon.heal { color: #4ade80; }
.panel-icon.buff { color: #facc15; }

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

.timer-panel .input-grid.burn-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.timer-panel .input-group.full-width {
    grid-column: 1 / -1;
}

.timer-panel .input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted, #9aa3b2);
}

.timer-panel input[type="text"],
.timer-panel input[type="number"] {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 0.95rem;
}

.timer-panel input[type="number"] {
    font-variant-numeric: tabular-nums;
}

.custom-select-container {
    position: relative;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
}

.custom-select-trigger.open {
    border-color: rgba(59, 130, 246, 0.45);
}

.custom-select-trigger .selected-text {
    flex: 1;
    min-width: 0;
}

.custom-select-trigger .arrow {
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.15s ease;
}

.custom-select-trigger .arrow.rotated {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
    background: var(--surface-elevated, #1a1f2e);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    text-align: left;
}

.dropdown-option:hover,
.dropdown-option.selected {
    background: rgba(59, 130, 246, 0.12);
}

.option-icon {
    width: 1rem;
    text-align: center;
    opacity: 0.85;
}

.dhm-row {
    display: flex;
    gap: 0.45rem;
}

.dhm-field {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.dhm-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted, #9aa3b2);
    flex-shrink: 0;
}

.toggle-row {
    margin: 0.75rem 0 0.25rem;
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font-size: 0.84rem;
    cursor: pointer;
}

.toggle-track {
    width: 2.5rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    position: relative;
    transition: background 0.2s ease;
}

.toggle-btn[aria-pressed="true"] .toggle-track {
    background: var(--accent, #3b82f6);
    border-color: transparent;
}

.toggle-thumb {
    position: absolute;
    top: 0.12rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.toggle-btn[aria-pressed="true"] .toggle-thumb {
    transform: translateX(1.1rem);
}

.buff-fields {
    margin-top: 0.75rem;
}

.buff-info.hint {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted, #9aa3b2);
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    line-height: 1.45;
}

.timer-panel .action-row {
    margin-top: 0.85rem;
}

.timer-result-wrap {
    margin-top: 1rem;
}

.result-card {
    position: relative;
    padding: 1rem 1rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.22);
}

.result-card.error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.45);
}

.btn-clear-corner {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #9aa3b2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-corner:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.result-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.burn-icon { color: #f97316; }
.shield-icon { color: #60a5fa; }
.heal-icon { color: #4ade80; }
.buff-icon { color: #facc15; }

.result-section + .result-section,
.result-divider + .result-section {
    margin-top: 0.75rem;
}

.result-divider {
    height: 1px;
    background: var(--border-subtle, rgba(255, 255, 255, 0.1));
    margin: 0.75rem 0;
}

.result-label {
    font-size: 0.84rem;
    margin-bottom: 0.45rem;
    line-height: 1.4;
}

.time-rows {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.time-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.84rem;
}

.time-tag {
    flex-shrink: 0;
    min-width: 3.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted, #9aa3b2);
}

.time-value {
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.time-value.relative {
    color: #93c5fd;
    font-weight: 600;
}

.result-stat {
    margin-top: 0.65rem;
    font-size: 0.84rem;
}

.stat-label {
    color: var(--text-muted, #9aa3b2);
}

.stat-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .timer-panel .input-grid.burn-grid {
        grid-template-columns: 1fr;
    }

    .timer-panel .input-grid {
        grid-template-columns: 1fr;
    }

    .timer-tabs {
        gap: 0.25rem;
    }

    .timer-tab span {
        font-size: 0.78rem;
    }
}

/* Flag cost calculator */
.panel-icon.flag {
    color: #f97316;
}

.flag-calculator-container {
    margin-top: 0.25rem;
}

.flag-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.flag-panel .input-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.resource-inputs-section {
    margin-bottom: 1rem;
}

.resource-inputs-section .section-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.resource-inputs-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.resource-input-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 0.65rem 0.85rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.15);
}

.resource-input-icon-wrap {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.resource-input-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.resource-input-label {
    font-weight: 600;
    font-size: 0.9rem;
    grid-column: 2;
}

.resource-input-fields {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.resource-input-row .input-group.compact label {
    font-size: 0.78rem;
    color: var(--muted);
}

.resource-input-row .input-group.compact input {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.flag-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.flag-stat-grid.wide {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.flag-stat-grid .stat-item {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.flag-stat-grid .stat-item-wide {
    grid-column: 1 / -1;
}

.flag-stat-grid .stat-item.highlight {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.25);
}

.flag-stat-grid .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.flag-stat-grid .stat-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.flag-stat-grid .stat-value.large {
    font-size: 1.35rem;
}

.flag-stat-grid .stat-value.crystal {
    color: #38bdf8;
}

.result-section-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.flag-result-icon {
    color: #f97316;
}

.resource-table {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.resource-table-header,
.resource-table-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr);
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
}

.resource-table-header {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--muted);
    font-size: 0.75rem;
}

.resource-table-row {
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.resource-table-row.deficit {
    background: rgba(239, 68, 68, 0.06);
}

.resource-table-row .rt-col-resource {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.resource-table-row .rt-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resource-table-row .rt-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.resource-table-row .rt-col {
    font-variant-numeric: tabular-nums;
}

.status-deficit {
    color: #f87171;
    font-weight: 600;
}

.status-surplus {
    color: #4ade80;
}

.resource-table-note {
    margin: 0.65rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}

.next-flag-info {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--muted);
}

.next-flag-info.max {
    color: #fbbf24;
}

.next-flag-info strong {
    color: var(--text);
}

@media (min-width: 720px) {
    .resource-input-row {
        grid-template-columns: 40px minmax(100px, 120px) 1fr;
    }

    .resource-input-label {
        grid-column: auto;
    }

    .resource-input-fields {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .resource-table-header {
        display: none;
    }

    .resource-table-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
    }

    .resource-table-row .rt-col-resource {
        grid-column: 1 / -1;
    }
}

/* Honour points calculator */
.honour-container {
    margin-top: 0.25rem;
}

.honour-panel-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.honour-panel-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.honour-panel-header h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.honour-panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.honour-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.honour-section {
    padding-bottom: 0.25rem;
}

.honour-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.honour-section-label .label-text {
    font-weight: 600;
    font-size: 0.9rem;
}

.honour-readout-accent {
    color: #60a5fa;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.honour-ap-input-row input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.honour-ap-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--accent);
}

.honour-ap-returned {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #4ade80;
}

.honour-slider-track {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    touch-action: none;
}

.honour-slider-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
}

.honour-slider-thumb {
    position: absolute;
    top: 50%;
    left: calc(var(--pct, 0) * 1%);
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.honour-grad-accent { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.honour-grad-barb { background: linear-gradient(90deg, #38bdf8, #6ee7ff); }
.honour-grad-fort { background: linear-gradient(90deg, #6366f1, #818cf8); }
.honour-grad-chain { background: linear-gradient(90deg, #f97316, #f28d00); }
.honour-grad-auto { background: linear-gradient(90deg, #c084fc, #ca62e6); }

.slider-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.slider-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.slider-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.honour-hint {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.timing-preset-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
}

.timing-preset-btn {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.timing-preset-btn:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.timing-preset-btn.active {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.12);
}

.timing-preset-label {
    font-weight: 600;
    font-size: 0.88rem;
}

.timing-preset-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}

.honour-chain-input {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.65rem;
    font-size: 0.85rem;
}

.honour-chain-input input {
    width: 4rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.honour-collapsible {
    display: none;
    margin-top: 0.75rem;
}

.honour-collapsible.is-open {
    display: block;
}

.honour-passive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.honour-passive-item label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.honour-passive-item input {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.honour-passive-note {
    margin: 0.65rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}

.honour-bounty-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.honour-bounty-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.honour-bounty-info {
    flex: 1;
    min-width: 0;
}

.honour-bounty-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.honour-bounty-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

.honour-bounty-stepper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bounty-step-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bounty-step-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bounty-step-value {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 700;
}

.honour-bounty-range {
    width: 100%;
    margin-top: 0.35rem;
}

.honour-result-wrap {
    margin-top: 1rem;
}

.honour-result-box {
    position: relative;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.22);
}

.honour-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    font-size: 0.88rem;
}

.honour-row-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex-wrap: wrap;
}

.honour-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.honour-row-label {
    font-weight: 600;
}

.honour-row-detail {
    color: var(--muted);
    font-size: 0.8rem;
}

.honour-row-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.honour-row-label.muted-hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.82rem;
}

.honour-divider {
    height: 1px;
    background: var(--border-subtle, rgba(255, 255, 255, 0.1));
    margin: 0.65rem 0;
}

.honour-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
}

.honour-total-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.honour-total-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.honour-total-value {
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.honour-crystal-total {
    color: #38bdf8;
}

.honour-crystal-section {
    margin-top: 0.75rem;
}

.readout-barb { color: #6ee7ff; }
.readout-fort { color: #818cf8; }
.readout-chain { color: #f28d00; }
.readout-auto { color: #ca62e6; }

@media (max-width: 640px) {
    .honour-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .timing-preset-row {
        grid-template-columns: 1fr;
    }
}

/* Map maker (leadership) — portal landing */
.mapmaker-portal-wrap .mapmaker-page {
    margin-top: 0;
}

.mapmaker-portal-wrap .maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.mapmaker-portal-wrap .map-thumbnail {
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    padding: 0.65rem;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.mapmaker-portal-wrap .map-thumbnail img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.mapmaker-portal-wrap .map-name {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.mapmaker-portal-wrap .file-input-wrapper {
    margin-bottom: 1rem;
}

.mapmaker-portal-wrap .file-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border-subtle, rgba(255, 255, 255, 0.2));
    border-radius: 10px;
    cursor: pointer;
}

.mapmaker-portal-wrap input[type="file"] {
    display: none;
}

.mapmaker-portal-wrap .preview-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.mapmaker-portal-wrap .preview-container img {
    max-width: 100%;
    border-radius: 8px;
}

.mapmaker-portal-wrap .mapmaker-instructions {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--muted);
    line-height: 1.55;
}

.mapmaker-portal-wrap .progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin: 0.75rem 0;
    overflow: hidden;
}

.mapmaker-portal-wrap .progress-fill {
    height: 100%;
    width: 40%;
    background: var(--accent);
    animation: mapmaker-progress 1s ease-in-out infinite alternate;
}

@keyframes mapmaker-progress {
    from { width: 20%; }
    to { width: 80%; }
}

/* Portal mobile tables, safe areas, and tool pages */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@supports (padding: max(0px)) {
    .has-sidebar .topbar {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .site-footer {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .sidebar {
        padding-left: env(safe-area-inset-left);
    }

    .lang-switcher-auth-wrap {
        top: max(1rem, env(safe-area-inset-top));
        right: max(1rem, env(safe-area-inset-right));
    }
}

body.tools-area .main-content {
    max-width: 1200px;
}

@media (max-width: 900px) {
    .panel-header {
        flex-wrap: wrap;
        gap: 0.5rem 0.75rem;
        align-items: flex-start;
    }

    .panel-header .btn-sm {
        margin-left: 0;
    }

    .user-search-form {
        width: 100%;
        margin-left: 0;
    }

    .user-search-form input[type="search"] {
        flex: 1;
        min-width: 0;
    }

    .admin-tool-grid {
        grid-template-columns: 1fr;
    }

    .portal-tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .data-table th,
    .data-table td {
        padding: 0.55rem 0.6rem;
        font-size: 0.84rem;
    }

    .data-table-compact th,
    .data-table-compact td {
        padding: 0.45rem 0.5rem;
        font-size: 0.8rem;
    }

    .topbar-user .badge {
        display: none;
    }
}

/* Kingdom stats overview dashboard */
.kd-overview {
    margin-top: 0;
}

.kd-overview-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.35rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background:
        linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, transparent 45%),
        linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
}

.kd-overview-hero__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.kd-overview-hero__title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    line-height: 1.15;
}

.kd-overview-hero__meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.kd-overview-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.kd-overview-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.kd-kpi-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    min-width: 0;
}

.kd-kpi-card--power { border-color: rgba(249, 115, 22, 0.35); }
.kd-kpi-card--kp { border-color: rgba(248, 113, 113, 0.35); }
.kd-kpi-card--deads { border-color: rgba(167, 139, 250, 0.35); }

.kd-kpi-card__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.kd-kpi-card__value {
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.kd-kpi-delta {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.kd-kpi-delta--up { color: #4ade80; }
.kd-kpi-delta--down { color: #f87171; }
.kd-kpi-delta--flat { color: var(--muted); }

.kd-overview-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.kd-overview-grid--charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kd-overview-grid--tables {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kd-overview-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem 1.1rem 1.1rem;
    min-width: 0;
}

.kd-overview-panel--wide {
    grid-column: 1 / -1;
}

.kd-overview-panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.kd-overview-panel__head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.kd-overview-panel__head .hint {
    font-size: 0.78rem;
}

.kd-overview-chart-wrap {
    position: relative;
    height: 280px;
}

.kd-overview-chart-wrap--short {
    height: 220px;
}

.kd-overview-panel__head--battle {
    align-items: flex-start;
}

.kd-battle-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.kd-battle-summary__stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    min-width: 5.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.kd-battle-summary__label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.kd-battle-summary__value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
}

.kd-battle-summary__stat--victory .kd-battle-summary__value {
    color: #60a5fa;
}

.kd-battle-summary__stat--defeat .kd-battle-summary__value {
    color: #f87171;
}

.kd-battle-summary__stat--rate .kd-battle-summary__value {
    color: #fbbf24;
}

.kd-overview-battle-charts {
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.kd-overview-battle-charts__donut {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.kd-battle-donut-wrap {
    position: relative;
    width: 100%;
    max-width: 240px;
    height: 220px;
}

.kd-battle-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding-bottom: 1.75rem;
}

.kd-battle-donut-center__rate {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    color: #f8fafc;
    text-shadow: 0 0 24px rgba(251, 191, 36, 0.35);
}

.kd-battle-donut-center__label {
    margin-top: 0.25rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.kd-battle-donut-caption {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    text-align: center;
}

.kd-overview-battle-charts__trend {
    position: relative;
    min-height: 220px;
    height: 240px;
}

.kd-overview-panel--battle {
    background:
        radial-gradient(ellipse 80% 60% at 12% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
        radial-gradient(ellipse 70% 50% at 88% 100%, rgba(248, 113, 113, 0.07), transparent 50%),
        var(--surface);
}

.kd-overview-table td,
.kd-overview-table th {
    white-space: nowrap;
}

.kd-overview-grid--tables .table-wrap {
    overflow-x: clip;
}

.kd-overview-table {
    table-layout: fixed;
    width: 100%;
}

.kd-overview-table th:nth-child(1),
.kd-overview-table td:nth-child(1) {
    width: 2.25rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.kd-overview-table th:nth-child(3),
.kd-overview-table td:nth-child(3) {
    width: 30%;
}

.kd-overview-table th:nth-child(4),
.kd-overview-table td:nth-child(4) {
    width: 28%;
    text-align: right;
}

.kd-overview-table td:nth-child(2),
.kd-overview-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.kd-overview-table .kd-top10-trophy {
    filter: none;
}

.kd-overview-table td:nth-child(3) {
    max-width: none;
}

@media (max-width: 1100px) {
    .kd-overview-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kd-overview-grid--tables {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kd-overview-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kd-overview-grid--charts {
        grid-template-columns: 1fr;
    }

    .kd-overview-hero {
        padding: 1rem;
    }

    .kd-overview-hero__title {
        font-size: 1.35rem;
    }

    .kd-overview-chart-wrap {
        height: 240px;
    }

    .kd-overview-battle-charts {
        grid-template-columns: 1fr;
    }

    .kd-battle-donut-wrap {
        max-width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    .kd-battle-summary {
        width: 100%;
        justify-content: flex-start;
    }

    .kd-battle-summary__stat {
        align-items: flex-start;
    }
}

/* Stats — Top 10 leaderboards */
.kd-top10-page {
    margin-top: 0.5rem;
}

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

.kd-top10-scan-meta {
    margin: 0;
}

.kd-top10-dkp {
    margin-bottom: 1.25rem;
}

.kd-top10-dkp__head {
    margin-bottom: 0.75rem;
}

.kd-top10-dkp__head h2 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.kd-top10-section {
    margin-bottom: 1.5rem;
}

.kd-top10-section__title {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.kd-top10-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
}

.kd-top10-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.85rem 0.9rem 0.75rem;
    min-width: 0;
}

.kd-top10-card__title {
    margin: 0 0 0.6rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.kd-top10-card__hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    font-weight: 500;
}

.kd-top10-card__empty {
    margin: 0;
    font-size: 0.8rem;
}

.kd-top10-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kd-top10-list__item {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
    padding: 0.28rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    font-size: 0.82rem;
}

.kd-top10-list__item--has-detail {
    grid-template-rows: auto auto;
    row-gap: 0.12rem;
}

.kd-top10-list__item--has-detail .kd-top10-list__rank {
    grid-row: 1;
}

.kd-top10-list__item--has-detail .kd-top10-list__name {
    grid-column: 2;
    grid-row: 1;
}

.kd-top10-list__item--has-detail .kd-top10-list__value {
    grid-column: 3;
    grid-row: 1;
}

.kd-top10-list__item--has-detail .kd-top10-list__detail {
    grid-column: 2 / -1;
    grid-row: 2;
    text-align: right;
}

.kd-top10-list__item:first-child {
    border-top: none;
    padding-top: 0;
}

.kd-top10-list__rank {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.kd-top10-trophy {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    line-height: 1;
    vertical-align: middle;
    flex-shrink: 0;
}

.kd-top10-trophy--gold {
    color: #fbbf24;
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.4));
}

.kd-top10-trophy--silver {
    color: #cbd5e1;
    filter: drop-shadow(0 0 4px rgba(203, 213, 225, 0.25));
}

.kd-top10-trophy--bronze {
    color: #d97706;
    filter: drop-shadow(0 0 4px rgba(217, 119, 6, 0.3));
}

.kd-top10-table__rank {
    width: 2rem;
    text-align: center;
    vertical-align: middle;
}

.kd-top10-list__name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.kd-top10-list__name a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kd-top10-list__alliance {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kd-top10-list__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #f8fafc;
    white-space: nowrap;
    text-align: right;
}

.kd-top10-list__detail {
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}


.kd-top10-foot {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.kd-top10-table td:nth-child(2) {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Complaints Department */
.portal-tool-page--complaints {
    max-width: 960px;
}

.complaints-dept-panel {
    display: grid;
    gap: 1.5rem;
}

.complaints-dept-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.complaints-form .form-grid-2 {
    margin-bottom: 1rem;
}

.complaints-form-actions {
    display: grid;
    gap: 0.75rem;
}

.complaints-queue-wrap {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.25rem;
}

.complaints-queue-title {
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.complaints-queue {
    display: grid;
    gap: 1rem;
}

.complaints-case {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    background: rgba(0, 0, 0, 0.18);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.complaints-case--highlight {
    border-color: rgba(201, 162, 39, 0.75);
    box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.complaints-case-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    margin-bottom: 0.65rem;
}

.complaints-case-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: #c9a227;
    font-weight: 700;
}

.complaints-case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
    flex: 1;
}

.complaints-case-name {
    font-weight: 600;
}

.complaints-case-date {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
}

.complaints-priority {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.complaints-priority--trivial {
    color: #a3e635;
    border-color: rgba(163, 230, 53, 0.35);
    background: rgba(163, 230, 53, 0.08);
}

.complaints-priority--annoying {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.complaints-priority--serious {
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.35);
    background: rgba(251, 146, 60, 0.08);
}

.complaints-priority--apocalyptic {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.1);
}

.complaints-case-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.complaints-tag {
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.complaints-tag--muted {
    color: rgba(255, 255, 255, 0.65);
}

.complaints-tag--outcome {
    border: 1px solid rgba(201, 162, 39, 0.35);
    color: #e8dcc8;
}

.complaints-case-status {
    font-size: 0.86rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.complaints-case-text {
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 0.85rem;
    white-space: pre-wrap;
}

.complaints-case-response {
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    padding-top: 0.75rem;
}

.complaints-case-response-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.35rem;
}

.complaints-case-response-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e8dcc8;
}

.complaints-badge-link {
    text-decoration: none;
    display: inline-flex;
}

.complaints-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: rgba(139, 41, 66, 0.25);
    border: 1px solid rgba(255, 107, 138, 0.35);
    color: #ffb3c7;
    white-space: nowrap;
}

.complaints-badge-icon {
    font-size: 0.85em;
    line-height: 1;
}

.complaints-badge-count {
    font-weight: 700;
}

.stats-th-complaints,
.stats-complaints {
    text-align: center;
    width: 5.5rem;
}

.stats-complaints .complaints-badge-link {
    justify-content: center;
}

/* EMSPI */
.portal-tool-page--emspi {
    max-width: 760px;
}

.emspi-panel {
    display: grid;
    gap: 1rem;
}

.emspi-screen {
    display: none;
}

.emspi-screen.is-active {
    display: block;
}

.emspi-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.emspi-section-title {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.emspi-intro-text {
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.6;
}

.emspi-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    background: rgba(0, 0, 0, 0.16);
}

.emspi-question {
    margin-bottom: 0.5rem;
}

.emspi-statement {
    margin: 0 0 0.85rem;
    font-size: 1.02rem;
    line-height: 1.55;
}

.emspi-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.emspi-opt {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    font-size: 0.88rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.emspi-opt:hover {
    border-color: rgba(201, 162, 39, 0.45);
    background: rgba(255, 255, 255, 0.07);
}

.emspi-opt.is-selected {
    border-color: rgba(201, 162, 39, 0.75);
    background: rgba(74, 58, 42, 0.55);
    color: #f0e6d8;
}

.emspi-nav {
    margin-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.emspi-nav-actions {
    display: flex;
    gap: 0.5rem;
}

.emspi-analysis {
    text-align: center;
    padding: 2rem 1rem;
}

.emspi-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #8b7355;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: emspi-spin 0.8s linear infinite;
}

@keyframes emspi-spin {
    to { transform: rotate(360deg); }
}

.emspi-analysis-msg {
    margin: 0;
    font-size: 1.02rem;
    color: rgba(255, 255, 255, 0.68);
    min-height: 1.5em;
}

.emspi-result-commander {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.emspi-result-sdi {
    font-size: 2rem;
    font-weight: 700;
    color: #c9a86c;
    margin-bottom: 0.35rem;
}

.emspi-result-code {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 1rem;
}

.emspi-result-block {
    margin-bottom: 1.1rem;
}

.emspi-result-block h3 {
    margin: 0 0 0.45rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
}

.emspi-result-block p {
    margin: 0;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.78);
}

.emspi-symptoms {
    list-style: none;
    padding: 0;
    margin: 0;
}

.emspi-symptoms li {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
}

.emspi-symptoms li:last-child {
    border-bottom: 0;
}

.emspi-advice {
    font-style: italic;
    color: #9a8b72;
    margin: 0.35rem 0;
}

.emspi-chart {
    margin-top: 0.35rem;
}

.emspi-chart-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.emspi-chart-label {
    width: 11.5rem;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
}

.emspi-chart-bar-wrap {
    flex: 1;
    height: 18px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.emspi-chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a3a2a, #8b7355);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.emspi-chart-pct {
    width: 2.5rem;
    text-align: right;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.62);
}

.emspi-result-actions,
.emspi-footer-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.emspi-leaderboard .emspi-lb-rank {
    width: 2.5rem;
    color: rgba(255, 255, 255, 0.55);
}

.emspi-leaderboard .emspi-lb-sdi {
    width: 4rem;
    font-weight: 700;
    color: #c9a86c;
}

.emspi-sdi-inline {
    font-variant-numeric: tabular-nums;
}

.emspi-sdi-badge-link {
    text-decoration: none;
    display: inline-flex;
}

.emspi-sdi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.76rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: rgba(74, 58, 42, 0.35);
    border: 1px solid rgba(201, 162, 39, 0.35);
    color: #e8dcc8;
    white-space: nowrap;
}

.emspi-sdi-badge--moderate {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.emspi-sdi-badge--severe {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.emspi-sdi-badge--omega {
    border-color: rgba(192, 132, 252, 0.45);
    background: rgba(192, 132, 252, 0.15);
    color: #e9d5ff;
}

.emspi-sdi-badge-label {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

.emspi-sdi-badge-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-th-emspi,
.stats-emspi {
    text-align: center;
    width: 5rem;
}

.stats-emspi .emspi-sdi-badge-link {
    justify-content: center;
}

/* Dashboard gratitude + poll spotlight row — always side-by-side on desktop */
.dashboard-spotlight-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.dashboard-spotlight-row--single {
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-spotlight-row > .panel {
    height: 100%;
    margin-bottom: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-gratitude-spotlight {
    background:
        radial-gradient(ellipse 80% 60% at 0% 0%, rgba(242, 210, 122, 0.16), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 100%, rgba(120, 180, 210, 0.12), transparent 50%);
    border-color: rgba(242, 210, 122, 0.22);
}

.dashboard-poll-spotlight {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 90% 70% at 100% 0%, rgba(56, 189, 168, 0.22), transparent 55%),
        radial-gradient(ellipse 70% 60% at 0% 100%, rgba(255, 122, 89, 0.16), transparent 50%),
        linear-gradient(160deg, rgba(18, 42, 48, 0.55), rgba(20, 28, 36, 0.2));
    border-color: rgba(56, 189, 168, 0.35);
    box-shadow: 0 0 0 1px rgba(56, 189, 168, 0.08), 0 10px 28px rgba(0, 0, 0, 0.18);
}

.dashboard-poll-spotlight::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 168, 0.18), transparent 68%);
    pointer-events: none;
}

.dashboard-poll-spotlight > * {
    position: relative;
    z-index: 1;
}

.dashboard-poll-spotlight .panel-header {
    align-items: center;
    gap: 0.65rem;
}

.dashboard-poll-spotlight .panel-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.dashboard-poll-title-icon {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 4px;
    background: linear-gradient(135deg, #38bda8, #ff7a59);
    box-shadow: 0 0 10px rgba(56, 189, 168, 0.45);
    transform: rotate(12deg);
}

.dashboard-poll-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-poll-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-poll-status.is-live {
    color: #0d3b34;
    background: linear-gradient(135deg, #5eead4, #38bda8);
    box-shadow: 0 0 12px rgba(56, 189, 168, 0.35);
}

.dashboard-poll-status.is-live::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #0d3b34;
    animation: dashboard-poll-pulse 1.4s ease-in-out infinite;
}

.dashboard-poll-status.is-closed {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes dashboard-poll-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.75); }
}

.dashboard-poll-question {
    margin: 0 0 0.95rem;
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f4fffc;
    text-wrap: balance;
}

.dashboard-poll-choices {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.dashboard-poll-choice-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    border: 1px solid transparent;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

.dashboard-poll-choice-btn--0 {
    background: linear-gradient(135deg, rgba(56, 189, 168, 0.28), rgba(56, 189, 168, 0.1));
    border-color: rgba(56, 189, 168, 0.45);
}

.dashboard-poll-choice-btn--1 {
    background: linear-gradient(135deg, rgba(255, 122, 89, 0.28), rgba(255, 122, 89, 0.1));
    border-color: rgba(255, 122, 89, 0.45);
}

.dashboard-poll-choice-btn--2 {
    background: linear-gradient(135deg, rgba(242, 210, 122, 0.28), rgba(242, 210, 122, 0.1));
    border-color: rgba(242, 210, 122, 0.45);
}

.dashboard-poll-choice-btn--3 {
    background: linear-gradient(135deg, rgba(110, 168, 255, 0.28), rgba(110, 168, 255, 0.1));
    border-color: rgba(110, 168, 255, 0.45);
}

.dashboard-poll-choice-btn:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.01);
    filter: brightness(1.08);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.dashboard-poll-choice-btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.99);
}

.dashboard-poll-choice-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.dashboard-poll-choice-btn.is-voting {
    outline: 2px solid rgba(94, 234, 212, 0.55);
}

.dashboard-poll-choice-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #0d1a1f;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.dashboard-poll-choice-btn--0 .dashboard-poll-choice-letter { background: #5eead4; }
.dashboard-poll-choice-btn--1 .dashboard-poll-choice-letter { background: #ff9a7a; }
.dashboard-poll-choice-btn--2 .dashboard-poll-choice-letter { background: #f2d27a; }
.dashboard-poll-choice-btn--3 .dashboard-poll-choice-letter { background: #8eb8ff; }

.dashboard-poll-choice-text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.dashboard-poll-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.dashboard-poll-result__row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.3rem;
}

.dashboard-poll-result__label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.92);
    min-width: 0;
}

.dashboard-poll-result .dashboard-poll-choice-letter {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.7rem;
}

.dashboard-poll-result--0 .dashboard-poll-choice-letter { background: #5eead4; }
.dashboard-poll-result--1 .dashboard-poll-choice-letter { background: #ff9a7a; }
.dashboard-poll-result--2 .dashboard-poll-choice-letter { background: #f2d27a; }
.dashboard-poll-result--3 .dashboard-poll-choice-letter { background: #8eb8ff; }

.dashboard-poll-result.is-selected .dashboard-poll-result__label {
    font-weight: 700;
}

.dashboard-poll-yours {
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #5eead4;
    margin-left: 0.2rem;
}

.dashboard-poll-result__pct {
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}

.dashboard-poll-result__bar {
    height: 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.dashboard-poll-result__bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.dashboard-poll-result__bar > span.is-animated {
    /* width set inline */
}

.dashboard-poll-result--0 .dashboard-poll-result__bar > span {
    background: linear-gradient(90deg, #2a9d8f, #5eead4);
}
.dashboard-poll-result--1 .dashboard-poll-result__bar > span {
    background: linear-gradient(90deg, #e76f51, #ff9a7a);
}
.dashboard-poll-result--2 .dashboard-poll-result__bar > span {
    background: linear-gradient(90deg, #c79a3b, #f2d27a);
}
.dashboard-poll-result--3 .dashboard-poll-result__bar > span {
    background: linear-gradient(90deg, #4c7fd4, #8eb8ff);
}

.dashboard-poll-result__votes {
    margin-top: 0.2rem;
}

.dashboard-poll-meta {
    margin: 0.9rem 0 0;
}

.poll-admin-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.poll-admin-choice-actions {
    margin: 0.5rem 0 0;
}

@media (max-width: 720px) {
    .dashboard-spotlight-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.dashboard-gratitude-note {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.dashboard-gratitude-jar {
    position: relative;
    width: 3.5rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.dashboard-gratitude-jar-lid {
    display: block;
    height: 0.55rem;
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(to bottom, #f2d27a, #c79a3b);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.dashboard-gratitude-jar-body {
    display: block;
    margin-top: 2px;
    height: 3.25rem;
    border: 1.5px solid rgba(170, 200, 225, 0.85);
    border-radius: 1rem 1rem 0.65rem 0.65rem;
    background: linear-gradient(to bottom, rgba(245, 252, 255, 0.92), rgba(214, 236, 247, 0.75));
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.dashboard-gratitude-quote {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.dashboard-gratitude-quote p {
    margin: 0 0 0.5rem;
    font-size: 1.02rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.88);
    font-style: italic;
}

.dashboard-gratitude-quote footer {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.62);
}

.dashboard-gratitude-quote cite {
    font-style: normal;
    font-weight: 600;
    color: #e8dcc8;
}

@media (max-width: 640px) {
    .dashboard-gratitude-note {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Gratitude Journal */
.portal-tool-page--gratitude {
    max-width: 640px;
}

.gratitude-journal {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem 1.35rem 1.5rem;
    background: linear-gradient(180deg, rgba(42, 36, 48, 0.65), rgba(28, 24, 32, 0.85));
}

.gratitude-view-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gratitude-view-btn {
    padding: 0.45rem 1rem;
    font-size: 0.86rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gratitude-view-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.gratitude-view-btn.is-active {
    background: rgba(201, 162, 39, 0.18);
    border-color: rgba(201, 162, 39, 0.45);
    color: #f0e6d8;
}

.gratitude-journal-title {
    position: relative;
    text-align: center;
    margin: 0 0 1.25rem;
    padding: 0.75rem 0;
}

.gratitude-washi-tape {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    width: 82%;
    height: 100%;
    background: linear-gradient(135deg, rgba(245, 215, 217, 0.35), rgba(240, 200, 204, 0.28));
    border-radius: 4px;
    z-index: 0;
}

.gratitude-title-text {
    position: relative;
    z-index: 1;
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-size: 2rem;
    font-weight: 600;
    color: #f0e6d8;
}

.gratitude-input-card {
    background: rgba(255, 249, 208, 0.12);
    border: 1px solid rgba(255, 249, 208, 0.2);
    padding: 1rem;
    border-radius: 8px;
    transform: rotate(-0.4deg);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    margin-bottom: 1.25rem;
    display: grid;
    gap: 0.65rem;
}

.gratitude-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    color: #f5f0e8;
    box-sizing: border-box;
}

.gratitude-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.gratitude-list {
    min-height: 4rem;
}

.gratitude-item {
    padding: 1rem 1.1rem;
    margin-bottom: 0.85rem;
    background: rgba(240, 245, 248, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transform: rotate(0.5deg);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.55;
    position: relative;
    padding-right: 2.5rem;
    animation: gratitude-fade-in 0.45s ease-out;
}

.gratitude-item:nth-child(even) {
    background: rgba(245, 240, 232, 0.08);
    transform: rotate(-0.4deg);
}

.gratitude-item:nth-child(3n) {
    background: rgba(240, 248, 240, 0.08);
    transform: rotate(0.3deg);
}

.gratitude-item::before {
    content: "✨";
    position: absolute;
    top: 0.55rem;
    right: 0.75rem;
    opacity: 0.55;
}

.gratitude-item:nth-child(even)::before { content: "💝"; }
.gratitude-item:nth-child(3n)::before { content: "⭐"; }

.gratitude-entry-date {
    display: block;
    margin-bottom: 0.35rem;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    font-size: 1.05rem;
    color: #c9a86c;
}

@keyframes gratitude-fade-in {
    from { opacity: 0; transform: translateY(8px) rotate(0.5deg); }
    to { opacity: 1; transform: translateY(0) rotate(0.5deg); }
}

.gratitude-clear-button {
    display: block;
    margin: 1rem auto 0;
}

.gratitude-jar-view {
    text-align: center;
    padding: 1.5rem 0.5rem 0.25rem;
}

.gratitude-jar-empty {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(245, 240, 232, 0.08);
    border-radius: 8px;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    font-size: 1.15rem;
    color: #c9a86c;
}

.gratitude-jar-slip {
    margin: 0 auto 1.25rem;
    max-width: 26rem;
    padding: 1rem 1.1rem;
    background: rgba(255, 249, 208, 0.14);
    border: 1px solid rgba(255, 249, 208, 0.22);
    border-radius: 8px;
    transform: rotate(1.2deg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.55;
    text-align: left;
    animation: gratitude-slip-appear 0.45s ease-out;
}

.gratitude-jar-slip::before {
    content: "✨";
    float: right;
    opacity: 0.55;
}

@keyframes gratitude-slip-appear {
    from { opacity: 0; transform: translateY(-12px) rotate(1.2deg) scale(0.95); }
    to { opacity: 1; transform: translateY(0) rotate(1.2deg) scale(1); }
}

.gratitude-jar {
    position: relative;
    width: 11.5rem;
    margin: 0 auto;
    cursor: pointer;
}

.gratitude-jar-lid {
    height: 1.4rem;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(to bottom, #f2d27a, #c79a3b);
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.25);
}

.gratitude-jar-twine {
    position: absolute;
    top: 1.45rem;
    left: 1.1rem;
    right: 1.1rem;
    height: 0.8rem;
    background: repeating-linear-gradient(135deg, #8b5a2b, #8b5a2b 4px, #c8a46d 4px, #c8a46d 8px);
    border-radius: 8px;
    z-index: 2;
}

.gratitude-jar-body {
    position: relative;
    height: 15rem;
    border: 2px solid rgba(170, 200, 225, 0.85);
    border-radius: 3rem 3rem 1.6rem 1.6rem;
    background: linear-gradient(to bottom, rgba(245, 252, 255, 0.9), rgba(214, 236, 247, 0.75));
    box-shadow: 0 10px 16px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.gratitude-jar-body::before {
    content: "";
    position: absolute;
    top: 1.25rem;
    left: 1.1rem;
    width: 2rem;
    height: 11rem;
    border-radius: 1rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent);
}

.gratitude-jar-scrap {
    position: absolute;
    width: 2rem;
    height: 1.7rem;
    background: #fff9d0;
    border-radius: 4px;
    border: 1px solid rgba(200, 180, 150, 0.35);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gratitude-jar-body.jar-has-entries .gratitude-jar-scrap {
    opacity: 1;
}

.gratitude-jar-scrap.scrap-1 { bottom: 2.2rem; left: 1.7rem; transform: rotate(-15deg); }
.gratitude-jar-scrap.scrap-2 { bottom: 3.4rem; left: 3rem; transform: rotate(8deg); background: #fef5e6; }
.gratitude-jar-scrap.scrap-3 { bottom: 2.8rem; right: 2rem; transform: rotate(-8deg); background: #f0f5f8; }
.gratitude-jar-scrap.scrap-4 { bottom: 4.2rem; left: 2.3rem; transform: rotate(12deg); background: #f0f8f0; }
.gratitude-jar-scrap.scrap-5 { bottom: 3.6rem; right: 2.5rem; transform: rotate(-5deg); background: #f5f0e8; }

.gratitude-jar-label {
    position: absolute;
    left: 1.4rem;
    right: 1.4rem;
    top: 1.7rem;
    padding: 0.35rem 0.55rem;
    background: #f5f0e8;
    border-radius: 8px;
    font-family: "Segoe Print", "Bradley Hand", cursive;
    font-size: 1rem;
    font-weight: 600;
    color: #6b5d4d;
    transform: rotate(-0.5deg);
    z-index: 2;
}

.gratitude-jar-hint {
    margin-top: 0.65rem;
    font-style: italic;
}

.gratitude-jar:hover .gratitude-jar-body {
    transform: translateY(-2px);
    transition: transform 0.18s ease;
}

/* Leadership shared to-do list (mobile-first) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.leadership-todos-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
}

.leadership-todos-panel {
    padding: 0;
    overflow: hidden;
}

.leadership-todos-section {
    padding: 1rem 1.1rem;
}

.leadership-todos-section + .leadership-todos-section {
    border-top: 1px solid var(--border);
}

.leadership-todos-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.leadership-todos-heading {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.leadership-todos-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.leadership-todos-hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.leadership-todos-section--daily {
    background: rgba(249, 115, 22, 0.05);
}

.leadership-todo-badge {
    display: inline-block;
    margin-right: 0.4rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.18);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.leadership-todo-item--daily.leadership-todo-item--done-today {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.22);
}

.leadership-todo-item--daily.leadership-todo-item--done-today .leadership-todo-text {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

.leadership-todo-side-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin: -0.25rem -0.25rem 0 0;
}

.leadership-todo-make-daily,
.leadership-todo-make-once {
    min-height: 2.5rem;
    padding: 0 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
}

.leadership-todo-make-daily:hover,
.leadership-todo-make-daily:focus-visible,
.leadership-todo-make-once:hover,
.leadership-todo-make-once:focus-visible {
    color: var(--accent);
    border-color: rgba(249, 115, 22, 0.45);
}

.leadership-todos-daily-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.75rem;
    padding: 0.35rem 0.1rem;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.leadership-todos-daily-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.leadership-todos-daily-toggle-ui {
    width: 1.65rem;
    height: 1.65rem;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 0.35rem;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.leadership-todos-daily-toggle input:checked + .leadership-todos-daily-toggle-ui {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.35);
}

.leadership-todos-daily-toggle input:checked + .leadership-todos-daily-toggle-ui::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.leadership-todos-daily-toggle-label {
    font-size: 1rem;
    font-weight: 600;
}

.leadership-todos-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.leadership-todo-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.65rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.leadership-todo-item.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.leadership-todo-item--done {
    grid-template-columns: auto 1fr;
    background: rgba(255, 255, 255, 0.03);
}

.leadership-todo-complete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: -0.35rem 0 -0.35rem -0.35rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}

.leadership-todo-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
}

.leadership-todo-check--done {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.18);
    color: var(--success);
    font-size: 0.95rem;
    font-weight: 700;
}

.leadership-todo-body {
    min-width: 0;
    padding-top: 0.15rem;
}

.leadership-todo-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.leadership-todo-meta {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}

.leadership-todo-item--done .leadership-todo-text {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.25);
}

.leadership-todo-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: -0.25rem -0.25rem 0 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.leadership-todo-delete:hover,
.leadership-todo-delete:focus-visible {
    color: var(--error);
    background: rgba(239, 68, 68, 0.12);
}

.leadership-todos-empty {
    margin: 0;
}

.leadership-todos-compose {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: rgba(13, 14, 18, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.leadership-todos-compose .leadership-todos-daily-toggle {
    grid-column: 1 / -1;
}

.leadership-todos-compose .leadership-todos-add-btn {
    grid-column: 1 / -1;
}

.leadership-todos-input {
    width: 100%;
    min-height: 3.25rem;
    max-height: 8rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.45;
    resize: vertical;
    touch-action: manipulation;
}

.leadership-todos-input:focus {
    outline: none;
    border-color: rgba(249, 115, 22, 0.65);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.leadership-todos-add-btn {
    min-height: 3rem;
    width: 100%;
    font-size: 1rem;
    touch-action: manipulation;
}

@media (min-width: 768px) {
    .leadership-todos-page {
        padding-bottom: 1rem;
    }

    .leadership-todos-compose {
        position: static;
        left: auto;
        right: auto;
        grid-template-columns: 1fr auto auto;
        align-items: end;
        padding: 0;
        border-top: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .leadership-todos-compose .leadership-todos-daily-toggle {
        grid-column: auto;
        white-space: nowrap;
    }

    .leadership-todos-compose .leadership-todos-add-btn {
        grid-column: auto;
    }

    .leadership-todos-add-btn {
        width: auto;
        min-width: 8.5rem;
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    .leadership-hero--compact .lead {
        font-size: 0.92rem;
    }

    .admin-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Kingdom team management plan */
.team-plan-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
}

.team-plan-updated {
    margin: 0;
    padding: 0 0.15rem;
}

.team-plan-tabs {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.15rem 0;
}

.team-plan-tab {
    flex: 0 0 auto;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.team-plan-tab.is-active {
    border-color: rgba(249, 115, 22, 0.55);
    background: var(--accent-soft);
    color: var(--accent);
}

.team-plan-panel {
    padding: 1rem 1.1rem;
}

.team-plan-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.team-plan-section-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.team-plan-section-lead {
    margin: 0;
    max-width: 42rem;
}

.team-plan-subheading {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.team-plan-empty {
    margin: 0.75rem 0 0;
}

.team-plan-objectives {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.team-plan-objective-card {
    padding: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.team-plan-objective-card.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.team-plan-objective-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.team-plan-objective-title {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
}

.team-plan-objective-horizon {
    min-height: 2.75rem;
    padding: 0 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

.team-plan-smart-grid {
    display: grid;
    gap: 0.65rem;
}

.team-plan-smart-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.team-plan-smart-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
}

.team-plan-smart-input,
.team-plan-charter-grid textarea,
.team-plan-field input,
.team-plan-field select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.45;
    resize: vertical;
}

.team-plan-objective-actions,
.team-plan-raci-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.team-plan-charter-grid {
    display: grid;
    gap: 0.85rem;
}

.team-plan-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.team-plan-label {
    font-size: 0.85rem;
    font-weight: 700;
}

.team-plan-raci-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.team-plan-raci-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.12);
}

.team-plan-raci-table {
    width: 100%;
    min-width: 36rem;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.team-plan-raci-table th,
.team-plan-raci-table td {
    padding: 0.55rem 0.45rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.team-plan-raci-table th {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

.team-plan-raci-activity-col {
    min-width: 10rem;
}

.team-plan-raci-role-col {
    min-width: 6.5rem;
}

.team-plan-role-input,
.team-plan-raci-activity-input {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

.team-plan-raci-select {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

.team-plan-raci-actions-col {
    white-space: nowrap;
}

.team-plan-raci-actions-col .btn {
    min-height: 2.35rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

.team-plan-raci-table tr.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.team-plan-action-compose {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.team-plan-field--grow {
    grid-column: 1 / -1;
}

.team-plan-actions-split {
    display: grid;
    gap: 1rem;
}

.team-plan-action-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.team-plan-action-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.65rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    touch-action: manipulation;
}

.team-plan-action-item.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.team-plan-action-item--done {
    background: rgba(255, 255, 255, 0.03);
}

.team-plan-action-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: -0.35rem 0 -0.35rem -0.35rem;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.team-plan-action-item--done .team-plan-action-check {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.18);
    color: var(--success);
}

.team-plan-action-item--done .team-plan-action-title {
    color: var(--muted);
    text-decoration: line-through;
}

.team-plan-action-body {
    min-width: 0;
    padding-top: 0.15rem;
}

.team-plan-action-title {
    font-size: 1rem;
    line-height: 1.45;
    word-break: break-word;
}

.team-plan-action-meta,
.team-plan-action-notes {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}

.team-plan-action-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: -0.25rem -0.25rem 0 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 1.35rem;
    cursor: pointer;
}

.team-plan-action-delete:hover,
.team-plan-action-delete:focus-visible {
    color: var(--error);
    background: rgba(239, 68, 68, 0.12);
}

.team-plan-action-compose.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

@media (min-width: 768px) {
    .team-plan-smart-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-plan-charter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .team-plan-action-compose {
        grid-template-columns: 2fr 1fr 9rem 1.2fr auto;
        align-items: end;
    }

    .team-plan-field--grow {
        grid-column: auto;
    }

    .team-plan-actions-split {
        grid-template-columns: 1fr 1fr;
    }
}

/* Season of Conquest Mode Tracker */
body.soc-tracker-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

body.soc-tracker-page .portal-tool-page--soc-tracker,
body.soc-tracker-page .soc-tracker-panel {
    max-width: none;
    width: 100%;
}

.soc-tracker-app {
    width: 100%;
}

.soc-story-guide {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

@media (min-width: 720px) {
    .soc-story-guide-toolbar {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .soc-story-guide-label {
        min-width: 14rem;
        max-width: 18rem;
    }
}

.soc-story-guide-heading {
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.soc-story-guide-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.soc-story-guide-lead {
    margin: 0;
}

.soc-story-guide-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.soc-story-guide-select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.soc-story-guide-body {
    margin-top: 0.25rem;
}

.soc-story-guide-card {
    max-width: 52rem;
}

.soc-story-guide-title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    line-height: 1.35;
}

.soc-story-guide-kicker {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.65;
}

.soc-story-guide-subheading {
    margin: 1rem 0 0.45rem;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.soc-story-guide-subicon {
    line-height: 1;
}

.soc-story-guide-text {
    margin: 0 0 0.65rem;
    line-height: 1.55;
    font-size: 0.94rem;
}

.soc-story-guide-list {
    margin: 0 0 0.75rem;
    padding-left: 1.2rem;
    line-height: 1.5;
    font-size: 0.94rem;
}

.soc-story-guide-list li {
    margin-bottom: 0.2rem;
}

.soc-story-feature {
    margin: 0.5rem 0 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.soc-story-feature-head {
    margin-bottom: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
}

.soc-story-feature-debut {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.soc-story-guide-link {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
}

.soc-tracker-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.soc-tracker-screenshot-btn {
    margin-left: auto;
}

.soc-tracker-capture-head {
    display: none;
    margin-bottom: 0.75rem;
}

.soc-tracker-capture--export .soc-tracker-capture-head {
    display: block;
}

.soc-tracker-capture-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.soc-tracker-capture-meta {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
}

.soc-tracker-capture--export {
    padding: 1rem;
    background: #12141a;
    border-radius: 10px;
}

.soc-tracker-capture--export .soc-window-actions {
    display: none !important;
}

.soc-tracker-year-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.soc-tracker-year-select {
    min-width: 7rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
}

.soc-tracker-intro {
    margin: 0;
    flex: 1 1 12rem;
}

.soc-tracker-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.soc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
}

.soc-badge {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 2px;
    flex-shrink: 0;
    vertical-align: middle;
    margin-left: 0.2rem;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.soc-badge-remaster {
    background-image: linear-gradient(135deg, #c0c0c0, #ececec 40%, #9ca3af);
    clip-path: polygon(50% 0%, 62% 32%, 98% 35%, 70% 57%, 79% 92%, 50% 72%, 21% 92%, 30% 57%, 2% 35%, 38% 32%);
}

.soc-badge-pioneer {
    background-image: linear-gradient(135deg, #d4a017, #fde68a 45%, #b45309);
    clip-path: polygon(50% 0%, 62% 32%, 98% 35%, 70% 57%, 79% 92%, 50% 72%, 21% 92%, 30% 57%, 2% 35%, 38% 32%);
}

.soc-badge-crystal {
    background-image: linear-gradient(135deg, #2563eb, #93c5fd 50%, #1d4ed8);
    clip-path: polygon(50% 0%, 62% 32%, 98% 35%, 70% 57%, 79% 92%, 50% 72%, 21% 92%, 30% 57%, 2% 35%, 38% 32%);
}

.soc-tracker-section {
    margin-bottom: 1.75rem;
}

.soc-tracker-heading {
    font-size: 1.05rem;
    margin: 0 0 0.75rem;
}

.soc-tracker-windows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.soc-window-row {
    display: grid;
    grid-template-columns: 5.5rem auto 1fr auto;
    align-items: center;
    gap: 0.5rem 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.soc-window-date {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
}

.soc-window-arrow {
    opacity: 0.45;
}

.soc-window-modes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.25rem;
    line-height: 1.45;
}

.soc-mode-sep {
    opacity: 0.55;
    margin: 0 0.1rem;
}

.soc-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.soc-window-tbd {
    opacity: 0.55;
    font-style: italic;
}

.soc-window-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.soc-tracker-admin {
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.soc-tracker-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.soc-tracker-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1rem;
}

.soc-tracker-form-row label,
.soc-mode-field label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.soc-tracker-form-row input,
.soc-mode-field select {
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    min-width: 10rem;
}

.soc-tracker-mode-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
}

.soc-mode-field {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.65rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
}

.soc-tracker-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .soc-window-row {
        grid-template-columns: 1fr;
    }

    .soc-window-arrow {
        display: none;
    }

    .soc-window-actions {
        justify-content: flex-end;
    }
}

/* KvK rewards distribution (leadership) — dark spreadsheet layout */
body.kvk-rewards-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.kvk-rewards-page {
    width: 100%;
}

.kvk-rewards-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.kvk-rewards-session-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 16rem;
    flex: 1;
}

.kvk-rewards-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kvk-rewards-status {
    margin-bottom: 0.75rem;
    color: var(--muted);
}

.kvk-rewards-map-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 1rem;
    padding: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.kvk-rewards-map-tab {
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.kvk-rewards-map-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.kvk-rewards-map-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.kvk-rewards-map-panel {
    display: none;
    margin-bottom: 1.5rem;
}

.kvk-rewards-map-panel.is-active {
    display: block;
}

.kvk-rewards-capture {
    padding: 1rem;
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    font-family: 'Oswald', "Segoe UI", system-ui, sans-serif;
    box-shadow: var(--shadow);
}

.kvk-rewards-sheet-session {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.kvk-rewards-sheet-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
    table-layout: auto;
    font-family: 'Oswald', "Segoe UI", system-ui, sans-serif;
    font-size: 0.82rem;
    color: var(--text);
}

.kvk-rewards-sheet-table td {
    border: 1px solid var(--border);
    padding: 0.3rem 0.45rem;
    vertical-align: middle;
    text-align: center;
    background: var(--surface);
}

.kvk-rewards-title-cell {
    font-size: 1.35rem;
    font-weight: 700;
    padding: 0.65rem 0.5rem;
    border: none !important;
    background: transparent !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text);
}

.kvk-rewards-th {
    font-weight: 700;
    font-size: 0.85rem;
    border-color: var(--border) !important;
    background: var(--surface-hover);
    color: var(--text);
    white-space: nowrap;
}

.kvk-rewards-th-num,
.kvk-rewards-th-camp {
    border-color: var(--border) !important;
}

.kvk-rewards-reward-cell {
    min-width: 4.5rem;
}

.kvk-rewards-num-cell {
    min-width: 3rem;
    max-width: 4.5rem;
}

.kvk-rewards-cell-input {
    width: 100%;
    min-width: 3rem;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-align: center;
    padding: 0.15rem 0.2rem;
    box-sizing: border-box;
}

.kvk-rewards-cell-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: rgba(249, 115, 22, 0.08);
}

.kvk-rewards-cell-input::placeholder {
    color: var(--muted);
}

.kvk-rewards-mark-cell {
    width: 2.5rem;
    min-width: 2.5rem;
}

.kvk-rewards-reward-mark {
    background: rgba(180, 90, 130, 0.18) !important;
}

.kvk-rewards-mark.is-yes {
    color: var(--success);
    font-weight: 700;
}

.kvk-rewards-mark.is-no {
    color: var(--muted);
    font-weight: 700;
}

.kvk-rewards-camp-toggle {
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    padding: 0.15rem;
    width: 100%;
    color: inherit;
}

.kvk-rewards-spacer {
    border: none !important;
    background: transparent !important;
    height: 0.75rem;
    padding: 0;
}

.kvk-rewards-banner {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.5rem;
    border: 1px solid var(--border) !important;
    background: var(--surface-hover) !important;
    color: var(--text);
}

.kvk-rewards-banner-summary {
    text-align: center;
}

.kvk-rewards-camp-pink {
    background: rgba(180, 90, 130, 0.14) !important;
}

.kvk-rewards-dkp-pink {
    background: rgba(239, 68, 68, 0.12) !important;
}

.kvk-rewards-gap {
    border: none !important;
    background: var(--bg-elevated) !important;
}

.kvk-rewards-derived {
    font-weight: 700;
    white-space: nowrap;
    color: var(--text);
}

.kvk-rewards-side-head {
    font-weight: 700;
    border-color: var(--border) !important;
    background: var(--surface-hover);
    text-align: center;
    color: var(--text);
}

.kvk-rewards-icon-cell {
    padding: 0.2rem 0.35rem;
    vertical-align: middle;
}

.kvk-rewards-icon {
    display: block;
    margin: 0 auto;
    width: 21px;
    height: 21px;
    object-fit: contain;
}

.kvk-rewards-th-num .kvk-rewards-icon {
    width: 24px;
    height: 24px;
}

.kvk-rewards-side-icon .kvk-rewards-icon {
    width: 21px;
    height: 21px;
}

.kvk-rewards-side-label {
    font-weight: 700;
    text-align: left;
    color: var(--text);
}

.kvk-rewards-side-empty {
    border-top: 1px dotted var(--border) !important;
    border-bottom: 1px dotted var(--border) !important;
    background: var(--surface) !important;
}

.kvk-rewards-summary-val {
    font-weight: 700;
    color: var(--text);
}

.kvk-rewards-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

@media (max-width: 900px) {
    .kvk-rewards-capture {
        padding: 0.5rem;
    }
}

/* Story timelines (leadership) */
body.timelines-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.timelines-page {
    width: 100%;
}

.timelines-hub {
    padding: 1.25rem;
}

.timelines-story-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 720px) {
    .timelines-story-list {
        grid-template-columns: 1fr;
    }
}

.timelines-story-block {
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--surface);
    padding: 1rem 1.25rem;
}

.timelines-story-block-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.timelines-story-empty {
    margin: 0;
    padding-top: 0.25rem;
}

.timelines-saved-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.timelines-saved-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--bg-elevated);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.timelines-saved-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.timelines-saved-label {
    font-weight: 600;
}

.timelines-saved-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.timelines-story-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.timelines-story-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.timelines-story-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.timelines-story-desc {
    color: var(--muted);
    font-size: 0.9rem;
}

.timelines-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.timelines-session-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 16rem;
    flex: 1;
}

.timelines-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timelines-status {
    margin-bottom: 0.75rem;
    color: var(--muted);
}

.timelines-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}

.timelines-view-tab {
    flex: 1;
    min-width: 8rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: calc(var(--radius, 8px) - 2px);
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.timelines-view-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.timelines-view-tab.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.timelines-view-panel {
    margin-bottom: 1.5rem;
}

.timelines-ruins-actions,
.timelines-view-actions {
    margin-bottom: 0.75rem;
}

.sot-dates-capture {
    padding: 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}

.sot-dates-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    text-align: center;
    color: var(--text);
}

.sot-dates-form {
    display: grid;
    gap: 1rem;
    max-width: 36rem;
    margin: 0 auto 1.25rem;
}

.sot-dates-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.sot-dates-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sot-dates-format {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 5.5rem;
}

.sot-date-input,
.sot-hms-input {
    max-width: 12rem;
    font-family: Montserrat, var(--font-sans), sans-serif;
    font-weight: 700;
}

.sot-dates-computed {
    display: inline-block;
    padding: 0.45rem 0.75rem;
    background: var(--surface);
    color: var(--text);
    font-family: Montserrat, var(--font-sans), sans-serif;
    font-weight: 700;
    border-radius: var(--radius, 8px);
    border: 1px solid var(--border);
}

.sot-dates-hint {
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
}

.sot-dates-banner {
    text-align: center;
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.sot-milestones-table {
    width: 100%;
    border-collapse: collapse;
}

.sot-milestone-row td {
    border: 1px solid var(--border);
    padding: 0.65rem 0.75rem;
    text-align: center;
    background: var(--surface);
}

.sot-milestone-label {
    font-family: Montserrat, var(--font-sans), sans-serif;
    font-weight: 700;
    color: var(--text);
}

.sot-milestone-date {
    font-family: Comfortaa, var(--font-sans), sans-serif;
    color: var(--accent);
    font-weight: 700;
}

.sot-timeline-capture {
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    color: var(--text);
    box-shadow: var(--shadow);
}

.sot-timeline-header {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius, 8px);
}

.sot-timeline-title {
    font-family: Montserrat, var(--font-sans), sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    font-style: italic;
    color: var(--text);
    letter-spacing: 0.02em;
}

.sot-timeline-table-wrap {
    overflow-x: auto;
}

.sot-timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-family: Montserrat, var(--font-sans), sans-serif;
    color: var(--text);
}

.sot-timeline-table th {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    padding: 0.45rem 0.35rem;
    text-align: center;
    font-weight: 700;
    font-style: italic;
    color: var(--text);
}

.sot-timeline-table td {
    border: 1px solid var(--border);
    padding: 0.35rem 0.4rem;
    vertical-align: middle;
    background: var(--surface);
}

.sot-chapter-row.is-done td,
.sot-chapter-end.is-done td {
    background: var(--surface);
    color: var(--muted);
}

.sot-col-done {
    width: 2.5rem;
    text-align: right;
}

.sot-col-name {
    min-width: 10rem;
    font-weight: 700;
}

.sot-col-dur {
    text-align: center;
    width: 4rem;
}

.sot-col-se {
    width: 1.5rem;
    text-align: center;
    font-weight: 700;
}

.sot-col-start,
.sot-col-unlock-time,
.sot-col-unlock-label {
    min-width: 8rem;
    text-align: center;
}

.sot-col-desc {
    min-width: 14rem;
}

.sot-col-rewards {
    min-width: 8rem;
    text-align: center;
}

.sot-col-cap-skill,
.sot-col-cap-what,
.sot-col-cap-when {
    text-align: center;
    min-width: 6rem;
}

.timelines-ruins-capture,
.timelines-timeline-capture {
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}

.sot-ruins-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.sot-ruins-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sot-ruins-block {
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: var(--radius, 8px);
    background: var(--surface);
}

.sot-ruins-ancient,
.sot-ruins-kau,
.sot-ruins-altar {
    background: var(--surface);
}

.sot-ruins-block-title {
    text-align: center;
    font-family: Montserrat, var(--font-sans), sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    font-style: italic;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-hover);
    color: var(--text);
    border-radius: var(--radius, 8px);
    border: 1px solid var(--border);
}

.sot-ruins-header-date {
    text-align: center;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.sot-ruins-times-label {
    text-align: center;
    font-weight: 700;
    border: 1px solid var(--border);
    margin-bottom: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface-hover);
    color: var(--muted);
    font-size: 0.85rem;
    border-radius: var(--radius, 8px);
}

.sot-ruins-table,
.sot-kau-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text);
}

.sot-ruins-table td,
.sot-kau-table td {
    border: 1px solid var(--border);
    padding: 0.35rem 0.5rem;
    background: var(--bg-elevated);
}

.sot-kau-hero {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.sot-kau-hero-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.sot-ruins-slot.is-done td {
    background: var(--bg-elevated);
    color: var(--muted);
}

.sot-ruins-done {
    width: 3rem;
    text-align: center;
}

.sot-ruins-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.sot-ruins-time {
    text-align: center;
}

.sot-kau-label {
    text-align: center;
}

.sot-kau-start {
    text-align: center;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .sot-ruins-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sot-timeline-table {
        font-size: 0.7rem;
    }
}

/* Timed markers (leadership) */
body.leadership-area .timed-markers-page {
    max-width: 72rem;
    margin: 0 auto;
}

.timed-markers-clock {
    margin-bottom: 1rem;
    text-align: center;
    padding: 1.1rem 1.25rem;
}

.timed-markers-clock-label {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #9aa3b2);
}

.timed-markers-clock-value {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fbbf24;
}

.timed-markers-clock-hint {
    margin: 0.5rem 0 0;
}

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

.timed-markers-section h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.timed-markers-steps {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    line-height: 1.5;
    color: var(--text-muted, #9aa3b2);
}

.timed-markers-steps li + li {
    margin-top: 0.35rem;
}

.timed-markers-figure {
    margin: 0;
}

.timed-markers-picker-img {
    display: block;
    width: 100%;
    max-width: 22rem;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.timed-markers-figure figcaption {
    margin-top: 0.5rem;
    text-align: center;
}

.timed-markers-datetime-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.timed-markers-game-preview {
    margin: 0.25rem 0 0.75rem;
    color: #4ade80;
}

.timed-markers-countdown-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.timed-markers-reverse-label {
    margin: 0 0 0.2rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9aa3b2);
}

.timed-markers-reverse-value {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timed-markers-reverse-game {
    margin: 0 0 0.75rem;
}

.timed-markers-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.timed-markers-section-head h2 {
    margin: 0;
}

.timed-markers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.timed-markers-item {
    position: relative;
    padding: 0.85rem 2.5rem 0.85rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.timed-markers-item--past {
    opacity: 0.72;
}

.timed-markers-item-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.35rem;
}

.timed-markers-item-label {
    font-size: 0.95rem;
}

.timed-markers-item-countdown {
    font-weight: 700;
    color: #4ade80;
    font-variant-numeric: tabular-nums;
}

.timed-markers-item--past .timed-markers-item-countdown {
    color: var(--text-muted, #9aa3b2);
}

.timed-markers-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted, #9aa3b2);
}

.timed-markers-item-utc {
    font-variant-numeric: tabular-nums;
}

.timed-markers-item-notes {
    margin: 0.35rem 0 0;
}

.timed-markers-item-delete {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #9aa3b2);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.timed-markers-item-delete:hover,
.timed-markers-item-delete:focus-visible {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.timed-markers-empty {
    margin: 0;
}

@media (min-width: 960px) {
    .timed-markers-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    }

    .timed-markers-section--guide {
        grid-row: span 2;
    }

    .timed-markers-opens-countdown {
    margin: 0.35rem 0 0;
    color: #4ade80;
    font-weight: 600;
}

.timed-markers-section--list {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .timed-markers-datetime-row {
        grid-template-columns: 1fr;
    }
}

/* My pairings (portal page) */
.my-pairings-gov-hint {
    margin: 0 0 1rem;
}

.my-pairings-panel {
    max-width: 960px;
}

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

.my-pairings-rows {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.my-pairings-row {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    background: rgba(0, 0, 0, 0.18);
}

.my-pairings-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.my-pairings-row-title {
    font-weight: 700;
}

.my-pairings-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.my-pairings-fields .form-group {
    margin: 0;
}

.my-pairings-fields .form-group > span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted, #94a3b8);
}

.my-pairings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.my-pairings-status.is-error {
    color: #f87171;
}

.my-pairings-preview {
    margin-top: 0.5rem;
}

.my-pairings-editor {
    margin-bottom: 1rem;
}

.my-pairings-editor .battle-report-bulk-import-body {
    padding-top: 0.75rem;
}

.player-march-card--engineer .player-march-badge--troop {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

@media (max-width: 900px) {
    .my-pairings-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .my-pairings-fields {
        grid-template-columns: 1fr;
    }
}

/* Rise of Humanity leaderboard */
.roh-leaderboard-mine {
    margin-bottom: 1rem;
    text-align: center;
}

.roh-leaderboard-mine__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.roh-leaderboard-mine__score {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #c9a86c;
    font-variant-numeric: tabular-nums;
}

.roh-leaderboard-table .stats-rank {
    width: 2.5rem;
    color: rgba(255, 255, 255, 0.55);
}

.roh-leaderboard-row--mine {
    background: rgba(201, 168, 108, 0.08);
}

.roh-leaderboard-row--mine .stats-player {
    font-weight: 700;
}

.roh-tag-victory {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
}

.roh-leaderboard-foot {
    margin-top: 0.75rem;
}

.portal-training-tabs {
    margin: 0 0 1rem;
}

.portal-tool-page--roh {
    max-width: min(100%, 960px);
}

.roh-shell-panel {
    padding: 0;
    overflow: visible;
    background: #080c14;
}

.roh-game-frame {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    border: 0;
    background: #080c14;
    overflow: hidden;
}

.roh-shell-foot {
    margin-top: 0.75rem;
    text-align: center;
}

body.hag-quest-page .main-content {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.portal-tool-page.portal-tool-page--wide.portal-tool-page--hag-quest {
    width: 100%;
    max-width: none;
}

.portal-tool-page--hag-quest {
    max-width: min(100%, 1120px);
}

.hag-quest-shell-panel {
    padding: 0;
    overflow: hidden;
    background: #07090f;
}

.cosmic-quest-root {
    width: 100%;
}

.hag-quest-game-frame {
    display: block;
    width: 100%;
    min-height: 720px;
    height: auto;
    border: 0;
    background: #07090f;
}

.hag-quest-shell-foot {
    margin-top: 0.75rem;
    text-align: center;
}
