    :root {
      --bg-body: #0a0a0a;
      --bg-panel: #1a1a1a;
      --bg-header-start: #2a2a2a;
      --bg-header-end: #1f1f1f;
      --bg-row-a: #252525;
      --bg-row-b: #1f1f1f;
      --border: #3a3a3a;
      --border-light: #454545;

      --text-main: #d0d0d0;
      --text-muted: #7a7a7a;
      --text-blue: #7fb3d5;
      --text-green: #8fa85a;
      --text-red: #c17070;
      --text-yellow: #c9a76a;
      --text-orange: #b8845c;
      --font: Arial, Helvetica, sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background-color: var(--bg-body);
      color: var(--text-main);
      font-family: var(--font);
      display: flex;
      flex-direction: column;
    }

    #app-wrapper {
      display: flex;
      flex-direction: column;
      width: 100%;
      flex-grow: 1;
    }

    #sidebar {
      width: 100%;
      height: 50px;
      background: var(--bg-header-end);
      border-bottom: 1px solid #000;
      padding: 0 20px;
      display: flex;
      flex-direction: row;
      gap: 10px;
      align-items: center;
      position: sticky;
      top: 0;
      z-index: 50;
      flex-wrap: wrap;
    }

    .nav-link {
      display: flex;
      align-items: center;
      height: 50px;
      color: var(--text-muted);
      text-decoration: none;
      font-weight: bold;
      font-size: 13px;
      white-space: nowrap;
      padding: 0 15px;
      transition: color 0.2s ease;
    }

    .nav-link .icon {
      width: 20px;
      height: 20px;
      display: flex;
      justify-content: center;
      align-items: center;
      margin-right: 8px;
    }

    .nav-link .text {
      opacity: 1;
      transition: opacity 0.2s ease;
    }

    .nav-link.active {
      color: var(--text-main);
      background: var(--bg-panel);
      border-radius: 3px;
    }

    #main-content {
      flex-grow: 1;
      padding: 30px 20px;
      display: flex;
      justify-content: center;
      width: 100%;
    }

    .container {
      width: 100%;
      max-width: 750px;
      display: flex;
      flex-direction: column;
      gap: 25px;
    }

    .torn-panel {
      background: var(--bg-panel);
      border: 1px solid var(--border);
      border-radius: 5px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
      overflow: hidden;
    }

    .panel-header {
      background: linear-gradient(180deg, var(--bg-header-start) 0%, var(--bg-header-end) 100%);
      padding: 10px 15px;
      border-bottom: 1px solid #000;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .panel-header h3 {
      margin: 0;
      font-size: 15px;
      font-weight: 700;
      color: #fff;
      text-shadow: 0 1px 2px #000;
      letter-spacing: 0.5px;
    }

    .panel-content {
      display: flex;
      flex-direction: column;
    }

    .data-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 12px;
      font-size: 13px;
      border-bottom: 1px solid #000;
      height: 40px;
    }

    .data-row:nth-child(even) {
      background-color: var(--bg-row-a);
    }

    .data-row:nth-child(odd) {
      background-color: var(--bg-row-b);
    }

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

    input {
      background: #fff;
      border: 1px solid #999;
      padding: 8px;
      width: 100%;
      font-size: 13px;
      margin-bottom: 10px;
      border-radius: 3px;
    }

    button {
      background: linear-gradient(180deg, #ddd 0%, #bbb 100%);
      border: 1px solid #999;
      color: #000;
      font-weight: 700;
      padding: 8px 16px;
      cursor: pointer;
      font-size: 12px;
      border-radius: 3px;
      width: 100%;
    }

    button:hover {
      background: linear-gradient(180deg, #fff 0%, #ccc 100%);
    }

    button:active {
      background: #bbb;
    }

    .btn-sm {
      width: auto;
      padding: 5px 10px;
      font-size: 11px;
      flex-shrink: 0;
      white-space: nowrap;
    }

    .progress-bg {
      width: 120px;
      height: 10px;
      background: #333;
      border: 1px solid #555;
      position: relative;
    }

    .progress-fill {
      height: 100%;
      background: var(--text-blue);
      width: 0%;
      transition: width 0.5s ease;
    }

    .progress-fill.maxed {
      background: var(--text-green);
    }

    /* --- UPDATED WAR SCOREBOARD STYLES (High Impact) --- */
    .war-scoreboard {
      padding: 0;
      /* Removed padding for full-width footer */
      background: transparent;
      display: flex;
      flex-direction: column;
    }

    .score-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px 20px;
    }

    .faction-side {
      flex: 1;
    }

    .align-right {
      text-align: right;
    }

    .align-left {
      text-align: left;
    }

    .faction-score-lg {
      font-size: 28px;
      font-weight: bold;
      line-height: 1;
      margin-bottom: 5px;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    .faction-name-sm {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .vs-divider {
      padding: 0 15px;
    }

    .vs-text {
      font-size: 10px;
      background: var(--bg-row-a);
      padding: 4px 8px;
      border-radius: 10px;
      border: 1px solid var(--border);
      color: var(--text-muted);
    }

    .status-bar-container {
      height: 6px;
      background: var(--bg-row-b);
      display: flex;
      position: relative;
      margin: 0 20px 20px;
      border-radius: 3px;
      overflow: visible;
      /* Allows percentage text to float out */
    }

    .fill {
      height: 100%;
      transition: width 0.5s ease;
    }

    .fill-green {
      background-color: var(--text-green);
    }

    .fill-red {
      background-color: var(--text-red);
    }

    .pct {
      position: absolute;
      top: -16px;
      font-size: 10px;
      font-weight: bold;
    }

    .pct-left {
      left: 0;
      color: var(--text-green);
    }

    .pct-right {
      right: 0;
      color: var(--text-red);
    }

    .war-footer {
      background: var(--bg-row-a);
      padding: 8px 15px;
      border-top: 1px solid var(--border);
      font-size: 11px;
      display: flex;
      justify-content: space-between;
      color: var(--text-muted);
    }

    .war-time-label {
      font-weight: 500;
    }

    .war-time-value {
      font-weight: 600;
      font-family: 'Courier New', monospace;
    }

    /* --- END WAR STYLES --- */

    .filter-bar {
      background: var(--bg-row-a);
      padding: 10px 12px;
      border-bottom: 1px solid #000;
      display: flex;
      gap: 15px;
      align-items: center;
      flex-wrap: wrap;
      min-height: auto;
    }

    #stat-filter-container {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .stat-filter-group {
      display: flex;
      gap: 5px;
      align-items: center;
    }

    .stat-filter-group label {
      font-size: 11px;
      color: var(--text-muted);
      cursor: pointer;
    }

    .stat-filter-group input[type="checkbox"] {
      cursor: pointer;
    }

    .filter-bar>span {
      white-space: nowrap;
      font-size: 11px;
    }

    select {
      background: #fff;
      color: #000;
      border: 1px solid #999;
      padding: 5px 8px;
      font-size: 11px;
      font-weight: bold;
      border-radius: 3px;
      cursor: pointer;
      outline: none;
      transition: all 0.2s ease;
      flex-shrink: 0;
    }

    select:hover {
      background: #f5f5f5;
      border-color: #ccc;
    }

    select:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    .grid-header {
      display: grid;
      grid-template-columns: 2fr 0.7fr 0.8fr 1fr;
      gap: 8px;
      padding: 10px 12px;
      background: #252525;
      border-bottom: 1px solid #444;
      font-size: 10px;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .grid-row {
      display: grid;
      grid-template-columns: 2fr 0.7fr 0.8fr 1fr;
      gap: 8px;
      padding: 10px 12px;
      align-items: center;
      border-bottom: 1px solid #000;
      font-size: 12px;
      transition: background 0.2s;
    }

    .grid-row.status-okay {
      background: linear-gradient(90deg, var(--bg-row-b) 0%, rgba(143, 168, 90, 0.08) 100%);
    }

    .grid-row.status-hospital {
      background: linear-gradient(90deg, var(--bg-row-b) 0%, rgba(193, 112, 112, 0.08) 100%);
    }

    .grid-row.status-jail {
      background: linear-gradient(90deg, var(--bg-row-b) 0%, rgba(127, 179, 213, 0.06) 100%);
    }

    .grid-row:nth-child(even) {
      background-color: var(--bg-row-a);
    }

    .grid-row:nth-child(odd) {
      background-color: var(--bg-row-b);
    }

    .grid-row.status-okay:nth-child(even) {
      background: linear-gradient(90deg, var(--bg-row-a) 0%, rgba(143, 168, 90, 0.1) 100%);
    }

    .grid-row.status-okay:nth-child(odd) {
      background: linear-gradient(90deg, var(--bg-row-b) 0%, rgba(143, 168, 90, 0.1) 100%);
    }

    .grid-row.status-hospital:nth-child(even) {
      background: linear-gradient(90deg, var(--bg-row-a) 0%, rgba(193, 112, 112, 0.1) 100%);
    }

    .grid-row.status-hospital:nth-child(odd) {
      background: linear-gradient(90deg, var(--bg-row-b) 0%, rgba(193, 112, 112, 0.1) 100%);
    }

    .grid-row:hover {
      background-color: #2a2a2a;
    }

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

    .col-center {
      text-align: center;
    }

    .col-right {
      text-align: right;
    }

    .col-flex-v {
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    a {
      text-decoration: none;
      color: var(--text-blue);
      font-weight: bold;
    }

    a:hover {
      text-decoration: underline;
    }

    .t-green {
      color: var(--text-green);
    }

    .t-red {
      color: var(--text-red);
    }

    .t-orange {
      color: var(--text-orange);
    }

    .t-muted {
      color: var(--text-muted);
      font-size: 11px;
    }

    .t-bold {
      font-weight: bold;
    }

    .t-lg {
      font-size: 14px;
    }

    .btn-attack {
      background: linear-gradient(180deg, #c17070 0%, #8b4a4a 100%);
      border: 1px solid #5f3333;
      color: #f0f0f0;
      font-weight: 600;
      padding: 8px 0;
      width: 100%;
      text-align: center;
      cursor: pointer;
      font-size: 11px;
      text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.4);
      transition: all 0.15s ease;
      display: block;
      text-decoration: none;
      white-space: normal;
      word-wrap: break-word;
      line-height: 1.2;
    }

    .btn-attack:hover {
      background: linear-gradient(180deg, #d68888 0%, #a75a5a 100%);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 6px rgba(0, 0, 0, 0.5);
    }

    .btn-attack:active {
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.3);
      transform: translateY(1px);
    }

    .btn-disabled {
      background: rgba(50, 50, 50, 0.5);
      border: 1px solid #444;
      color: #666;
      padding: 8px 0;
      width: 100%;
      text-align: center;
      font-size: 11px;
      border-radius: 3px;
      cursor: default;
      text-transform: uppercase;
      font-weight: bold;
      letter-spacing: 0.3px;
    }

    .btn-attack-hospital {
      background: linear-gradient(180deg, #9a8a7a 0%, #6b6058 100%);
      border: 1px solid #4a4035;
      color: #d0d0d0;
      font-weight: 600;
      padding: 8px 0;
      width: 100%;
      text-align: center;
      cursor: pointer;
      font-size: 11px;
      text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.4);
      transition: all 0.15s ease;
      display: block;
      text-decoration: none;
      white-space: normal;
      word-wrap: break-word;
      line-height: 1.2;
    }

    .btn-attack-hospital:hover {
      background: linear-gradient(180deg, #b0a090 0%, #7a6d62 100%);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 6px rgba(0, 0, 0, 0.5);
    }

    .btn-attack-hospital:active {
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.3);
      transform: translateY(1px);
    }

    .badge-hosp {
      background: rgba(229, 76, 76, 0.15);
      border: 1px solid rgba(229, 76, 76, 0.3);
      color: var(--text-red);
      padding: 2px 6px;
      border-radius: 3px;
      font-size: 11px;
      display: inline-block;
    }

    .badge-soon {
      background: rgba(255, 153, 51, 0.15);
      border: 1px solid rgba(255, 153, 51, 0.3);
      color: var(--text-orange);
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0% {
        box-shadow: 0 0 0 0 rgba(255, 153, 51, 0.2);
      }

      70% {
        box-shadow: 0 0 0 4px rgba(255, 153, 51, 0);
      }

      100% {
        box-shadow: 0 0 0 0 rgba(255, 153, 51, 0);
      }
    }

    .skeleton {
      color: transparent !important;
      position: relative;
      overflow: hidden;
      pointer-events: none;
    }

    .skeleton::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
      background-size: 200% 100%;
      animation: shimmer 1.5s infinite linear;
    }

    .skeleton * {
      opacity: 0;
    }

    @keyframes shimmer {
      0% {
        background-position: -200% 0;
      }

      100% {
        background-position: 200% 0;
      }
    }

    .hidden {
      display: none !important;
    }

    #toast {
      position: fixed;
      bottom: 20px;
      right: 20px;
      background: var(--bg-panel);
      border: 1px solid var(--border);
      color: var(--text-main);
      padding: 12px 20px;
      font-size: 13px;
      font-weight: bold;
      box-shadow: 0 4px 10px #000;
      z-index: 100;
    }

    .spinner {
      border: 2px solid rgba(255, 255, 255, 0.1);
      border-left-color: #fff;
      border-radius: 50%;
      width: 14px;
      height: 14px;
      animation: spin 1s linear infinite;
      margin: 0 auto;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    /* Container: Natural flow for Desktop */
    #stat-filter-container {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      width: 100%;
      padding: 5px 0;
    }

    /* The "FILTER:" label */
    #stat-filter-container>span {
      font-size: 10px;
      letter-spacing: 0.5px;
      margin-right: 4px;
      text-transform: uppercase;
    }

    /* The Group wrapper */
    .stat-filter-group {
      display: block;
    }

    /* Hide the actual checkbox */
    .stat-filter-group input[type="checkbox"] {
      display: none;
    }

    /* The Label: Fixed width on desktop ensures uniformity without stretching */
    .stat-filter-group label {
      display: flex;
      align-items: center;
      justify-content: center;

      /* FIXED WIDTH for uniformity */
      width: 85px;
      height: 28px;

      background: #2d2d2d;
      border: 1px solid #444;
      border-radius: 4px;
      font-size: 10.5px;
      font-weight: 500;
      color: #bbb;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    /* Logic: Checked State */
    .stat-filter-group input[type="checkbox"]:checked+label {
      background-color: #007bff;
      color: white;
      border-color: #0056b3;
    }

    /* Hover effect */
    .stat-filter-group label:hover {
      border-color: #666;
      background: #363636;
    }

    /* MOBILE: Switch to Grid for perfect 3-column alignment */
    @media (max-width: 480px) {
      #stat-filter-container {
        display: grid;
        /* 3 equal columns */
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
      }

      #stat-filter-container>span {
        grid-column: 1 / -1;
        /* Filter text takes the top row */
        margin-bottom: 2px;
      }

      .stat-filter-group label {
        width: 100%;
        /* Labels fill the 1/3 grid width exactly */
        height: 35px;
        /* Slightly taller for thumbs */
      }
    }
