/* =========================================================================
   Loquary — Super Admin "Command Center"
   Cyberpunk dashboard shell. Built on the tokens in app.css; everything here
   is scoped under body.cc so it can't leak into the world/account pages.
   ========================================================================= */
body.cc {
    --cc-bg: #0a0e14;
    --cc-panel: #10151d;
    --cc-panel-2: #131a24;
    --cc-line: rgba(255, 255, 255, 0.07);
    --cc-line-strong: rgba(255, 255, 255, 0.13);
    --cc-text: #eef1f5;
    --cc-muted: #838d9c;
    --cc-red: #ff3b2f;
    --cc-red-deep: #e5321f;
    --cc-teal: #5fd6f5;
    --cc-green: #4bd88a;
    --cc-gold: #e6ab55;

    display: block;
    background:
        radial-gradient(
            circle at 82% -5%,
            rgba(229, 50, 31, 0.12),
            transparent 42%
        ),
        var(--cc-bg);
    color: var(--cc-text);
}

.cc-layout {
    display: grid;
    grid-template-columns: 236px 1fr;
    min-height: 100vh;
}

/* ---- Sidebar --------------------------------------------------------- */
.cc-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0b0f16 0%, #090c12 100%);
    border-right: 1px solid var(--cc-line);
    overflow: hidden;
}
.cc-logo {
    padding: 22px 22px 20px;
    border-bottom: 1px solid var(--cc-line);
}
.cc-logo-main {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 0.06em;
    line-height: 1;
    color: #fff;
}
.cc-logo-main .jp {
    color: var(--cc-red);
    margin: 0 1px;
}
.cc-logo-sub {
    margin-top: 8px;
    color: var(--cc-red);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
}
.cc-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 12px 20px;
    gap: 2px;
    z-index: 1;
}
.cc-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    color: var(--cc-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition:
        color 0.15s,
        background 0.15s;
}
.cc-nav-item svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    opacity: 0.85;
}
.cc-nav-item:hover {
    color: var(--cc-text);
    background: rgba(255, 255, 255, 0.03);
}
.cc-nav-item.active {
    color: var(--cc-red);
    background: linear-gradient(90deg, rgba(229, 50, 31, 0.16), transparent);
    border-left-color: var(--cc-red);
}
/* leftcolumn art fading up into the nav */
.cc-sidebar-art {
    margin-top: auto;
    height: 300px;
    background: url("../img/admin/leftcolumn.webp") center bottom / cover
        no-repeat;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 42%);
    mask-image: linear-gradient(180deg, transparent, #000 42%);
    opacity: 0.9;
    pointer-events: none;
}

/* ---- Main column ----------------------------------------------------- */
.cc-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 22px 0;
    gap: 18px;
}

/* ---- Banner ---------------------------------------------------------- */
.cc-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 132px;
    padding: 22px 26px;
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background:
        linear-gradient(
            90deg,
            rgba(10, 14, 20, 0.96) 8%,
            rgba(10, 14, 20, 0.6) 42%,
            rgba(10, 14, 20, 0.15) 72%,
            rgba(10, 14, 20, 0.55) 100%
        ),
        url("../img/admin/banner.webp") center 30% / cover no-repeat;
}
.cc-banner-text {
    position: relative;
    z-index: 1;
}
.cc-banner-text h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 34px;
    letter-spacing: 0.04em;
    color: #fff;
}
.cc-banner-text p {
    margin: 8px 0 0;
    color: var(--cc-muted);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.cc-user {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 11px;
}
.cc-user-meta {
    text-align: right;
    line-height: 1.35;
}
.cc-user-meta .role {
    display: block;
    color: var(--cc-red);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.18em;
}
.cc-user-meta .name {
    display: block;
    color: var(--cc-text);
    font-size: 13px;
    font-weight: 600;
}
.cc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(150deg, #b3301f, #5a1712);
    border: 1px solid rgba(255, 120, 100, 0.5);
}
.cc-user .chev {
    color: var(--cc-muted);
    width: 14px;
    height: 14px;
}

/* ---- Stat cards ------------------------------------------------------ */
.cc-stats {
    display: grid;
    grid-template-columns: repeat(4, 1.18fr) repeat(3, 0.84fr);
    gap: 14px;
}
.cc-stat {
    position: relative;
    padding: 15px 16px;
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
    min-width: 0;
    overflow: hidden;
}
.cc-stat-top {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--cc-muted);
}
.cc-stat-ico {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
    flex: 0 0 auto;
}
.cc-stat-ico svg {
    width: 16px;
    height: 16px;
}
.cc-stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.cc-stat-value {
    margin-top: 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 27px;
    color: #fff;
    line-height: 1;
}
.cc-delta {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
}
.cc-delta.up {
    color: var(--cc-green);
}
.cc-delta.down {
    color: var(--cc-red);
}
.cc-stat-sub {
    margin-top: 6px;
    color: var(--cc-muted);
    font-size: 11.5px;
}
.cc-spark {
    display: block;
    width: 100%;
    height: 34px;
    margin-top: 10px;
}
/* budget bar in the "AI spend this month" card */
.cc-budget {
    margin-top: 12px;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.cc-budget > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cc-red-deep), var(--cc-red));
}
.cc-budget-pct {
    float: right;
    color: var(--cc-muted);
    font-size: 11px;
}
/* compact cards (paused / memory / billing issues) */
.cc-stat.compact .cc-stat-value {
    margin-top: 14px;
    font-size: 30px;
}

/* ---- Panel rows ------------------------------------------------------ */
.cc-row {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 16px;
}
.cc-panel {
    position: relative;
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    padding: 16px 18px 14px;
    min-width: 0;
    overflow: hidden;
}
.cc-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.cc-panel-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--cc-text);
}
.cc-select {
    background: var(--cc-panel-2);
    color: var(--cc-muted);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    font-size: 11px;
    padding: 5px 8px;
}
.cc-more {
    display: inline-block;
    margin-top: 12px;
    color: var(--cc-red);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    text-decoration: none;
}
.cc-more:hover {
    color: #ff6a5f;
}

/* ---- Needs Attention list ------------------------------------------- */
.cc-attn {
    display: flex;
    flex-direction: column;
}
.cc-attn-item {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
}
.cc-attn-item:last-child {
    border-bottom: 0;
}
.cc-attn-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.cc-attn-ico svg {
    width: 17px;
    height: 17px;
}
.cc-attn-ico.gold {
    color: var(--cc-gold);
    background: rgba(230, 171, 85, 0.1);
    border: 1px solid rgba(230, 171, 85, 0.3);
}
.cc-attn-ico.red {
    color: var(--cc-red);
    background: rgba(229, 50, 31, 0.1);
    border: 1px solid rgba(229, 50, 31, 0.32);
}
.cc-attn-body b {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--cc-text);
}
.cc-attn-body span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--cc-muted);
}
.cc-attn-btn {
    padding: 6px 11px;
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--cc-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    white-space: nowrap;
}
.cc-attn-btn:hover {
    color: var(--cc-text);
    border-color: var(--cc-red);
}

/* ---- Charts ---------------------------------------------------------- */
.cc-chart {
    width: 100%;
    height: 218px;
    display: block;
}
.cc-chart .axis {
    fill: var(--cc-muted);
    font-size: 10px;
}
.cc-chart .grid {
    stroke: var(--cc-line);
    stroke-width: 1;
}

