:root {
    --bg: #ececec;
    --panel: #ffffff;
    --panel-soft: #2e2e2e;
    --line: #d7d7d7;
    --ink: #212121;
    --muted: #666;
    --accent: #7b1818;
    --accent-2: #9f2a2a;
    --ok: #2f7f4f;
    --warn: #8d5e0f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Bahnschrift, 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(180deg, #f2f2f2 0%, var(--bg) 100%);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.topbar-inner {
    max-width: 1380px;
    margin: 0 auto;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    gap: 12px;
    align-items: center;
}

.brand {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
}

.brand small {
    display: block;
    margin-top: -2px;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
}

.main-nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #505050;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.nav-link-inner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.nav-icon {
    width: 17px;
    height: 17px;
    object-fit: contain;
    flex: 0 0 17px;
    opacity: 0.86;
}

.nav-alert {
    display: inline-grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    margin-left: 6px;
    padding: 0 4px;
    border-radius: 999px;
    background: #555;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.nav-alert.urgent {
    background: #c62828;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.15);
}

/* Colored meter bars for low health/stamina */
.meter i.bar-danger { background: #c62828; }
.meter i.bar-warn   { background: #e67e22; }

/* Full-width warning banner below header */
.body-alert-banner {
    padding: 10px 18px;
    font-size: 14px;
    border-left: 4px solid;
    margin-bottom: 12px;
    border-radius: 4px;
}
.body-alert-banner.danger {
    background: rgba(198, 40, 40, 0.16);
    border-color: #c62828;
    color: #2d0a0a;
}
.body-alert-banner.warn {
    background: rgba(230, 126, 34, 0.12);
    border-color: #e67e22;
    color: #111;
}
.body-alert-banner a {
    color: inherit;
    font-weight: bold;
    text-decoration: underline;
}

/* Jail lockdown — locked nav items and custody banner */
.nav-locked {
    display: inline-flex;
    align-items: center;
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    font-size: inherit;
}

.jail-lockdown-banner {
    padding: 10px 18px;
    font-size: 14px;
    border-left: 4px solid #8b1111;
    margin-bottom: 12px;
    border-radius: 4px;
    background: rgba(139, 17, 17, 0.18);
    color: #2d0a0a;
}

.jail-lockdown-banner .jail-timer {
    margin-left: 12px;
    font-size: 12px;
    opacity: 0.85;
    font-style: italic;
}

.housing-status-banner {
    display: grid;
    gap: 3px;
    padding: 10px 18px;
    border-left: 4px solid #1f6b84;
    margin-bottom: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(31, 107, 132, 0.18) 0%, rgba(31, 107, 132, 0.08) 100%);
    color: #10232a;
}

.housing-status-banner strong {
    font-size: 14px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.housing-status-banner span {
    font-size: 12px;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--accent);
}

.top-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.search {
    width: 150px;
    border: 1px solid var(--line);
    background: #fff;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
}

.btn {
    border: 1px solid transparent;
    background: #fff;
    color: var(--ink);
    padding: 0 10px;
    height: 28px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #621111;
}

.btn.has-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: auto;
    min-height: 38px;
    padding: 4px 10px;
}

.btn-icon {
    width: 35px;
    height: 35px;
    object-fit: contain;
    flex: 0 0 35px;
}

