:root {
    color-scheme: dark;
    --bg: #0f172a;
    --panel: #111827;
    --line: #334155;
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --danger: #f87171;
    --good: #34d399;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, .14), transparent 34%), var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 23, 42, .86);
}

.topbar strong {
    display: block;
    font-size: 18px;
}

.topbar span {
    color: var(--muted);
    font-size: 13px;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.panel {
    background: rgba(17, 24, 39, .9);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(32px, 5vw, 56px);
    line-height: .95;
    letter-spacing: -.06em;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.grid article {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: #0b1220;
}

.grid article strong,
.grid article span {
    display: block;
}

.grid article span {
    margin-top: 8px;
    color: var(--good);
}

.form-card {
    width: min(460px, 100%);
    margin: 0 auto;
}

label {
    display: block;
    margin: 18px 0 8px;
    color: var(--muted);
    font-weight: 700;
}

input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #020617;
    color: var(--text);
    font: inherit;
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    background: var(--accent);
    color: #00111d;
    font-weight: 800;
}

.form-card button {
    width: 100%;
    margin-top: 22px;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-form button {
    padding: 8px 12px;
}

.alert {
    border: 1px solid rgba(248, 113, 113, .5);
    color: #fecaca;
    background: rgba(127, 29, 29, .3);
    border-radius: 12px;
    padding: 12px;
    margin: 18px 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: #0b1220;
}

.stat b {
    display: block;
    font-size: 28px;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 760px) {
    .topbar,
    .logout-form {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.button-link {
    display: inline-block;
    border-radius: 12px;
    padding: 11px 14px;
    background: #1e293b;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.filter-bar {
    display: flex;
    align-items: end;
    gap: 14px;
    margin: 24px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #0b1220;
}

.filter-bar label {
    flex: 1;
    margin: 0;
}

select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #020617;
    color: var(--text);
    font: inherit;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: #0b1220;
}

tr:last-child td {
    border-bottom: 0;
}

.pill {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 9px;
    background: rgba(56, 189, 248, .14);
    color: #bae6fd;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .page-head,
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

.main-nav {
    display: flex;
    gap: 10px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(2, 6, 23, .72);
    overflow-x: auto;
}

.main-nav a,
.panel a {
    color: #bae6fd;
}

.main-nav a {
    display: inline-block;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.main-nav a:hover,
.button-link:hover {
    border-color: var(--accent);
}

.detail-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 18px;
    margin: 24px 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 800;
}

.detail-list dd {
    margin: 0;
    word-break: break-word;
}

.stack {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.subpanel {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: #0b1220;
}

.subpanel h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

@media (max-width: 760px) {
    .main-nav {
        padding: 12px 16px;
    }

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

.action-form {
    display: grid;
    gap: 14px;
    margin: 24px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #0b1220;
}

.action-form label {
    margin: 0;
}

.action-form button {
    justify-self: start;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #020617;
    color: var(--text);
    font: inherit;
    resize: vertical;
}


.flash-wrap {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #0b1220;
    color: var(--text);
    font-weight: 700;
}

.flash-success {
    border-color: rgba(52, 211, 153, .5);
    color: #bbf7d0;
}

.flash-error {
    border-color: rgba(248, 113, 113, .5);
    color: #fecaca;
}


.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* TRG tenant-branded login */
.tenant-login-card {
    text-align: center;
}

.tenant-login-brand {
    display: flex;
    justify-content: center;
    margin: 0 0 18px;
}

.tenant-login-brand img {
    width: min(190px, 70%);
    height: auto;
    display: block;
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
    padding: 14px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .28);
}

.tenant-login-card h1 {
    font-size: clamp(2.15rem, 5vw, 3.45rem);
}

.tenant-login-powered {
    margin-top: 8px;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, .9);
}

.tenant-login-card form {
    text-align: left;
}


/* TRG platform administration context */
.platform-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1.5rem;
    color: #b9d9f5;
    background: #07101f;
    border-bottom: 1px solid #31445e;
}

.platform-context strong {
    color: #36bdf2;
    letter-spacing: .08em;
}

.admin-action-grid article {
    align-items: flex-start;
    gap: .75rem;
}

.admin-action-grid .button-link {
    display: inline-block;
    margin-top: auto;
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

@media (max-width: 720px) {
    .platform-context {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* TRG platform shell redesign — 2026-07-31 */
.platform-topbar {
    min-height: 72px;
    background: #07101f;
}

.platform-brand {
    display: grid;
    gap: 3px;
}

.platform-brand strong {
    font-size: 20px;
    letter-spacing: -.02em;
}

.platform-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.workspace-badge,
.context-kicker {
    display: inline-flex;
    align-items: center;
    width: max-content;
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.workspace-badge {
    border: 1px solid rgba(56, 189, 248, .45);
    border-radius: 999px;
    padding: 6px 9px;
    background: rgba(56, 189, 248, .09);
}

.platform-nav {
    min-height: 58px;
    align-items: center;
    background: #020617;
}

.platform-context {
    min-height: 86px;
    padding: 16px 28px;
}

.platform-context--global {
    background: #111827;
    border-bottom-color: #334155;
}

.platform-context--tenant {
    background: linear-gradient(90deg, #07101f, #10243a);
    border-bottom: 2px solid #38bdf8;
}

.platform-context__identity {
    display: grid;
    gap: 4px;
}

.platform-context__identity strong {
    color: #f8fafc;
    font-size: 19px;
    letter-spacing: -.02em;
}

.platform-context__identity > span:last-child {
    color: #94a3b8;
    font-size: 13px;
}

.context-exit-form {
    margin: 0;
}

.button-danger-outline {
    border: 1px solid rgba(248, 113, 113, .7);
    background: transparent;
    color: #fecaca;
}

.button-danger-outline:hover {
    background: rgba(127, 29, 29, .25);
}

.platform-shell {
    width: min(1240px, calc(100% - 36px));
    padding: 36px 0 56px;
}

.platform-page {
    display: grid;
    gap: 24px;
}

.platform-hero,
.workspace-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    padding: 32px;
    border: 1px solid #334155;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(17, 24, 39, .98), rgba(7, 16, 31, .98));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.platform-hero--compact {
    padding: 26px 28px;
}

.platform-hero h1,
.workspace-hero h1 {
    max-width: 780px;
    font-size: clamp(34px, 5vw, 58px);
}

.platform-hero p,
.workspace-hero p {
    max-width: 760px;
    margin-bottom: 0;
}

.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 210px;
    border-radius: 14px;
    padding: 14px 18px;
    background: #38bdf8;
    color: #03111d;
    text-decoration: none;
    font-weight: 900;
}

.workspace-identity-card {
    display: grid;
    min-width: 280px;
    gap: 6px;
    border: 1px solid rgba(56, 189, 248, .35);
    border-radius: 16px;
    padding: 18px;
    background: rgba(56, 189, 248, .07);
}

.workspace-identity-card span,
.workspace-identity-card small {
    color: #94a3b8;
}

.workspace-identity-card strong {
    font-size: 18px;
}

.workspace-safety {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(52, 211, 153, .35);
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(6, 78, 59, .18);
}

.workspace-safety strong {
    color: #6ee7b7;
    white-space: nowrap;
}

.workspace-safety span {
    color: #cbd5e1;
}

.workspace-action-grid,
.tenant-directory {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.workspace-action-grid > a {
    display: grid;
    min-height: 170px;
    align-content: start;
    gap: 9px;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 20px;
    background: #0b1220;
    color: #f8fafc;
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.workspace-action-grid > a:hover {
    transform: translateY(-2px);
    border-color: #38bdf8;
    background: #101b2d;
}

.workspace-action-grid > a span {
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.workspace-action-grid > a strong {
    font-size: 21px;
}

.workspace-action-grid > a small {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
}

.platform-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.platform-section-head {
    padding-top: 8px;
}

.platform-section-head h2 {
    margin: 0;
    font-size: 28px;
}

.active-workspace-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border: 1px solid rgba(56, 189, 248, .42);
    border-radius: 18px;
    padding: 22px;
    background: rgba(14, 116, 144, .12);
}

.active-workspace-card h2 {
    margin: 5px 0 4px;
}

.active-workspace-card p {
    margin: 0;
}

.tenant-card {
    display: grid;
    align-content: start;
    gap: 16px;
    min-height: 220px;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 20px;
    background: #0b1220;
}

.tenant-card--active {
    border-color: #38bdf8;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .25);
}

.tenant-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.tenant-card__head span:first-child {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.tenant-card h2 {
    margin: 5px 0 0;
    font-size: 21px;
}

.tenant-card p {
    margin: 0;
    word-break: break-word;
}

.tenant-card form {
    margin-top: auto;
}

.tenant-card form button {
    width: 100%;
}

.tenant-card__state {
    margin-top: auto;
    border-radius: 12px;
    padding: 11px 12px;
    background: rgba(56, 189, 248, .1);
    color: #bae6fd;
    font-size: 13px;
    font-weight: 800;
}

.tenant-card__state--locked {
    background: rgba(100, 116, 139, .12);
    color: #94a3b8;
}

@media (max-width: 980px) {
    .workspace-action-grid,
    .tenant-directory {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .platform-user,
    .platform-hero,
    .workspace-hero,
    .active-workspace-card,
    .workspace-safety {
        align-items: stretch;
        flex-direction: column;
    }

    .workspace-identity-card {
        min-width: 0;
    }

    .workspace-action-grid,
    .platform-action-grid,
    .tenant-directory {
        grid-template-columns: 1fr;
    }

    .platform-context {
        padding: 14px 16px;
    }

    .context-exit-form,
    .context-exit-form button {
        width: 100%;
    }
}