/* ---- Tables ---------------------------------------------------------- */
.cc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.cc-table th {
    text-align: left;
    padding: 7px 8px;
    color: var(--cc-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--cc-line);
}
.cc-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--cc-line);
    vertical-align: middle;
}
.cc-table tr:last-child td {
    border-bottom: 0;
}
.cc-table td.name {
    color: var(--cc-text);
    font-weight: 600;
}
.cc-table td.num {
    font-variant-numeric: tabular-nums;
}
.cc-table .muted {
    color: var(--cc-muted);
}
.cc-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    color: var(--cc-muted);
    border: 1px solid var(--cc-line);
}
.cc-trend {
    width: 60px;
    height: 20px;
    display: block;
}
/* usage bar inside the users table */
.cc-usage {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cc-usage-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    min-width: 46px;
}
.cc-usage-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cc-gold), var(--cc-red));
}
.cc-usage-pct {
    color: var(--cc-muted);
    font-size: 11px;
    width: 30px;
    text-align: right;
}

/* ---- Recent admin actions ------------------------------------------- */
.cc-actions {
    display: flex;
    flex-direction: column;
}
.cc-action {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--cc-line);
    font-size: 12px;
}
.cc-action:last-child {
    border-bottom: 0;
}
.cc-action-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(150deg, #7a2418, #3a0f0b);
    border: 1px solid rgba(255, 120, 100, 0.35);
}
.cc-action-body .who {
    color: var(--cc-muted);
}
.cc-action-body .what {
    color: var(--cc-text);
    font-weight: 600;
}
.cc-action-body .target {
    color: var(--cc-teal);
}
.cc-action-time {
    color: var(--cc-muted);
    font-size: 11px;
    white-space: nowrap;
}

/* ---- System health --------------------------------------------------- */
.cc-panel--health .cc-health {
    position: relative;
    z-index: 1;
    max-width: 62%;
}
.cc-health-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--cc-line);
    font-size: 12.5px;
}
.cc-health-row:last-child {
    border-bottom: 0;
}
.cc-health-row .svc {
    color: var(--cc-text);
}
.cc-health-row .stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--cc-green);
    font-size: 11.5px;
    font-weight: 600;
}
.cc-health-row .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cc-green);
    box-shadow: 0 0 0 3px rgba(75, 216, 138, 0.15);
}
.cc-health-row.down .stat {
    color: var(--cc-red);
}
.cc-health-row.down .dot {
    background: var(--cc-red);
    box-shadow: 0 0 0 3px rgba(229, 50, 31, 0.15);
}
.cc-health-art {
    position: absolute;
    right: 0;
    bottom: 0;
    top: 0;
    width: 46%;
    background: url("../img/admin/lowerright.webp") right center / cover
        no-repeat;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%);
    mask-image: linear-gradient(90deg, transparent, #000 55%);
    opacity: 0.85;
    pointer-events: none;
}

/* ---- Footer ---------------------------------------------------------- */
.cc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 20px;
    margin-top: 4px;
    color: var(--cc-muted);
    font-size: 11px;
    border-top: 1px solid var(--cc-line);
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 1180px) {
    .cc-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    .cc-row {
        grid-template-columns: 1fr;
    }
    .cc-panel--health .cc-health {
        max-width: 100%;
    }
    .cc-health-art {
        opacity: 0.25;
    }
}
@media (max-width: 900px) {
    .cc-layout {
        grid-template-columns: 1fr;
    }
    .cc-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--cc-line);
    }
    .cc-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .cc-sidebar-art {
        display: none;
    }
    .cc-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================================
   Worlds page
   ========================================================================= */
.cc-stats--worlds {
    grid-template-columns: repeat(6, 1fr);
}
.cc-stat-ico.green-ico {
    color: var(--cc-green);
    border-color: rgba(75, 216, 138, 0.3);
}
.cc-stat-ico.gold-ico {
    color: var(--cc-gold);
    border-color: rgba(230, 171, 85, 0.3);
}
.cc-stat-ico.red-ico {
    color: var(--cc-red);
    border-color: rgba(229, 50, 31, 0.32);
}

.cc-worlds-panel {
    padding: 0;
}
.cc-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--cc-line);
    flex-wrap: wrap;
}
.cc-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.cc-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--cc-muted);
}
.cc-search input {
    width: 100%;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-text);
    font-size: 13px;
    padding: 9px 12px 9px 34px;
}
.cc-search input::placeholder {
    color: var(--cc-muted);
}
.cc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cc-field span {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cc-muted);
}
.cc-toolbar .cc-select {
    padding: 8px 10px;
    min-width: 120px;
}
.cc-create-btn {
    margin-left: auto;
    padding: 9px 16px;
    background: rgba(229, 50, 31, 0.1);
    border: 1px solid var(--cc-red);
    border-radius: var(--radius-sm);
    color: var(--cc-red);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
}
.cc-create-btn:hover {
    background: rgba(229, 50, 31, 0.2);
}

.cc-table-wrap {
    overflow-x: auto;
}
.cc-worlds-table {
    min-width: 940px;
}
.cc-worlds-table th,
.cc-worlds-table td {
    padding: 12px 14px;
}
.cc-worlds-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.w-world {
    display: flex;
    align-items: center;
    gap: 11px;
}
.w-thumb {
    width: 40px;
    height: 30px;
    border-radius: 5px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    background: linear-gradient(
        150deg,
        hsl(var(--h, 210), 45%, 32%),
        hsl(var(--h, 210), 55%, 12%)
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.w-world-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.w-world-txt small {
    color: var(--cc-muted);
    font-size: 11px;
}
.w-owner {
    color: var(--cc-muted);
    white-space: nowrap;
}
.w-av {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(150deg, #7a2418, #3a0f0b);
    border: 1px solid rgba(255, 120, 100, 0.35);
}
.w-av.muted {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--cc-line);
    color: var(--cc-muted);
}
.w-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
}
.w-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.w-status.running {
    color: var(--cc-green);
}
.w-status.running .dot {
    background: var(--cc-green);
    box-shadow: 0 0 0 3px rgba(75, 216, 138, 0.15);
}
.w-status.paused {
    color: var(--cc-gold);
}
.w-status.paused .dot {
    background: var(--cc-gold);
    box-shadow: 0 0 0 3px rgba(230, 171, 85, 0.15);
}
.w-status.broken {
    color: var(--cc-red);
}
.w-status.broken .dot {
    background: var(--cc-red);
    box-shadow: 0 0 0 3px rgba(229, 50, 31, 0.15);
}
.cc-worlds-table td small {
    font-size: 10.5px;
}
.w-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}
.w-actions button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: 6px;
    color: var(--cc-muted);
    font-size: 12px;
    cursor: pointer;
}
.w-actions button:hover {
    color: var(--cc-text);
    border-color: var(--cc-red);
}
/* Map-skin picker — matches the action buttons but needs room for a label. */
.w-actions .w-skin {
    height: 30px;
    max-width: 150px;
    padding: 0 6px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: 6px;
    color: var(--cc-muted);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}
.w-actions .w-skin:hover {
    color: var(--cc-text);
    border-color: var(--cc-red);
}
.w-actions .w-skin:disabled {
    opacity: 0.5;
    cursor: progress;
}

.cc-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid var(--cc-line);
    flex-wrap: wrap;
    gap: 10px;
}
.cc-pager-info {
    color: var(--cc-muted);
    font-size: 12px;
}
.cc-pager-btns {
    display: flex;
    gap: 6px;
}
.cc-pager-btns button {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: 6px;
    color: var(--cc-muted);
    font-size: 12px;
    cursor: pointer;
}
.cc-pager-btns button.active {
    background: var(--cc-red);
    border-color: var(--cc-red);
    color: #fff;
    font-weight: 700;
}
.cc-pager-btns button:hover:not(.active):not(:disabled) {
    color: var(--cc-text);
    border-color: var(--cc-red);
}
.cc-pager-btns button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 1180px) {
    .cc-stats--worlds {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 900px) {
    .cc-stats--worlds {
        grid-template-columns: repeat(2, 1fr);
    }
    .cc-create-btn {
        margin-left: 0;
    }
}

/* =========================================================================
   NPC Management page
   ========================================================================= */
.npc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px;
    gap: 16px;
    align-items: start;
}
.npc-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.cc-stats--npc {
    grid-template-columns: repeat(5, 1fr);
}