.jail-action-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.jail-image-submit {
    border: 1px solid #d6d6d6;
    background: #fff;
    width: 41px;
    height: 41px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.jail-image-submit:hover {
    border-color: var(--accent);
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.layout {
    max-width: 1380px;
    margin: 10px auto;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 10px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
}

.panel-head {
    background: var(--panel-soft);
    border-bottom: 1px solid #1f1f1f;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #ffffff;
}

.panel-body {
    padding: 8px;
}

.stack {
    display: grid;
    gap: 8px;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    font-size: 12px;
    padding: 2px 0;
}

.stat-row span:first-child {
    color: var(--muted);
}

.stat-row strong {
    font-weight: 700;
    color: #1f1f1f;
}

.families-status-rows {
    margin-bottom: 8px;
}

.families-status-rows .stat-row {
    padding: 6px 8px;
    border: 1px solid #d6d6d6;
    margin-bottom: 4px;
}

.families-status-rows .stat-row:nth-child(odd) {
    background: #ececec;
}

.families-status-rows .stat-row:nth-child(even) {
    background: #dfdfdf;
}

.meter {
    margin-bottom: 6px;
    height: 6px;
    background: #e5e5e5;
    border: 1px solid #dddddd;
}

.meter > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.side-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-decoration: none;
    color: #444;
    border: 1px solid #e6e6e6;
    background: #fcfcfc;
    padding: 7px 8px;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.side-links a.active,
.side-links a:hover {
    border-color: #cfcfcf;
    border-left: 2px solid var(--accent);
    color: var(--accent);
    padding-left: 7px;
}

.content-col {
    display: grid;
    gap: 10px;
}

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.hero-side {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.hero-art {
    width: 80px;
    height: 80px;
    display: grid;
    place-items: center;
    border: 1px solid #d9d1c8;
    background: radial-gradient(circle at top, #fff5e7 0%, #f0e3d0 58%, #e7d4bf 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.page-intro {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.section-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex: 0 0 30px;
}

.section-title {
    font-size: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.section-copy {
    color: #565656;
    font-size: 12px;
}

.panel-head-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.panel-head-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: 0 0 18px;
    filter: brightness(0) invert(1);
}

.hero h1 {
    font-size: 18px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.hero p {
    color: #565656;
    font-size: 12px;
}

.hero-housing-goal {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #d1d8dc;
    background: #f4f7f8;
    color: #2a2a2a;
    font-size: 12px;
    font-weight: 700;
}

.hero-housing-action {
    margin-top: 8px;
}

.housing-hero {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 18px;
    align-items: start;
}

.housing-hero-visual {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    border: 1px solid #7e6a5a;
    background:
        linear-gradient(145deg, rgba(123, 24, 24, 0.22), rgba(35, 24, 18, 0.4)),
        linear-gradient(180deg, #5a473a 0%, #2a211c 100%);
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(23, 14, 10, 0.24), inset 0 0 0 1px rgba(255, 244, 226, 0.08);
    position: relative;
}

.housing-hero-visual::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(243, 219, 190, 0.18);
    pointer-events: none;
}

.housing-hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 18px;
    position: relative;
    z-index: 1;
}

.housing-image-placeholder {
    width: calc(100% - 30px);
    height: calc(100% - 30px);
    background: #ffffff;
    border: 1px solid #dadada;
    position: relative;
    z-index: 1;
}

.housing-image-placeholder.small {
    width: 100%;
    height: 100%;
}

.housing-hero-copy {
    display: grid;
    gap: 12px;
    align-content: start;
}

.housing-intro {
    margin-bottom: 0;
}

.housing-hero-copy h1 {
    font-size: 24px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.housing-hero-text {
    color: #424242;
    font-size: 13px;
    line-height: 1.5;
}

.housing-upgrade-form {
    margin-top: 2px;
}

.housing-main-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.housing-stat-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #ededed;
    font-size: 12px;
}

.housing-stat-line span {
    color: var(--muted);
}

.housing-stat-line span small {
    display: block;
    margin-top: 2px;
    color: #7a7a7a;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.housing-stat-line strong {
    color: #1d1d1d;
}

.housing-tier-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.housing-tier-card {
    border: 1px solid #d9d9d9;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    padding: 12px;
    display: grid;
    gap: 10px;
}

.site-footer {
    max-width: 1380px;
    margin: 0 auto 18px;
    padding: 0 12px;
}

.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-top: 1px solid #d8d0c7;
    color: #6b645e;
    font-size: 11px;
}

.site-footer-inner a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.site-footer-inner a:hover {
    text-decoration: underline;
}

.housing-tier-card.current {
    border-color: #9f2a2a;
    box-shadow: inset 3px 0 0 #9f2a2a;
}

.housing-tier-card.upcoming {
    border-color: #1f6b84;
    box-shadow: inset 3px 0 0 #1f6b84;
}

.housing-tier-media {
    height: 180px;
    border: 1px solid #e1ddd7;
    background: linear-gradient(180deg, #f8f4ee 0%, #ede4d6 100%);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.housing-tier-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 14px;
}

.housing-tier-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.housing-tier-title {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.housing-tier-copy {
    font-size: 12px;
    color: #4f4f4f;
    line-height: 1.45;
}

.housing-tier-meta {
    display: grid;
    gap: 0;
}

.credits-list {
    display: grid;
    gap: 8px;
}

.credits-link {
    display: block;
    padding: 9px 10px;
    border: 1px solid #e3ddd6;
    background: #fbfaf8;
    color: #3a332d;
    text-decoration: none;
    font-size: 12px;
}

.credits-link:hover {
    border-color: #cdb8aa;
    color: var(--accent);
    background: #fffdf9;
}

.chip {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 6px;
    border: 1px solid #dfdfdf;
    background: #fafafa;
}

.chip.warn {
    color: var(--warn);
    border-color: #e0d4bc;
    background: #fbf8f1;
}

.chip.ok {
    color: var(--ok);
    border-color: #cfe0d6;
    background: #f4faf6;
}

.grid-3 {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th {
    text-align: left;
    background: #f7f7f7;
    border-bottom: 1px solid #d8d8d8;
    color: #383838;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 7px 8px;
}

td {
    border-bottom: 1px solid #ececec;
    padding: 7px 8px;
    color: #474747;
}

tr:hover td {
    background: #fcfcfc;
}

.tiny {
    font-size: 11px;
    color: #666;
}

.stat-meter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-meter-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.stat-meter-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex: 0 0 14px;
}

.status {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 5px;
    border: 1px solid #ddd;
    background: #fafafa;
    color: #444;
}

.status.hot {
    color: #8f1d1d;
    border-color: #ddc4c4;
    background: #fbf4f4;
}

.status.good {
    color: #2f7f4f;
    border-color: #cde0d4;
    background: #f3faf5;
}

.now-feed {
    font-size: 12px;
    color: #1f1f1f;
    line-height: 1.45;
}

.now-feed p {
    margin-bottom: 6px;
}
.now-feed strong {
    color: #5a0e0e;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.tone-ok {
    color: var(--ok);
}

.tone-warn {
    color: var(--warn);
}

.tone-danger {
    color: #c0392b;
}

/* Loyalty bar */
.loyalty-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0 2px;
}

.loyalty-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loyalty-bar.loyalty-ok     { background: var(--ok); }
.loyalty-bar.loyalty-warn   { background: var(--warn); }
.loyalty-bar.loyalty-danger { background: #c0392b; }

.loyalty-label {
    font-size: 10px;
    text-align: center;
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.arrears-row strong { font-weight: 900; }

.badge-walked {
    font-size: 9px;
    font-weight: 900;
    background: #c0392b;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.06em;
}

.live-officer.walked {
    filter: grayscale(1) opacity(0.5);
}

/* Arrested / sentenced dimmed portrait */
.live-officer.arrested-dim {
    filter: grayscale(1) opacity(0.4);
}

/* Status badges */
.badge-status {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.06em;
    color: #fff;
}

.badge-arrested  { background: #c0392b; }
.badge-sentenced { background: #7b1818; }
.badge-served    { background: #27ae60; }

.crew-board {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crew-org-shell {
    display: grid;
    gap: 14px;
}

.crew-org-title {
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.crew-boss-wrap {
    display: flex;
    justify-content: center;
}

.boss-card {
    width: min(100%, 290px);
    border: 2px solid #6bb7e2;
    background: linear-gradient(180deg, #39a5df 0%, #1d88c3 100%);
    color: #101820;
    padding: 12px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.boss-ribbon {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(16, 24, 32, 0.72);
}

.boss-name {
    margin-top: 3px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.boss-meta {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.boss-stats {
    margin-top: 10px;
    display: grid;
    gap: 4px;
}

.boss-stats .stat-row span,
.boss-stats .stat-row strong {
    color: #101820;
}

.crew-connector {
    display: flex;
    justify-content: center;
    height: 30px;
    position: relative;
}

.crew-connector span {
    display: block;
    width: calc(100% - 80px);
    max-width: 980px;
    position: relative;
    border-top: 2px solid #8a8a8a;
}

.crew-connector span::before {
    content: "";
    position: absolute;
    top: -30px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: #8a8a8a;
    transform: translateX(-50%);
}

.org-board {
    position: relative;
}

.crew-card {
    border: 1px solid var(--line);
    background: #fcfcfc;
    padding: 10px;
    display: grid;
    gap: 8px;
    position: relative;
}

.org-board .crew-card::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 50%;
    width: 2px;
    height: 15px;
    background: #8a8a8a;
    transform: translateX(-50%);
}

.crew-card.locked {
    background: #f6f6f6;
}

.crew-card-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.crew-slot-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.crew-portrait {
    height: 150px;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #efefef 0%, #dcdcdc 100%);
    font-size: 40px;
    font-weight: 800;
    color: var(--accent);
    overflow: hidden;
}

.silhouette-frame {
    background: #f3f3f3;
    width: 50px;
    height: 50px;
    overflow: hidden;
    margin: 0 auto;
}

.silhouette-frame img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    object-position: center bottom;
    filter: contrast(1.02);
}

.crew-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-align: center;
}

.crew-role {
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 800;
}

.live-officer {
    background: linear-gradient(180deg, #f5efe8 0%, #e0d6ca 100%);
    width: 50px;
    height: 50px;
    overflow: hidden;
    margin: 0 auto;
}

.live-officer img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    object-position: center bottom;
    filter: contrast(1.02);
}

.crew-recruit-form,
.crime-form-grid {
    display: grid;
    gap: 6px;
}

.crime-officer-select {
    width: 100%;
}

.crime-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.crime-list-icon-wrap {
    width: 35px;
    min-width: 35px;
    max-width: 35px;
    height: 35px;
    min-height: 35px;
    max-height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    place-items: center;
    border: 1px solid #ddd6cb;
    background: linear-gradient(180deg, #fbf8f3 0%, #eee6d9 100%);
    flex: 0 0 35px;
    overflow: hidden;
}

.crime-list-icon {
    width: 22px;
    max-width: 22px;
    height: 22px;
    max-height: 22px;
    object-fit: contain;
    display: block;
    flex: 0 0 22px;
}

.chip-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.crew-stats {
    display: grid;
    gap: 4px;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        grid-template-columns: 1fr;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-side {
        justify-items: start;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .housing-hero,
    .housing-main-grid,
    .housing-tier-grid {
        grid-template-columns: 1fr;
    }

    .crew-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crew-connector span {
        width: calc(100% - 40px);
    }
}

@media (max-width: 680px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .housing-status-banner {
        padding: 9px 12px;
    }

    .housing-status-banner strong {
        font-size: 13px;
    }

    .housing-hero-visual {
        max-width: 100%;
    }

    .page-intro {
        align-items: flex-start;
    }

    .crew-connector {
        display: none;
    }

    .org-board .crew-card::before {
        display: none;
    }

    .crew-board {
        grid-template-columns: 1fr;
    }
}
