/* ============================================
   GLOBAL
============================================ */

.hidden { display: none !important; }

body {
    background: #0d0d0d;
    color: #e5e5e5;
    font-family: Arial, sans-serif;
    margin: 0;
}

a {
    color: #ffdd99;
    text-decoration: none;
}

a:hover {
    color: #ffffff;
}

/* ============================================
   HEADER
============================================ */

.header-bar {
    width: 100%;
    background: linear-gradient(90deg, #0a0a0a 0%, #161616 50%, #0a0a0a 100%);
    border-bottom: 2px solid #b8860b;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    gap: 20px;
    box-shadow: 0 2px 16px rgba(255,180,70,0.15);
}

/* Alliance brand */
.header-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-tag {
    font-size: 1.15rem;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255,215,0,0.6);
}

.brand-name {
    font-size: 1rem;
    font-weight: bold;
    color: #ffb347;
    letter-spacing: 0.5px;
}

.brand-motto {
    font-size: 0.72rem;
    color: #888;
    font-style: italic;
    letter-spacing: 0.3px;
}

.header-left a,
.header-right a {
    color: #ffb347;
    margin-right: 20px;
    font-weight: bold;
}

.header-left a:last-child,
.header-right a:last-child {
    margin-right: 0;
}

.header-left a:hover,
.header-right a:hover {
    color: #ffd9a0;
}

.header-left a.context-nav-link {
    color: #8ed8e8;
    text-shadow: 0 0 8px rgba(91, 205, 224, 0.18);
}

.header-left a.context-nav-link:hover {
    color: #d5fbff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right select {
    background: #1a1a1a;
    border: 1px solid #555;
    color: #ffdd99;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.logout-btn {
    color: #ff6666;
    font-weight: bold;
}

.logout-btn:hover {
    color: #ff9999;
}

.admin-link {
    color: #ff6666 !important;
}

.admin-link:hover {
    color: #ff9999 !important;
}

/* ============================================
   MAIN CONTENT
============================================ */

.main-content {
    padding: 30px;
    box-sizing: border-box;
}

/* ============================================
   PANEL BOXES
============================================ */

.panel {
    background: #111;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255, 180, 70, 0.1);
}

/* ============================================
   DASHBOARD GLOW TILES
============================================ */

.grid-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.dashboard-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-title {
    margin: 0;
    flex: 1;
}

.dash-highlight-stack {
    width: min(840px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 10px;
}

.dash-highlight-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 183, 71, 0.2), rgba(255, 120, 60, 0.12));
    border: 1px solid rgba(255, 190, 95, 0.55);
    border-radius: 10px;
    padding: 12px 34px 12px 12px;
    box-shadow: 0 0 16px rgba(255, 170, 70, 0.18);
}

.dash-highlight-card-critical {
    background: linear-gradient(135deg, rgba(195, 45, 45, 0.26), rgba(120, 16, 16, 0.18));
    border: 1px solid rgba(255, 95, 95, 0.62);
    box-shadow: 0 0 16px rgba(170, 55, 55, 0.3);
}

.dash-highlight-card-critical h2 {
    color: #ffd6d6;
}

.dash-highlight-card-critical p,
.dash-highlight-card-critical a {
    color: #ffeaea;
}

.dash-highlight-card.is-dismissed {
    display: none;
}

.dash-highlight-card h2 {
    margin: 0 0 4px;
    color: #ffd67f;
    font-size: 1rem;
}

.dash-highlight-card p {
    margin: 0;
    color: #f3e6cf;
    font-size: 0.86rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dash-highlight-card a {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.84rem;
    color: #fff1ce;
    text-decoration: underline;
    font-weight: bold;
}

.dash-highlight-more {
    margin-left: 10px;
    opacity: 0.95;
}

.dash-highlight-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(20, 20, 20, 0.35);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.dash-highlight-close:hover {
    background: rgba(0, 0, 0, 0.55);
}

.dash-news-cta-wrap {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dash-news-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 208, 122, 0.55);
    background: linear-gradient(135deg, rgba(255, 196, 98, 0.2), rgba(255, 140, 90, 0.12));
    color: #ffe1af;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.dash-news-cta:hover {
    border-color: rgba(255, 223, 150, 0.75);
    box-shadow: 0 0 14px rgba(255, 185, 90, 0.28);
    transform: translateY(-1px);
}

.dash-news-cta-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    padding: 0 9px;
    background: rgba(255, 170, 80, 0.16);
    border: 1px solid rgba(255, 219, 155, 0.4);
    color: #fff6df;
    font-size: 0.82rem;
    font-weight: 800;
}

.dash-manage-cta-wrap {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dash-manage-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(111, 186, 255, 0.45);
    background: linear-gradient(135deg, rgba(75, 135, 220, 0.25), rgba(42, 87, 170, 0.15));
    color: #dcecff;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.dash-manage-cta:hover {
    border-color: rgba(159, 214, 255, 0.8);
    box-shadow: 0 0 14px rgba(85, 160, 255, 0.3);
    transform: translateY(-1px);
}


.glow-tile {
    display: block;
    background: #111;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #ffdd99;
    box-shadow: 0 0 20px rgba(255, 180, 70, 0.15);
    transition: 0.2s;
}

.glow-tile:hover {
    box-shadow: 0 0 25px rgba(255, 180, 70, 0.35);
    transform: translateY(-3px);
}

.glow-tile h2 {
    font-size: 1.3rem;
    margin: 0 0 6px 0;
    color: #ffb347;
}