.cc-ghost-btn {
    padding: 8px 12px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-muted);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cc-ghost-btn:hover {
    color: var(--cc-text);
    border-color: var(--cc-red);
}
.cc-ghost-btn.danger {
    color: #ff8b80;
    border-color: rgba(229, 50, 31, 0.4);
}

/* NPC list table */
.npc-table {
    min-width: 940px;
}
.npc-table th,
.npc-table td {
    padding: 10px 12px;
}
.npc-table tbody tr {
    cursor: pointer;
}
.npc-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}
.npc-table tbody tr.selected {
    background: rgba(229, 50, 31, 0.08);
    box-shadow: inset 3px 0 0 var(--cc-red);
}
.n-npc {
    display: flex;
    align-items: center;
    gap: 10px;
}
.n-av {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(
        150deg,
        hsl(var(--h, 210), 45%, 34%),
        hsl(var(--h, 210), 55%, 13%)
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.n-npc-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.n-npc-txt small,
.n-world small {
    font-size: 10.5px;
}
.n-world b {
    font-weight: 600;
    color: var(--cc-text);
}
.n-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
}
.n-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.n-status.active {
    color: var(--cc-green);
}
.n-status.active .dot {
    background: var(--cc-green);
}
.n-status.idle {
    color: #9aa6ff;
}
.n-status.idle .dot {
    background: #9aa6ff;
}
.n-status.sleeping {
    color: #8fa3c8;
}
.n-status.sleeping .dot {
    background: #8fa3c8;
}
.n-status.paused {
    color: var(--cc-gold);
}
.n-status.paused .dot {
    background: var(--cc-gold);
}
.n-health {
    font-weight: 600;
    font-size: 12px;
}
.n-health.excellent {
    color: #48d1c9;
}
.n-health.good {
    color: var(--cc-green);
}
.n-health.fair {
    color: var(--cc-gold);
}
.n-health.poor {
    color: var(--cc-red);
}

/* Detail panel */
.npc-detail {
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    padding: 18px;
    min-width: 0;
    position: sticky;
    top: 16px;
}
.npc-detail-head {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 14px;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cc-line);
}
.npc-portrait {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    color: #fff;
    background: linear-gradient(
        150deg,
        hsl(var(--h, 210), 45%, 34%),
        hsl(var(--h, 210), 55%, 12%)
    );
    border: 1px solid rgba(255, 255, 255, 0.14);
}
.npc-detail-name {
    display: flex;
    align-items: center;
    gap: 10px;
}
.npc-detail-name b {
    font-family: var(--font-display);
    font-size: 19px;
    color: #fff;
}
.npc-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-green);
}
.npc-live .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.npc-live.idle {
    color: #9aa6ff;
}
.npc-live.sleeping {
    color: #8fa3c8;
}
.npc-live.paused {
    color: var(--cc-gold);
}
.npc-detail-job {
    margin-top: 4px;
    color: var(--cc-text);
    font-size: 13px;
}
.npc-detail-world {
    color: var(--cc-muted);
    font-size: 12px;
}
.npc-detail-code {
    color: var(--cc-muted);
    font-size: 11px;
    margin-top: 2px;
}
.npc-detail-head .cc-ghost-btn {
    color: var(--cc-gold);
    border-color: rgba(230, 171, 85, 0.4);
    align-self: start;
}

/* tabs */
.npc-tabs {
    display: flex;
    gap: 4px;
    margin: 14px 0 16px;
    border-bottom: 1px solid var(--cc-line);
    overflow-x: auto;
}
.npc-tab {
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
}
.npc-tab:hover {
    color: var(--cc-text);
}
.npc-tab.active {
    color: var(--cc-red);
    border-bottom-color: var(--cc-red);
}

.npc-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}
.npc-subtab {
    padding: 6px 12px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line);
    border-radius: 20px;
    color: var(--cc-muted);
    font-size: 11.5px;
    cursor: pointer;
}
.npc-subtab.active {
    color: var(--cc-red);
    border-color: var(--cc-red);
    background: rgba(229, 50, 31, 0.08);
}

/* vector card */
.npc-vecard {
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 14px;
    background: var(--cc-panel-2);
}
.npc-vecard-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-text);
    margin-bottom: 12px;
}
.npc-vecard-title span {
    color: var(--cc-muted);
    font-weight: 400;
}
.npc-vecard-btns {
    margin-left: auto;
    display: flex;
    gap: 6px;
}
.npc-vecard-btns .cc-ghost-btn {
    padding: 5px 9px;
    font-size: 10.5px;
}
.npc-vecard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.npc-vecard-grid small {
    display: block;
    color: var(--cc-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}
.npc-vecard-grid b {
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--cc-text);
}

.npc-mem-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.npc-mem-toolbar .cc-search {
    flex: 1;
}
.npc-mem-table {
    min-width: 0;
    font-size: 12px;
}
.npc-mem-table th,
.npc-mem-table td {
    padding: 9px 8px;
}
.n-mem-sum {
    max-width: 190px;
    color: var(--cc-text);
    line-height: 1.35;
}
.n-mem-tags {
    max-width: 110px;
}
.n-tag {
    display: inline-block;
    margin: 0 3px 3px 0;
    padding: 1px 7px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cc-line);
    color: var(--cc-muted);
    font-size: 10px;
}
.n-mem-vec {
    font-size: 10px;
    line-height: 1.4;
}
.v-hi {
    color: #ff5a4a;
    font-weight: 700;
}
.v-md {
    color: var(--cc-gold);
    font-weight: 700;
}
.v-lo {
    color: #f0864f;
    font-weight: 700;
}
.v-ok {
    color: var(--cc-green);
    font-weight: 700;
}
.npc-mem-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* overview / schedule / lists */
.npc-kv-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 2px;
    border-bottom: 1px solid var(--cc-line);
    font-size: 13px;
}
.npc-kv-row:last-child {
    border-bottom: 0;
}
.npc-kv-row span {
    color: var(--cc-muted);
}
.npc-kv-row b {
    color: var(--cc-text);
    text-transform: capitalize;
}
.npc-line {
    padding: 11px 2px;
    border-bottom: 1px solid var(--cc-line);
}
.npc-line b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
    font-size: 13px;
}
.npc-line span {
    font-size: 11.5px;
}
.npc-empty {
    padding: 26px 8px;
    text-align: center;
    color: var(--cc-muted);
    font-size: 12.5px;
}

@media (max-width: 1240px) {
    .npc-grid {
        grid-template-columns: 1fr;
    }
    .npc-detail {
        position: static;
    }
    .cc-stats--npc {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 760px) {
    .cc-stats--npc {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Sample-data warning banner --------------------------------------- */
.cc-mockbanner {
    padding: 11px 16px;
    border: 1px solid rgba(230, 171, 85, 0.5);
    border-radius: var(--radius-md);
    background: rgba(230, 171, 85, 0.09);
    color: var(--cc-gold);
    font-size: 12.5px;
    line-height: 1.45;
    cursor: pointer;
}
.cc-mockbanner:hover {
    background: rgba(230, 171, 85, 0.16);
}
.cc-mockbanner b {
    letter-spacing: 0.06em;
}
.cc-mockbanner code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 11px;
    color: var(--cc-text);
}

/* ---- NPC detail: relationship / god-bond cards ------------------------ */
.n-relcard {
    padding: 12px 2px;
    border-bottom: 1px solid var(--cc-line);
}
.n-relcard:last-child {
    border-bottom: 0;
}
.n-relhead {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.n-relhead b {
    color: var(--cc-text);
    font-size: 13px;
    font-weight: 600;
}
.n-reltype {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cc-muted);
    border: 1px solid var(--cc-line-strong);
    border-radius: 12px;
    padding: 1px 7px;
}
.n-bar-row {
    display: grid;
    grid-template-columns: 92px 1fr 48px;
    gap: 8px;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    color: var(--cc-muted);
    text-transform: capitalize;
}
.n-bar {
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.n-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cc-teal), #6aa8ff);
}
.n-bar i.neg {
    background: linear-gradient(90deg, var(--cc-red-deep), var(--cc-red));
}
.n-bar-val {
    color: var(--cc-text);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.n-rel-meta {
    font-size: 10.5px;
    margin-top: 6px;
}

/* ---- NPC detail: wide rows (working memory / recall history) ---------- */
.n-widecell {
    padding: 12px 14px !important;
}
.n-widecell b {
    display: block;
    color: var(--cc-text);
    font-size: 12.5px;
}
.n-widecell small {
    color: var(--cc-muted);
    font-size: 11px;
}
.n-recall-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

/* ---- NPC detail: conversations ---------------------------------------- */
.n-convo-room {
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--cc-panel-2);
}
.n-convo-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11px;
}
.n-convo-head b {
    color: var(--cc-text);
    font-size: 12px;
    word-break: break-all;
}
.n-convo-line {
    padding: 7px 10px;
    border-radius: 8px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.03);
    max-width: 92%;
}
.n-convo-line.self {
    margin-left: auto;
    background: rgba(229, 50, 31, 0.08);
    border: 1px solid rgba(229, 50, 31, 0.2);
}
.n-convo-line.sp-player {
    border-left: 2px solid var(--cc-teal);
}
.n-convo-line.sp-system {
    opacity: 0.75;
    font-style: italic;
}
.n-convo-speaker {
    display: block;
    font-size: 10px;
    color: var(--cc-muted);
    margin-bottom: 3px;
}
.n-convo-speaker em {
    font-style: normal;
    margin-left: 4px;
    opacity: 0.7;
}
.n-convo-line p {
    margin: 0;
    font-size: 12.5px;
    color: var(--cc-text);
    line-height: 1.4;
}

/* ---- NPC detail: integrity check --------------------------------------- */
.npc-integrity {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--cc-line);
}
.npc-integrity-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.n-integrity-ok {
    color: var(--cc-green);
    font-size: 12.5px;
    padding: 8px 0;
}
.n-integrity-bad {
    color: var(--cc-gold);
    font-size: 12.5px;
    padding: 8px 0;
}
.n-issue {
    padding: 7px 10px;
    border-left: 2px solid var(--cc-muted);
    margin: 5px 0;
    font-size: 12px;
    color: var(--cc-muted);
    background: rgba(255, 255, 255, 0.02);
}
.n-issue b {
    text-transform: uppercase;
    font-size: 10px;
    margin-right: 6px;
}
.n-issue.high,
.n-issue.critical {
    border-left-color: var(--cc-red);
}
.n-issue.high b,
.n-issue.critical b {
    color: var(--cc-red);
}
.n-issue.medium {
    border-left-color: var(--cc-gold);
}
.n-issue.medium b {
    color: var(--cc-gold);
}

/* =========================================================================
   Billing Ops page
   ========================================================================= */
body.cc .err {
    color: var(--cc-red);
}
body.cc .ok {
    color: var(--cc-green);
}
.bill-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}
.bill-left,
.bill-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.cc-stats--bill {
    grid-template-columns: repeat(5, 1fr);
}

/* customer table */
.bill-table {
    min-width: 880px;
}
.bill-table th,
.bill-table td {
    padding: 11px 12px;
}
.bill-table tbody tr {
    cursor: pointer;
}
.bill-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}
.bill-table tbody tr.selected {
    background: rgba(229, 50, 31, 0.08);
    box-shadow: inset 3px 0 0 var(--cc-red);
}
.b-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.b-av {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(
        150deg,
        hsl(var(--h, 210), 45%, 34%),
        hsl(var(--h, 210), 55%, 13%)
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.b-av.lg {
    width: 48px;
    height: 48px;
    font-size: 19px;
}
.b-user-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.b-user-txt small {
    font-size: 10.5px;
    color: var(--cc-muted);
}
.b-bonus {
    color: var(--cc-green);
    font-size: 10.5px;
}
.b-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
}
.b-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.b-status.active {
    color: var(--cc-green);
}
.b-status.active .dot {
    background: var(--cc-green);
}
.b-status.pastdue {
    color: var(--cc-gold);
}
.b-status.pastdue .dot {
    background: var(--cc-gold);
}
.b-status.cancelled {
    color: var(--cc-muted);
}
.b-status.cancelled .dot {
    background: var(--cc-muted);
}
.b-status.trial {
    color: #6aa8ff;
}
.b-status.trial .dot {
    background: #6aa8ff;
}

/* stripe card (mock) */
.bill-stripe {
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}
.bill-stripe-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bill-stripe-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    color: #a79bff;
    letter-spacing: -0.02em;
}
.bill-stripe-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-green);
}
.bill-stripe-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cc-green);
    box-shadow: 0 0 0 3px rgba(75, 216, 138, 0.15);
}
.bill-stripe-acct {
    margin: 12px 0 10px;
    color: var(--cc-muted);
    font-size: 11.5px;
    word-break: break-all;
}
.bill-livemode {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--cc-green);
    background: rgba(75, 216, 138, 0.1);
    border: 1px solid rgba(75, 216, 138, 0.3);
    margin-bottom: 14px;
}
.bill-stripe .cc-ghost-btn {
    display: block;
    width: 100%;
    text-align: center;
}

/* detail panel */
.bill-detail {
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    position: sticky;
    top: 16px;
}
.bill-detail-head {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cc-line);
}
.bill-detail-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bill-detail-name b {
    font-family: var(--font-display);
    font-size: 17px;
    color: #fff;
}
.bill-detail-email {
    color: var(--cc-muted);
    font-size: 12px;
    margin-top: 3px;
}
.bill-detail-code {
    color: var(--cc-muted);
    font-size: 10.5px;
    margin-top: 2px;
}
.bill-detail-code span {
    color: #a9b2c0;
}

.cc-ghost-btn.sm,
.cc-create-btn.sm {
    padding: 5px 10px;
    font-size: 10.5px;
}
.bill-sec {
    padding: 14px 0;
    border-bottom: 1px solid var(--cc-line);
}
.bill-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.bill-sec-head span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cc-muted);
}
.bill-plan-name {
    font-family: var(--font-display);
    font-size: 18px;
    color: #fff;
}
.bill-plan-meta {
    color: var(--cc-muted);
    font-size: 11.5px;
    margin-top: 3px;
}
.bill-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cc-line);
}
.bill-grid2 small {
    display: block;
    color: var(--cc-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.bill-grid2 b {
    display: block;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--cc-text);
}
.bill-grid2 span {
    color: var(--cc-muted);
    font-size: 11px;
}
.bill-token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12.5px;
    color: var(--cc-muted);
}
.bill-token-row b {
    color: var(--cc-text);
    margin-left: auto;
}
.bill-token-row em {
    font-style: normal;
    color: var(--cc-muted);
    font-size: 10.5px;
    margin-left: 8px;
}
.bill-token-row.total {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--cc-line);
    font-weight: 600;
}
.bill-token-row.total b {
    font-family: var(--font-display);
    font-size: 16px;
    color: #fff;
    margin-left: 0;
}
.bill-token-row.total span {
    flex: 1;
}
.b-token-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin: 2px 0 6px;
}
.b-token-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #3aa76d, var(--cc-green));
}
.b-quick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.b-quick .cc-ghost-btn {
    text-align: center;
}
.b-portal-btn {
    margin-top: 14px;
    width: 100%;
    padding: 11px;
    background: rgba(229, 50, 31, 0.1);
    border: 1px solid var(--cc-red);
    border-radius: var(--radius-sm);
    color: var(--cc-red);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}
.b-portal-btn:hover {
    background: rgba(229, 50, 31, 0.2);
}