.glow-tile p {
    margin: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.r4-performance-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: nowrap;
    margin-top: 10px;
}
.r4-performance-heading { flex: 0 1 330px; min-width: 260px; padding: 4px 0; }
.r4-performance-eyebrow { display: block; margin-bottom: 7px; color: #8ed8e8; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.r4-performance-heading h1 { margin: 0; color: #ffd28a; font-size: 1.7rem; line-height: 1.1; }
.r4-performance-subtitle { max-width: 300px; margin: 7px 0 13px; color: #aaa; font-size: 0.86rem; line-height: 1.35; }
.r4-performance-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.r4-performance-month { display: inline-flex; align-items: baseline; gap: 9px; padding: 7px 11px; border: 1px solid rgba(142, 216, 232, 0.35); border-radius: 7px; background: rgba(142, 216, 232, 0.08); color: #9ec2c8; font-size: 0.76rem; }
.r4-performance-month strong { color: #e8fcff; font-size: 1.12rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.r4-performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.r4-performance-card {
    display: block;
    padding: 16px;
    border: 1px solid #383838;
    border-radius: 8px;
    background: #131313;
    color: #eee;
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.r4-performance-card:hover { border-color: #ffb347; transform: translateY(-2px); }
.r4-performance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.r4-performance-card h2 { margin: 0; font-size: 1.05rem; color: #ffd28a; overflow-wrap: anywhere; }
.r4-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border-radius: 50%;
    font-weight: 800;
    color: #111;
}
.r4-performance-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-top: 5px;
    padding: 4px 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
}
.r4-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.r4-performance-card p, .r4-performance-card small { display: block; margin: 8px 0 0; color: #bbb; }
.r4-score-badge.excellent, .r4-performance-status.excellent { background: #61c58a; color: #092016; }
.r4-score-badge.watch, .r4-performance-status.watch { background: #e3b341; color: #241707; }
.r4-score-badge.problem, .r4-performance-status.problem { background: #e39a45; color: #241707; }
.r4-score-badge.critical, .r4-performance-status.critical { background: #d85a5a; color: #fff5f5; }
.r4-score-badge.removal, .r4-performance-status.removal { background: #8e3548; color: #fff; }
.r4-performance-detail { max-width: 1100px; }
.r4-performance-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.r4-performance-detail-head h2 { margin: 14px 0 0; color: #ffd28a; }
.r4-score-hero { min-width: 110px; padding: 14px; text-align: center; border-radius: 8px; }
.r4-score-hero strong { display: block; font-size: 2rem; }
.r4-score-hero span, .r4-score-hero small { display: block; }
.r4-performance-forms, .r4-performance-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.r4-performance-form, .r4-performance-history-panel { padding: 16px; border: 1px solid #333; border-radius: 8px; background: #121212; }
.r4-performance-form h3, .r4-performance-history-panel h3 { margin: 0 0 12px; color: #ffd28a; }
.r4-performance-form label { display: block; margin: 10px 0; color: #ccc; }
.r4-performance-form input, .r4-performance-form select, .r4-performance-form textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 5px; padding: 8px; border: 1px solid #444; border-radius: 5px; background: #090909; color: #eee; }
.r4-performance-form input[name="points"] { -moz-appearance: textfield; appearance: textfield; }
.r4-performance-form input[name="points"]::-webkit-inner-spin-button,
.r4-performance-form input[name="points"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.r4-performance-form textarea { min-height: 76px; resize: vertical; }
.r4-performance-form button { margin-top: 6px; }
.r4-performance-header-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.r4-performance-options-link, .r4-performance-history-link { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 5px 9px; font-size: 0.76rem; text-decoration: none; }
.r4-performance-history-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 12px 0 16px; }
.r4-performance-history-page-head h1 { margin: 0; color: #ffd28a; }
.r4-performance-history-page-head p { margin: 7px 0 0; color: #aaa; font-size: 0.86rem; }
.r4-performance-options-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 14px; max-width: 1100px; }
.r4-performance-options-layout h2 { margin-top: 0; color: #ffd28a; font-size: 1.05rem; }
.r4-performance-option-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 80px auto auto; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid #2d2d2d; }
.r4-performance-option-head { display: grid; grid-template-columns: minmax(0, 1fr) 90px 80px 150px; gap: 6px; padding: 6px 0; color: #ffca72; font-size: 0.78rem; font-weight: 700; }
.r4-performance-option-row input { width: 100%; box-sizing: border-box; padding: 7px; border: 1px solid #444; border-radius: 5px; background: #090909; color: #eee; }
.r4-performance-option-row button { margin: 0; padding: 6px 8px; }
.r4-performance-options-fixed { margin: 0 0 12px; padding: 8px; border-left: 3px solid #e3b341; background: rgba(227, 179, 65, 0.08); color: #ccc; font-size: 0.85rem; }
.r4-performance-history-grid { margin-top: 14px; }
.r4-penalty-item, .r4-absence-item { padding: 10px 0; border-top: 1px solid #2d2d2d; }
.r4-penalty-item span { display: block; color: #aaa; font-size: 0.82rem; }
.r4-penalty-item p, .r4-absence-item p { margin: 5px 0 0; color: #ccc; overflow-wrap: anywhere; }
.r4-history-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.r4-history-delete { padding: 3px 7px; border: 1px solid #a94442; border-radius: 4px; background: transparent; color: #ff8c87; font-size: 0.72rem; cursor: pointer; }
.r4-history-delete:hover { background: rgba(217, 83, 79, 0.15); }
.r4-month-history-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid #2d2d2d; color: #ddd; }
.r4-performance-all-history { margin-top: 18px; padding: 14px; border: 1px solid #333; border-radius: 8px; background: #121212; }
.r4-performance-history-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.r4-performance-history-section-head h2 { margin: 0; color: #ffd28a; font-size: 1.05rem; }
.r4-performance-history-section-head span { color: #999; font-size: 0.78rem; }
.r4-performance-history-table-wrap { overflow-x: auto; }
.r4-performance-history-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 0.82rem; }
.r4-performance-history-table th, .r4-performance-history-table td { padding: 7px 9px; border-top: 1px solid #2d2d2d; text-align: center; white-space: nowrap; }
.r4-performance-history-table thead th { color: #ffca72; background: #1a1a1a; border-top: 0; }
.r4-performance-history-table tbody th { color: #ffd28a; text-align: left; font-weight: 650; }
.r4-history-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.r4-history-score.excellent { color: #61c58a; }
.r4-history-score.watch { color: #e3b341; }
.r4-history-score.problem { color: #e39a45; }
.r4-history-score.critical, .r4-history-score.removal { color: #d85a5a; }
.r4-history-score-empty { color: #666; }
.r4-performance-list { overflow-x: auto; border: 1px solid #333; border-radius: 8px; background: #121212; }
.r4-performance-list-head, .r4-performance-list-row { display: grid; grid-template-columns: minmax(180px, 1.5fr) 90px 150px 100px 90px minmax(250px, 2fr); align-items: center; gap: 8px; padding: 7px 10px; }
.r4-performance-list-head { color: #ffca72; background: #1a1a1a; font-size: 0.78rem; font-weight: 700; }
.r4-performance-list-row { min-height: 0; border-top: 1px solid #2d2d2d; color: #ddd; }
.r4-performance-list-row:hover { background: #181818; }
.r4-performance-member-name { padding: 0; border: 0; background: transparent; color: #ffd28a; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.r4-performance-score { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.r4-performance-score.excellent { color: #61c58a; }
.r4-performance-score.watch { color: #e3b341; }
.r4-performance-score.problem { color: #e39a45; }
.r4-performance-score.critical, .r4-performance-score.removal { color: #d85a5a; }
.r4-performance-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.r4-performance-actions a { padding: 4px 7px; font-size: 0.74rem; text-decoration: none; }
.r4-performance-actions button { padding: 4px 7px; font-size: 0.74rem; }
.r4-performance-modal[hidden] { display: none; }
.r4-performance-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; }
.r4-performance-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }
.r4-performance-modal-dialog { position: relative; z-index: 1; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px; border: 1px solid #444; border-radius: 9px; background: #151515; box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
.r4-performance-modal-dialog h2 { margin: 0; color: #ffd28a; }
.r4-performance-modal-member { margin: 5px 0 12px; color: #aaa; font-weight: 700; }
.r4-performance-modal-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: #bbb; font-size: 1.5rem; cursor: pointer; }
.r4-performance-top-grid { grid-template-columns: repeat(3, minmax(190px, 1fr)); flex: 1 1 720px; margin: 0 0 0 auto; }
.r4-performance-top-card .squads-summary-name { color: #ffd28a; text-decoration: none; }
.r4-performance-top-card .squads-summary-name:hover { text-decoration: underline; }
body .r4-performance-top-card.is-expanded .squads-summary-list {
    height: 180px !important;
    max-height: 180px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #555 transparent;
}
body .r4-performance-top-card.is-expanded li.squads-summary-extra { display: flex !important; }
.r4-performance-top-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.r4-performance-top-score.excellent { color: #61c58a; }
.r4-performance-top-score.watch { color: #e3b341; }
.r4-performance-top-score.problem, .r4-performance-top-score.critical { color: #e39a45; }
.r4-performance-top-score.removal { color: #d85a5a; }

@media (max-width: 700px) {
    .r4-performance-topbar, .r4-performance-detail-head { flex-direction: column; align-items: stretch; flex-wrap: wrap; }
    .r4-performance-heading { min-width: 0; }
    .r4-performance-heading h1 { font-size: 1.4rem; }
    .r4-performance-forms, .r4-performance-history-grid { grid-template-columns: 1fr; }
    .r4-performance-options-layout { grid-template-columns: 1fr; }
    .r4-performance-option-row { grid-template-columns: minmax(0, 1fr) 70px 60px; }
    .r4-performance-option-row button { grid-column: span 1; }
    .r4-performance-option-head { grid-template-columns: minmax(0, 1fr) 70px 60px; }
    .r4-performance-option-head span:last-child { grid-column: 1 / -1; }
    .r4-performance-header-actions { align-items: flex-start; margin-left: 0; }
    .r4-performance-history-page-head { flex-direction: column; }
    .r4-performance-history-section-head { align-items: flex-start; flex-direction: column; gap: 3px; }
    .r4-performance-card { padding: 14px; }
    .r4-performance-list { overflow: visible; border: 0; background: transparent; }
    .r4-performance-list-head { display: none; }
    .r4-performance-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; min-height: 0; padding: 12px 0; border-top: 1px solid #333; }
    .r4-performance-list-row > :nth-child(2), .r4-performance-list-row > :nth-child(3), .r4-performance-list-row > :nth-child(4), .r4-performance-list-row > :nth-child(5) { display: none; }
    .r4-performance-list-row.is-open > :nth-child(2), .r4-performance-list-row.is-open > :nth-child(3), .r4-performance-list-row.is-open > :nth-child(4), .r4-performance-list-row.is-open > :nth-child(5) { display: block; }
    .r4-performance-member-name { font-size: 1rem; }
    .r4-performance-actions { grid-column: 1 / -1; display: none; }
    .r4-performance-list-row.is-open .r4-performance-actions { display: flex; }
    .r4-performance-top-grid { grid-template-columns: 1fr; flex-basis: 100%; margin: 8px 0 0; }
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 1200px;
}

.rules-grid--single { max-width: none; }

.rules-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #333;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 0 18px rgba(255, 180, 70, 0.1);
}

.rules-card--single {
    min-height: calc(100vh - 220px);
}

.rules-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.rules-card-header h2 {
    margin: 0 0 4px;
    color: #ffb347;
    font-size: 1.25rem;
}

.rules-card-header p {
    margin: 0;
    color: #aaa;
    font-size: 0.9rem;
}

.rules-content {
    min-height: 180px;
    padding: 14px;
    overflow-wrap: anywhere;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0f0f0f;
    color: #eee;
}

.rules-empty { color: #999; }
.rules-form[hidden], .rules-content[hidden] { display: none; }
.rules-form { margin-top: 10px; }
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    margin-bottom: 0;
    border: 1px solid #3b3b3b;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #181818;
}
.editor-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-right: 6px;
    border-right: 1px solid #3b3b3b;
}
.editor-toolbar-group:last-child { padding-right: 0; border-right: 0; }
.editor-tool { min-width: 34px; height: 32px; padding: 5px 8px; }
.editor-tool-wide { min-width: 0; }
.editor-align-icon,
.editor-list-icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: 17px;
    height: 16px;
    vertical-align: middle;
}
.editor-align-icon i,
.editor-list-icon i,
.editor-list-icon b {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    font-size: 8px;
    font-weight: 700;
    line-height: 2px;
    text-align: left;
}
.editor-align-left i:nth-child(1), .editor-align-left i:nth-child(2), .editor-align-left i:nth-child(3) { width: 16px; }
.editor-align-center i:nth-child(1) { width: 10px; align-self: center; }
.editor-align-center i:nth-child(2) { width: 16px; align-self: center; }
.editor-align-center i:nth-child(3) { width: 12px; align-self: center; }
.editor-align-right i:nth-child(1) { width: 10px; align-self: flex-end; }
.editor-align-right i:nth-child(2) { width: 16px; align-self: flex-end; }
.editor-align-right i:nth-child(3) { width: 12px; align-self: flex-end; }
.editor-list-icon-bullets { gap: 3px; }
.editor-list-icon-bullets i { position: relative; width: 12px; margin-left: 5px; }
.editor-list-icon-bullets i::before { content: ''; position: absolute; left: -5px; top: 0; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.editor-list-icon-numbered { gap: 2px; width: 20px; }
.editor-list-icon-numbered b { width: 17px; background: none; }
.editor-list-icon-numbered b::first-letter { font-size: 8px; }
.editor-format-select {
    min-width: 132px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #0d0d0d;
    color: #eee;
}
.editor-format-select:focus { outline: 2px solid rgba(102, 170, 255, 0.65); outline-offset: 1px; }
.rules-editor {
    min-height: 220px;
    padding: 12px;
    overflow: auto;
    border: 1px solid #3b3b3b;
    border-radius: 0 0 8px 8px;
    background: #070707;
    color: #eee;
    line-height: 1.6;
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.22);
}
.rules-editor:focus { outline: 2px solid rgba(102, 170, 255, 0.65); outline-offset: -2px; }
.rules-editor h2, .rules-content h2 { margin: 0.2em 0 0.45em; color: #ffca72; }
.rules-editor h3, .rules-content h3 { margin: 0.2em 0 0.4em; color: #ffdca8; }
.rules-editor blockquote, .rules-content blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid #ffb347;
    background: rgba(255, 179, 71, 0.08);
    color: #ddd;
}
.rules-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rules-updated { margin-top: 8px; color: #888; font-size: 0.9rem; }

.member-history-count {
    display: inline-block;
    min-width: 1.2em;
    font-size: 1.05rem;
    line-height: 1;
    vertical-align: middle;
}

.member-history-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    margin-right: 5px;
    border-radius: 50%;
    color: #111;
    font-size: 0.64rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.member-history-indicator.is-never { background: #718096; color: #f4f7fb; }
.member-history-indicator.is-old { background: #61c58a; color: #092016; }
.member-history-indicator.is-recent { background: #d85a5a; color: #fff5f5; }

.member-squad-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    vertical-align: middle;
}

.member-squad-indicator.is-never { background: #718096; color: #f4f7fb; }
.member-squad-indicator.is-current { background: #61c58a; color: #092016; }
.member-squad-indicator.is-warning { background: #e3b341; color: #241707; }
.member-squad-indicator.is-critical { background: #d85a5a; color: #fff5f5; }
.member-squad-indicator.is-registered-no-data {
    background: linear-gradient(135deg, #ff7a18, #ff3d00);
    color: #fff8f2;
    border: 2px solid #ffd166;
    box-shadow: 0 0 0 2px rgba(255, 122, 24, 0.18), 0 0 10px rgba(255, 61, 0, 0.8);
    letter-spacing: 0.04em;
}

.members-header-mobile { display: none; }
.members-mobile-edit-toggle { display: none; }
.member-name-display { display: none; }

@media (max-width: 900px) {
    .rules-grid { grid-template-columns: 1fr; gap: 12px; }
    .rules-card { padding: 14px; }
    .rules-card-header { flex-direction: column; }
    .rules-card-header .btn-blue { width: 100%; }
    .editor-toolbar-group { border-right: 0; padding-right: 0; }
    .editor-format-select { flex: 1 1 100%; min-width: 0; }

    .members-table th:nth-child(n + 5),
    .members-table td:nth-child(n + 5) {
        display: none;
    }

    .members-mobile-edit-toggle { display: inline-flex; }
    .members-topbar-actions > button:not(.members-mobile-edit-toggle),
    .members-add-form { display: none !important; }
    .members-table .member-name-input { display: none !important; }
    .member-name-display { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    body.members-mobile-editing .members-topbar-actions > button:not(.members-mobile-edit-toggle),
    body.members-mobile-editing .members-add-form { display: inline-flex !important; }
    body.members-mobile-editing .members-table .member-name-input { display: block !important; }
    body.members-mobile-editing .member-name-display { display: none; }
    body.members-mobile-editing .members-table th:nth-child(n + 5),
    body.members-mobile-editing .members-table td:nth-child(n + 5) { display: table-cell !important; }
    body.members-mobile-editing .table-wrapper:has(.members-table) { overflow-x: auto; }
    body.members-mobile-editing .members-table { min-width: 720px !important; table-layout: auto; }

    .members-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .members-table th,
    .members-table td {
        padding: 6px 3px;
        font-size: 0.76rem;
        overflow: hidden;
    }

    .members-table th:nth-child(1),
    .members-table td:nth-child(1) { width: 52%; }
    .members-table th:nth-child(2),
    .members-table td:nth-child(2) { width: 16%; }
    .members-table th:nth-child(3),
    .members-table td:nth-child(3) { width: 14%; }
    .members-table th:nth-child(4),
    .members-table td:nth-child(4) { width: 18%; }

    .members-header-desktop { display: none; }
    .members-header-mobile { display: inline; }

    .members-table .member-name-input {
        width: 100%;
        min-width: 0;
        padding: 5px 4px;
        font-size: 0.76rem;
    }

    .members-table .member-history-indicator,
    .members-table .member-squad-indicator {
        width: 26px;
        height: 26px;
        margin-right: 2px;
        font-size: 0.64rem;
    }
}

@media (max-width: 480px) {
    .members-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
    }

    .members-table th,
    .members-table td {
        padding-left: 1px;
        padding-right: 1px;
    }

    .members-table th:nth-child(1),
    .members-table td:nth-child(1) { width: 60% !important; }
    .members-table th:nth-child(2),
    .members-table td:nth-child(2) { width: 14% !important; }
    .members-table th:nth-child(3),
    .members-table td:nth-child(3) { width: 13% !important; }
    .members-table th:nth-child(4),
    .members-table td:nth-child(4) { width: 13% !important; }

    .members-table .member-history-indicator,
    .members-table .member-squad-indicator {
        width: 27px;
        height: 27px;
        margin-right: 0;
        font-size: 0.68rem;
    }

    .members-table .member-history-count {
        font-size: 0.82rem;
    }

    .members-table .member-name-display,
    .members-table .member-name-input {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .members-table .member-name-input { display: none !important; }
    body.members-mobile-editing .members-table .member-name-input { display: block !important; }
    body.members-mobile-editing .members-table .member-name-display { display: none !important; }

    body.members-mobile-editing .members-table {
        min-width: 720px !important;
        table-layout: auto !important;
    }
}

/* ============================================
   LOGIN BOX
============================================ */

.login-brand {
    text-align: center;
    margin: 40px auto 16px;
}

.login-brand-tag {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(255,215,0,0.7), 0 0 40px rgba(255,215,0,0.3);
    line-height: 1;
}

.login-brand-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffb347;
    letter-spacing: 2px;
    margin-top: 4px;
    text-shadow: 0 0 10px rgba(255,180,70,0.4);
}

.login-brand-motto {
    font-size: 0.85rem;
    color: #777;
    font-style: italic;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

.login-box {
    max-width: 380px;
    margin: 80px auto;
    background: #111;
    border: 1px solid #333;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(255, 180, 70, 0.15);
}

.login-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 25px;
    color: #ffb347;
}

.login-box input,
.login-box button {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
}

.login-box input {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ffdd99;
    transition: 0.2s;
}

.login-box input:focus {
    border-color: #ffb347;
    box-shadow: 0 0 10px rgba(255, 180, 70, 0.25);
}

.login-box button {
    background: #ffb347;
    color: #000;
    border: none;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 5px;
    transition: 0.2s;
}

.login-box button:hover {
    background: #ffdd99;
}

.login-box .register-link {
    text-align: center;
    margin-top: 10px;
}

.login-box .register-link a {
    color: #ffdd99;
}

.login-box .register-link a:hover {
    color: #ffffff;
}

/* ============================================
   TABLE WRAPPER (SCROLL)
============================================ */

.table-wrapper {
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

/* Tasks distribution needs overlay pickers to extend outside the table box. */
.table-wrapper.tasks-table-wrapper {
    max-height: none;
    overflow: visible;
}

/* ============================================
   SQUAD TABLE
============================================ */

.squads-topbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.squads-topbar-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.squads-topbar h1 {
    margin: 0;
}

.squads-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    flex: 1 1 980px;
    max-width: 100%;
}

.squads-summary-card {
    background: linear-gradient(180deg, #171717 0%, #111 100%);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px 9px;
    box-shadow: 0 0 18px rgba(255, 180, 70, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
}

.squads-summary-card h2 {
    margin: 0 0 6px 0;
    font-size: 0.74rem;
    color: #ffb347;
}

.squads-summary-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 6px;
}

.squads-summary-card-header h2 {
    margin: 0;
}

.squads-summary-showall {
    background: none;
    border: none;
    color: #888;
    font-size: 0.64rem;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    text-decoration: underline dotted;
    line-height: 1.4;
    flex-shrink: 0;
}

.squads-summary-showall:hover {
    color: #ffb347;
}

.squads-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.squads-summary-card.is-expanded .squads-summary-list {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.squads-summary-extra {
    display: none !important;
}

.squads-summary-card.is-expanded .squads-summary-extra {
    display: flex !important;
}

.squads-summary-list li {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 0;
    border-bottom: 1px solid #222;
    font-size: 0.74rem;
}

.squads-summary-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.squads-summary-own-item {
    background: rgba(255, 180, 70, 0.07);
    border-radius: 3px;
    padding-left: 3px;
}

.squads-summary-own {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid #ffb347;
    font-size: 0.74rem;
    background: rgba(255, 180, 70, 0.06);
    border-radius: 0 0 6px 6px;
    padding: 5px 3px 0;
    flex-shrink: 0;
}

.squads-summary-own .squads-summary-rank {
    color: #ffb347;
}

.squads-summary-own .squads-summary-name {
    color: #ffdd99;
    font-weight: bold;
}

.squads-summary-own .squads-summary-strength {
    color: #7ad67a;
    font-weight: bold;
}

.squads-summary-rank {
    min-width: 16px;
    color: #ffdd99;
    font-weight: bold;
}

.squads-summary-name {
    flex: 1;
    color: #e5e5e5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.squads-summary-strength {
    color: #7ad67a;
    font-weight: bold;
    white-space: nowrap;
}

.squads-summary-empty {
    color: #888;
    font-style: italic;
}

.squads-mobile-controls {
    display: none;
    margin: 0 0 12px 0;
}

.squads-table-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #ffdd99;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.squads-table-toggle-btn:hover {
    background: #242424;
}

/* Edit squads button */
.squads-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 1px solid #ffb347;
    color: #ffb347;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.squads-edit-btn:hover {
    background: #2a2010;
}

.squads-edit-btn--mobile {
    width: 100%;
    margin-top: 8px;
}

@media (max-width: 760px) {
    #squads-edit-btn {
        display: none;
    }
}

/* ============================================
   SQUAD EDIT MODAL
============================================ */

.squads-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.squads-modal-overlay[hidden] {
    display: none;
}

.squads-modal {
    background: #141414;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 28px 24px 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 0 40px rgba(255,180,70,0.2);
    box-sizing: border-box;
}

.squads-modal h2 {
    margin: 0 0 20px 0;
    color: #ffb347;
    font-size: 1.15rem;
}

.squads-modal-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.squads-modal-row {
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 12px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.squads-modal-row legend {
    color: #ffdd99;
    font-size: 0.82rem;
    padding: 0 4px;
}

.squads-modal-select {
    flex: 0 0 auto;
    width: 110px;
}

.squads-modal .squads-modal-select.inline-select {
    width: 110px;
    flex: 0 0 110px;
    min-width: 0;
}

.squads-modal-input {
    flex: 1;
    width: auto;
    min-width: 0;
}

.squads-modal .squads-modal-input.inline-input {
    width: 80px;
    flex: 0 0 80px;
}

/* Make modal inputs larger and visually consistent */
.squads-modal input,
.squads-modal select,
.squads-modal textarea,
.squads-modal .squads-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ffdd99;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.squads-modal input:focus,
.squads-modal select:focus,
.squads-modal textarea:focus {
    border-color: #ffb347;
    box-shadow: 0 0 10px rgba(255,180,70,0.12);
    outline: none;
}

/* helper class to group two inputs side-by-side but stack on small screens */
.modal-pair {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.squads-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.squads-modal-actions .btn-green,
.squads-modal-actions .btn-red {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.squads-modal-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.squads-modal-status {
    min-height: 1.2em;
    font-size: 0.88rem;
    text-align: center;
}

.squads-modal-status--ok  { color: #66ff66; }
.squads-modal-status--err { color: #ff6666; }

/* ============================================
   MODERN TOOLTIP (data-tooltip)
============================================ */

.tt-wrap {
    position: relative;
    display: inline-block;
}

/* Actual tooltip box is a single floating element positioned by JS (see layout.php),
   so it always escapes any overflow:auto/hidden ancestor (scrollable lists, tables). */
.tt-floating {
    position: fixed;
    z-index: 4000;
    background: #1c1c1c;
    color: #ffdd99;
    border: 1px solid rgba(255, 179, 71, 0.35);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    max-width: 280px;
    width: max-content;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.tt-floating.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 480px) {
    .squads-modal {
        padding: 20px 14px 16px;
    }
}

.squad-table {
    width: 100%;
    border-collapse: collapse;
    background: #111;
    border: 1px solid #333;
    box-shadow: 0 0 25px rgba(255, 180, 70, 0.1);
}


.squad-table thead th {
    background: #1a1a1a;
    color: #ffb347;
    padding: 6px 8px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid #333;

    /* Sticky Header */
    position: sticky;
    top: -1px;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.squad-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
}

@media (max-width: 1100px) {
    .squads-summary-grid {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
        max-width: none;
    }
}

@media (max-width: 760px) {
    .squads-mobile-controls {
        display: block;
    }

    .squads-summary-grid {
        display: none;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .squads-summary-grid.squads-summary-visible {
        display: grid;
    }

    .squad-table thead th,
    .squad-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .squads-modal-row { flex-direction: column; align-items: stretch; }
    .modal-pair { flex-direction: column; gap: 8px; }
    .squads-modal-actions { flex-direction: column-reverse; }
    .squads-modal-actions a.btn-yellow { width: 100%; text-align: center; }
    /* Make action buttons fit inside the modal on small screens */
    .squads-modal-actions > * {
        width: 100%;
        box-sizing: border-box;
        padding: 10px 12px;
        font-size: 0.98rem;
    }
    .squads-modal-actions button,
    .squads-modal-actions a {
        display: block;
    }
}

.squad-table tr:hover {
    background: #181818;
}

.squad-table tr.task-row-underfilled td {
    background: rgba(255, 220, 0, 0.14);
}

.squad-table tr.task-row-underfilled:hover td {
    background: rgba(255, 220, 0, 0.2);
}

/* ============================================
   INLINE EDITING
============================================ */

.editable {
    cursor: pointer;
    color: #ffdd99;
}

.editable:hover {
    background: #222;
}

.inline-input {
    width: 80px;
    padding: 6px;
    background: #1a1a1a;
    border: 1px solid #555;
    color: #ffdd99;
    border-radius: 6px;
}

.inline-select {
    padding: 6px;
    background: #1a1a1a;
    border: 1px solid #555;
    color: #ffdd99;
    border-radius: 6px;
}

.task-responsible-picker {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.task-lead-picker {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

#tasks-table td {
    vertical-align: middle;
}

#tasks-table {
    width: 100%;
    table-layout: fixed;
}

#tasks-table thead th,
#tasks-table td {
    font-size: 0.94rem;
}

#tasks-table thead th {
    font-size: 1.12rem;
    font-weight: 700;
}

#tasks-table th.tasks-col-no,
#tasks-table td.tasks-col-no,
#tasks-table th.tasks-col-min,
#tasks-table td.tasks-col-min {
    text-align: center;
}

#tasks-table .tasks-col-min-head {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.05;
    text-align: center;
    font-size: 1.12rem;
}

#tasks-table thead th,
#tasks-table td {
    padding-top: 4px;
    padding-bottom: 4px;
}

#tasks-table input[type="text"],
#tasks-table input[type="number"],
#tasks-table textarea,
#tasks-table select {
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(180deg, #171717 0%, #121212 100%);
    border: 1px solid #474747;
    color: #f3f3f3;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#tasks-table input[type="text"]:focus,
#tasks-table input[type="number"]:focus,
#tasks-table textarea:focus,
#tasks-table select:focus {
    outline: none;
    border-color: #ffb347;
    box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.16);
    background: #1b1b1b;
}

#tasks-table textarea {
    min-height: 0;
    height: auto;
    line-height: 1.2;
    resize: none;
    overflow-y: auto;
}

#tasks-table .task-no-select {
    min-width: 72px;
    max-width: 78px;
    margin: 0 auto;
    text-align: center;
    text-align-last: center;
    font-weight: 700;
    color: #ffd49a;
}

#tasks-table .tasks-col-min .task-min-input {
    max-width: 112px;
    margin: 0 auto;
    text-align: center;
}

.task-responsible-toggle {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 4px 8px;
    background: linear-gradient(180deg, #171717 0%, #121212 100%);
    border: 1px solid #474747;
    color: #ffd9a8;
    border-radius: 8px;
    cursor: pointer;
    white-space: normal;
    overflow: hidden;
    line-height: 1.2;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.task-lead-toggle {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 4px 8px;
    background: linear-gradient(180deg, #171717 0%, #121212 100%);
    border: 1px solid #474747;
    color: #b9d8ff;
    border-radius: 8px;
    cursor: pointer;
    white-space: normal;
    overflow: hidden;
    line-height: 1.2;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.task-responsible-text {
    display: block;
    width: 100%;
    max-height: 100%;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.25;
}

.task-lead-text {
    display: block;
    width: 100%;
    max-height: 100%;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.25;
}

.task-responsible-hoverbox {
    position: absolute;
    z-index: 58;
    pointer-events: none;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    max-height: 220px;
    overflow: auto;
    display: none;
    box-sizing: border-box;
    padding: 4px 8px;
    background: linear-gradient(180deg, #1b1b1b 0%, #131313 100%);
    border: 1px solid #c18a34;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
    color: #ffe3bb;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.25;
    font-size: 0.92rem;
}

.task-responsible-picker.has-overflow:not(.is-panel-open):hover .task-responsible-hoverbox,
.task-responsible-picker.has-overflow:not(.is-panel-open):focus-within .task-responsible-hoverbox {
    display: block;
}

.task-responsible-toggle.has-value {
    align-items: center;
}

.table-wrapper #tasks-table .task-responsible-toggle {
    font-size: 1rem;
    line-height: 1.35;
}

.table-wrapper #tasks-table .task-lead-toggle {
    font-size: 1rem;
    line-height: 1.35;
}

.task-responsible-toggle:hover:not(:disabled) {
    border-color: #c18a34;
    background: #1b1b1b;
}

.task-lead-toggle:hover:not(:disabled) {
    border-color: #c18a34;
    background: #1b1b1b;
}

.task-responsible-toggle:focus-visible {
    outline: none;
    border-color: #ffb347;
    box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.16);
}

.task-lead-toggle:focus-visible {
    outline: none;
    border-color: #ffb347;
    box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.16);
}

.task-responsible-toggle:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.task-lead-toggle:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.task-responsible-panel {
    position: absolute;
    z-index: 60;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 190px;
    overflow: auto;
    background: #0f0f10;
    border: 1px solid #5a5a5a;
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(255, 179, 71, 0.12);
}

.task-lead-panel {
    position: absolute;
    z-index: 60;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 190px;
    overflow: auto;
    background: #0f0f10;
    border: 1px solid #5a5a5a;
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(255, 179, 71, 0.12);
}

.task-responsible-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 6px;
    border-radius: 7px;
    color: #eee;
    font-size: 0.92rem;
}

.task-lead-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 6px;
    border-radius: 7px;
    color: #eee;
    font-size: 0.92rem;
}

.task-responsible-item:hover {
    background: rgba(255, 179, 71, 0.08);
}

.task-lead-item:hover {
    background: rgba(255, 179, 71, 0.08);
}

.task-responsible-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #ffb347;
}

.task-lead-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #ffb347;
}

/* ============================================
   TYPE COLORS
============================================ */

.type-Tank { color: #ff6666; font-weight: bold; }
.type-Air { color: #66aaff; font-weight: bold; }
.type-Missile { color: #66ff66; font-weight: bold; }
.type-Mixed { color: #ffdd66; font-weight: bold; }
.type-None { color: #888; font-weight: bold; }

/* ============================================
   SORTABLE HEADERS
============================================ */

.sortable {
    cursor: pointer;
    position: relative;
}

.sortable::after {
    content: "⇅";
    font-size: 0.8rem;
    color: #666;
    margin-left: 6px;
}

.sorted-asc::after {
    content: "↑";
    color: #ffb347;
}

.sorted-desc::after {
    content: "↓";
    color: #ffb347;
}

/* ============================================
   ADMIN BADGES & BUTTONS
============================================ */

.badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85rem;
}

/* Compact action buttons inside table wrapper to reduce row height */
.table-wrapper .btn-yellow,
.table-wrapper .btn-blue,
.table-wrapper .btn-danger,
.table-wrapper .btn-green,
.table-wrapper button,
.table-wrapper a.btn {
    padding: 6px 8px;
    font-size: 0.82rem;
    border-radius: 6px;
    line-height: 1;
    white-space: nowrap;
}

/* ============================================
   HAMBURGER BUTTON (mobile nav)
============================================ */

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    z-index: 100;
}

.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    background: #ffb347;
    border-radius: 2px;
    transition: 0.25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Nav wrapper (desktop: flex row) */
.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: space-between;
}

/* ============================================
   RESPONSIVE — TABLET (≤ 900px)
============================================ */
@media (max-width: 900px) {
    .brand-motto { display: none; }

    .grid-tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-content { padding: 20px 16px; }

    /* Squads / Admin: reduce padding */
    .squad-table thead th,
    .squad-table td {
        padding: 8px 8px;
        font-size: 0.88rem;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤ 600px)
============================================ */
@media (max-width: 600px) {
    /* Header */
    .header-bar {
        flex-wrap: wrap;
        padding: 10px 14px;
        gap: 0;
    }

    .header-brand {
        flex: 1;
    }

    .brand-name  { font-size: 0.85rem; }
    .brand-motto { display: none; }

    .hamburger { display: flex; }

    /* Nav: hidden by default, shown when .open */
    .header-nav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        background: #111;
        border-top: 1px solid #333;
        padding: 12px 0 8px;
        gap: 0;
    }

    .header-nav.open { display: flex; }

    .header-left {
        display: flex;
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .header-left a {
        display: block;
        padding: 12px 16px;
        margin: 0;
        border-bottom: 1px solid #222;
        font-size: 1.05rem;
    }

    .header-right {
        width: 100%;
        padding: 10px 16px;
        justify-content: space-between;
    }

    /* Page headings */
    h1 { font-size: 1.3rem; text-align: center; }

    /* Dashboard tiles: 1 column */
    .grid-tiles {
        grid-template-columns: 1fr;
    }

    .glow-tile { padding: 16px; }

    .main-content { padding: 12px 10px; }

    .dashboard-top-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .dashboard-title {
        text-align: center;
    }

    .dash-highlight-stack {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .dash-news-cta-wrap {
        align-items: flex-start;
    }

    .dash-news-cta {
        font-size: 0.8rem;
        padding: 7px 10px;
    }

    .dash-manage-cta {
        font-size: 0.8rem;
        padding: 7px 10px;
    }

    /* Panel */
    .panel { padding: 14px; }

    /* Tables: horizontal scroll, compact */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .squad-table {
        min-width: 560px; /* force scroll rather than wrapping */
    }

    .members-table {
        min-width: 0 !important;
        width: 100%;
        table-layout: fixed;
    }

    .table-wrapper:has(.members-table) {
        overflow-x: hidden;
    }

    .members-table th:nth-child(-n + 4),
    .members-table td:nth-child(-n + 4) {
        display: table-cell !important;
    }

    .members-table thead th,
    .members-table td {
        padding: 6px 3px;
        font-size: 0.76rem;
    }

    .members-table .member-name-input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        color: #f4f7fb;
        text-overflow: ellipsis;
    }

    .squad-table thead th,
    .squad-table td {
        padding: 8px 6px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* Admin user table */
    .admin-table {
        min-width: 480px;
    }

    /* Login / Register */
    .login-brand { margin-top: 24px; }
    .login-brand-tag  { font-size: 2rem; }
    .login-brand-name { font-size: 1rem; }

    .login-box {
        margin: 12px auto;
        padding: 20px 14px;
    }

    .login-box input,
    .login-box button {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Inline editing inputs */
    .inline-input  { width: 60px; }

    .main-content { padding: 16px 12px; }

    /* Tables: horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Login brand */
    .login-brand { margin-top: 24px; }
    .login-brand-tag  { font-size: 2rem; }
    .login-brand-name { font-size: 1rem; }

    .login-box {
        margin: 12px auto;
        padding: 20px 16px;
    }
}

/* ============================================
   PENDING USERS TILE (Dashboard Admin)
============================================ */

.glow-tile--pending-users {
    cursor: default;
}

.glow-tile--pending-users:hover {
    transform: none;
}

/* ============================================================
   Allies page (allies.php)
   ============================================================ */
.allies-rule-banner {
    display: inline-block;
    background: rgba(200,0,0,0.18);
    border: 1px solid #8b0000;
    color: #ff6b6b;
    font-size: 0.92rem;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 28px;
    letter-spacing: 0.04em;
}

.allies-section {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.allies-section-title {
    font-size: 1.1rem;
    color: #ffb347;
    margin: 0 0 6px 0;
}

.allies-section-sub {
    color: #aaa;
    font-size: 0.83rem;
    margin: 0 0 16px 0;
}

.allies-server-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.allies-full-server {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,215,0,0.06);
    border: 1px solid #c8a84b;
    border-radius: 8px;
    padding: 8px 14px;
}

.allies-server-num {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    font-family: monospace;
}

.allies-full-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Server badge (table) */
.allies-server-badge {
    display: inline-block;
    background: #222;
    border: 1px solid #555;
    color: #ccc;
    font-size: 0.78rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.allies-server-badge--ours {
    background: rgba(255,215,0,0.1);
    border-color: #c8a84b;
    color: #ffd700;
}

/* Table */
.allies-table-wrap {
    overflow-x: auto;
}

.allies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.allies-table th {
    text-align: left;
    padding: 8px 12px;
    color: #ffb347;
    border-bottom: 1px solid #333;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.allies-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #1e1e1e;
    vertical-align: middle;
}

.allies-table tbody tr:last-child td { border-bottom: none; }
.allies-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

.allies-row--allied-server td { background: rgba(255,215,0,0.03); }

.allies-server-header-row td {
    background: #1a1a2e;
    border-top: 2px solid #333;
    border-bottom: none;
    padding: 10px 12px 4px;
}
.allies-server-header-row--allied td {
    background: rgba(255,215,0,0.06);
    border-top-color: rgba(255,215,0,0.25);
}
.allies-server-header-cell {
    line-height: 1;
}
.allies-server-header-cell .allies-server-badge {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 3px 10px;
    letter-spacing: 0.03em;
}

.allies-clan-tag {
    font-family: monospace;
    font-weight: bold;
    color: #e0c070;
    font-size: 0.95rem;
}

.allies-forbidden {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Rule badges */
.rule-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.rule-badge--trucks {
    background: rgba(180,90,0,0.25);
    border: 1px solid #b45309;
    color: #fbbf24;
}
.rule-badge--trains {
    background: rgba(29,78,216,0.2);
    border: 1px solid #1d4ed8;
    color: #93c5fd;
}
.rule-badge--attacks {
    background: rgba(185,28,28,0.25);
    border: 1px solid #b91c1c;
    color: #fca5a5;
}
.rule-badge--tasks {
    background: rgba(109,40,217,0.2);
    border: 1px solid #6d28d9;
    color: #c4b5fd;
}
.rule-badge--war {
    background: rgba(159,18,57,0.3);
    border: 1px solid #9f1239;
    color: #fecdd3;
}

@media (max-width: 600px) {
    .allies-section { padding: 14px 12px; }
    .allies-table th, .allies-table td { padding: 7px 8px; }
    .allies-server-num { font-size: 1rem; }
}

/* Allies edit-mode controls */
.allies-edit-toggle {
    background: #2a2a2a;
    border: 1px solid #555;
    color: #ffb347;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.allies-edit-toggle:hover { background: #333; border-color: #ffb347; }

.allies-save-msg { font-size: 0.85rem; font-weight: bold; }
.allies-save-msg--ok  { color: #4ade80; }
.allies-save-msg--err { color: #f87171; }

.edit-server-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.edit-server-input,
.edit-clan-server,
.edit-clan-tag {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #eee;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.edit-server-input { width: 100px; }
.edit-clan-server  { width: 80px; }
.edit-clan-tag     { width: 90px; }

.allies-del-btn {
    background: none;
    border: 1px solid #7f1d1d;
    color: #f87171;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 7px;
    font-size: 0.8rem;
    line-height: 1.4;
}
.allies-del-btn:hover { background: rgba(185,28,28,0.2); }

.allies-add-btn {
    margin-top: 8px;
    background: rgba(255,179,70,0.1);
    border: 1px dashed #c8a84b;
    color: #ffb347;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.83rem;
}
.allies-add-btn:hover { background: rgba(255,179,70,0.2); }

.allies-save-btn {
    background: #16a34a;
    border: none;
    color: #fff;
    padding: 7px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}
.allies-save-btn:hover:not(:disabled) { background: #15803d; }
.allies-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.allies-cancel-btn {
    background: #333;
    border: 1px solid #555;
    color: #ccc;
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.allies-cancel-btn:hover { background: #3a3a3a; }

.th-center, .td-center { text-align: center; }
.td-center input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

.pending-users-list {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.pending-users-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: #1a1a1a;
    border-radius: 6px;
    border: 1px solid #333;
}

.pending-username {
    flex: 1;
    color: #e5e5e5;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-activate-inline {
    padding: 4px 10px;
    background: #4caf50;
    color: #000;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.btn-activate-inline:hover {
    background: #6ddd6d;
    color: #000;
}

.btn-activate-gast {
    background: #66aaff;
}
.btn-activate-gast:hover {
    background: #88ccff;
    color: #000;
}

.pending-users-empty {
    margin-top: 8px;
    opacity: 0.55;
    font-size: 0.85em;
    color: #999;
}

@media (max-width: 600px) {
    .pending-users-list {
        max-height: 180px;
    }
}

.badge-admin { background: #ff6666; color: #000; }
.badge-dsadmin { background: #ffaa33; color: #000; }
.badge-ally-admin { background: #4ade80; color: #000; }
.badge-user { background: #66aaff; color: #000; }
.badge-tcadmin { background: #ffd700; color: #000; }
.badge-aradmin { background: #9f7aea; color: #000; }
.badge-r4 { background: #22d3ee; color: #000; }
.badge-gast { background: #94a3b8; color: #000; }
.badge-pending { background: #f97316; color: #000; }

.badge-active { background: #66ff66; color: #000; }
.badge-inactive { background: #888; color: #000; }

/* Role dropdown */
.role-dropdown-wrap {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin-right: 6px;
}
.roles-popup {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: #1e1e2e;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 12px;
    min-width: 180px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}
.roles-popup--open {
    display: block;
}
.role-pill {
    display: block;
    margin-bottom: 6px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    background: #2a2a3a;
    color: #aaa;
    border: 1px solid #3a3a4a;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
.role-pill input[type=checkbox] {
    display: none;
}
.role-pill--on {
    background: #3b5bdb;
    color: #fff;
    border-color: #5c7cfa;
}
.role-pill:hover {
    background: #33334a;
    color: #ddd;
}
.role-pill--on:hover {
    background: #4c6ef5;
}

.btn-green,
.btn-red,
.btn-yellow,
.btn-blue {
    padding: 8px 12px;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    text-decoration: none;
    margin-right: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-block;
}

.btn-green  { background: #66ff66; }
.btn-red    { background: #ff6666; }
.btn-yellow { background: #ffdd66; }
.btn-blue   { background: #66aaff; }

.btn-green:hover,
.btn-red:hover,
.btn-yellow:hover,
.btn-blue:hover {
    opacity: 0.8;
    color: #000;
}

/* Highlighted theme button — use brand gold with subtle glow to draw attention */
.btn-highlight {
    padding: 8px 12px;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    text-decoration: none;
    margin-right: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-block;
    background: linear-gradient(180deg, #ffb347 0%, #ffd66d 100%);
    box-shadow: 0 6px 24px rgba(255,180,70,0.22), inset 0 -2px 0 rgba(0,0,0,0.06);
    transition: box-shadow 0.15s ease, transform 0.12s ease;
}
.btn-highlight:hover {
    box-shadow: 0 10px 34px rgba(255,180,70,0.32), inset 0 -2px 0 rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.roles-form input[type="checkbox"] { transform: translateY(2px); margin-right:4px; }
.roles-form label { cursor: pointer; }

/* Compact site-wide navigation button used for back and parent-page links. */
.btn-back {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    box-sizing: border-box;
    padding: 4px 10px;
    margin: 0 6px 6px 0;
    border: 1px solid rgba(255, 179, 71, 0.42);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(255, 179, 71, 0.13), rgba(255, 179, 71, 0.04));
    color: #ffdca6;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.1;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.btn-back:hover {
    background: linear-gradient(180deg, rgba(255, 179, 71, 0.24), rgba(255, 179, 71, 0.09));
    border-color: rgba(255, 203, 117, 0.8);
    box-shadow: 0 3px 12px rgba(255, 179, 71, 0.16), inset 0 1px 0 rgba(255,255,255,0.08);
    color: #fff0cc;
    transform: translateY(-1px);
}

/* Legacy page-level back links are replaced by the dynamic top navigation. */
.btn-back { display: none !important; }

@media (max-width: 700px) {
    .btn-back {
        min-height: 28px;
        padding: 4px 8px;
        margin-right: 4px;
        font-size: 0.74rem;
    }
}

/* User notification banner shown under the header (compact) */
.user-notices { max-width:1100px; margin:8px auto; padding:0 12px; }
.notice { display:flex; align-items:center; gap:10px; background: rgba(255,215,0,0.06); border:1px solid rgba(255,180,70,0.08); padding:6px 10px; border-radius:6px; color:#ffefc7; font-size:0.92rem; }
.notice strong { color:#ffd700; font-weight:700; margin-right:6px; font-size:0.95rem; }
.notice-content { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#fff; opacity:0.95; }
.notice .notice-actions { margin-left:auto; flex-shrink:0; }
.notice .notice-close { background:transparent; border:0; color:#ccc; font-size:1.05rem; cursor:pointer; margin-left:8px; }

@media (max-width: 760px) {
    .user-notices { padding:0 10px; }
    .notice {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
        font-size:0.9rem;
    }
    .notice strong {
        display: block;
        margin-right: 0;
    }
    .notice-content {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .notice .notice-actions {
        margin-left: 0;
        width: 100%;
    }
    .notice .notice-actions a {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .notice .notice-close {
        position: absolute;
        top: 6px;
        right: 8px;
        margin-left: 0;
    }
}

/* Leader rules: mobile layout — image above, text below */
@media (max-width: 760px) {
    .leader-rules-panel {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .leader-rules-panel .leader-image,
    #image-preview-wrap {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .leader-rules-panel .leader-image img,
    #image-preview-wrap img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 0 10px 0 !important;
    }
}

/* Temp-PW Box (Admin) */
.temp-pw-box {
    margin: 16px 0;
    padding: 16px 20px;
    background: #1a1a1a;
    border: 1px solid #ffb347;
    border-radius: 10px;
    box-shadow: 0 0 18px rgba(255,180,70,0.15);
}

.temp-pw-box p {
    margin: 0 0 10px;
    color: #e5e5e5;
}

.temp-pw-display {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.temp-pw-display code {
    font-size: 1.3rem;
    font-family: monospace;
    color: #ffd700;
    background: #111;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 6px 14px;
    letter-spacing: 2px;
    user-select: all;
}

.temp-pw-hint {
    margin: 10px 0 0 !important;
    font-size: 0.83rem;
    color: #ffb347;
    opacity: 0.9;
}

/* ============================================
   PROFILE DROPDOWN
============================================ */

.profile-menu {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid #555;
    border-radius: 20px;
    padding: 5px 12px 5px 8px;
    color: #ffb347;
    font-size: 0.88rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.profile-btn:hover {
    background: rgba(255,179,71,0.1);
    border-color: #ffb347;
    color: #ffd9a0;
}

.profile-icon {
    font-size: 1rem;
    line-height: 1;
}

.profile-caret {
    font-size: 0.75rem;
    opacity: 0.7;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: #1a1a1a;
    border: 1px solid #b8860b;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
    padding: 16px;
    z-index: 9999;
}

.profile-dropdown-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.profile-dropdown label {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    color: #aaa;
    margin-bottom: 10px;
    gap: 4px;
}

.profile-dropdown label input {
    background: #111;
    border: 1px solid #444;
    border-radius: 6px;
    color: #f0f0f0;
    padding: 7px 9px;
    font-size: 0.88rem;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.profile-dropdown label input:focus {
    outline: none;
    border-color: #b8860b;
}

.pf-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 12px 0;
}

.pf-optional {
    font-size: 0.72rem;
    opacity: 0.55;
    font-style: italic;
}

.pf-required {
    color: #ff8888;
    font-size: 0.75rem;
}

.pf-save-btn {
    width: 100%;
    margin-top: 6px;
    padding: 9px;
    background: #b8860b;
    border: none;
    border-radius: 7px;
    color: #000;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.pf-save-btn:hover:not(:disabled) {
    background: #d4a017;
}

.pf-save-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.pf-delete-btn {
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    background: #5a1111;
    border: 1px solid #a93232;
    border-radius: 7px;
    color: #ffd7d7;
    font-weight: bold;
    font-size: 0.86rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pf-delete-btn:hover:not(:disabled) {
    background: #7a1515;
    border-color: #d44;
}

.pf-delete-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.pf-message {
    font-size: 0.82rem;
    border-radius: 5px;
    padding: 7px 10px;
    margin-bottom: 8px;
}

.pf-success {
    background: rgba(100,200,100,0.15);
    border: 1px solid #4a9;
    color: #6ddb8b;
}

.pf-error {
    background: rgba(200,80,80,0.15);
    border: 1px solid #c55;
    color: #f99;
}

.input-field {
    width: 100%;
    padding: 14px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ffdd99;
    border-radius: 8px;
    margin-bottom: 15px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #ffb347;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary:hover {
    background: #ffdd99;
}

.error-box {
    background: #ff4444;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.success-box {
    background: #2d7a2d;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.btn-danger {
    padding: 8px 12px;
    border-radius: 6px;
    background: #c62828;
    color: #000;
    font-weight: bold;
    text-decoration: none;
    margin-right: 6px;
    display: inline-block;
}

.btn-danger:hover {
    opacity: 0.8;
}

.v4-admin-page .v4-form-section {
    border: 1px solid #444;
    border-radius: 6px;
    margin: 16px 0;
    padding: 16px;
}

.v4-admin-page .v4-form-section legend {
    color: #eee;
    font-weight: 700;
    padding: 0 6px;
}

.v4-admin-page .v4-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

.v4-admin-page .v4-field {
    display: block;
    min-width: 0;
    color: #ddd;
    font-weight: 600;
}

.v4-admin-page .v4-field--full {
    grid-column: 1 / -1;
}

.v4-admin-page .v4-field > input:not([type="checkbox"]),
.v4-admin-page .v4-field > textarea,
.v4-admin-page .v4-field > select {
    box-sizing: border-box;
    display: block;
    margin-top: 5px;
    padding: 8px 10px;
    width: 100%;
    border: 1px solid #444;
    border-radius: 5px;
    background: #090909;
    color: #eee;
}

.v4-admin-page .v4-field > textarea {
    min-height: 76px;
    resize: vertical;
}

.v4-admin-page .v4-help {
    color: #aaa;
    display: block;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.4;
    margin-top: 4px;
}

@media (max-width: 760px) {
    .v4-admin-page .v4-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .v4-admin-page .v4-field--full {
        grid-column: auto;
    }
}

.v4-admin-page.v4-new-card-page {
    max-width: 1040px;
}

.v4-new-card-page .v4-breadcrumbs {
    align-items: center;
    color: #aaa;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 18px 0 20px;
}

.v4-new-card-page .v4-breadcrumbs a {
    color: #ffca7a;
    text-decoration: none;
}

.v4-new-card-page .v4-page-heading,
.v4-admin-page .v4-list-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: space-between;
    margin: 0 0 22px;
}

.v4-new-card-page .v4-page-heading h1,
.v4-admin-page .v4-list-heading h1 {
    margin: 0;
}

.v4-new-card-page .v4-page-heading p,
.v4-admin-page .v4-list-heading p {
    color: #b8b8b8;
    margin: 7px 0 0;
}

.v4-new-card-page .v4-eyebrow {
    color: #ffb347 !important;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 6px !important;
}

.v4-admin-page .v4-status-badge {
    background: rgba(255, 179, 71, 0.12);
    border: 1px solid rgba(255, 179, 71, 0.5);
    border-radius: 999px;
    color: #ffd18a;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    white-space: nowrap;
}

.v4-admin-page .v4-status-badge--inline {
    align-self: flex-start;
    margin-top: 8px;
    width: fit-content;
}

.v4-new-card-page .v4-message {
    text-align: left;
}

.v4-new-card-page .v4-workflow-panel {
    background: #151719;
    border: 1px solid #35393c;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    margin: 16px 0;
    padding: 20px;
}

.v4-new-card-page .v4-workflow-panel--compact {
    padding-bottom: 16px;
    padding-top: 16px;
}

.v4-new-card-page .v4-section-heading {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    margin-bottom: 17px;
}

.v4-new-card-page .v4-step-number {
    align-items: center;
    background: #ffb347;
    border-radius: 50%;
    color: #171717;
    display: inline-flex;
    flex: 0 0 28px;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.v4-new-card-page .v4-section-heading h2 {
    font-size: 1.12rem;
    margin: 1px 0 4px;
}

.v4-new-card-page .v4-section-heading p {
    color: #aaa;
    margin: 0;
}

.v4-new-card-page .v4-form-section {
    border-color: #41464a;
    margin: 0;
    padding: 16px;
}

.v4-new-card-page .v4-required {
    color: #ffc56f;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 5px;
    text-transform: uppercase;
}

.v4-new-card-page .v4-upload-zone {
    align-items: center;
    background: #101214;
    border: 1px dashed #777;
    border-radius: 8px;
    color: #eee;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 185px;
    justify-content: center;
    padding: 24px;
    text-align: center;
    transition: border-color 140ms ease, background 140ms ease;
}

.v4-new-card-page .v4-upload-zone:hover,
.v4-new-card-page .v4-upload-zone:focus-within {
    background: #17191b;
    border-color: #ffb347;
}

.v4-new-card-page .v4-upload-zone strong {
    font-size: 1rem;
}

.v4-new-card-page .v4-upload-zone > span:not(.v4-upload-icon) {
    color: #b9b9b9;
    max-width: 64ch;
}

.v4-new-card-page .v4-upload-zone .v4-upload-icon {
    align-items: center;
    border: 1px solid #555;
    border-radius: 50%;
    color: #ffb347;
    display: inline-flex;
    font-size: 1.4rem;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.v4-new-card-page .v4-upload-zone input[type="file"] {
    color: #ccc;
    max-width: 100%;
}

.v4-new-card-page .v4-upload-formats {
    color: #ffca7a !important;
    font-size: 0.82rem;
}

.v4-new-card-page .v4-artwork-preview,
.v4-admin-page .v4-artwork-saved {
    align-items: center;
    background: #101214;
    border: 1px solid #35393c;
    border-radius: 8px;
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding: 12px;
}

.v4-new-card-page .v4-artwork-preview img,
.v4-admin-page .v4-artwork-saved img {
    background: #080909;
    border: 1px solid #444;
    border-radius: 5px;
    max-height: 220px;
    max-width: 160px;
    object-fit: contain;
}

.v4-new-card-page .v4-artwork-preview > div,
.v4-admin-page .v4-artwork-saved > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.v4-new-card-page .v4-artwork-preview span,
.v4-admin-page .v4-artwork-saved span {
    color: #aaa;
}

.v4-new-card-page .v4-language-value,
.v4-new-card-page .v4-version-summary {
    align-items: center;
    background: #101214;
    border: 1px solid #35393c;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
}

.v4-new-card-page .v4-language-code {
    color: #ffca7a;
    font-weight: 800;
}

.v4-new-card-page .v4-language-value code {
    color: #bbb;
}

.v4-new-card-page .v4-version-summary span {
    color: #bbb;
}

.v4-new-card-page .v4-content-next-step {
    border-left: 3px solid #ffb347;
    color: #c7c7c7;
    margin: 0;
    padding: 8px 12px;
}

.v4-new-card-page .v4-form-actions {
    align-items: center;
    border-top: 1px solid #35393c;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 20px 0 32px;
    padding-top: 16px;
}

.v4-admin-page .v4-button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    text-decoration: none;
}

.v4-admin-page .v4-button--primary {
    background: #ffb347;
    color: #191919;
}

.v4-admin-page .v4-button--primary:hover {
    background: #ffd18a;
}

.v4-admin-page .v4-button--secondary {
    background: #26292b;
    border-color: #555;
    color: #eee;
}

.v4-admin-page .v4-form-actions button,
.v4-new-card-page form > button[type="submit"] {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
    min-height: 42px;
    padding: 10px 18px;
}

.v4-admin-page .v4-form-actions button,
.v4-new-card-page form > button[type="submit"] {
    background: #ffb347;
    color: #171717;
}

.v4-admin-page .v4-form-actions button:hover,
.v4-new-card-page form > button[type="submit"]:hover {
    background: #ffd18a;
}

@media (max-width: 680px) {
    .v4-new-card-page .v4-workflow-panel {
        padding: 15px;
    }

    .v4-new-card-page .v4-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .v4-new-card-page .v4-form-actions .v4-button,
    .v4-new-card-page .v4-form-actions button {
        width: 100%;
    }

    .v4-new-card-page .v4-artwork-preview,
    .v4-admin-page .v4-artwork-saved {
        align-items: flex-start;
        flex-direction: column;
    }
}

.v4-new-card-page .v4-card-info,
.v4-card-create-prompt {
    border-color: #44494d;
}

.v4-new-card-page .v4-workflow-panel h2,
.v4-admin-page .v4-card-create-prompt h2 {
    color: #f2f2f2;
}

.v4-new-card-page .v4-language-value,
.v4-new-card-page .v4-version-summary {
    min-height: 48px;
}

.v4-new-card-page .v4-upload-zone:focus-within {
    box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.22);
}

.v4-new-card-page .v4-upload-zone input[type="file"]::file-selector-button {
    background: #292d30;
    border: 1px solid #60666a;
    border-radius: 5px;
    color: #f2f2f2;
    cursor: pointer;
    margin-right: 10px;
    padding: 8px 12px;
}

.v4-new-card-page .v4-upload-zone input[type="file"]::file-selector-button:hover {
    border-color: #ffb347;
}

.v4-admin-page .v4-card-create-prompt {
    align-items: center;
    background: #151719;
    border: 1px solid #35393c;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-top: 20px;
    padding: 18px;
}

.v4-admin-page .v4-card-create-prompt h2 {
    margin: 0 0 5px;
}

.v4-admin-page .v4-card-create-prompt p {
    color: #aaa;
    margin: 0;
}

.v4-card-overview,
.v4-version-editor {
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 1240px;
    padding: 18px 20px 36px;
    width: 100%;
}

.v4-breadcrumbs {
    align-items: center;
    color: #999;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 22px;
}

.v4-breadcrumbs a {
    color: #ffca7a;
    text-decoration: none;
}

.v4-breadcrumbs a:hover {
    text-decoration: underline;
}

.v4-card-heading,
.v4-version-heading {
    align-items: center;
    border-bottom: 1px solid #393d40;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.v4-card-heading h1,
.v4-version-heading h1 {
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    margin: 0;
}

.v4-card-core-message {
    color: #bdbdbd;
    margin: 8px 0 0;
    max-width: 70ch;
}

.v4-card-badges {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.v4-status-badge--category {
    background: #252a2d;
    border-color: #596166;
    color: #e4e8ea;
}

.v4-status-badge--draft,
.v4-status-badge--ready {
    background: rgba(255, 179, 71, 0.12);
    border-color: rgba(255, 179, 71, 0.45);
    color: #ffd18a;
}

.v4-status-badge--published,
.v4-status-badge--master_approved {
    background: rgba(80, 180, 115, 0.14);
    border-color: rgba(80, 180, 115, 0.5);
    color: #93e2ad;
}

.v4-status-badge--disabled,
.v4-status-badge--update_required,
.v4-status-badge--superseded {
    background: rgba(160, 160, 160, 0.12);
    border-color: rgba(160, 160, 160, 0.38);
    color: #c1c6c9;
}

.v4-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 18px;
}

.v4-analysis-status-banner,
.v4-warning-banner {
    align-items: center;
    background: rgba(43, 48, 52, 0.92);
    border: 1px solid #3d4549;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
}

.v4-analysis-status-banner p,
.v4-warning-banner span {
    color: #c8ced1;
    margin: 0;
}

.v4-warning-banner {
    background: rgba(143, 95, 21, 0.12);
    border-color: rgba(255, 179, 71, 0.45);
}

.v4-warning-banner strong {
    color: #ffd18a;
}

.v4-analysis-layout {
    grid-template-columns: minmax(300px, 0.8fr) minmax(560px, 1.4fr);
}

.v4-analysis-results-panel {
    min-height: 100%;
}

.v4-analysis-visual-panel {
    align-self: start;
    max-height: calc(100vh - 28px);
    overflow: auto;
    position: sticky;
    top: 14px;
}

.v4-analysis-artwork-heading {
    align-items: flex-start;
}

.v4-analysis-artwork-heading > a {
    flex: 0 0 auto;
    margin: 0;
}

.v4-analysis-zoom-controls {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin: 0 0 8px;
}

.v4-analysis-zoom-controls .v4-button {
    margin: 0;
    min-width: 36px;
    padding: 5px 9px;
}

.v4-analysis-zoom-controls output {
    color: #c9ced0;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    min-width: 44px;
    text-align: right;
}

.v4-analysis-artwork-canvas {
    display: block;
    max-width: 100%;
    position: relative;
}

.v4-analysis-artwork-canvas img {
    display: block;
    height: auto;
    max-width: 100%;
    width: 100%;
}

.v4-analysis-artwork-overlay {
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.v4-analysis-artwork-box {
    appearance: none;
    border: 2px solid #ffd18a;
    background: rgba(255, 209, 138, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.72);
    cursor: move;
    display: none;
    margin: 0;
    min-width: 0;
    padding: 0;
    pointer-events: auto;
    position: absolute;
    touch-action: none;
    user-select: none;
}

.v4-analysis-artwork-box.is-selected {
    display: block;
}

.v4-analysis-artwork-box-handle {
    background: #ffd18a;
    border: 1px solid #17191a;
    bottom: -5px;
    cursor: nwse-resize;
    height: 12px;
    position: absolute;
    right: -5px;
    width: 12px;
}

.v4-analysis-artwork {
    background: #090a0b;
    display: block;
    min-height: 420px;
    overflow: auto;
    text-align: left;
}

.v4-analysis-artwork-overlay {
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.v4-analysis-artwork-box {
    background: rgba(255, 209, 138, 0.18);
    border: 2px solid #ffd18a;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.72);
    display: none;
    position: absolute;
}

.v4-analysis-artwork-box.is-selected {
    display: block;
}

.v4-analysis-list {
    display: grid;
    gap: 14px;
}

.v4-analysis-results-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.v4-analysis-results-heading h2,
.v4-analysis-results-heading p {
    margin: 0;
}

.v4-analysis-results-heading p {
    color: #aeb3b6;
    margin-top: 5px;
}

.v4-analysis-summary {
    align-items: flex-end;
    color: #aeb3b6;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    font-size: 0.78rem;
    gap: 3px;
}

.v4-analysis-summary strong {
    color: #ffd18a;
    font-size: 0.95rem;
}

.v4-analysis-action-bar {
    background: #151719;
    border-bottom: 1px solid #35393c;
    margin: 0 -18px 12px;
    padding: 10px 18px;
    position: sticky;
    top: 0;
    z-index: 4;
}

.v4-analysis-tools {
    align-items: end;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.v4-analysis-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.v4-analysis-filter {
    background: #111315;
    border: 1px solid #3a4043;
    border-radius: 5px;
    color: #cbd0d2;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    padding: 6px 9px;
}

.v4-analysis-filter.is-active {
    background: rgba(255, 179, 71, 0.14);
    border-color: #b87828;
    color: #ffd18a;
}

.v4-analysis-filter:focus-visible,
.v4-analysis-edit-button:focus-visible,
.v4-analysis-search input:focus-visible {
    outline: 2px solid #ffb347;
    outline-offset: 2px;
}

.v4-analysis-search {
    color: #aeb3b6;
    display: grid;
    flex: 0 1 220px;
    font-size: 0.72rem;
    gap: 4px;
}

.v4-analysis-search input {
    background: #0d0f10;
    border: 1px solid #3a4043;
    border-radius: 5px;
    color: #f1f3f4;
    min-width: 0;
    padding: 7px 9px;
}

.v4-analysis-table-wrap {
    border: 1px solid #353a3d;
    border-radius: 7px;
    max-height: calc(100vh - 300px);
    min-height: 260px;
    overflow: auto;
}

.v4-analysis-table {
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: fixed;
    width: 100%;
}

.v4-analysis-table thead {
    background: #202326;
    position: sticky;
    top: 0;
    z-index: 3;
}

.v4-analysis-table th,
.v4-analysis-table td {
    border-bottom: 1px solid #303538;
    padding: 8px 9px;
    text-align: left;
    vertical-align: middle;
}

.v4-analysis-table th {
    color: #b9c0c3;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.v4-analysis-table th:nth-child(1) { width: 17%; }
.v4-analysis-table th:nth-child(2) { width: auto; }
.v4-analysis-table th:nth-child(3) { width: 13%; }
.v4-analysis-table th:nth-child(4) { width: 16%; }
.v4-analysis-table th:nth-child(5) { width: 11%; }
.v4-analysis-table th:nth-child(6) { width: 64px; }

.v4-analysis-summary-row:hover {
    background: #181b1d;
}

.v4-analysis-select-row {
    cursor: pointer;
}

.v4-analysis-select-row.is-selected {
    background: #2a241a;
    box-shadow: inset 3px 0 #ffd18a;
}

.v4-analysis-select-row:focus-visible {
    outline: 2px solid #ffd18a;
    outline-offset: -2px;
}

.v4-analysis-select-row {
    cursor: pointer;
}

.v4-analysis-select-row.is-selected {
    background: #2a241a;
    box-shadow: inset 3px 0 #ffd18a;
}

.v4-analysis-select-row:focus-visible {
    outline: 2px solid #ffd18a;
    outline-offset: -2px;
}

.v4-analysis-source {
    color: #edf0f1;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.v4-analysis-confidence {
    color: #d9dedf;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.v4-analysis-row-action {
    text-align: right !important;
}

.v4-analysis-row-action .v4-button {
    margin: 0;
    padding: 5px 8px;
}

.v4-analysis-editor-row > td {
    background: #101214;
    padding: 12px;
}

.v4-analysis-editor-row[hidden],
.v4-analysis-row-group[hidden] {
    display: none;
}

.v4-analysis-inline-edit {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(140px, 0.7fr) minmax(140px, 0.7fr) minmax(220px, 1.6fr) minmax(140px, 0.7fr);
    margin: 0;
}

.v4-analysis-inline-edit .v4-field:nth-child(3),
.v4-analysis-inline-edit .v4-field:nth-child(5),
.v4-analysis-inline-edit .v4-technical-details {
    grid-column: 1 / -1;
}

.v4-analysis-technical-meta {
    display: grid;
    gap: 6px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0 0;
}

.v4-analysis-technical-meta div {
    min-width: 0;
}

.v4-analysis-technical-meta dt {
    color: #91999c;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.v4-analysis-technical-meta dd {
    color: #d9dddf;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

.v4-analysis-inline-edit[hidden] {
    display: none;
}

.v4-technical-details {
    margin-top: 12px;
}

.v4-card-overview-grid {
    align-items: stretch;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    margin-bottom: 16px;
}

.v4-overview-panel,
.v4-editor-section {
    background: #151719;
    border: 1px solid #35393c;
    border-radius: 9px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
    margin: 16px 0;
    min-width: 0;
    padding: 18px;
}

.v4-overview-panel h2,
.v4-editor-section h2 {
    font-size: 1.16rem;
    margin: 0;
}

.v4-section-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.v4-section-heading p {
    color: #aeb3b6;
    margin: 5px 0 0;
}

.v4-artwork-preview-link {
    align-items: center;
    background: #090a0b;
    border: 1px solid #34383b;
    border-radius: 7px;
    display: flex;
    justify-content: center;
    min-height: 280px;
    overflow: hidden;
    padding: 12px;
}

.v4-artwork-preview-link img {
    display: block;
    max-height: 620px;
    max-width: 100%;
    object-fit: contain;
}

.v4-artwork-preview-link.v4-analysis-artwork {
    align-items: flex-start;
    display: block;
    overflow: auto;
}

.v4-artwork-preview-link.v4-analysis-artwork .v4-analysis-artwork-canvas {
    flex: 0 0 auto;
    max-width: none;
}

.v4-artwork-preview-link.v4-analysis-artwork .v4-analysis-artwork-canvas img {
    max-height: none;
    max-width: none;
}

.v4-artwork-facts,
.v4-card-facts,
.v4-technical-facts {
    display: grid;
    gap: 10px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 16px 0 0;
}

.v4-artwork-facts div,
.v4-card-facts div,
.v4-technical-facts div {
    min-width: 0;
}

.v4-artwork-facts dt,
.v4-card-facts dt,
.v4-technical-facts dt {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.v4-artwork-facts dd,
.v4-card-facts dd,
.v4-technical-facts dd {
    color: #eee;
    margin: 0;
    overflow-wrap: anywhere;
}

.v4-content-counts {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.v4-content-counts > div {
    align-items: baseline;
    background: #101214;
    border: 1px solid #33383b;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
}

.v4-content-counts strong {
    color: #ffca7a;
    font-size: 1.3rem;
}

.v4-content-counts span {
    color: #b6babc;
}

.v4-version-cards {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.v4-version-card {
    align-items: center;
    background: #101214;
    border: 1px solid #35393c;
    border-radius: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    justify-content: space-between;
    padding: 14px;
}

.v4-version-card.is-current {
    border-color: #ffb347;
    box-shadow: inset 3px 0 #ffb347;
}

.v4-version-card h3 {
    font-size: 1rem;
    margin: 2px 0 0;
}

.v4-version-card .v4-eyebrow {
    color: #aaa;
    font-size: 0.7rem;
    margin: 0;
}

.v4-current-label {
    color: #ffd18a;
    font-size: 0.72rem;
    font-weight: 800;
}

.v4-empty-state {
    background: #101214;
    border: 1px dashed #555b60;
    border-radius: 7px;
    color: #b4b9bc;
    padding: 18px;
}

.v4-empty-state h3 {
    color: #e4e6e7;
    margin: 0 0 6px;
}

.v4-empty-state p {
    margin: 0 0 12px;
}

.v4-empty-state--compact {
    margin: 10px 0;
    padding: 12px 14px;
}

.v4-secondary-panel,
.v4-row-details {
    background: #121416;
    border: 1px solid #35393c;
    border-radius: 7px;
    margin: 12px 0;
    padding: 12px 14px;
}

.v4-secondary-panel > summary,
.v4-row-details > summary {
    color: #e5e5e5;
    cursor: pointer;
    font-weight: 700;
}

.v4-secondary-panel[open] > summary,
.v4-row-details[open] > summary {
    margin-bottom: 12px;
}

.v4-readonly-notice {
    background: #202326;
    border-left: 3px solid #8d969b;
    border-radius: 4px;
    color: #c5cacc;
    margin: 0 0 16px;
    padding: 10px 13px;
}

.v4-table-scroll {
    overflow-x: auto;
    width: 100%;
}

.v4-data-table,
.v4-text-table {
    border-collapse: collapse;
    min-width: 680px;
    width: 100%;
}

.v4-data-table th,
.v4-text-table th {
    color: #aeb3b6;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 10px 11px;
    text-align: left;
    white-space: nowrap;
}

.v4-data-table td,
.v4-text-table td {
    border-top: 1px solid #303538;
    color: #e0e2e3;
    padding: 11px;
    vertical-align: top;
}

.v4-data-table td small,
.v4-text-table td small {
    color: #999;
    display: block;
    margin-top: 3px;
}

.v4-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 180px;
}

.v4-row-actions .v4-button {
    min-height: 34px;
    padding: 6px 10px;
}

.v4-text-table {
    min-width: 760px;
}

.v4-text-table .v4-source-text {
    max-width: 560px;
    min-width: 220px;
    white-space: pre-wrap;
}

.v4-priority-badge,
.v4-protected-badge {
    background: #24282b;
    border: 1px solid #464d51;
    border-radius: 999px;
    color: #d7dcde;
    display: inline-block;
    font-size: 0.75rem;
    padding: 4px 8px;
    white-space: nowrap;
}

.v4-protected-badge {
    background: rgba(255, 179, 71, 0.1);
    border-color: rgba(255, 179, 71, 0.4);
    color: #ffd18a;
}

.v4-version-editor > h2,
.v4-version-editor > h3 {
    margin-top: 24px;
}

.v4-version-editor > form,
.v4-version-editor .v4-row-details form {
    margin: 12px 0;
}

.v4-version-editor .v4-editor-section > .v4-section-heading {
    margin-bottom: 12px;
}

.v4-version-editor .v4-character-card {
    background: #121416;
    border: 1px solid #35393c;
    border-radius: 7px;
    margin: 10px 0;
    padding: 14px;
}

.v4-version-editor .v4-character-card > strong {
    display: block;
    margin-bottom: 10px;
}

@media (max-width: 760px) {
    .v4-card-overview,
    .v4-version-editor,
    .v4-card-analysis {
        padding: 14px 12px 28px;
    }

    .v4-card-overview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .v4-artwork-facts,
    .v4-card-facts,
    .v4-technical-facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .v4-content-counts {
        grid-template-columns: minmax(0, 1fr);
    }

    .v4-card-actions .v4-button {
        flex: 1 1 100%;
    }

    .v4-analysis-visual-panel {
        max-height: none;
        overflow: visible;
        position: static;
    }

    .v4-analysis-results-heading,
    .v4-analysis-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .v4-analysis-summary {
        align-items: flex-start;
    }

    .v4-analysis-search {
        flex-basis: auto;
        width: 100%;
    }

    .v4-analysis-action-bar {
        margin-inline: -12px;
        padding-inline: 12px;
        position: static;
    }

    .v4-analysis-table-wrap {
        max-height: 68vh;
        min-height: 240px;
    }

    .v4-analysis-table,
    .v4-analysis-table tbody,
    .v4-analysis-table tr,
    .v4-analysis-table td {
        display: block;
        width: 100%;
    }

    .v4-analysis-table thead {
        display: none;
    }

    .v4-analysis-row-group {
        border-bottom: 1px solid #3a3f42;
    }

    .v4-analysis-summary-row {
        display: grid !important;
        gap: 5px 10px;
        grid-template-columns: minmax(0, 1fr) auto auto;
        padding: 9px 10px;
    }

    .v4-analysis-summary-row td {
        border: 0;
        padding: 0;
    }

    .v4-analysis-summary-row td:first-child,
    .v4-analysis-source {
        grid-column: 1 / -1;
    }

    .v4-analysis-row-action {
        align-self: center;
        grid-column: 3;
        grid-row: 3;
    }

    .v4-analysis-editor-row > td {
        border: 0;
        padding: 10px;
    }

    .v4-analysis-inline-edit,
    .v4-analysis-technical-meta {
        grid-template-columns: minmax(0, 1fr);
    }
}