@media (max-width: 1300px) {
    .bill-grid {
        grid-template-columns: 1fr;
    }
    .bill-detail {
        position: static;
    }
    .cc-stats--bill {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 760px) {
    .cc-stats--bill {
        grid-template-columns: repeat(2, 1fr);
    }
    .b-quick {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   AI Spend page
   ========================================================================= */
.ai-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}
.ai-left,
.ai-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.ai-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}
.ai-toolbar .cc-field {
    gap: 5px;
}
.ai-daterange {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-text);
    font-size: 12px;
    white-space: nowrap;
}
.ai-toolbar .cc-ghost-btn,
.ai-toolbar .cc-create-btn {
    height: 34px;
}
.ai-toolbar .cc-create-btn {
    margin-left: auto;
}
.cc-stats--ai {
    grid-template-columns: repeat(6, 1fr);
}

.ai-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.ai-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* donut */
.ai-donut-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ai-donut {
    width: 168px;
    height: 168px;
    flex: 0 0 auto;
}
.ai-donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}
.ai-leg {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
}
.ai-leg .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.ai-leg .lbl {
    color: var(--cc-text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-leg .val {
    color: var(--cc-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.ai-leg .val em {
    font-style: normal;
    opacity: 0.75;
}

/* model + top tables */
.ai-model-table {
    min-width: 760px;
}
.ai-model-table th,
.ai-model-table td,
.ai-top-table th,
.ai-top-table td,
.ai-recent-table th,
.ai-recent-table td {
    padding: 9px 12px;
}
.ai-pct {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-pct-bar {
    flex: 1;
    min-width: 54px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.ai-pct-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cc-red-deep), var(--cc-red));
}
.ai-top-tabs {
    margin-bottom: 0;
}

/* cost control */
.ai-cc {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ai-cc-toggle,
.ai-cc-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ai-cc-toggle span b,
.ai-cc-field span b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.ai-cc-toggle span small,
.ai-cc-field span small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--cc-muted);
}
.ai-cc-field input {
    width: 90px;
    text-align: right;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-text);
    font-size: 13px;
    padding: 7px 10px;
}
.ai-cc .b-portal-btn {
    margin-top: 12px;
}

/* toggle switch (cost control checkbox + routing indicator) */
.ai-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.14);
    position: relative;
    cursor: pointer;
    display: inline-block;
    border: none;
    flex: 0 0 auto;
    margin: 0;
}
.ai-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.15s;
}
input.ai-switch:checked,
.ai-switch.on {
    background: var(--cc-green);
}
input.ai-switch:checked::after,
.ai-switch.on::after {
    left: 18px;
}

/* model & agent routing */
.ai-routing {
    display: flex;
    flex-direction: column;
}
.ai-route {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ai-route:last-child {
    border-bottom: 0;
}
.ai-route-agent b {
    display: block;
    font-size: 12px;
    color: var(--cc-text);
}
.ai-route-agent small {
    color: var(--cc-muted);
    font-size: 10px;
}
.ai-route-model {
    font-size: 10.5px;
    color: var(--cc-text);
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    padding: 5px 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-recent-table {
    font-size: 11.5px;
}

@media (max-width: 1400px) {
    .cc-stats--ai {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 1200px) {
    .ai-grid {
        grid-template-columns: 1fr;
    }
    .ai-row,
    .ai-row2 {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 760px) {
    .cc-stats--ai {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================================
   System Settings page
   ========================================================================= */
.ss-cats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}
.ss-cat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
}
.ss-cat.active {
    border-color: rgba(95, 214, 245, 0.5);
    box-shadow: inset 0 0 0 1px rgba(95, 214, 245, 0.15);
}
.ss-cat-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
    color: var(--cc-muted);
}
.ss-cat.active .ss-cat-ico {
    color: var(--cc-teal);
    border-color: rgba(95, 214, 245, 0.4);
}
.ss-cat-ico svg {
    width: 18px;
    height: 18px;
}
.ss-cat b {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cc-text);
}
.ss-cat.active b {
    color: var(--cc-teal);
}
.ss-cat small {
    flex: 1;
    color: var(--cc-muted);
    font-size: 11px;
    line-height: 1.4;
}
.ss-cat-btn {
    margin-top: 4px;
    padding: 8px 10px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}
.ss-cat-btn:hover {
    color: var(--cc-text);
    border-color: var(--cc-red);
}
.ss-cat.active .ss-cat-btn {
    color: var(--cc-teal);
    border-color: rgba(95, 214, 245, 0.4);
}

.ss-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
    margin-top: 16px;
}
.ss-left,
.ss-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* API key table */
.ss-key-table {
    min-width: 820px;
}
.ss-key-table th,
.ss-key-table td {
    padding: 11px 12px;
}
.ss-key-name b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.ss-key-name small {
    color: var(--cc-muted);
    font-size: 10.5px;
}
.ss-key-preview {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 11px;
    color: var(--cc-muted);
    letter-spacing: 0.02em;
}
.ss-usage {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}
.ss-usage > span {
    color: var(--cc-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ss-usage em {
    font-style: normal;
    color: var(--cc-muted);
    font-size: 11px;
    width: 34px;
    text-align: right;
}
.w-actions button.del:hover {
    color: var(--cc-red);
    border-color: var(--cc-red);
}

/* platform settings form */
.ss-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.ss-form {
    display: flex;
    flex-direction: column;
}
.ss-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ss-field:last-child {
    border-bottom: 0;
}
.ss-field > span b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.ss-field > span small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--cc-muted);
}
.ss-field input[type="text"],
.ss-field select {
    width: 190px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-text);
    font-size: 13px;
    padding: 8px 10px;
}
.ss-theme {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 200px;
}
.ss-theme button {
    padding: 6px 10px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    color: var(--cc-muted);
    font-size: 10.5px;
    cursor: pointer;
}
.ss-theme button.active {
    color: var(--cc-red);
    border-color: var(--cc-red);
    background: rgba(229, 50, 31, 0.08);
}

/* integrations */
.ss-integrations {
    display: flex;
    flex-direction: column;
}
.ss-int {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ss-int-ico {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(
        150deg,
        hsl(var(--h, 210), 55%, 45%),
        hsl(var(--h, 210), 60%, 22%)
    );
}
.ss-int-txt {
    flex: 1;
    min-width: 0;
}
.ss-int-txt b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.ss-int-txt small {
    color: var(--cc-muted);
    font-size: 11px;
}
.ss-conn {
    color: var(--cc-green);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.ss-integrations .b-portal-btn {
    margin-top: 14px;
    color: var(--cc-text);
    border-color: var(--cc-line-strong);
    background: var(--cc-panel-2);
}
.ss-integrations .b-portal-btn:hover {
    border-color: var(--cc-red);
}

/* security & auth */
.ss-sec {
    display: flex;
    flex-direction: column;
}
.ss-sec-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ss-sec-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
    color: var(--cc-muted);
}
.ss-sec-ico svg {
    width: 17px;
    height: 17px;
}
.ss-sec-row > div {
    flex: 1;
    min-width: 0;
}
.ss-sec-row b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.ss-sec-row small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--cc-muted);
}
.ss-sec-val {
    color: var(--cc-muted);
    font-size: 12px;
    white-space: nowrap;
}
.ss-sec-val.ok {
    color: var(--cc-green);
}
.cc-select.sm {
    padding: 6px 8px;
    font-size: 11.5px;
    width: auto;
}

/* system activity */
.ss-activity {
    display: flex;
    flex-direction: column;
}
.ss-act {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--cc-line);
}
.ss-act:last-child {
    border-bottom: 0;
}
.ss-act-time {
    color: var(--cc-muted);
    font-size: 10.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.ss-act-body {
    min-width: 0;
}
.ss-act-body b {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--cc-text);
}
.ss-act-body small {
    display: block;
    font-size: 10.5px;
    color: var(--cc-muted);
}
.ss-act-who {
    color: var(--cc-teal);
    font-size: 11px;
    white-space: nowrap;
}
.ss-right .b-portal-btn {
    margin-top: 14px;
}

@media (max-width: 1300px) {
    .ss-grid {
        grid-template-columns: 1fr;
    }
    .ss-cats {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 760px) {
    .ss-cats {
        grid-template-columns: repeat(2, 1fr);
    }
    .ss-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Audit Log page
   ========================================================================= */
.audit-toolbar .cc-search {
    flex: 1;
    min-width: 180px;
}
.audit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}
.audit-grid.closed {
    grid-template-columns: 1fr;
}

.audit-table {
    min-width: 900px;
}
.audit-table th,
.audit-table td {
    padding: 11px 12px;
    vertical-align: middle;
}
.audit-table tbody tr {
    cursor: pointer;
}
.audit-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}
.audit-table tbody tr.selected {
    background: rgba(229, 50, 31, 0.08);
    box-shadow: inset 3px 0 0 var(--cc-red);
}
.a-time {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.a-cal {
    opacity: 0.5;
    font-size: 13px;
}
.a-user {
    display: flex;
    align-items: center;
    gap: 9px;
}
.a-user-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.a-user-txt small {
    color: var(--cc-muted);
    font-size: 10.5px;
}
.a-event {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
}
.a-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cc-muted);
    display: inline-block;
    flex: 0 0 auto;
}
.a-event.green,
.a-event.green .a-dot,
.a-dot.green {
    color: var(--cc-green);
}
.a-event.green .a-dot,
.a-dot.green {
    background: var(--cc-green);
}
.a-event.gold,
.a-dot.gold {
    color: var(--cc-gold);
}
.a-event.gold .a-dot,
.a-dot.gold {
    background: var(--cc-gold);
}
.a-event.red,
.a-dot.red {
    color: var(--cc-red);
}
.a-event.red .a-dot,
.a-dot.red {
    background: var(--cc-red);
}
.a-event.blue,
.a-dot.blue {
    color: #6aa8ff;
}
.a-event.blue .a-dot,
.a-dot.blue {
    background: #6aa8ff;
}
.a-module {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cc-text);
    white-space: nowrap;
}
.a-mod-ico {
    display: inline-grid;
    place-items: center;
    color: var(--cc-muted);
}
.a-mod-ico svg {
    width: 15px;
    height: 15px;
}
.a-details {
    max-width: 220px;
}
.a-ip {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 11px;
    white-space: nowrap;
}

/* detail panel */
.audit-detail {
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    position: sticky;
    top: 16px;
}
.audit-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cc-line);
}
.audit-detail-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cc-text);
}
.audit-close {
    background: transparent;
    border: 0;
    color: var(--cc-muted);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
}
.audit-close:hover {
    color: var(--cc-text);
}
.audit-detail-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cc-line);
}
.audit-detail-title b {
    display: block;
    color: var(--cc-text);
    font-size: 14px;
    font-weight: 600;
}
.audit-detail-title small {
    color: var(--cc-muted);
    font-size: 10px;
    font-family: ui-monospace, Menlo, monospace;
    word-break: break-all;
}
.audit-kv {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
}
.audit-kv-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 10px;
    padding: 7px 0;
    font-size: 12px;
}
.audit-kv-row span {
    color: var(--cc-muted);
}
.audit-kv-row b {
    color: var(--cc-text);
    font-weight: 500;
    word-break: break-word;
}
.audit-kv-label {
    display: block;
    color: var(--cc-muted);
    font-size: 12px;
    margin: 6px 0;
}
.audit-changes {
    margin: 0 0 6px;
    padding: 10px 12px;
    background: var(--cc-bg);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 11px;
    color: #b9e6c6;
    white-space: pre-wrap;
    overflow-x: auto;
}
.a-link {
    color: var(--cc-teal);
    cursor: pointer;
}
.audit-detail .b-portal-btn {
    margin-top: 12px;
}

@media (max-width: 1240px) {
    .audit-grid,
    .audit-grid.closed {
        grid-template-columns: 1fr;
    }
    .audit-detail {
        position: static;
    }
}

/* =========================================================================
   Divine Interventions page
   ========================================================================= */
.dv-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    align-items: start;
}
.dv-left,
.dv-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.cc-stats--dv {
    grid-template-columns: repeat(5, 1fr);
}
.dv-tabs {
    margin: 14px 16px 0;
    flex-wrap: wrap;
}

.dv-table {
    min-width: 1040px;
}
.dv-table th,
.dv-table td {
    padding: 10px 12px;
    vertical-align: middle;
}
.dv-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}
.dv-sigil {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    flex: 0 0 auto;
    color: hsl(var(--h, 280), 70%, 70%);
    background: hsla(var(--h, 280), 60%, 45%, 0.16);
    border: 1px solid hsla(var(--h, 280), 60%, 55%, 0.4);
}
.dv-sigil.sm {
    width: 20px;
    height: 20px;
    font-size: 11px;
    border-radius: 5px;
}
.dv-name {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dv-name-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.dv-name-txt small {
    color: var(--cc-muted);
    font-size: 10.5px;
}
.dv-god {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    color: var(--cc-text);
}
.dv-god-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.dv-world b {
    color: var(--cc-text);
    font-weight: 600;
}
.dv-world small {
    font-size: 10.5px;
}
.dv-effect {
    max-width: 180px;
}
.dv-power-used {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--cc-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.dv-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.dv-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.dv-status.active {
    color: var(--cc-green);
}
.dv-status.active .dot {
    background: var(--cc-green);
}
.dv-status.scheduled {
    color: var(--cc-gold);
}
.dv-status.scheduled .dot {
    background: var(--cc-gold);
}
.dv-status.completed {
    color: var(--cc-muted);
}
.dv-status.completed .dot {
    background: var(--cc-muted);
}
.dv-status.expired {
    color: #8fa3c8;
}
.dv-status.expired .dot {
    background: #8fa3c8;
}
.dv-status.failed {
    color: var(--cc-red);
}
.dv-status.failed .dot {
    background: var(--cc-red);
}
.dv-status.cancelled {
    color: #c77;
}
.dv-status.cancelled .dot {
    background: #c77;
}

/* create panel */
.dv-create {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dv-cfield {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.dv-cfield > span {
    font-size: 11px;
    color: var(--cc-muted);
}
.dv-power {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.dv-power-in {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a98cff;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line-strong);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    flex: 1;
}
.dv-power-in input {
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--cc-text);
    font-size: 13px;
    outline: none;
}
.dv-power small {
    color: var(--cc-muted);
    font-size: 11px;
    white-space: nowrap;
}
.dv-power small b {
    color: var(--cc-teal);
}
.dv-create .b-portal-btn {
    margin-top: 2px;
}

/* recently used */
.dv-recent {
    display: flex;
    flex-direction: column;
}
.dv-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--cc-line);
}
.dv-recent-item:last-child {
    border-bottom: 0;
}
.dv-recent-txt b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.dv-recent-txt small {
    color: var(--cc-muted);
    font-size: 11px;
}
.dv-netfaith {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--cc-line);
    color: var(--cc-muted);
    font-size: 12px;
}
.dv-netfaith b {
    font-weight: 700;
}

@media (max-width: 1300px) {
    .dv-grid {
        grid-template-columns: 1fr;
    }
    .cc-stats--dv {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 760px) {
    .cc-stats--dv {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================================
   Memory Integrity page
   ========================================================================= */
.cc-stats--mem {
    grid-template-columns: repeat(6, 1fr);
}
.mem-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}
.mem-left,
.mem-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.mem-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 16px;
}
.mem-chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 11px;
    color: var(--cc-muted);
}
.mem-chart-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}

/* issues table */
.mem-table {
    min-width: 900px;
}
.mem-table th,
.mem-table td {
    padding: 11px 12px;
    vertical-align: middle;
}
.mem-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}
.m-sev {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.m-sev.high {
    color: var(--cc-red);
}
.m-sev.medium {
    color: var(--cc-gold);
}
.m-sev.low {
    color: #6aa8ff;
}
.m-npc {
    display: flex;
    align-items: center;
    gap: 9px;
}
.m-npc-txt b {
    display: block;
    color: var(--cc-text);
    font-weight: 600;
}
.m-npc-txt small {
    color: var(--cc-muted);
    font-size: 10.5px;
}
.m-world b {
    color: var(--cc-text);
    font-weight: 600;
}
.m-world small {
    font-size: 10.5px;
}
.m-preview {
    max-width: 230px;
    color: var(--cc-text);
}
.m-sub {
    color: #d98a7f;
    font-size: 10.5px;
}
.m-status {
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.m-status.new {
    color: var(--cc-red);
}
.m-status.investigating {
    color: var(--cc-gold);
}
.m-status.reviewing {
    color: #6aa8ff;
}

/* integrity tools */
.mem-tools {
    display: flex;
    flex-direction: column;
}
.mem-tool {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cc-line);
}
.mem-tool:last-child {
    border-bottom: 0;
}
.mem-tool-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
    color: var(--cc-teal);
}
.mem-tool-ico svg {
    width: 17px;
    height: 17px;
}
.mem-tool > div {
    flex: 1;
    min-width: 0;
}
.mem-tool b {
    display: block;
    font-size: 12.5px;
    color: var(--cc-text);
}
.mem-tool small {
    display: block;
    margin-top: 2px;
    font-size: 10.5px;
    color: var(--cc-muted);
}
.mem-tool-btn {
    padding: 6px 12px;
    background: var(--cc-panel-2);
    border: 1px solid rgba(95, 214, 245, 0.4);
    border-radius: var(--radius-sm);
    color: var(--cc-teal);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.mem-tool-btn:hover {
    background: rgba(95, 214, 245, 0.1);
}

/* recent activity */
.mem-activity {
    display: flex;
    flex-direction: column;
}
.mem-act {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
}
.mem-act:last-child {
    border-bottom: 0;
}
.mem-act-ico {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
    color: var(--cc-muted);
}
.mem-act-ico svg {
    width: 15px;
    height: 15px;
}
.mem-act > div {
    flex: 1;
    min-width: 0;
}
.mem-act b {
    display: block;
    font-size: 12px;
    color: var(--cc-text);
    font-weight: 500;
}
.mem-act small {
    color: var(--cc-muted);
    font-size: 10.5px;
}
.mem-act-time {
    color: var(--cc-muted);
    font-size: 10.5px;
    white-space: nowrap;
}
.mem-right .b-portal-btn {
    margin-top: 12px;
}

@media (max-width: 1300px) {
    .mem-grid {
        grid-template-columns: 1fr;
    }
    .cc-stats--mem {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 900px) {
    .mem-row {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 760px) {
    .cc-stats--mem {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================================
   Help & Docs page
   ========================================================================= */
.help-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}
.help-left,
.help-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.help-top {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.help-search {
    flex: 1;
    min-width: 240px;
}
.help-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    min-width: 150px;
    background: var(--cc-panel);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
}
.help-tile:hover {
    border-color: var(--cc-red);
}
.help-tile-ico {
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
}
.help-tile-ico svg {
    width: 20px;
    height: 20px;
}
.help-tile b {
    font-size: 12.5px;
    color: var(--cc-text);
}
.help-tile small {
    color: var(--cc-muted);
    font-size: 11px;
}

/* documentation category cards */
.help-cats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}
.help-cat {
    position: relative;
    display: block;
    padding: 16px;
    background: var(--cc-panel-2);
    border: 1px solid var(--cc-line);
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition:
        border-color 0.15s,
        transform 0.15s;
}
.help-cat:hover {
    border-color: var(--cc-red);
    transform: translateY(-2px);
}
.help-cat-ico {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
}
.help-cat-ico svg {
    width: 24px;
    height: 24px;
}
.help-cat-h {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}
.help-cat-h b {
    color: var(--cc-text);
    font-size: 13px;
    font-weight: 600;
}
.help-cat-h em {
    font-style: normal;
    color: var(--cc-muted);
    font-size: 11px;
}
.help-cat p {
    margin: 0;
    color: var(--cc-muted);
    font-size: 11.5px;
    line-height: 1.4;
}
.help-cat-arrow {
    position: absolute;
    right: 14px;
    bottom: 14px;
    color: var(--cc-muted);
    font-size: 14px;
}
.help-cat:hover .help-cat-arrow {
    color: var(--cc-red);
}

/* bottom 3-column row */
.help-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.help-list {
    display: flex;
    flex-direction: column;
}
.help-art {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
    text-decoration: none;
    cursor: pointer;
}
.help-art:last-of-type {
    border-bottom: 0;
}
.help-art-ico {
    flex: 0 0 auto;
    font-size: 15px;
    opacity: 0.7;
}
.help-art > div {
    flex: 1;
    min-width: 0;
}
.help-art b {
    display: block;
    color: var(--cc-text);
    font-size: 12.5px;
    font-weight: 600;
}
.help-art small {
    color: var(--cc-muted);
    font-size: 11px;
    line-height: 1.35;
}
.help-art:hover b {
    color: var(--cc-red);
}

.help-videos {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.help-video {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 0;
    text-decoration: none;
    cursor: pointer;
}
.help-video-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 66px;
    height: 42px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: linear-gradient(
        150deg,
        hsl(var(--h, 0), 45%, 30%),
        hsl(var(--h, 0), 55%, 10%)
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.help-play {
    color: #fff;
    font-size: 12px;
    opacity: 0.9;
}
.help-video-thumb em {
    position: absolute;
    right: 3px;
    bottom: 2px;
    font-style: normal;
    font-size: 9px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    padding: 0 3px;
}
.help-video > div {
    flex: 1;
    min-width: 0;
}
.help-video b {
    display: block;
    color: var(--cc-text);
    font-size: 12.5px;
    font-weight: 600;
}
.help-video small {
    color: var(--cc-muted);
    font-size: 11px;
    line-height: 1.35;
}
.help-video:hover b {
    color: var(--cc-red);
}

/* quick actions */
.help-qa {
    display: flex;
    flex-direction: column;
}
.help-qa-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    text-align: left;
    cursor: pointer;
    width: 100%;
}
.help-qa-item:last-child {
    border-bottom: 0;
}
.help-qa-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cc-line);
}
.help-qa-ico svg {
    width: 17px;
    height: 17px;
}
.help-qa-item b {
    display: block;
    color: var(--cc-text);
    font-size: 12.5px;
}
.help-qa-item small {
    color: var(--cc-muted);
    font-size: 11px;
}
.help-qa-item:hover b {
    color: var(--cc-red);
}

/* help center */
.help-center {
    display: flex;
    flex-direction: column;
}
.help-hc {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cc-line);
}
.help-hc:last-child {
    border-bottom: 0;
}
.help-hc-ico {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--cc-muted);
}
.help-hc-ico svg {
    width: 17px;
    height: 17px;
}
.help-hc > div {
    flex: 1;
    min-width: 0;
}
.help-hc b {
    display: block;
    color: var(--cc-text);
    font-size: 12.5px;
}
.help-hc small {
    color: var(--cc-muted);
    font-size: 11px;
}
.help-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.help-badge.ok {
    color: var(--cc-green);
    background: rgba(75, 216, 138, 0.1);
    border: 1px solid rgba(75, 216, 138, 0.3);
}
.help-mut {
    color: var(--cc-muted);
    font-size: 10.5px;
    white-space: nowrap;
}

/* platform status */
.help-status {
    display: flex;
    flex-direction: column;
}
.help-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--cc-line);
    font-size: 12.5px;
}
.help-status-row:last-child {
    border-bottom: 0;
}
.help-status-row .stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cc-text);
}
.help-status-row .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cc-green);
    box-shadow: 0 0 0 3px rgba(75, 216, 138, 0.15);
}
.help-status-row .ok {
    color: var(--cc-green);
    font-size: 11.5px;
    font-weight: 600;
}

@media (max-width: 1300px) {
    .help-grid {
        grid-template-columns: 1fr;
    }
    .help-cats {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 900px) {
    .help-bottom {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 760px) {
    .help-cats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Create NPC modal */
.npc-create-modal[hidden] {
    display: none;
}
.npc-create-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
}
.npc-create-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(7px);
}
.npc-create-dialog {
    position: relative;
    width: min(1210px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: linear-gradient(
        145deg,
        rgba(15, 24, 34, 0.98),
        rgba(5, 10, 16, 0.98)
    );
    border: 1px solid var(--cc-line-strong);
    border-left: 3px solid var(--cc-red);
    border-radius: 12px;
    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(229, 50, 31, 0.16);
}
.npc-create-head {
    display: grid;
    grid-template-columns: 62px 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 30px 38px 20px;
}
.npc-create-icon {
    width: 62px;
    height: 62px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--cc-red);
    background: rgba(229, 50, 31, 0.1);
    font-size: 32px;
}
.npc-create-head h2 {
    margin: 0;
    font-family: var(--font-display);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.npc-create-head p,
.npc-c-card p {
    margin: 6px 0 0;
    color: var(--cc-muted);
}
.npc-create-x {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--cc-line);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-size: 28px;
    cursor: pointer;
}
.npc-create-body {
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    gap: 14px;
    padding: 0 22px 22px;
}
.npc-create-left,
.npc-create-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.npc-c-card {
    border: 1px solid var(--cc-line);
    background: rgba(10, 18, 27, 0.78);
    border-radius: 8px;
    padding: 20px;
}
.npc-c-card h3 {
    margin: 0 0 16px;
    color: #d8dde7;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 13px;
}
.npc-c-type-grid,
.npc-c-grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.npc-c-type {
    text-align: left;
    padding: 22px 26px;
    min-height: 108px;
    border-radius: 8px;
    border: 1px solid var(--cc-line);
    background: rgba(255, 255, 255, 0.02);
    color: var(--cc-text);
    cursor: pointer;
}
.npc-c-type.active {
    border-color: var(--cc-red);
    background: rgba(229, 50, 31, 0.1);
    box-shadow: inset 0 0 0 1px rgba(229, 50, 31, 0.45);
}
.npc-c-type:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.npc-c-type b {
    display: block;
    font-size: 15px;
    color: #fff;
    margin-bottom: 6px;
}
.npc-c-type span {
    color: var(--cc-muted);
}
.npc-c-card label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #c7cfdd;
    font-size: 13px;
}
.npc-c-card em {
    color: var(--cc-red);
    font-style: normal;
}
.npc-c-card input,
.npc-c-card textarea,
.npc-c-card select,
.npc-c-world input {
    width: 100%;
    border: 1px solid var(--cc-line);
    background: rgba(3, 8, 13, 0.72);
    color: #fff;
    border-radius: 7px;
    padding: 12px 13px;
    font: inherit;
}
.npc-c-card textarea {
    min-height: 112px;
    resize: vertical;
    line-height: 1.45;
}
.npc-c-full,
.npc-c-select {
    margin-top: 14px;
}
.npc-c-ai-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #c7cfdd;
    font-size: 13px;
}
.npc-c-ai-row > div,
.npc-c-label-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.npc-c-label-actions {
    margin-left: auto;
}
.npc-c-card label.npc-c-full {
    position: relative;
}
.npc-c-card label.npc-c-full > span.npc-c-label-actions {
    position: absolute;
    right: 0;
    top: -6px;
}
.npc-c-card label.npc-c-full > span.npc-c-label-actions .cc-ghost-btn,
.npc-c-ai-row .cc-ghost-btn {
    padding: 7px 10px;
    font-size: 12px;
}
.npc-c-ai-status {
    margin-top: 10px;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.35;
    border: 1px solid var(--cc-line);
}
.npc-c-ai-status.ok {
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.09);
    border-color: rgba(16, 185, 129, 0.35);
}
.npc-c-ai-status.warn {
    color: #ffd6a6;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.45);
}
.npc-c-profile {
    display: grid;
    grid-template-columns: 126px 1fr;
    gap: 24px;
    align-items: center;
    border-bottom: 1px solid var(--cc-line);
    padding: 8px 0 26px;
}
.npc-c-avatar {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-family: var(--font-display);
    font-size: 44px;
    color: #fff;
    background: linear-gradient(150deg, #263242, #090d13);
    border: 1px solid var(--cc-line-strong);
}
.npc-c-avatar img,
.n-av.has-img img,
.npc-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.n-av.has-img {
    overflow: hidden;
    padding: 0;
    background: transparent;
}
.npc-portrait {
    overflow: hidden;
}
.npc-c-profile h4 {
    margin: 0 0 8px;
    font-size: 21px;
    color: #fff;
}
.npc-c-profile p {
    margin: 4px 0;
    color: #cbd3df;
}
.npc-c-profile span {
    display: inline-flex;
    margin-top: 8px;
    border: 1px solid var(--cc-line);
    border-radius: 6px;
    padding: 5px 8px;
    color: #dce4f1;
    font-size: 12px;
}
.npc-c-mem-head {
    margin: 22px 0 12px;
    color: #aeb8c8;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.npc-c-memories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.npc-c-memory {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--cc-line);
    border-radius: 8px;
    padding: 14px;
    background: rgba(3, 8, 13, 0.46);
}
.npc-c-brain {
    color: #a98cff;
    font-size: 24px;
}
.npc-c-thumb {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(169, 140, 255, 0.08);
}
.npc-c-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.npc-c-memory b {
    color: #a98cff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.npc-c-memory p {
    margin: 5px 0 0;
    color: #e1e6ef;
    line-height: 1.4;
}
.npc-c-empty {
    color: var(--cc-muted);
    border: 1px dashed var(--cc-line);
    border-radius: 8px;
    padding: 16px;
}
.npc-c-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.npc-c-chip {
    border: 1px solid rgba(169, 140, 255, 0.45);
    color: #d7ccff;
    background: rgba(169, 140, 255, 0.1);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
}
.npc-c-beliefs,
.npc-c-profile-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.npc-c-section {
    border: 1px solid var(--cc-line);
    border-radius: 8px;
    background: rgba(3, 8, 13, 0.46);
    overflow: hidden;
}
.npc-c-section summary {
    cursor: pointer;
    padding: 11px 12px;
    color: #d7ccff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 11px;
}
.npc-c-section summary span {
    float: right;
    color: var(--cc-muted);
}
.npc-c-section ul {
    margin: 0;
    padding: 0 14px 12px 30px;
    color: #e1e6ef;
    line-height: 1.42;
}
.npc-c-section li + li {
    margin-top: 6px;
}
.npc-c-belief {
    border: 1px solid var(--cc-line);
    border-radius: 8px;
    padding: 12px;
    background: rgba(3, 8, 13, 0.46);
    color: #e1e6ef;
    line-height: 1.4;
}
.npc-c-belief small {
    display: block;
    margin-top: 6px;
    color: var(--cc-muted);
}
.muted-card {
    color: var(--cc-muted);
}
.npc-create-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 22px;
    border-top: 1px solid var(--cc-line);
}
.npc-c-world {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--cc-muted);
    font-size: 12px;
}
.npc-c-world input {
    width: 110px;
}
@media (max-width: 980px) {
    .npc-create-body {
        grid-template-columns: 1fr;
    }
    .npc-c-grid.two,
    .npc-c-type-grid {
        grid-template-columns: 1fr;
    }
}
