:root {
    --ink: #081020;
    --panel: #ffffff;
    --line: #dbe3ee;
    --muted: #58708f;
    --soft: #f4f7fb;
    --nav: #030817;
    --nav-hover: #1b2840;
    --blue: #1747e8;
    --red: #b30000;
    --green: #008b63;
    --amber: #bd7900;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.console-shell { min-height: 100vh; display: grid; grid-template-columns: 292px 1fr; }
.console-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--nav);
    color: #fff;
    border-right: 1px solid #172033;
}
.console-brand {
    padding: 24px 22px 34px;
    border-bottom: 1px solid #172033;
}
.console-brand span {
    display: block;
    color: #9cc6ff;
    font-size: 13px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}
.console-brand strong {
    display: block;
    margin-top: 12px;
    font-size: 22px;
    letter-spacing: .2px;
}
.console-nav { padding: 20px 16px 36px; }
.console-nav span {
    display: block;
    margin: 26px 6px 10px;
    color: #9fb8d7;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
}
.console-nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    color: #f7fbff;
    font-size: 15px;
    line-height: 1.2;
}
.console-nav a:hover { background: var(--nav-hover); }

.console-main { min-width: 0; }
.console-topbar {
    min-height: 96px;
    padding: 24px 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.console-topbar span,
.console-kicker {
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .7px;
    text-transform: uppercase;
}
.console-topbar h1 {
    margin: 6px 0 0;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1;
    letter-spacing: -.5px;
}
.console-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.console-actions a,
.console-actions button,
.button,
.admin-button,
.admin-form button,
.login-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #bdd0e8;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
}
.console-actions form { margin: 0; }
.button.primary,
.admin-button,
.admin-form button,
.login-form button {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.button.red { background: var(--red); color: #fff; border-color: var(--red); }
.button.ghost,
.admin-button.ghost { background: #fff; color: var(--ink); border-color: #bdd0e8; }
.admin-button.danger,
.danger-link {
    background: #fff4f4;
    border-color: #e4a3a3;
    color: #9b0000;
}
.admin-form button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.console-context {
    padding: 20px 28px;
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    background: #eef3f9;
    border-bottom: 1px solid var(--line);
    color: #203b5d;
    font-size: 15px;
}
.console-alert {
    margin: 24px 28px 0;
    padding: 16px 18px;
    background: #effaf5;
    border: 1px solid #a9e7c8;
    border-radius: 8px;
    color: #075f42;
}

.admin-success {
    margin-bottom: 18px;
    padding: 16px 18px;
    background: #effaf5;
    border: 1px solid #a9e7c8;
    border-radius: 8px;
    color: #075f42;
}

.console-page { padding: 28px; }
.hero-panel,
.admin-header,
.admin-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(8,16,32,.04);
}
.hero-panel,
.admin-header {
    padding: 34px;
    margin-bottom: 26px;
}
.hero-panel h2,
.admin-header h1 {
    margin: 14px 0 0;
    font-size: clamp(34px, 5vw, 64px);
    line-height: .98;
    letter-spacing: -.8px;
}
.hero-panel p,
.admin-header-note { margin: 14px 0 0; color: #274363; font-size: 17px; line-height: 1.5; }
.admin-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.admin-kicker { color: var(--blue); font-size: 13px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; }
.admin-action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-action-row form {
    margin: 0;
}

.metrics-grid,
.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}
.metric-card,
.admin-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    min-height: 146px;
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(8,16,32,.035);
}
.metric-card span,
.admin-card span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}
.metric-card strong,
.admin-card strong {
    display: block;
    margin-top: 20px;
    font-size: 42px;
    line-height: 1;
}
.metric-card small,
.admin-card small {
    display: block;
    margin-top: 14px;
    color: #466284;
    font-size: 15px;
    line-height: 1.4;
}
.metric-card.red { border-color: #ffc8c8; background: #fff3f3; }
.metric-card.green { border-color: #b6efd5; background: #f2fff8; }

.panel-grid,
.admin-workspace-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}
.panel-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-panel { padding: 26px; margin-bottom: 26px; }
.admin-panel h2 { margin: 0 0 18px; font-size: 28px; letter-spacing: -.2px; }
.admin-panel p { color: #314c6e; line-height: 1.6; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.module-tile {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    min-height: 118px;
    padding: 20px;
}
.module-tile span { color: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.module-tile strong { display: block; margin-top: 20px; font-size: 20px; }

.console-tabs,
.admin-portal-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 24px;
}
.console-tabs a,
.admin-portal-tabs a {
    padding: 10px 14px;
    border: 1px solid #bdd0e8;
    border-radius: 999px;
    background: #fff;
    color: #17365f;
    font-weight: 700;
    font-size: 13px;
}
.console-tabs a.active,
.admin-portal-tabs a.active { background: #e9f2ff; color: var(--blue); border-color: #92bfff; }

.record-list { display: grid; gap: 12px; }
.record-row,
.client-record-row,
.portal-room-row {
    display: grid;
    grid-template-columns: 1fr 1.6fr .8fr auto;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.record-row span,
.client-record-row span,
.portal-room-row span { color: #405d80; line-height: 1.4; }
.record-row em,
.client-record-row em,
.portal-room-row em { color: var(--muted); font-style: normal; }
.record-row.compact {
    grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) auto;
}

.record-row.compact strong {
    min-width: 0;
}

.gantt { display: grid; gap: 12px; }
.gantt-row {
    display: grid;
    grid-template-columns: 1.1fr .7fr 1.4fr .75fr;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.gantt-bar,
.portal-gantt-row em {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue) var(--progress), #e1e8f2 var(--progress));
}
.gantt-row small { color: var(--muted); }

.finance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ring-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    background: #fff;
}
.ring-card .ring {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--red) var(--value), #e5ebf3 0);
    margin-top: 16px;
}
.ring-card .ring span {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    font-weight: 700;
}

.ptf-ledger {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 10px 0 28px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}

.ptf-ledger-summary span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.ptf-ledger-summary strong {
    display: block;
    margin-top: 10px;
    font-size: 24px;
}

.ptf-progress {
    grid-column: 1 / -1;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e1e8f2;
}

.ptf-progress span {
    display: block;
    width: var(--progress);
    height: 100%;
    background: var(--red);
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.admin-table th,
.admin-table td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.admin-table tr:last-child td { border-bottom: 0; }

.admin-form { display: grid; gap: 16px; max-width: 1100px; }
.admin-form label { display: grid; gap: 8px; color: #314c6e; font-weight: 700; }
.admin-form input,
.admin-form textarea,
.admin-form select,
.login-form input {
    width: 100%;
    border: 1px solid #c9d7e8;
    border-radius: 8px;
    padding: 13px 14px;
    background: #fff;
    color: var(--ink);
}
.admin-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.admin-meta-line {
    width: fit-content;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 12px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.admin-error { padding: 14px; border: 1px solid #ffc8c8; background: #fff3f3; border-radius: 8px; }
.password-service-panel code {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--red);
    font-size: 18px;
    letter-spacing: 1px;
}
.admin-current-image img { max-width: 220px; border-radius: 8px; filter: grayscale(100%); }
.admin-checkbox { display: flex !important; gap: 10px; align-items: center; }
.admin-checkbox input { width: auto; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.admin-panel.soft { background: #f8fafc; }
.admin-pagination { margin-top: 18px; }
.admin-toolbar { margin-top: 18px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.admin-tabs { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-tabs a {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    color: var(--muted);
}
.admin-tabs a.active { border-color: var(--red); color: var(--red); }
.admin-search { display: flex; gap: 10px; align-items: center; }
.admin-search input[type="search"] {
    width: min(420px, 70vw);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.admin-search button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.admin-search button:hover { border-color: var(--red); color: var(--red); }

.admin-pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-pager a,
.admin-pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
}
.admin-pager a:hover { border-color: var(--red); color: var(--red); }
.admin-pager .active { border-color: var(--red); color: var(--red); }
.admin-pager .disabled { opacity: .45; }

.admin-task-board {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.admin-task-row {
    display: grid;
    grid-template-columns: minmax(260px, .75fr) minmax(220px, .45fr) minmax(520px, 1.25fr) auto;
    gap: 16px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.admin-task-row strong,
.admin-task-row span,
.admin-task-row small {
    display: block;
}

.admin-task-row strong {
    font-size: 17px;
}

.admin-task-row span,
.admin-task-row small {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.4;
}

.admin-task-progress {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e1e8f2;
    margin-top: 8px;
}

.admin-task-progress span {
    display: block;
    height: 100%;
    background: #0c49ff;
}

.admin-task-progress.work-progress span {
    background: var(--red);
}

.admin-task-metrics strong,
.admin-task-metrics small {
    display: block;
    margin-top: 8px;
}

.schedule-pill {
    display: inline-flex;
    width: fit-content;
    padding: 7px 10px;
    border: 1px solid #bdd0e9;
    color: #163b6f;
    background: #f2f7ff;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.schedule-pill.overdue {
    border-color: #ffb3b3;
    color: #a00000;
    background: #fff1f1;
}

.schedule-pill.blocked {
    border-color: #f2c066;
    color: #7a4a00;
    background: #fff8e8;
}

.schedule-pill.complete {
    border-color: #9ce6bf;
    color: #006b35;
    background: #ecfff5;
}

.admin-task-row form,
.admin-task-edit-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 8px;
    margin: 0;
}

.admin-task-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.admin-task-field span {
    margin: 0;
    color: #52616f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1.2;
    text-transform: uppercase;
}

.admin-task-field-wide {
    grid-column: span 2;
}

.admin-task-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    width: max-content;
    max-width: 100%;
    overflow: visible;
}

.admin-task-row .admin-task-action-form {
    display: inline-flex;
    margin: 0;
    min-width: fit-content;
    flex: 0 0 auto;
    align-items: stretch;
    white-space: nowrap;
}

.admin-task-action-update {
    flex: 0 0 auto;
    white-space: nowrap;
}

.admin-task-actions button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #c9d7e8;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 800;
}

.admin-task-actions .admin-task-action-update {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.admin-task-actions .admin-task-action-delete {
    border-color: #ffb3b3;
    color: #a00000;
}

.admin-task-actions .admin-task-action-unblock {
    border-color: #f2c066;
    background: #fff8e8;
    color: #7a4a00;
}

.admin-task-row input,
.admin-task-row select {
    min-width: 0;
    border: 1px solid #c9d7e8;
    border-radius: 8px;
    padding: 10px;
}

.portal-gantt-chart {
    margin: 28px 0 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    overflow-x: auto;
}

.portal-gantt-head,
.portal-gantt-line {
    min-width: 980px;
    display: grid;
    grid-template-columns: 260px minmax(420px, 1fr) 240px;
    border-bottom: 1px solid var(--line);
}

.portal-gantt-head {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.portal-gantt-head > span,
.portal-gantt-label,
.portal-gantt-formula {
    padding: 16px;
}

.portal-gantt-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.portal-gantt-label strong,
.portal-gantt-label span,
.portal-gantt-label small,
.portal-gantt-formula small,
.portal-gantt-unscheduled span {
    display: block;
}

.portal-gantt-label strong {
    color: var(--ink);
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-gantt-label span,
.portal-gantt-label small,
.portal-gantt-formula small {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.portal-gantt-trackline {
    position: relative;
    min-height: 82px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(12, 73, 255, .08) 1px, transparent 1px) 0 0 / 20% 100%,
        #f8fbff;
}

.portal-gantt-bar {
    position: absolute;
    top: 31px;
    height: 20px;
    border-radius: 999px;
    overflow: hidden;
    background: #dfe7f3;
}

.portal-gantt-baseline {
    position: absolute;
    top: 58px;
    height: 4px;
    border-radius: 999px;
    background: var(--red);
    opacity: .72;
}

.portal-gantt-bar i {
    display: block;
    height: 100%;
    background: var(--blue);
}

.portal-gantt-bar.overdue,
.portal-gantt-bar.blocked {
    outline: 2px solid var(--red);
}

.portal-gantt-bar.complete i {
    background: #0a7a3b;
}

.portal-gantt-trackline em {
    position: absolute;
    right: 12px;
    top: 12px;
    color: var(--red);
    font-size: 10px;
    letter-spacing: .16em;
    font-style: normal;
}

.portal-gantt-formula {
    background: #fbfdff;
}

.portal-gantt-empty,
.portal-gantt-unscheduled {
    min-width: 980px;
    padding: 18px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.portal-gantt-unscheduled {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.portal-gantt-unscheduled strong {
    color: var(--red);
    letter-spacing: .16em;
    text-transform: uppercase;
}

.admin-inline-create {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--nav); color: #fff; }
.login-form { width: min(420px, 90vw); display: grid; gap: 16px; }
.login-form h1 { font-size: 34px; margin: 0 0 12px; }

.admin-muted {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@media (max-width: 1180px) {
    .metrics-grid, .admin-card-grid, .module-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-grid.thirds { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .console-shell { grid-template-columns: 1fr; }
    .console-sidebar { position: static; height: auto; }
    .console-topbar { align-items: flex-start; flex-direction: column; }
    .panel-grid, .admin-workspace-grid, .admin-form-grid, .finance-grid { grid-template-columns: 1fr; }
    .metrics-grid, .admin-card-grid, .module-grid { grid-template-columns: 1fr; }
    .record-row, .client-record-row, .portal-room-row, .gantt-row { grid-template-columns: 1fr; }
    .record-row.compact,
    .ptf-ledger {
        grid-template-columns: 1fr;
    }
    .admin-task-row,
    .admin-task-row form {
        grid-template-columns: 1fr;
    }
}

/* PTAD portal density and elegance pass */
.console-shell {
    grid-template-columns: 252px minmax(0, 1fr);
}

.console-brand {
    padding: 18px 18px 22px;
}

.console-brand strong {
    font-size: 18px;
    letter-spacing: .08em;
}

.console-brand span {
    font-size: 10px;
}

.console-nav {
    padding: 14px 12px 24px;
}

.console-nav span {
    margin: 18px 8px 8px;
    font-size: 10px;
    letter-spacing: .12em;
}

.console-nav a,
.console-nav button {
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.console-topbar {
    min-height: 72px;
    padding: 16px 22px;
}

.console-topbar h1 {
    font-size: clamp(22px, 2vw, 32px);
    letter-spacing: 0;
}

.console-topbar span,
.console-kicker {
    font-size: 11px;
    letter-spacing: .08em;
}

.console-context {
    padding: 12px 22px;
    font-size: 13px;
}

.console-main main,
.admin-content {
    padding: 18px 22px 28px;
}

.metrics-grid,
.admin-card-grid,
.module-grid,
.panel-grid,
.admin-workspace-grid,
.finance-grid {
    gap: 14px;
}

.admin-card,
.metric-card,
.panel,
.admin-panel,
.project-workspace-panel,
.workspace-panel {
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(8, 16, 32, .04);
}

.admin-card,
.metric-card,
.panel,
.admin-panel {
    padding: 18px;
}

.admin-card h2,
.metric-card h2,
.panel h2,
.admin-panel h2 {
    font-size: clamp(18px, 1.6vw, 28px);
    line-height: 1.1;
}

.record-row,
.client-record-row,
.portal-room-row,
.gantt-row {
    gap: 12px;
    padding: 12px 0;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    font-size: 12px;
}

.admin-form {
    gap: 14px;
}

.admin-form label {
    gap: 6px;
    font-size: 11px;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    min-height: 40px;
    padding: 10px 12px;
}

.portal-gantt-chart {
    margin: 16px 0 20px;
    border-radius: 10px;
}

.portal-gantt-head,
.portal-gantt-line {
    min-width: 840px;
    grid-template-columns: 220px minmax(360px, 1fr) 200px;
}

.portal-gantt-head {
    padding: 10px 12px;
}

.portal-gantt-line {
    min-height: 58px;
}

.portal-gantt-title,
.portal-gantt-dates {
    padding: 12px;
}

.portal-gantt-trackline {
    min-height: 58px;
}

.portal-gantt-bar {
    top: 18px;
    height: 18px;
    border-radius: 999px;
}

.portal-gantt-trackline em {
    top: 8px;
    right: 10px;
}

.chat-messenger-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 420px);
    gap: 18px;
    min-height: calc(100vh - 220px);
}

.chat-stage,
.chat-room-rail {
    min-width: 0;
    border: 1px solid #ded8d0;
    border-top: 2px solid #c40000;
    background: #fff;
}

.chat-stage {
    display: grid;
    grid-template-rows: auto minmax(360px, 1fr) auto;
}

.chat-stage-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border-bottom: 1px solid #e7e1da;
}

.chat-stage-header span,
.chat-rail-label {
    color: #c40000;
    font-size: 10px;
    letter-spacing: .34em;
    text-transform: uppercase;
}

.chat-stage-header h2 {
    margin: 8px 0 6px;
    color: #101010;
    font-size: clamp(24px, 2.4vw, 42px);
    font-weight: 300;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.chat-stage-header p {
    margin: 0;
    color: #706d68;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.video-room-strip {
    width: min(310px, 38%);
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px;
    background: #060606;
    color: #fff;
}

.video-room-strip strong {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: .16em;
}

.video-room-strip button,
.chat-composer button,
.chat-room-form button {
    min-height: 42px;
    border: 1px solid #c40000;
    background: #c40000;
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.chat-thread {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px;
    background: #f7f8fa;
}

.chat-bubble {
    max-width: min(680px, 76%);
    padding: 14px 16px;
    border: 1px solid #e0d9d1;
    background: #fff;
    color: #111;
}

.chat-bubble.mine {
    align-self: flex-end;
    border-color: #111;
    background: #080808;
    color: #fff;
}

.chat-bubble-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    color: #777;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.chat-bubble.mine .chat-bubble-meta {
    color: rgba(255,255,255,.62);
}

.chat-bubble p {
    margin: 0;
    color: inherit;
    font-size: 14px;
    line-height: 1.55;
}

.chat-attachment {
    display: inline-block;
    margin-top: 10px;
    color: #c40000;
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.chat-composer {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid #e7e1da;
    background: #fff;
}

.chat-composer textarea,
.chat-room-form input,
.chat-room-form textarea {
    width: 100%;
    border: 1px solid #d8d1ca;
    border-radius: 0;
    background: #fff;
    color: #111;
}

.chat-composer textarea {
    resize: vertical;
    min-height: 72px;
}

.chat-composer > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-room-rail {
    overflow-y: auto;
    padding: 18px;
}

.chat-rail-block,
.chat-room-form {
    display: grid;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid #e7e1da;
}

.chat-project-list,
.chat-room-list,
.chat-participant-picker {
    display: grid;
    gap: 8px;
}

.chat-project-list a,
.chat-room-list a {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid #e0d9d1;
    color: #111;
    text-decoration: none;
}

.chat-project-list a.active,
.chat-room-list a.active {
    border-color: #c40000;
    background: #070707;
    color: #fff;
}

.chat-project-list strong,
.chat-room-list strong {
    font-size: 13px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.chat-project-list span,
.chat-room-list span {
    color: #777;
    font-size: 10px;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.chat-project-list a.active span,
.chat-room-list a.active span {
    color: rgba(255,255,255,.62);
}

.chat-room-form label {
    display: grid;
    gap: 8px;
    color: #666;
    font-size: 10px;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.chat-check,
.chat-participant-picker label {
    display: flex !important;
    align-items: center;
    gap: 9px;
}

.chat-check input,
.chat-participant-picker input {
    width: auto;
}

.chat-participant-picker label {
    padding: 9px 0;
    border-bottom: 1px solid #eee8e1;
}

.chat-participant-picker small {
    margin-left: auto;
    color: #c40000;
}

.chat-empty-state {
    align-self: center;
    justify-self: center;
    max-width: 560px;
    padding: 26px;
    text-align: center;
}

.chat-empty-state span {
    color: #c40000;
    font-size: 11px;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.chat-empty-state p {
    margin: 12px 0 0;
    color: #6f6a64;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .console-shell {
        grid-template-columns: 1fr;
    }

    .console-main main,
    .admin-content {
        padding: 16px;
    }
}

@media (max-width: 1100px) {
    .chat-messenger-shell {
        grid-template-columns: 1fr;
    }

    .chat-stage-header {
        flex-direction: column;
    }

    .video-room-strip {
        width: 100%;
    }
}

/* PTAD V12 control room and portal operating system */
.admin-panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.admin-panel-heading p {
    margin: 8px 0 0;
    color: #686868;
    max-width: 720px;
    line-height: 1.5;
}

.admin-code {
    display: inline-block;
    padding: 4px 7px;
    background: #f7f8fa;
    border: 1px solid #dfe3e8;
    color: #111;
    font-size: 12px;
}

.status-ready {
    color: #087f4f;
    font-weight: 700;
}

.status-check {
    color: #c40000;
    font-weight: 700;
}

@media (max-width: 760px) {
    .admin-panel-heading {
        display: block;
    }

    .admin-panel-heading form {
        margin-top: 14px;
    }
}

:root {
    --ink: #08090b;
    --panel: #ffffff;
    --line: #dfe3e8;
    --muted: #656a70;
    --soft: #f7f8fa;
    --nav: #050607;
    --nav-hover: #171717;
    --blue: #111111;
    --red: #b40000;
    --green: #007a5a;
    --amber: #9a6600;
    --shadow: 0 16px 42px rgba(12, 11, 9, .07);
}

body {
    background: var(--soft);
    color: var(--ink);
    letter-spacing: 0;
}

.console-shell {
    grid-template-columns: 264px minmax(0, 1fr);
}

.console-sidebar {
    background: #050607;
    border-right: 1px solid rgba(180, 0, 0, .35);
}

.console-brand {
    padding: 22px 20px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.console-brand span {
    color: #bdb7ad;
    font-size: 10px;
    letter-spacing: .24em;
}

.console-brand strong {
    margin-top: 10px;
    color: #fff;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: .02em;
}

.console-nav {
    padding: 16px 12px 34px;
}

.console-nav span {
    margin: 22px 8px 8px;
    color: #bdb7ad;
    font-size: 10px;
    letter-spacing: .2em;
}

.console-nav a,
.console-nav button {
    position: relative;
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #f7f8fa;
    font-size: 13px;
    line-height: 1.25;
    text-align: left;
}

.console-nav a:hover,
.console-nav button:hover,
.console-nav a.active {
    background: rgba(255, 255, 255, .055);
    border-left-color: var(--red);
}

.console-main {
    background:
        linear-gradient(180deg, rgba(255,255,255,.72), rgba(247,248,250,.96) 260px),
        var(--soft);
}

.console-topbar {
    min-height: 76px;
    padding: 18px 26px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
}

.console-topbar span,
.console-kicker {
    color: var(--red);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .22em;
}

.console-topbar h1 {
    margin-top: 5px;
    font-size: clamp(24px, 2.2vw, 36px);
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0;
}

.console-context {
    gap: 26px;
    padding: 11px 26px;
    background: #eef2f5;
    border-bottom: 1px solid var(--line);
    color: #323437;
    font-size: 13px;
}

.console-actions a,
.console-actions button,
.button,
.admin-button,
.admin-form button,
.login-form button {
    min-height: 39px;
    padding: 9px 16px;
    border: 1px solid #cfc8bf;
    border-radius: 0;
    background: #fff;
    color: #101010;
    font-size: 13px;
    font-weight: 700;
}

.console-actions a:hover,
.console-actions button:hover,
.button:hover,
.admin-button:hover {
    border-color: var(--red);
    color: var(--red);
}

.button.primary,
.admin-button,
.admin-form button,
.login-form button {
    background: #090909;
    border-color: #090909;
    color: #fff;
}

.button.primary:hover,
.admin-button:hover,
.admin-form button:hover,
.login-form button:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.console-main main,
.admin-content {
    padding: 22px 26px 34px;
}

.console-page {
    display: grid;
    gap: 18px;
}

.hero-panel,
.admin-panel,
.panel,
.workspace-panel,
.project-workspace-panel,
.admin-card,
.metric-card,
.portal-card {
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 24px 26px 0;
    overflow: hidden;
}

.hero-panel h2 {
    margin: 8px 0 22px;
    font-size: clamp(28px, 3vw, 46px);
    line-height: .98;
    font-weight: 500;
    letter-spacing: 0;
}

.hero-context {
    margin: 22px -26px 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.metrics-grid,
.admin-card-grid,
.module-grid,
.panel-grid,
.admin-workspace-grid,
.finance-grid,
.client-cockpit-grid,
.client-module-grid,
.portal-stats-grid {
    gap: 16px;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.admin-card,
.panel,
.admin-panel {
    padding: 20px;
}

.metric-card {
    min-height: 132px;
    border-top: 2px solid transparent;
}

.metric-card:hover,
.module-tile:hover,
.workspace-panel:hover,
.project-workspace-panel:hover {
    border-color: var(--line);
    border-top-color: var(--red);
    transform: none;
}

.metric-card span,
.admin-card span,
.module-tile span,
.panel-kicker,
.record-meta,
.portal-meta,
.form-hint {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.metric-card strong {
    margin: 15px 0 9px;
    color: var(--ink);
    font-size: clamp(32px, 3vw, 48px);
    line-height: .9;
    font-weight: 500;
}

.metric-card small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.admin-panel h2,
.panel h2,
.workspace-panel h2,
.project-workspace-panel h2 {
    margin-top: 0;
    font-size: clamp(20px, 1.7vw, 30px);
    font-weight: 500;
    letter-spacing: 0;
}

.project-workspace-dashboard,
.quote-page {
    display: grid;
    gap: 18px;
}

.workspace-hero,
.quote-page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(22px, 3vw, 42px);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 20px 45px rgba(9, 18, 32, .06);
}

.workspace-hero h1,
.quote-page-hero h1 {
    margin: 4px 0 8px;
    font-size: clamp(34px, 4vw, 62px);
    font-weight: 500;
    line-height: .98;
    letter-spacing: 0;
}

.workspace-hero p,
.quote-page-hero p,
.workspace-register-head p {
    margin: 0;
    max-width: 760px;
    color: #526070;
    font-size: 14px;
    line-height: 1.55;
}

.workspace-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.workspace-stat-grid .admin-card {
    min-height: 130px;
}

.workspace-section-grid {
    align-items: start;
}

.workspace-register-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.workspace-register-head h2 {
    margin-bottom: 6px;
}

.workspace-register-head > span {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: #1f2937;
    font-size: 12px;
    font-weight: 700;
}

.workspace-register-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.workspace-register-actions form {
    display: inline-flex;
}

.workspace-register-actions .admin-button,
.workspace-register-actions button {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 12px;
}

.workspace-quote-create,
.quote-editor-panel {
    margin-top: 18px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.workspace-quote-create > summary,
.quote-editor-panel > summary {
    cursor: pointer;
    padding: 14px 16px;
    color: #111;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.workspace-quote-create[open] > summary,
.quote-editor-panel[open] > summary {
    border-bottom: 1px solid var(--line);
}

.workspace-quote-create .admin-form,
.quote-editor-panel .admin-form {
    padding: 16px;
}

.quote-page {
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
}

.quote-action-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.quote-document-shell {
    padding: clamp(16px, 2vw, 28px);
    background: #eef1f5;
    border: 1px solid var(--line);
}

.quote-document-shell .quote-document {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.quote-issue-panel {
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
}

.project-workspace-dashboard .project-workspace-tabs {
    margin-bottom: 12px;
}

.project-workspace-dashboard .workspace-dashboard-hero .dashboard-hero-status {
    margin-right: 0;
}

.project-workspace-dashboard .workspace-action-bar {
    justify-content: flex-end;
    margin-top: -4px;
}

.project-workspace-dashboard .workspace-action-bar form {
    margin: 0;
}

.project-workspace-dashboard .workspace-command-grid .dashboard-command strong {
    font-size: clamp(28px, 3vw, 48px);
    line-height: .98;
}

.project-workspace-dashboard .admin-flow-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.project-workspace-dashboard .admin-flow-grid a,
.project-workspace-dashboard .admin-flow-grid > div {
    display: block;
    min-height: 92px;
    padding: 14px;
    border: 1px solid #dfe3e8;
    border-top: 2px solid transparent;
    background: #fff;
    color: #101010;
    text-decoration: none;
}

.project-workspace-dashboard .admin-flow-grid a:hover {
    border-top-color: #c40000;
}

.project-workspace-dashboard .admin-flow-grid strong {
    display: block;
    margin-bottom: 8px;
    color: #101010;
    font-size: clamp(24px, 2.1vw, 38px);
    font-weight: 500;
    line-height: .95;
}

.project-workspace-dashboard .admin-flow-grid span {
    display: block;
    color: #686868;
    font-size: 12px;
    line-height: 1.4;
}

.project-workspace-dashboard .admin-panel {
    overflow: hidden;
}

.project-workspace-dashboard .admin-table.compact td {
    vertical-align: middle;
}

@media (max-width: 1280px) {
    .project-workspace-dashboard .admin-flow-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .project-workspace-dashboard .admin-flow-grid {
        grid-template-columns: 1fr;
    }

    .project-workspace-dashboard .workspace-action-bar {
        justify-content: flex-start;
    }
}

@media (max-width: 980px) {
    .workspace-hero,
    .quote-page-hero {
        flex-direction: column;
    }

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

@media (max-width: 640px) {
    .workspace-stat-grid {
        grid-template-columns: 1fr;
    }

    .workspace-register-actions {
        justify-content: flex-start;
    }
}

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

.module-tile {
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--line);
    border-top: 2px solid transparent;
    border-radius: 0;
    background: #fff;
}

.module-tile strong {
    margin-top: 18px;
    font-size: 19px;
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: .02em;
}

.admin-table {
    border: 1px solid var(--line);
    background: #fff;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}

.admin-table th {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .18em;
}

.admin-table a {
    color: var(--red);
}

.admin-form {
    gap: 14px;
}

.admin-form label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(180, 0, 0, .08);
    outline: none;
}

.record-row,
.client-record-row,
.portal-room-row,
.gantt-row,
.admin-task-row {
    border-bottom: 1px solid var(--line);
}

.pill,
.status-pill,
.schedule-pill,
.portal-pill {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: #121212;
}

.schedule-pill.overdue,
.status-pill.overdue,
.portal-pill.overdue {
    border-color: #efb8b8;
    background: #fff3f3;
    color: #9c0000;
}

.schedule-pill.complete,
.status-pill.complete,
.portal-pill.complete {
    border-color: #b7dfd0;
    background: #effaf6;
    color: var(--green);
}

.portal-gantt-chart {
    border: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
}

.portal-gantt-head {
    background: #0a0a0a;
    color: #fff;
}

.portal-gantt-head span {
    color: #d6dee7;
}

.portal-gantt-title strong {
    color: var(--ink);
}

.portal-gantt-trackline {
    background:
        linear-gradient(90deg, rgba(180,0,0,.06) 1px, transparent 1px),
        #f7f8fa;
    background-size: calc(100% / 12) 100%;
}

.portal-gantt-bar {
    background: rgba(180, 0, 0, .9);
    box-shadow: none;
}

.portal-gantt-bar span {
    background: #111;
}

.portal-gantt-trackline em {
    color: var(--muted);
}

.admin-error,
.console-alert {
    border: 1px solid #e2b4b4;
    border-left: 3px solid var(--red);
    border-radius: 0;
    background: #fff7f7;
    color: #6f0000;
}

.login-body {
    background:
        radial-gradient(circle at 75% 15%, rgba(180,0,0,.16), transparent 28%),
        #050607;
}

.login-form {
    padding: 42px;
    border: 1px solid rgba(180, 0, 0, .45);
    background: rgba(0, 0, 0, .72);
}

.login-form h1 {
    font-weight: 400;
    letter-spacing: .12em;
    text-transform: uppercase;
}

@media (max-width: 1180px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .console-shell {
        grid-template-columns: 1fr;
    }

    .console-sidebar {
        position: static;
        height: auto;
    }

    .console-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

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

/* PTAD final console authority 20260504 */
body.portal-console-body,
body.admin-body,
body.login-body {
    background: #f7f8fa;
    color: #0c0c0d;
    font-family: Arial, Helvetica, sans-serif;
}

.portal-console-body * ,
.admin-body * ,
.login-body * {
    box-sizing: border-box;
    min-width: 0;
}

.portal-console-body .console-shell,
.admin-body .console-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: clamp(230px, 13.5vw, 280px) minmax(0, 1fr);
    background: #f7f8fa;
}

.portal-console-body .console-sidebar,
.admin-body .console-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #050505;
    border-right: 1px solid rgba(196, 0, 0, .35);
    color: #fff;
}

.portal-console-body .console-brand,
.admin-body .console-brand {
    display: block;
    padding: 22px 20px 26px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    text-decoration: none;
}

.portal-console-body .console-brand span,
.admin-body .console-brand span,
.portal-console-body .console-nav span,
.admin-body .console-nav span {
    color: rgba(255,255,255,.58);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .24em;
    text-transform: uppercase;
}

.portal-console-body .console-brand strong,
.admin-body .console-brand strong {
    display: block;
    margin-top: 10px;
    color: #fff;
    font-size: clamp(17px, 1.1vw, 22px);
    line-height: 1.08;
    letter-spacing: .02em;
}

.portal-console-body .console-nav,
.admin-body .console-nav {
    padding: 16px 12px 34px;
}

.portal-console-body .console-nav span,
.admin-body .console-nav span {
    display: block;
    margin: 22px 8px 8px;
}

.portal-console-body .console-nav a,
.portal-console-body .console-nav button,
.admin-body .console-nav a,
.admin-body .console-nav button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: rgba(255,255,255,.88);
    font-size: 13px;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.portal-console-body .console-nav a:hover,
.portal-console-body .console-nav button:hover,
.portal-console-body .console-nav a.active,
.admin-body .console-nav a:hover,
.admin-body .console-nav button:hover,
.admin-body .console-nav a.active {
    background: rgba(255,255,255,.055);
    border-left-color: #c40000;
    color: #fff;
}

.portal-console-body .console-main,
.admin-body .console-main {
    min-width: 0;
    background: #f7f8fa;
}

.portal-console-body .console-topbar,
.admin-body .console-topbar {
    min-height: 74px;
    padding: 16px clamp(20px, 2vw, 32px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid #dfe3e8;
}

.portal-console-body .console-topbar span,
.portal-console-body .console-kicker,
.admin-body .console-topbar span,
.admin-body .console-kicker,
.admin-kicker {
    color: #c40000;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.portal-console-body .console-topbar h1,
.admin-body .console-topbar h1 {
    max-width: 72vw;
    margin: 5px 0 0;
    color: #101010;
    font-size: clamp(23px, 2vw, 36px);
    line-height: 1.02;
    font-weight: 400;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.portal-console-body .console-actions,
.admin-body .console-actions,
.admin-action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.portal-console-body .console-actions a,
.portal-console-body .console-actions button,
.admin-body .console-actions a,
.admin-body .console-actions button,
.button,
.admin-button,
.admin-form button,
.login-form button {
    min-height: 38px;
    padding: 9px 15px;
    border: 1px solid #cfc8bf;
    border-radius: 0;
    background: #fff;
    color: #101010;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.button.primary,
.admin-button,
.admin-form button,
.login-form button {
    background: #070707;
    border-color: #070707;
    color: #fff;
}

.portal-console-body .console-actions a:hover,
.portal-console-body .console-actions button:hover,
.admin-body .console-actions a:hover,
.admin-body .console-actions button:hover,
.button:hover,
.admin-button:hover,
.admin-form button:hover {
    border-color: #c40000;
    color: #c40000;
}

.button.primary:hover,
.admin-button:hover,
.admin-form button:hover,
.login-form button:hover {
    background: #c40000;
    border-color: #c40000;
    color: #fff;
}

.admin-button.danger:hover,
.danger-link:hover {
    background: #9b0000;
    border-color: #9b0000;
    color: #fff;
}

.portal-console-body .console-context,
.admin-body .console-context {
    display: flex;
    gap: clamp(14px, 2vw, 28px);
    flex-wrap: wrap;
    padding: 10px clamp(20px, 2vw, 32px);
    background: #eef2f5;
    border-bottom: 1px solid #dfe3e8;
    color: #3a3a3a;
    font-size: 13px;
}

.portal-console-body .console-page,
.admin-body .console-page,
.admin-content {
    display: grid;
    gap: 16px;
    padding: clamp(18px, 2vw, 30px);
}

.admin-content > .console-page {
    padding: 0;
}

.admin-content .admin-panel {
    margin-bottom: 0;
}

.hero-panel,
.admin-header,
.admin-panel,
.panel,
.workspace-panel,
.project-workspace-panel,
.admin-card,
.metric-card,
.portal-card {
    border: 1px solid #dfe3e8;
    border-radius: 0;
    background: rgba(255,255,255,.96);
    box-shadow: 0 10px 26px rgba(6, 14, 25, .045);
}

.hero-panel,
.admin-header {
    margin-bottom: 0;
    padding: clamp(18px, 1.8vw, 28px);
}

.hero-panel h2,
.admin-header h1 {
    max-width: 1040px;
    margin: 10px 0 0;
    font-size: clamp(24px, 2.4vw, 40px);
    line-height: .98;
    font-weight: 400;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.hero-panel p,
.admin-header-note {
    max-width: 880px;
    margin: 14px 0 0;
    color: #4f4f4f;
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.55;
}

.metrics-grid,
.admin-card-grid,
.module-grid,
.panel-grid,
.finance-grid,
.client-cockpit-grid,
.client-module-grid,
.portal-stats-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 0;
}

.metrics-grid,
.admin-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric-card,
.admin-card,
.panel,
.admin-panel {
    min-height: 0;
    padding: clamp(12px, 1.1vw, 18px);
}

.metric-card {
    border-top: 2px solid transparent;
}

.metric-card:hover,
.admin-card:hover,
.module-tile:hover {
    border-top-color: #c40000;
}

.metric-card span,
.admin-card span,
.module-tile span,
.panel-kicker,
.record-meta,
.portal-meta,
.form-hint {
    color: #686868;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.metric-card strong,
.admin-card strong {
    display: block;
    margin: 12px 0 8px;
    color: #101010;
    font-size: clamp(22px, 2vw, 34px);
    line-height: .9;
    font-weight: 400;
}

.metric-card small,
.admin-card small {
    color: #686868;
    font-size: 12px;
    line-height: 1.45;
}

.admin-panel h2,
.panel h2,
.workspace-panel h2,
.project-workspace-panel h2 {
    margin: 0 0 14px;
    color: #111;
    font-size: clamp(18px, 1.35vw, 24px);
    line-height: 1.08;
    font-weight: 400;
    letter-spacing: 0;
}

.module-tile {
    min-height: 88px;
    padding: 14px;
    border: 1px solid #dfe3e8;
    border-top: 2px solid transparent;
    border-radius: 0;
    background: #fff;
    color: #111;
}

.module-tile strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(16px, 1.1vw, 20px);
    line-height: 1.12;
    font-weight: 400;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    align-items: end;
    gap: clamp(14px, 1.8vw, 24px);
}

.dashboard-hero .hero-context {
    grid-column: 1 / -1;
}

.dashboard-hero-status {
    padding: 14px;
    border-left: 2px solid #c40000;
    background: #fafafa;
}

.dashboard-hero-status span,
.dashboard-command span,
.dashboard-panel-heading span,
.dashboard-assurance .console-kicker {
    color: #c40000;
}

.dashboard-hero-status strong {
    display: block;
    margin: 8px 0;
    color: #111;
    font-size: clamp(22px, 2.2vw, 34px);
    line-height: .9;
    font-weight: 400;
}

.dashboard-hero-status small {
    color: #555;
    font-size: 12px;
    line-height: 1.45;
}

.dashboard-command-grid,
.dashboard-assurance-grid {
    display: grid;
    gap: 12px;
}

.dashboard-command-grid {
    grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
}

.dashboard-command {
    min-height: 150px;
    padding: clamp(14px, 1.2vw, 18px);
    border: 1px solid #dfe3e8;
    border-top: 2px solid transparent;
    background: #fff;
    color: #111;
    box-shadow: 0 10px 26px rgba(6, 14, 25, .04);
}

.dashboard-command.primary {
    background: #101010;
    color: #fff;
}

.dashboard-command:hover {
    border-top-color: #c40000;
}

.dashboard-command strong {
    display: block;
    margin: 12px 0 10px;
    font-size: clamp(30px, 3vw, 48px);
    line-height: .85;
    font-weight: 400;
}

.dashboard-command small {
    display: block;
    max-width: 330px;
    color: #646464;
    font-size: 12px;
    line-height: 1.55;
}

.dashboard-command.primary small {
    color: #d5d5d5;
}

.dashboard-metrics .metric-card {
    min-height: 120px;
}

.dashboard-panel-heading {
    margin-bottom: 18px;
}

.dashboard-panel-heading h2 {
    margin-top: 8px;
}

.dashboard-assurance-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-assurance {
    display: grid;
    gap: 10px;
}

.dashboard-assurance p {
    margin: 0;
    color: #555;
}

.dashboard-assurance a {
    justify-self: start;
    margin-top: 4px;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.dashboard-assurance a:hover {
    color: #c40000;
}

@media (max-width: 1100px) {
    .dashboard-command-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-assurance-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-hero,
    .dashboard-command-grid {
        grid-template-columns: 1fr;
    }
}

.admin-table {
    width: 100%;
    border: 1px solid #dfe3e8;
    border-collapse: collapse;
    background: #fff;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #dfe3e8;
    font-size: 12px;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: #686868;
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.admin-table a {
    color: #c40000;
}

.admin-form {
    display: grid;
    gap: 14px;
}

.admin-form label {
    display: grid;
    gap: 6px;
    color: #686868;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid #dfe3e8;
    border-radius: 0;
    background: #fff;
    color: #111;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: #c40000;
    box-shadow: 0 0 0 3px rgba(196, 0, 0, .08);
    outline: none;
}

.admin-help {
    margin-top: -8px;
    color: #686868;
    font-size: 12px;
    line-height: 1.5;
}

.admin-actions-inline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-media-thumb {
    display: block;
    width: 96px;
    height: 64px;
    object-fit: cover;
    background: #090909;
    border: 1px solid #dfe3e8;
}

.admin-file-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #dfe3e8;
    color: #686868;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
}

.portal-gantt-chart {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dfe3e8;
    border-radius: 0;
    background: #fff;
}

.portal-gantt-head,
.portal-gantt-line {
    min-width: 860px;
    grid-template-columns: 220px minmax(360px, 1fr) 200px;
}

.portal-gantt-head {
    background: #060606;
    color: #fff;
}

.portal-gantt-trackline {
    background:
        linear-gradient(90deg, rgba(196,0,0,.08) 1px, transparent 1px),
        #f7f8fa;
    background-size: calc(100% / 12) 100%;
}

.portal-gantt-bar {
    background: #c40000;
    box-shadow: none;
}

.portal-gantt-bar span {
    background: #111;
}

body.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0;
    background:
        linear-gradient(90deg, rgba(0,0,0,.78), rgba(0,0,0,.9)),
        url("/images/site/architecture-curves.jpeg") center / cover no-repeat,
        #050505;
    color: #fff;
}

.login-shell {
    width: min(1120px, calc(100vw - 48px));
    min-height: min(620px, calc(100vh - 48px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    border-top: 1px solid #c40000;
    background: rgba(0, 0, 0, .72);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .46);
}

.login-visual,
.login-form {
    min-width: 0;
}

.login-visual {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(36px, 5vw, 70px);
    background:
        linear-gradient(90deg, rgba(0,0,0,.48), rgba(0,0,0,.78)),
        url("/images/site/architecture-curves.jpeg") center / cover no-repeat;
}

.login-visual span,
.login-kicker {
    color: #c40000;
    font-size: 10px;
    letter-spacing: .42em;
    text-transform: uppercase;
}

.login-visual h1 {
    margin: 28px 0;
    max-width: 660px;
    color: #fff;
    font-size: clamp(70px, 8vw, 132px);
    font-weight: 300;
    letter-spacing: .05em;
    line-height: .88;
    text-transform: uppercase;
}

.login-visual-logo {
    display: block;
    width: min(620px, 100%);
    height: auto;
    margin: 28px 0;
}

.login-visual p {
    margin: 0;
    color: rgba(255,255,255,.74);
    font-size: 12px;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.login-form {
    align-self: stretch;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(34px, 4vw, 54px);
    border-left: 1px solid rgba(196, 0, 0, .42);
    background: rgba(0, 0, 0, .86);
}

.login-form h1 {
    margin: 22px 0 4px;
    color: #fff;
    font-size: 30px;
    font-weight: 300;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.login-form-logo {
    display: block;
    width: min(320px, 100%);
    height: auto;
    margin: 22px 0 34px;
}

.login-subtitle {
    margin: 0 0 34px;
    color: rgba(255,255,255,.56);
    font-size: 11px;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.login-form label {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    color: rgba(255,255,255,.62);
    font-size: 10px;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.login-form input {
    min-height: 48px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 0;
    background: rgba(255,255,255,.05);
    color: #fff;
}

.login-form input::placeholder {
    color: rgba(255,255,255,.35);
}

.login-form input:focus {
    border-color: #c40000;
    box-shadow: 0 0 0 3px rgba(196,0,0,.16);
    outline: none;
}

.login-form button {
    min-height: 50px;
    margin-top: 8px;
    border: 1px solid #c40000;
    border-radius: 0;
    background: #c40000;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .32em;
    text-transform: uppercase;
}

.login-form .admin-error {
    margin-bottom: 16px;
}

@media (max-width: 1180px) {
    .metrics-grid,
    .admin-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* MESSENGER CONSOLE */
.chat-messenger-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 340px;
    gap: 0;
    min-height: calc(100vh - 210px);
    max-height: calc(100vh - 150px);
    overflow: hidden;
    background: #f4f6f8;
    border: 1px solid #dfe3e8;
}

.chat-conversation-rail,
.chat-context-panel {
    background: #f7f8fa;
    color: #121212;
    overflow: auto;
}

.chat-conversation-rail { border-right: 1px solid #dfe3e8; }
.chat-context-panel { border-left: 1px solid #dfe3e8; }

.chat-sidebar-head,
.chat-topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
}

.chat-sidebar-head span,
.chat-list-label,
.chat-context-section dt {
    display: block;
    color: #b30000;
    font-size: 10px;
    letter-spacing: 3px;
    line-height: 1.4;
    text-transform: uppercase;
}

.chat-sidebar-head strong {
    font-size: 20px;
    letter-spacing: 3px;
}

.chat-list-section {
    padding: 18px 14px;
    border-bottom: 1px solid #dfe3e8;
}

.chat-list-section.rooms { border-bottom: none; }

.chat-project-switcher,
.chat-room-list,
.participant-stack {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.chat-project-switcher a,
.chat-room-link,
.participant-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: #121212;
    text-decoration: none;
    border: 1px solid transparent;
}

.chat-project-switcher a { grid-template-columns: minmax(0, 1fr); }

.chat-project-switcher a.active,
.chat-room-link.active {
    background: #fff;
    border-color: #b30000;
}

.chat-project-switcher strong,
.chat-room-copy strong,
.participant-row strong {
    display: block;
    color: #111;
    font-size: 13px;
    letter-spacing: 0.4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-project-switcher small,
.chat-room-copy small,
.participant-row small {
    display: block;
    color: #646464;
    font-size: 11px;
    letter-spacing: 0.2px;
    line-height: 1.4;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-avatar,
.chat-avatar,
.participant-row > span {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: #111;
    color: #fff;
    border: 1px solid #b30000;
    border-radius: 50%;
    font-size: 11px;
    letter-spacing: 1.5px;
}

.chat-room-avatar.large {
    width: 46px;
    height: 46px;
}

.chat-room-badge {
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #b30000;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
}

.chat-main-panel {
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #eef2f5;
}

.chat-room-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.chat-room-title h2 {
    margin: 0;
    color: #111;
    font-size: 18px;
    letter-spacing: 0.8px;
    line-height: 1.2;
}

.chat-room-title p {
    margin: 4px 0 0;
    color: #686868;
    font-size: 12px;
    letter-spacing: 0.2px;
}

.video-call-action,
.chat-composer button,
.chat-room-form button {
    border: 1px solid #111;
    background: #111;
    color: #fff;
    min-height: 42px;
    padding: 0 18px;
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.chat-thread {
    min-height: 0;
    overflow-y: auto;
    padding: 26px;
    background:
        radial-gradient(circle at 24px 24px, rgba(179, 0, 0, 0.055) 1px, transparent 1px),
        linear-gradient(135deg, #efe9df, #f7f2eb);
    background-size: 32px 32px, auto;
}

.chat-bubble-row {
    width: min(74%, 720px);
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin: 0 0 14px;
}

.chat-bubble-row.mine {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-bubble {
    padding: 10px 12px;
    background: #fff;
    color: #181818;
    border: 1px solid #dfe3e8;
    border-radius: 8px 8px 8px 2px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

.chat-bubble.mine {
    background: #111;
    color: #fff;
    border-color: #111;
    border-radius: 8px 8px 2px 8px;
}

.chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 5px;
}

.chat-bubble-meta strong {
    color: inherit;
    font-size: 11px;
    letter-spacing: 0.4px;
}

.chat-bubble-meta span {
    color: currentColor;
    opacity: 0.62;
    font-size: 10px;
    white-space: nowrap;
}

.chat-bubble p {
    margin: 0;
    color: inherit;
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: 0.2px;
}

.chat-attachment {
    display: inline-flex;
    margin-top: 8px;
    color: #b30000;
    font-size: 12px;
    letter-spacing: 0.8px;
    text-decoration: none;
}

.chat-bubble.mine .chat-attachment {
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.55);
}

.chat-composer {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) 92px;
    gap: 10px;
    align-items: end;
    padding: 14px;
    background: #fff;
    border-top: 1px solid #dfe3e8;
}

.chat-composer textarea,
.chat-room-form textarea,
.chat-room-form input[type="text"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid #dfe3e8;
    background: #f7f8fa;
    color: #111;
    padding: 12px;
    resize: vertical;
    font: inherit;
}

.chat-composer textarea {
    max-height: 100px;
    resize: none;
}

.chat-attach-control {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dfe3e8;
    background: #f7f8fa;
    color: #111;
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
}

.chat-attach-control input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.chat-context-section,
.chat-room-form {
    padding: 18px;
    border-bottom: 1px solid #dfe3e8;
}

.chat-context-section h3 {
    margin: 14px 0 8px;
    color: #111;
    font-size: 22px;
    letter-spacing: 1.5px;
    line-height: 1.1;
    text-transform: uppercase;
}

.chat-context-section p,
.chat-context-section dd {
    color: #5e5e5e;
    font-size: 13px;
    line-height: 1.55;
    letter-spacing: 0.3px;
}

.chat-context-section dl {
    display: grid;
    gap: 12px;
    margin: 16px 0 0;
}

.chat-context-section dd {
    margin: 4px 0 0;
    color: #111;
}

.participant-row {
    grid-template-columns: 36px minmax(0, 1fr);
    background: #fff;
    border-color: #dfe3e8;
}

.participant-row > span {
    width: 32px;
    height: 32px;
}

.chat-room-form {
    display: grid;
    gap: 12px;
}

.chat-room-form label {
    display: grid;
    gap: 6px;
    color: #555;
    font-size: 11px;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.chat-check {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.chat-participant-picker {
    display: grid;
    gap: 8px;
    max-height: 190px;
    overflow: auto;
    padding-right: 4px;
}

.chat-participant-picker label {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #dfe3e8;
}

.chat-empty-state {
    margin: auto;
    max-width: 420px;
    text-align: center;
    color: #111;
}

.chat-empty-state span {
    display: block;
    color: #b30000;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.chat-empty-state p {
    margin-top: 10px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 1280px) {
    .chat-messenger-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .chat-context-panel {
        display: none;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-visual {
        padding: 34px 28px 0;
    }

    .login-visual h1 {
        font-size: clamp(48px, 16vw, 76px);
    }

    .login-visual p {
        display: none;
    }

    .login-form {
        border-left: 0;
    }

    .portal-console-body .console-shell,
    .admin-body .console-shell {
        grid-template-columns: 1fr;
    }

    .portal-console-body .console-sidebar,
    .admin-body .console-sidebar {
        position: static;
        height: auto;
    }

    .portal-console-body .console-topbar,
    .admin-body .console-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-grid,
    .admin-card-grid,
    .module-grid,
    .client-module-grid,
    .panel-grid,
    .finance-grid,
    .client-cockpit-grid,
    .portal-stats-grid {
        grid-template-columns: 1fr;
    }

    .chat-messenger-shell {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .chat-conversation-rail {
        border-right: none;
        border-bottom: 1px solid #dfe3e8;
    }

    .chat-room-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-bubble-row {
        width: 94%;
    }

    .chat-composer {
        grid-template-columns: 1fr;
    }
}

/* MESSENGER V3 - project communication console */
.portal-console-body .chat-messenger-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) 320px;
    gap: 0;
    height: min(780px, calc(100vh - 174px));
    min-height: 620px;
    max-height: none;
    overflow: hidden;
    background: #f4f6f8;
    border: 1px solid #d6dee7;
    border-top: 2px solid #b30000;
    box-shadow: 0 18px 54px rgba(16, 16, 16, 0.08);
}

.portal-console-body .chat-conversation-rail,
.portal-console-body .chat-context-panel,
.portal-console-body .chat-main-panel {
    min-width: 0;
    min-height: 0;
}

.portal-console-body .chat-conversation-rail {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
    background: #fbfaf7;
    border-right: 1px solid #d6dee7;
}

.portal-console-body .chat-context-panel {
    overflow-y: auto;
    background: #fbfaf7;
    border-left: 1px solid #d6dee7;
}

.portal-console-body .chat-sidebar-head,
.portal-console-body .chat-topbar {
    min-height: 74px;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
}

.portal-console-body .chat-sidebar-head {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.portal-console-body .chat-sidebar-head strong {
    color: #101010;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.portal-console-body .chat-list-section {
    min-height: 0;
    padding: 14px;
    border-bottom: 1px solid #dfe3e8;
}

.portal-console-body .chat-list-section.rooms {
    overflow-y: auto;
}

.portal-console-body .chat-list-label,
.portal-console-body .chat-sidebar-head span,
.portal-console-body .chat-context-section dt {
    color: #b30000;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    line-height: 1.2;
    text-transform: uppercase;
}

.portal-console-body .chat-project-switcher {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.portal-console-body .chat-project-switcher a {
    min-width: 190px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2dcd5;
    color: #111;
}

.portal-console-body .chat-project-switcher a.active {
    border-color: #b30000;
    box-shadow: inset 0 2px 0 #b30000;
}

.portal-console-body .chat-room-list,
.portal-console-body .participant-stack {
    display: grid;
    gap: 0;
    margin-top: 10px;
}

.portal-console-body .chat-room-link {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 26px;
    gap: 10px;
    align-items: center;
    padding: 12px 10px;
    border: 0;
    border-bottom: 1px solid #e3e8ef;
    color: #111;
    text-decoration: none;
}

.portal-console-body .chat-room-link::before {
    content: "";
    position: absolute;
    inset: 10px auto 10px 0;
    width: 2px;
    background: transparent;
}

.portal-console-body .chat-room-link:hover,
.portal-console-body .chat-room-link.active {
    background: #fff;
}

.portal-console-body .chat-room-link.active::before {
    background: #b30000;
}

.portal-console-body .chat-room-avatar,
.portal-console-body .chat-avatar,
.portal-console-body .participant-row > span {
    width: 40px;
    height: 40px;
    border: 0;
    background: #111;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.portal-console-body .chat-room-avatar.large {
    width: 48px;
    height: 48px;
    background: #b30000;
}

.portal-console-body .chat-room-copy {
    min-width: 0;
}

.portal-console-body .chat-room-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.portal-console-body .chat-room-copy strong,
.portal-console-body .participant-row strong,
.portal-console-body .chat-project-switcher strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #101010;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-console-body .chat-room-line em {
    flex: 0 0 auto;
    color: #908a82;
    font-size: 10px;
    font-style: normal;
    letter-spacing: 0.04em;
}

.portal-console-body .chat-room-copy small,
.portal-console-body .participant-row small,
.portal-console-body .chat-project-switcher small {
    display: block;
    overflow: hidden;
    color: #706a64;
    font-size: 12px;
    letter-spacing: 0;
    line-height: 1.35;
    margin-top: 4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-console-body .chat-room-badge {
    width: 22px;
    min-width: 22px;
    height: 22px;
    background: #b30000;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

.portal-console-body .chat-main-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #ebe4dc;
}

.portal-console-body .chat-room-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.portal-console-body .chat-room-title h2 {
    overflow: hidden;
    margin: 0;
    color: #101010;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-console-body .chat-room-title p {
    margin: 3px 0 0;
    color: #68625d;
    font-size: 12px;
    letter-spacing: 0;
}

.portal-console-body .video-call-action {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #d6dee7;
    background: #fff;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.portal-console-body .chat-thread {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    background:
        radial-gradient(circle at 18px 18px, rgba(179, 0, 0, 0.055) 1px, transparent 1px),
        linear-gradient(135deg, #efe9df 0%, #f8f4ee 100%);
    background-size: 34px 34px, auto;
}

.portal-console-body .chat-bubble-row {
    display: flex;
    align-items: flex-end;
    width: min(76%, 720px);
    gap: 8px;
    margin: 0 0 12px;
}

.portal-console-body .chat-bubble-row.mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.portal-console-body .chat-bubble-row.mine .chat-avatar {
    display: none;
}

.portal-console-body .chat-bubble {
    position: relative;
    max-width: 100%;
    padding: 10px 12px 9px;
    background: #fff;
    color: #151515;
    border: 1px solid #dfd9d1;
    border-radius: 12px 12px 12px 3px;
    box-shadow: 0 8px 24px rgba(20, 16, 12, 0.06);
}

.portal-console-body .chat-bubble.mine {
    background: #111;
    color: #fff;
    border-color: #111;
    border-radius: 12px 12px 3px 12px;
}

.portal-console-body .chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.portal-console-body .chat-bubble-meta strong {
    color: inherit;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.portal-console-body .chat-bubble-meta span {
    color: currentColor;
    font-size: 10px;
    opacity: 0.58;
    white-space: nowrap;
}

.portal-console-body .chat-bubble p {
    margin: 0;
    color: inherit;
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.48;
}

.portal-console-body .chat-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 7px 9px;
    background: #f7f8fa;
    color: #b30000;
    border: 1px solid #dfe3e8;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.portal-console-body .chat-bubble.mine .chat-attachment {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
    color: #fff;
}

.portal-console-body .chat-composer {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 52px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #dfe3e8;
}

.portal-console-body .chat-attach-control,
.portal-console-body .chat-composer button {
    position: relative;
    width: 46px;
    min-height: 46px;
    height: 46px;
    overflow: hidden;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    cursor: pointer;
}

.portal-console-body .chat-attach-control {
    border: 1px solid #d6dee7;
    background: #f7f8fa;
    color: #111;
}

.portal-console-body .chat-attach-control::before {
    content: "+";
    color: #111;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
}

.portal-console-body .chat-attach-control input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.portal-console-body .chat-composer textarea {
    width: 100%;
    min-height: 46px;
    max-height: 118px;
    resize: none;
    border: 1px solid #d6dee7;
    border-radius: 23px;
    background: #f7f8fa;
    color: #111;
    padding: 13px 16px;
    font: inherit;
    font-size: 14px;
    letter-spacing: 0;
}

.portal-console-body .chat-composer button {
    border: 1px solid #b30000;
    background: #b30000;
    color: #fff;
}

.portal-console-body .chat-composer button::before {
    content: ">";
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.portal-console-body .chat-context-section,
.portal-console-body .chat-room-form {
    padding: 18px;
    border-bottom: 1px solid #dfe3e8;
}

.portal-console-body .chat-context-section h3 {
    margin: 12px 0 8px;
    color: #111;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
}

.portal-console-body .chat-context-section p,
.portal-console-body .chat-context-section dd {
    color: #566273;
    font-size: 13px;
    letter-spacing: 0;
    line-height: 1.5;
}

.portal-console-body .chat-context-section dl {
    display: grid;
    gap: 10px;
    margin: 16px 0 0;
}

.portal-console-body .chat-context-section dd {
    margin: 4px 0 0;
    color: #111;
}

.portal-console-body .participant-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    padding: 9px 0;
    border: 0;
    border-bottom: 1px solid #e3e8ef;
    background: transparent;
}

.portal-console-body .participant-row > span {
    width: 34px;
    height: 34px;
}

.portal-console-body .chat-room-form {
    display: grid;
    gap: 12px;
}

.portal-console-body .chat-room-form label {
    display: grid;
    gap: 6px;
    color: #5c5752;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.portal-console-body .chat-room-form input[type="text"],
.portal-console-body .chat-room-form textarea {
    width: 100%;
    border: 1px solid #d6dee7;
    background: #fff;
    color: #111;
    padding: 11px;
    font: inherit;
    letter-spacing: 0;
}

.portal-console-body .chat-check,
.portal-console-body .chat-participant-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-console-body .chat-check input,
.portal-console-body .chat-participant-picker input {
    width: auto;
}

.portal-console-body .chat-participant-picker {
    display: grid;
    max-height: 180px;
    overflow-y: auto;
}

.portal-console-body .chat-participant-picker label {
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e3e8ef;
}

.portal-console-body .chat-participant-picker small {
    margin-left: auto;
    color: #b30000;
}

.portal-console-body .chat-room-form button {
    min-height: 42px;
    border: 1px solid #111;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.portal-console-body .chat-empty-state {
    align-self: center;
    justify-self: center;
    max-width: 420px;
    margin: auto;
    text-align: center;
}

.portal-console-body .chat-empty-state span {
    display: block;
    color: #b30000;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.portal-console-body .chat-empty-state p {
    margin: 10px 0 0;
    color: #635d56;
    font-size: 14px;
    letter-spacing: 0;
    line-height: 1.5;
}

@media (max-width: 1320px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 310px minmax(0, 1fr);
    }

    .portal-console-body .chat-context-panel {
        display: none;
    }
}

@media (max-width: 900px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .portal-console-body .chat-conversation-rail {
        max-height: 420px;
        border-right: 0;
        border-bottom: 1px solid #d6dee7;
    }

    .portal-console-body .chat-main-panel {
        min-height: 620px;
    }

    .portal-console-body .chat-bubble-row {
        width: 92%;
    }
}

/* MESSENGER V4 - WhatsApp-style project workrooms */
.portal-console-body .chat-messenger-shell {
    grid-template-columns: 360px minmax(0, 1fr) 300px;
    height: min(820px, calc(100vh - 154px));
    min-height: 660px;
    border: 1px solid #d6d0c8;
    border-top: 3px solid #b30000;
    border-radius: 0;
    background: #f4f6f8;
    box-shadow: 0 24px 60px rgba(8, 8, 8, .10);
}

.portal-console-body .chat-conversation-rail {
    grid-template-rows: auto auto auto minmax(0, 1fr);
    background: #f7f8fa;
}

.portal-console-body .chat-sidebar-head {
    min-height: 86px;
    padding: 16px 18px 14px;
    background: #111;
    color: #fff;
    border-bottom: 1px solid #26221f;
}

.portal-console-body .chat-sidebar-head strong {
    width: 100%;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-console-body .chat-sidebar-head small {
    color: #96a0ad;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-console-body .chat-account-mark {
    color: #d50000 !important;
}

.portal-console-body .chat-search-wrap {
    padding: 12px 14px;
    background: #f7f8fa;
    border-bottom: 1px solid #e1dbd3;
}

.portal-console-body .chat-search-input {
    width: 100%;
    height: 42px;
    border: 1px solid #ded7ce;
    border-radius: 999px;
    background: #fff;
    color: #111;
    padding: 0 16px;
    font-size: 13px;
    letter-spacing: 0;
    outline: none;
}

.portal-console-body .chat-search-input:focus {
    border-color: #b30000;
}

.portal-console-body .chat-list-section {
    padding: 12px 0 0;
    border-bottom: 1px solid #e1dbd3;
}

.portal-console-body .chat-list-section > .chat-list-label {
    display: block;
    padding: 0 16px;
}

.portal-console-body .chat-project-switcher {
    display: grid;
    gap: 0;
    max-height: 150px;
    margin-top: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.portal-console-body .chat-project-switcher a {
    min-width: 0;
    padding: 11px 16px;
    border: 0;
    border-top: 1px solid #ebe5de;
    background: transparent;
}

.portal-console-body .chat-project-switcher a.active {
    background: #fff;
    border-color: #ebe5de;
    box-shadow: inset 3px 0 0 #b30000;
}

.portal-console-body .chat-list-section.rooms {
    padding-top: 12px;
    border-bottom: 0;
}

.portal-console-body .chat-room-list {
    margin-top: 8px;
}

.portal-console-body .chat-room-link {
    min-height: 72px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    padding: 12px 14px;
    border-bottom: 1px solid #e3e8ef;
    background: transparent;
}

.portal-console-body .chat-room-link:hover,
.portal-console-body .chat-room-link.active {
    background: #fff;
}

.portal-console-body .chat-room-link.active {
    box-shadow: inset 3px 0 0 #b30000;
}

.portal-console-body .chat-room-link.active::before {
    display: none;
}

.portal-console-body .chat-room-avatar,
.portal-console-body .chat-avatar,
.portal-console-body .participant-row > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1a1917;
    color: #fff;
}

.portal-console-body .chat-room-copy strong {
    font-size: 14px;
}

.portal-console-body .chat-room-copy small {
    max-width: 210px;
    color: #716960;
}

.portal-console-body .chat-room-badge {
    background: #111;
}

.portal-console-body .chat-main-panel {
    background: #eef2f5;
}

.portal-console-body .chat-topbar {
    min-height: 76px;
    padding: 12px 18px;
    background: #f7f8fa;
    border-bottom: 1px solid #dfe3e8;
}

.portal-console-body .chat-room-title h2 {
    font-size: 16px;
}

.portal-console-body .chat-room-avatar.large {
    background: #b30000;
}

.portal-console-body .video-call-action {
    border-radius: 999px;
    border-color: #d6dee7;
    background: #fff;
}

.portal-console-body .chat-thread {
    padding: 20px 28px;
    background:
        linear-gradient(rgba(238, 231, 222, .94), rgba(238, 231, 222, .94)),
        repeating-linear-gradient(45deg, rgba(179, 0, 0, .08) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, .035) 0 1px, transparent 1px 28px);
}

.portal-console-body .chat-day-chip {
    align-self: center;
    margin: 0 auto 18px;
    padding: 6px 12px;
    border: 1px solid #ddd4ca;
    border-radius: 999px;
    background: rgba(255, 255, 255, .8);
    color: #566273;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-console-body .chat-bubble-row {
    width: min(72%, 680px);
    margin-bottom: 10px;
}

.portal-console-body .chat-bubble {
    border-radius: 16px 16px 16px 3px;
    border: 0;
    background: #fff;
    box-shadow: 0 5px 18px rgba(6, 14, 25, .08);
}

.portal-console-body .chat-bubble.mine {
    border: 0;
    border-radius: 16px 16px 3px 16px;
    background: #111;
}

.portal-console-body .chat-composer {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    padding: 12px 14px;
    background: #f7f8fa;
}

.portal-console-body .chat-composer textarea {
    border-radius: 999px;
    background: #fff;
}

.portal-console-body .chat-context-panel {
    background: #f7f8fa;
}

.portal-console-body .chat-context-head {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 26px 18px 22px;
    border-bottom: 1px solid #dfe3e8;
    background: #111;
    color: #fff;
    text-align: center;
}

.portal-console-body .chat-context-head strong {
    max-width: 100%;
    overflow: hidden;
    color: #fff;
    font-size: 16px;
    letter-spacing: .08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.portal-console-body .chat-context-head small {
    color: #96a0ad;
    font-size: 12px;
}

.portal-console-body .chat-context-section h3 {
    font-size: 17px;
}

@media (max-width: 1440px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 330px minmax(0, 1fr) 280px;
    }
}

@media (max-width: 1180px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 320px minmax(0, 1fr);
    }

    .portal-console-body .chat-context-panel {
        display: none;
    }
}

/* MESSENGER V5 - compact WhatsApp-style project chat */
.portal-console-body .chat-messenger-shell {
    grid-template-columns: 352px minmax(520px, 1fr) 292px;
    height: min(790px, calc(100vh - 138px));
    min-height: 620px;
    border: 1px solid #d5dce5;
    border-top: 3px solid #b30000;
    background: #fff;
    box-shadow: 0 20px 46px rgba(10, 20, 32, .10);
}

.portal-console-body .chat-conversation-rail {
    background: #fff;
    border-right: 1px solid #dbe2ea;
}

.portal-console-body .chat-sidebar-head {
    min-height: 112px;
    padding: 18px 18px 16px;
    background: #07111f;
    color: #fff;
}

.portal-console-body .chat-sidebar-head::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: #b30000;
}

.portal-console-body .chat-account-mark,
.portal-console-body .chat-list-label {
    color: #b30000;
    font-size: 10px;
    letter-spacing: 2.6px;
}

.portal-console-body .chat-sidebar-head strong {
    margin-top: 8px;
    font-size: 20px;
    letter-spacing: .7px;
}

.portal-console-body .chat-sidebar-head small {
    color: #b9c3cf;
    font-size: 12px;
}

.portal-console-body .chat-search-wrap {
    padding: 12px 14px;
    background: #f4f7f8;
    border-bottom: 1px solid #e2e8ee;
}

.portal-console-body .chat-search-input {
    min-height: 42px;
    border: 1px solid #d6dee7;
    border-radius: 22px;
    background: #fff;
    padding: 0 16px;
    font-size: 13px;
}

.portal-console-body .chat-list-section {
    padding: 13px 0 0;
}

.portal-console-body .chat-list-section > .chat-list-label {
    display: block;
    padding: 0 18px 8px;
}

.portal-console-body .chat-project-switcher {
    padding: 0 14px 10px;
}

.portal-console-body .chat-project-switcher a {
    border: 1px solid #e3e8ee;
    border-radius: 12px;
    background: #fff;
    padding: 11px 12px;
    margin-bottom: 8px;
}

.portal-console-body .chat-project-switcher a.active {
    border-color: #b30000;
    background: #fff6f4;
}

.portal-console-body .chat-room-list {
    border-top: 1px solid #e8edf2;
}

.portal-console-body .chat-room-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 74px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #eef2f5;
    background: #fff;
    border-left: 4px solid transparent;
}

.portal-console-body .chat-room-row:hover {
    background: #f8fafb;
}

.portal-console-body .chat-room-row.active {
    background: #fff4f2;
    border-left-color: #b30000;
}

.portal-console-body .chat-room-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #142033;
    color: #fff;
    font-size: 12px;
    letter-spacing: 1px;
}

.portal-console-body .chat-room-avatar.large {
    width: 48px;
    height: 48px;
}

.portal-console-body .chat-room-line strong {
    color: #07111f;
    max-width: 185px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-console-body .chat-room-line em {
    color: #6e7c8d;
    font-style: normal;
    font-size: 10px;
    white-space: nowrap;
}

.portal-console-body .chat-room-copy small {
    display: block;
    max-width: 205px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6f7b88;
    font-size: 12px;
}

.portal-console-body .chat-room-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #b30000;
    color: #fff;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
}

.portal-console-body .chat-main-panel {
    background: #eef1f3;
}

.portal-console-body .chat-topbar {
    min-height: 76px;
    padding: 12px 18px;
    background: #fff;
    border-bottom: 1px solid #dbe2ea;
}

.portal-console-body .chat-room-title h2 {
    font-size: 19px;
    letter-spacing: .7px;
    color: #07111f;
}

.portal-console-body .chat-room-title p {
    color: #657386;
    font-size: 12px;
}

.portal-console-body .video-call-action {
    border-radius: 24px;
    border: 1px solid #b30000;
    color: #b30000;
    background: #fff;
    min-height: 40px;
    padding: 0 16px;
    font-size: 11px;
}

.portal-console-body .chat-thread {
    padding: 20px 26px;
    background:
        linear-gradient(rgba(247, 248, 250, .94), rgba(247, 248, 250, .94)),
        radial-gradient(circle at 16px 16px, rgba(7, 17, 31, .06) 1px, transparent 1px);
    background-size: auto, 28px 28px;
}

.portal-console-body .chat-day-chip {
    align-self: center;
    background: rgba(255, 255, 255, .82);
    border: 1px solid #d9e0e8;
    border-radius: 999px;
    color: #536273;
    padding: 6px 13px;
    font-size: 10px;
    letter-spacing: 1.5px;
}

.portal-console-body .chat-bubble-row {
    gap: 8px;
    margin: 7px 0;
}

.portal-console-body .chat-bubble-row.mine {
    justify-content: flex-end;
}

.portal-console-body .chat-bubble-row.mine .chat-avatar {
    order: 2;
}

.portal-console-body .chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-top: 3px;
    background: #253247;
    color: #fff;
    font-size: 11px;
}

.portal-console-body .chat-bubble {
    max-width: min(620px, 74%);
    border: 1px solid #dfe5eb;
    border-radius: 0 16px 16px 16px;
    background: #fff;
    color: #111827;
    padding: 10px 13px 9px;
    box-shadow: 0 6px 14px rgba(20, 30, 45, .08);
}

.portal-console-body .chat-bubble.mine {
    border-radius: 16px 0 16px 16px;
    background: #fff4f2;
    border-color: #efc1bc;
}

.portal-console-body .chat-bubble-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.portal-console-body .chat-bubble-meta strong {
    color: #b30000;
    font-size: 10px;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.portal-console-body .chat-bubble-meta span {
    color: #718092;
    font-size: 10px;
}

.portal-console-body .chat-bubble p {
    color: #1e293b;
    font-size: 14px;
    line-height: 1.45;
}

.portal-console-body .chat-attachment {
    display: inline-flex;
    margin-top: 8px;
    max-width: 100%;
    border-radius: 9px;
    background: #f4f7f8;
    color: #07111f;
    border: 1px solid #d8e0e8;
    padding: 8px 10px;
    font-size: 12px;
    text-decoration: none;
}

.portal-console-body .chat-composer {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #dbe2ea;
}

.portal-console-body .chat-attach-control {
    width: 46px;
    min-height: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid #d5dde6;
    background: #f4f7f8;
    overflow: hidden;
    color: transparent;
    font-size: 0;
}

.portal-console-body .chat-attach-control::before {
    content: "+";
    color: #07111f;
    font-size: 24px;
    line-height: 1;
}

.portal-console-body .chat-composer textarea {
    min-height: 46px;
    border-radius: 23px;
    background: #f7f9fb;
    border: 1px solid #d5dde6;
    color: #111827;
    padding: 13px 16px;
}

.portal-console-body .chat-composer button {
    width: 46px;
    min-height: 46px;
    height: 46px;
    border-radius: 50%;
    background: #b30000;
    border-color: #b30000;
}

.portal-console-body .chat-composer button::before {
    content: ">";
    font-size: 18px;
}

.portal-console-body .chat-context-panel {
    background: #fff;
    border-left: 1px solid #dbe2ea;
}

.portal-console-body .chat-context-head {
    min-height: 170px;
    background: #07111f;
}

.portal-console-body .chat-context-section,
.portal-console-body .chat-room-form {
    margin: 14px;
    border: 1px solid #e1e7ed;
    background: #fff;
    padding: 14px;
}

.portal-console-body .participant-row span {
    border-radius: 50%;
    background: #142033;
}

@media (min-width: 1600px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 380px minmax(0, 1fr) 320px;
        height: min(820px, calc(100vh - 136px));
    }
}

@media (max-width: 1280px) {
    .portal-console-body .chat-messenger-shell {
        grid-template-columns: 330px minmax(0, 1fr);
    }

    .portal-console-body .chat-context-panel {
        display: none;
    }
}

/* MESSENGER V6 - dedicated WhatsApp-style project communication app */
.portal-chat-screen .console-topbar {
    min-height: 74px;
    padding: 16px 26px;
}

.portal-chat-screen .console-topbar h1 {
    font-size: clamp(24px, 2.1vw, 34px);
    letter-spacing: .2px;
    line-height: 1.05;
}

.portal-chat-screen .console-topbar span,
.portal-chat-screen .console-context {
    font-size: 12px;
}

.portal-chat-screen .console-context {
    min-height: 38px;
    padding: 9px 26px;
}

.portal-chat-screen .console-page {
    padding: 18px 26px 22px;
}

.portal-chat-screen .chat-messenger-shell {
    grid-template-columns: 370px minmax(0, 1fr) 310px;
    height: calc(100vh - 156px);
    min-height: 690px;
    border-radius: 0;
    border: 1px solid #ccd5df;
    border-top: 3px solid #b30000;
    box-shadow: 0 16px 45px rgba(7, 17, 31, .13);
    background: #fff;
}

.portal-chat-screen .chat-conversation-rail {
    background: #f7f8f9;
    border-right: 1px solid #d6dee7;
}

.portal-chat-screen .chat-sidebar-head {
    background: #07111f;
    min-height: 130px;
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.portal-chat-screen .chat-sidebar-head-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.portal-chat-screen .chat-sidebar-head strong {
    color: #fff;
    font-size: 22px;
    line-height: 1.05;
    letter-spacing: .5px;
}

.portal-chat-screen .chat-sidebar-head small {
    color: #c8d2dd;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.portal-chat-screen .chat-new-room-chip {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-decoration: none;
}

.portal-chat-screen .chat-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38c172;
    box-shadow: 0 0 0 3px rgba(56, 193, 114, .16);
    display: inline-block;
}

.portal-chat-screen .chat-search-wrap {
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #dbe2ea;
}

.portal-chat-screen .chat-search-input {
    height: 42px;
    border-radius: 21px;
    padding-left: 42px;
    background:
        linear-gradient(transparent, transparent),
        #eef2f5;
    border: 1px solid #dde5ec;
    font-size: 13px;
}

.portal-chat-screen .chat-list-section {
    padding: 12px 12px 2px;
}

.portal-chat-screen .chat-list-section.rooms {
    padding-top: 6px;
}

.portal-chat-screen .chat-project-switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 7px;
}

.portal-chat-screen .chat-project-switcher a {
    min-width: 168px;
    padding: 11px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #dce4eb;
    box-shadow: none;
}

.portal-chat-screen .chat-project-switcher a.active {
    border-color: #b30000;
    background: #fff8f7;
}

.portal-chat-screen .chat-room-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.portal-chat-screen .chat-room-row {
    min-height: 78px;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid #e1e7ed;
    background: transparent;
    padding: 10px 8px;
    box-shadow: none;
}

.portal-chat-screen .chat-room-row:hover,
.portal-chat-screen .chat-room-row.active {
    background: #fff;
}

.portal-chat-screen .chat-room-row.active {
    border-left: 4px solid #b30000;
    padding-left: 10px;
}

.portal-chat-screen .chat-room-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, #142033, #07111f);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.portal-chat-screen .chat-room-badge {
    background: #38c172;
    color: #07111f;
    font-weight: 700;
}

.portal-chat-screen .chat-main-panel {
    display: grid;
    grid-template-rows: 74px minmax(0, 1fr) auto;
    min-width: 0;
}

.portal-chat-screen .chat-topbar {
    min-height: 74px;
    padding: 11px 18px;
}

.portal-chat-screen .chat-room-title h2 {
    font-size: 20px;
    letter-spacing: .2px;
    text-transform: none;
}

.portal-chat-screen .chat-thread {
    padding: 18px 24px;
    overflow-y: auto;
}

.portal-chat-screen .chat-bubble-row {
    width: 100%;
}

.portal-chat-screen .chat-bubble {
    max-width: min(680px, 68%);
    border-radius: 5px 18px 18px 18px;
}

.portal-chat-screen .chat-bubble.mine {
    border-radius: 18px 5px 18px 18px;
    background: #fdf0ee;
}

.portal-chat-screen .chat-bubble p {
    font-size: 14px;
    line-height: 1.5;
}

.portal-chat-screen .chat-composer {
    grid-template-columns: 44px auto minmax(0, 1fr) 44px;
    align-items: center;
    padding: 10px 12px;
}

.portal-chat-screen .chat-composer-tools {
    display: flex;
    gap: 6px;
    overflow: hidden;
}

.portal-chat-screen .chat-composer-tools span {
    border: 1px solid #dce4eb;
    background: #f7f9fb;
    color: #536273;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 7px 9px;
    white-space: nowrap;
}

.portal-chat-screen .chat-context-panel {
    overflow-y: auto;
}

.portal-chat-screen .chat-context-head {
    min-height: 150px;
    justify-content: flex-end;
}

.portal-chat-screen .chat-context-section,
.portal-chat-screen .chat-room-form {
    border-radius: 14px;
    box-shadow: none;
}

.portal-chat-screen .chat-room-form {
    scroll-margin-top: 24px;
}

.portal-chat-screen .chat-participant-picker label {
    border-radius: 12px;
}

@media (min-width: 1760px) {
    .portal-chat-screen .chat-messenger-shell {
        grid-template-columns: 410px minmax(0, 1fr) 340px;
    }
}

@media (max-width: 1280px) {
    .portal-chat-screen .chat-messenger-shell {
        grid-template-columns: 340px minmax(0, 1fr);
        height: auto;
        min-height: calc(100vh - 156px);
    }
}

@media (max-width: 900px) {
    .portal-chat-screen .console-page {
        padding: 14px;
    }

    .portal-chat-screen .chat-messenger-shell {
        grid-template-columns: 1fr;
    }

    .portal-chat-screen .chat-main-panel {
        min-height: 680px;
    }

    .portal-chat-screen .chat-composer {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .portal-chat-screen .chat-composer-tools {
        display: none;
    }
}

/* MESSENGER V7 - full-screen project chat application */
.portal-chat-screen {
    overflow: hidden;
}

.portal-chat-screen .console-shell {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    background: #e7ebef;
}

.portal-chat-screen .console-sidebar,
.portal-chat-screen .console-topbar,
.portal-chat-screen .console-context {
    display: none;
}

.portal-chat-screen .console-main,
.portal-chat-screen .console-page {
    min-height: 100vh;
    background: #e7ebef;
}

.portal-chat-screen .console-page {
    padding: clamp(10px, 1vw, 16px);
    display: block;
}

.portal-chat-screen .chat-messenger-shell {
    width: min(1840px, 100%);
    height: calc(100vh - clamp(20px, 2vw, 32px));
    min-height: 0;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(330px, 23vw) minmax(0, 1fr) minmax(292px, 18vw);
    border: 1px solid #cfd8df;
    border-top: 4px solid #b30000;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 22px 60px rgba(6, 14, 25, .16);
}

.portal-chat-screen .chat-conversation-rail {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    min-height: 0;
    background: #f5f7f8;
}

.portal-chat-screen .chat-sidebar-head {
    min-height: 118px;
    padding: 18px;
    background: linear-gradient(135deg, #07111f, #0f1a2a);
}

.portal-chat-screen .chat-sidebar-head-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.portal-chat-screen .chat-account-mark {
    margin-right: auto;
}

.portal-chat-screen .chat-portal-home,
.portal-chat-screen .chat-new-room-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    color: #fff;
    padding: 0 10px;
    font-size: 10px;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    text-decoration: none;
}

.portal-chat-screen .chat-new-room-chip {
    background: #b30000;
    border-color: #b30000;
}

.portal-chat-screen .chat-sidebar-head strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-chat-screen .chat-search-wrap {
    padding: 10px 12px;
}

.portal-chat-screen .chat-search-input {
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
}

.portal-chat-screen .chat-list-section {
    min-width: 0;
    padding: 10px 10px 0;
}

.portal-chat-screen .chat-project-switcher {
    gap: 8px;
    padding-bottom: 8px;
}

.portal-chat-screen .chat-project-switcher a {
    min-width: 154px;
    border-radius: 12px;
}

.portal-chat-screen .chat-list-section.rooms {
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

.portal-chat-screen .chat-room-list {
    height: 100%;
    overflow-y: auto;
    padding-right: 2px;
}

.portal-chat-screen .chat-room-row {
    min-height: 72px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.portal-chat-screen .chat-room-copy,
.portal-chat-screen .chat-room-line {
    min-width: 0;
}

.portal-chat-screen .chat-room-line strong,
.portal-chat-screen .chat-room-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-chat-screen .chat-room-copy small {
    max-width: 100%;
    color: #637083;
    text-transform: none;
    letter-spacing: 0;
}

.portal-chat-screen .chat-main-panel {
    grid-template-rows: 70px minmax(0, 1fr) auto;
    min-height: 0;
    background: #eef1f3;
}

.portal-chat-screen .chat-topbar {
    min-height: 70px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #d6dee7;
}

.portal-chat-screen .chat-room-title {
    min-width: 0;
}

.portal-chat-screen .chat-room-title h2,
.portal-chat-screen .chat-room-title p {
    max-width: min(52vw, 760px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-chat-screen .video-call-action {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.portal-chat-screen .chat-thread {
    min-height: 0;
    padding: 18px min(2vw, 32px);
    background:
        radial-gradient(circle at 18px 18px, rgba(7, 17, 31, .035) 0 1px, transparent 1px 10px),
        linear-gradient(180deg, #edf1f2, #e8edf0);
}

.portal-chat-screen .chat-day-chip {
    margin: 0 auto 14px;
    width: max-content;
    background: rgba(255, 255, 255, .82);
    color: #566273;
    border: 1px solid #d9e1e8;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.portal-chat-screen .chat-bubble-row {
    margin-bottom: 10px;
}

.portal-chat-screen .chat-bubble {
    max-width: min(760px, 72%);
    padding: 10px 12px;
    border: 1px solid #dce4eb;
    background: #fff;
    box-shadow: 0 3px 12px rgba(6, 14, 25, .06);
}

.portal-chat-screen .chat-bubble.mine {
    background: #fce8e5;
    border-color: #f1c3bd;
}

.portal-chat-screen .chat-bubble-meta {
    margin-bottom: 4px;
}

.portal-chat-screen .chat-bubble p {
    margin: 0;
    color: #16202e;
}

.portal-chat-screen .chat-attachment {
    display: inline-flex;
    max-width: 100%;
    margin-top: 8px;
    border-radius: 12px;
    background: #eef2f5;
    color: #07111f;
    padding: 8px 10px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-chat-screen .chat-composer {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    grid-template-areas:
        "tools tools tools"
        "attach message send";
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #d6dee7;
}

.portal-chat-screen .chat-attach-control {
    grid-area: attach;
    width: 46px;
    height: 46px;
    border-radius: 50%;
}

.portal-chat-screen .chat-composer-tools {
    grid-area: tools;
    display: flex;
    gap: 7px;
    padding-left: 54px;
}

.portal-chat-screen .chat-composer-tools span {
    background: #f4f7f9;
}

.portal-chat-screen .chat-composer textarea {
    grid-area: message;
    min-height: 46px;
    max-height: 96px;
    border-radius: 23px;
    padding: 12px 16px;
    resize: none;
}

.portal-chat-screen .chat-composer button {
    grid-area: send;
    width: 46px;
    height: 46px;
    min-height: 46px;
    border-radius: 50%;
    font-size: 0;
}

.portal-chat-screen .chat-context-panel {
    min-height: 0;
    background: #f8f9fa;
}

.portal-chat-screen .chat-context-head {
    min-height: 128px;
    background: #07111f;
}

.portal-chat-screen .chat-context-section,
.portal-chat-screen .chat-room-form {
    margin: 12px;
    border-radius: 14px;
}

.portal-chat-screen .chat-room-form {
    border-top: 3px solid #b30000;
}

@media (min-width: 1900px) {
    .portal-chat-screen .chat-messenger-shell {
        grid-template-columns: 420px minmax(0, 1fr) 360px;
    }
}

@media (max-width: 1260px) {
    .portal-chat-screen {
        overflow: auto;
    }

    .portal-chat-screen .chat-messenger-shell {
        height: auto;
        min-height: calc(100vh - 24px);
        grid-template-columns: 330px minmax(0, 1fr);
    }

    .portal-chat-screen .chat-context-panel {
        display: none;
    }
}

@media (max-width: 820px) {
    .portal-chat-screen .chat-messenger-shell {
        grid-template-columns: 1fr;
    }

    .portal-chat-screen .chat-conversation-rail {
        max-height: 46vh;
    }

    .portal-chat-screen .chat-main-panel {
        min-height: 620px;
    }

    .portal-chat-screen .chat-room-title h2,
    .portal-chat-screen .chat-room-title p {
        max-width: 58vw;
    }
}

@media (max-width: 520px) {
    .portal-chat-screen .chat-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 10px;
    }

    .portal-chat-screen .chat-room-title h2,
    .portal-chat-screen .chat-room-title p {
        max-width: 100%;
    }

    .portal-chat-screen .chat-topbar form,
    .portal-chat-screen .chat-new-room-chip,
    .portal-chat-screen .video-call-action {
        width: 100%;
        max-width: 100%;
    }

    .portal-chat-screen .video-call-action {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    .portal-chat-screen .chat-project-switcher {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-chat-screen .chat-project-switcher a {
        min-width: 0;
        width: 100%;
    }
}

/* PTAD WhatsApp-style workspace chat modal */
body.chat-modal-open {
    overflow: hidden;
}

.workspace-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: none;
}

.workspace-chat-modal.is-open {
    display: block;
}

.workspace-chat-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 15, .74);
    backdrop-filter: blur(6px);
}

.workspace-chat-app {
    position: absolute;
    inset: clamp(18px, 2.4vw, 42px);
    display: grid;
    grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) minmax(260px, 320px);
    min-height: 0;
    overflow: hidden;
    background: #f7f8fa;
    border: 1px solid #cfd8df;
    border-top: 4px solid #b30000;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
}

.workspace-chat-sidebar {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    background: #07111f;
    color: #fff;
}

.workspace-chat-brand {
    min-height: 104px;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.workspace-chat-brand span,
.workspace-chat-detail > span,
.workspace-chat-thread-head span {
    display: block;
    color: #b30000;
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.workspace-chat-brand strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
    line-height: 1.05;
    letter-spacing: .02em;
}

.workspace-chat-brand button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.workspace-chat-create {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.workspace-chat-create input[type="text"],
.workspace-chat-create input:not([type]),
.workspace-chat-create textarea,
.workspace-chat-create select {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.workspace-chat-create input::placeholder {
    color: rgba(255, 255, 255, .55);
}

.workspace-chat-checks {
    display: grid;
    gap: 6px;
    max-height: 150px;
    overflow: auto;
    padding-right: 4px;
}

.workspace-chat-checks label,
.workspace-chat-private {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: #d9e0e8;
    font-size: 12px;
}

.workspace-chat-checks small {
    grid-column: 2;
    color: #8da1b6;
}

.workspace-chat-create button,
.workspace-chat-composer button {
    min-height: 42px;
    border: 0;
    background: #b30000;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.workspace-chat-room-list {
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.workspace-chat-room-button {
    width: 100%;
    min-height: 70px;
    display: grid;
    gap: 6px;
    align-content: center;
    padding: 10px 12px;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.workspace-chat-room-button:hover,
.workspace-chat-room-button.is-active {
    background: rgba(255, 255, 255, .08);
    border-left-color: #b30000;
}

.workspace-chat-room-button span,
.workspace-chat-empty {
    color: #9baabd;
    font-size: 12px;
}

.workspace-chat-thread {
    min-width: 0;
    min-height: 0;
    background: #eef2f5;
}

.workspace-chat-room-panel {
    height: 100%;
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
}

.workspace-chat-room-panel.is-active {
    display: grid;
}

.workspace-chat-thread-head {
    min-height: 76px;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid #d7dee6;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.workspace-chat-thread-head strong {
    display: block;
    margin-top: 5px;
    color: #07111f;
    font-size: 21px;
}

.workspace-chat-thread-head small,
.workspace-chat-thread-head > div:last-child {
    color: #677587;
    font-size: 12px;
}

.workspace-chat-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background:
        radial-gradient(circle at 18px 18px, rgba(7, 17, 31, .035) 0 1px, transparent 1px 10px),
        linear-gradient(180deg, #edf1f3, #e8edf0);
}

.workspace-message {
    max-width: min(680px, 74%);
    width: fit-content;
    padding: 11px 13px;
    border-radius: 4px 18px 18px 18px;
    border: 1px solid #dce4eb;
    background: #fff;
    color: #16202e;
    box-shadow: 0 3px 12px rgba(6, 14, 25, .06);
}

.workspace-message.is-mine {
    align-self: flex-end;
    border-radius: 18px 4px 18px 18px;
    background: #fff1ef;
    border-color: #efc5bf;
}

.workspace-message-meta {
    margin-bottom: 5px;
    color: #b30000;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.workspace-message-meta span {
    color: #728093;
    letter-spacing: 0;
    text-transform: none;
}

.workspace-message p {
    margin: 0;
    color: #16202e;
    line-height: 1.45;
}

.workspace-message a {
    display: inline-flex;
    max-width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    overflow: hidden;
    border-radius: 10px;
    background: #eef2f5;
    color: #07111f;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-chat-no-messages {
    margin: auto;
    color: #637083;
}

.workspace-chat-composer {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 58px;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #d7dee6;
}

.workspace-chat-attach {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f4f7f8;
    border: 1px solid #d5dde6;
    color: #07111f;
    font-size: 22px;
    cursor: pointer;
}

.workspace-chat-attach input {
    display: none;
}

.workspace-chat-composer textarea {
    min-height: 46px;
    max-height: 120px;
    resize: vertical;
    border-radius: 23px;
    border: 1px solid #d5dde6;
    background: #f7f9fb;
    color: #111827;
    padding: 12px 16px;
}

.workspace-chat-detail {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid #d7dee6;
    padding: 18px;
}

.workspace-chat-person {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e2e7ed;
}

.workspace-chat-person strong,
.workspace-chat-person small {
    display: block;
}

.workspace-chat-person small {
    margin-top: 5px;
    color: #617083;
    line-height: 1.35;
}

.admin-chat-launch-panel .workspace-chat-launch {
    margin-bottom: 18px;
}

@media (max-width: 1180px) {
    .workspace-chat-app {
        grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    }

    .workspace-chat-detail {
        display: none;
    }
}

@media (max-width: 760px) {
    .workspace-chat-app {
        inset: 0;
        grid-template-columns: 1fr;
    }

    .workspace-chat-sidebar {
        max-height: 46vh;
    }

    .workspace-message {
        max-width: 88%;
    }
}

.chat-video-modal {
    position: fixed;
    inset: 0;
    z-index: 22000;
    display: none;
}

.chat-video-modal.is-open {
    display: block;
}

.chat-video-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 14, .78);
    backdrop-filter: blur(10px);
}

.chat-video-card {
    position: absolute;
    inset: clamp(18px, 4vw, 64px);
    max-width: 1180px;
    max-height: 780px;
    margin: auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #f7f8fa;
    border: 1px solid #cfd8e3;
    border-top: 4px solid #b30000;
    box-shadow: 0 30px 100px rgba(0, 0, 0, .45);
}

.chat-video-card header,
.chat-video-card footer {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid #dfe6ee;
}

.chat-video-card footer {
    border-top: 1px solid #dfe6ee;
    border-bottom: 0;
    justify-content: flex-end;
}

.chat-video-card h3 {
    margin: 0;
    color: #07111f;
    font-size: 24px;
    letter-spacing: .03em;
}

.chat-video-card p {
    margin: 4px 0 0;
    color: #607086;
}

.chat-video-grid {
    min-height: 0;
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
    gap: 18px;
}

#chatLocalVideo {
    width: 100%;
    height: 100%;
    min-height: 380px;
    object-fit: cover;
    background: #05090f;
    border: 1px solid #111827;
}

.chat-video-placeholder {
    min-height: 260px;
    padding: 24px;
    display: grid;
    align-content: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dfe6ee;
}

.chat-video-placeholder strong {
    color: #07111f;
    font-size: 22px;
}

.chat-video-placeholder span {
    color: #607086;
    line-height: 1.5;
}

@media (max-width: 860px) {
    .chat-video-card {
        inset: 0;
        max-height: none;
    }

    .chat-video-grid {
        grid-template-columns: 1fr;
    }

    #chatLocalVideo {
        min-height: 300px;
    }
}

.workspace-chat-thread-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.workspace-chat-thread-actions form {
    margin: 0;
}

.workspace-chat-video-button,
.workspace-chat-end-call {
    min-height: 34px;
    padding: 8px 13px;
    border: 1px solid #c90000;
    background: #c90000;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.workspace-chat-end-call {
    border-color: #1f2933;
    background: #fff;
    color: #1f2933;
}

.call-page {
    margin: 0;
    min-height: 100vh;
    background: #f6f8fa;
    color: #07111f;
    font-family: Arial, Helvetica, sans-serif;
}

.call-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.call-header {
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #05080d;
    color: #fff;
    border-top: 4px solid #c90000;
}

.call-header h1 {
    margin: 5px 0 4px;
    font-size: clamp(30px, 4vw, 64px);
    line-height: .95;
    font-weight: 300;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.call-header p {
    margin: 0;
    color: #b6bec8;
    letter-spacing: .04em;
}

.call-kicker {
    color: #c90000;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.call-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.call-button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #2f3947;
    background: #fff;
    color: #07111f;
    font-weight: 700;
    cursor: pointer;
}

.call-button.secondary {
    background: transparent;
    color: #fff;
}

.call-button.danger {
    border-color: #c90000;
    background: #c90000;
    color: #fff;
}

.call-main {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
}

.call-stage {
    min-width: 0;
    padding: 24px;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 14px;
}

.call-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-content: start;
}

.call-video-tile {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    background: #05080d;
    border: 1px solid #dce3eb;
}

.call-video-tile.local {
    border-top: 3px solid #c90000;
}

.call-video-tile video {
    width: 100%;
    height: 100%;
    min-height: 330px;
    display: block;
    object-fit: cover;
    background: #05080d;
}

.call-video-label {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 8px 10px;
    background: rgba(5, 8, 13, .78);
    color: #fff;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.call-empty {
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #dce3eb;
    color: #506176;
}

.call-diagnostics {
    max-height: 118px;
    overflow: auto;
    padding: 10px 12px;
    background: #05080d;
    color: #d7dde6;
    border: 1px solid rgba(7, 17, 31, .14);
    font-size: 11px;
    line-height: 1.45;
}

.call-diagnostics div + div {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.call-participants {
    padding: 24px;
    background: #fff;
    border-left: 1px solid #dce3eb;
}

.call-participant {
    padding: 14px 0;
    border-bottom: 1px solid #e4e9ef;
}

.call-participant strong,
.call-participant span,
.call-participant em {
    display: block;
}

.call-participant strong {
    font-size: 15px;
}

.call-participant span {
    margin-top: 4px;
    color: #5e6d7f;
}

.call-participant em {
    margin-top: 6px;
    color: #909bad;
    font-size: 12px;
    font-style: normal;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.call-participant.online em {
    color: #00865f;
}

.embedded-call-page {
    min-height: 0;
    background: transparent;
}

.embedded-call-page .call-shell {
    min-height: 0;
}

.embedded-call-page .call-header {
    padding: 18px 20px;
}

.embedded-call-page .call-header h1 {
    font-size: clamp(22px, 3vw, 36px);
}

.embedded-call-page .call-main {
    min-height: 560px;
    grid-template-columns: minmax(0, 1fr) 280px;
}

.embedded-call-page .call-video-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.embedded-call-page .call-video-tile,
.embedded-call-page .call-video-tile video {
    min-height: 220px;
}

.portal-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    padding: clamp(14px, 3vw, 38px);
    display: grid;
    place-items: center;
    /* Keep the call panel visible but let users interact with the portal behind it. */
    pointer-events: none;
    background: rgba(3, 6, 12, .26);
}

.portal-call-panel {
    width: min(1180px, 96vw);
    max-height: 92vh;
    display: grid;
    grid-template-rows: auto minmax(520px, 1fr);
    overflow: hidden;
    background: #fff;
    border-top: 4px solid #c90000;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
    pointer-events: auto;
}

.portal-call-panel > header {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #dfe3e8;
    cursor: grab;
    user-select: none;
}

.portal-call-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.portal-call-panel h3 {
    margin: 6px 0 4px;
    font-size: clamp(22px, 2.2vw, 34px);
    font-weight: 400;
}

.portal-call-panel p {
    margin: 0;
    color: #566273;
}

.portal-call-panel iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.portal-call-close {
    padding: 12px 16px;
    border: 1px solid #dfe3e8;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.portal-call-minimize,
.portal-call-restore {
    padding-inline: 12px;
}

.portal-call-overlay.is-minimized {
    padding: 10px;
    background: transparent;
}

.portal-call-overlay.is-minimized .portal-call-panel {
    width: min(520px, calc(100vw - 20px));
    max-height: min(420px, calc(100vh - 20px));
    grid-template-rows: auto minmax(0, 1fr);
    border-top-width: 3px;
}

.portal-call-overlay.is-minimized .portal-call-panel > header {
    padding: 12px 14px;
}

.portal-call-overlay.is-minimized .portal-call-panel p {
    display: none;
}

.portal-call-overlay.is-minimized .portal-call-panel h3 {
    margin: 0;
    font-size: 16px;
}

.active-call-card {
    border-left: 2px solid #c90000;
    background: #fff7f7;
}

.portal-call-invite {
    position: fixed;
    right: clamp(16px, 3vw, 34px);
    bottom: clamp(16px, 3vw, 34px);
    z-index: 86;
    width: min(420px, calc(100vw - 32px));
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    background: #fff;
    border-left: 4px solid #c90000;
    box-shadow: 0 18px 54px rgba(0, 0, 0, .24);
}

.portal-call-invite[hidden] {
    display: none;
}

.portal-call-invite strong,
.portal-call-invite small {
    display: block;
}

.portal-call-invite strong {
    margin: 6px 0;
    font-size: 20px;
    font-weight: 500;
}

.portal-call-invite small {
    color: #5d6878;
}

.portal-call-invite a {
    padding: 12px 16px;
    background: #c90000;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.portal-chat-global {
    bottom: clamp(112px, 10vw, 132px);
    border-left-color: #06111f;
}

.portal-live-alert {
    position: fixed;
    top: 18px;
    left: 18px;
    right: auto;
    bottom: auto;
    z-index: 999;
    width: min(430px, calc(100vw - 36px));
    border: 2px solid #c90000;
    border-left: 8px solid #c90000;
    background: #070707;
    color: #fff;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
    animation: portal-live-alert-flash 1s infinite;
}

.portal-live-alert[hidden] {
    display: none;
}

.portal-live-alert small {
    color: rgba(255, 255, 255, .72);
}

.portal-live-alert a {
    align-self: center;
    background: #d40000;
    color: #fff;
}

.portal-live-alert-chat {
    top: 112px;
    border-color: #111;
    border-left-color: #111;
    animation-duration: 1.4s;
}

@keyframes portal-live-alert-flash {
    0%,
    100% {
        transform: translateX(0);
        box-shadow: 0 18px 60px rgba(201, 0, 0, .25);
    }

    50% {
        transform: translateX(4px);
        box-shadow: 0 18px 72px rgba(201, 0, 0, .72);
    }
}

.portal-page-shell {
    width: 100%;
    min-height: calc(100vh - 140px);
    padding: clamp(34px, 5vw, 72px) 0;
}

.portal-page-shell.white-page,
.client-project-section.white-page,
.client-portal-hero.white-page {
    background: #f4f6f8;
    color: #06111f;
}

.portal-page-shell .container,
.client-project-section .container,
.client-portal-hero .container {
    width: min(1180px, calc(100vw - 48px));
    margin: 0 auto;
}

.portal-page-shell h1,
.client-portal-hero h1 {
    margin: 18px 0 16px;
    font-size: clamp(42px, 5vw, 78px);
    font-weight: 400;
    letter-spacing: 0;
    line-height: .95;
}

.portal-subnav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 18px;
    margin: 0 0 24px;
    overflow-x: auto;
    border-bottom: 1px solid #dfe4ea;
}

.portal-subnav a {
    flex: 0 0 auto;
    padding: 9px 13px;
    border: 1px solid #d8e0e8;
    border-radius: 999px;
    background: #fff;
    color: #1d2a3a;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.portal-subnav a.active,
.portal-subnav a:hover {
    border-color: #c90000;
    color: #c90000;
}

.portal-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 22px;
}

.portal-metric-grid article {
    min-height: 118px;
    padding: 18px;
    display: grid;
    align-content: space-between;
    gap: 8px;
    background: #fff;
    border: 1px solid #dfe4ea;
}

.portal-metric-grid span,
.portal-page-panel header span {
    color: #c90000;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.portal-metric-grid strong {
    font-size: 42px;
    font-weight: 400;
}

.portal-metric-grid em {
    color: #667386;
    font-style: normal;
}

.portal-page-stack {
    display: grid;
    gap: 16px;
}

.portal-page-panel {
    padding: clamp(20px, 3vw, 32px);
    background: #fff;
    border: 1px solid #dfe4ea;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .06);
}

.portal-page-panel header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px 24px;
    align-items: end;
    margin-bottom: 20px;
}

.portal-page-panel header span {
    grid-column: 1 / -1;
}

.portal-page-panel h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 42px);
    font-weight: 400;
}

.portal-page-panel header a,
.portal-page-panel > a,
.portal-mini-grid a {
    padding: 11px 14px;
    background: #06111f;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-decoration: none;
    text-transform: uppercase;
}

.portal-mini-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.portal-mini-grid div {
    min-height: 86px;
    padding: 14px;
    display: grid;
    align-content: center;
    gap: 4px;
    background: #f6f8fb;
    border: 1px solid #e5eaf0;
}

.portal-mini-grid strong {
    font-size: 28px;
    font-weight: 500;
}

.portal-mini-grid span {
    color: #5d6878;
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 920px) {
    .portal-metric-grid,
    .portal-mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-page-panel header {
        grid-template-columns: 1fr;
    }
}

.portal-chat-screen .chat-room-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.portal-chat-screen .chat-room-form-head a {
    color: #111;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.portal-chat-screen .chat-room-modal-form {
    display: none;
}

.portal-chat-screen .chat-room-form:target {
    position: fixed;
    z-index: 95;
    top: 50%;
    left: 50%;
    width: min(620px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
    overflow: auto;
    transform: translate(-50%, -50%);
    padding: 24px;
    display: grid;
    gap: 14px;
    background: #fff;
    border-top: 4px solid #c90000;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
}

.portal-chat-screen:has(.chat-room-form:target)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 94;
    background: rgba(3, 6, 12, .62);
}

@media (max-width: 980px) {
    .call-header,
    .call-main {
        grid-template-columns: 1fr;
    }

    .call-header {
        display: grid;
    }

    .call-participants {
        border-left: 0;
        border-top: 1px solid #dce3eb;
    }

    .embedded-call-page .call-main,
    .portal-call-panel {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
}

@media (max-width: 420px) {
    .call-header,
    .call-stage,
    .call-participants {
        padding: 16px;
    }

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

    .call-button {
        width: 100%;
        padding-inline: 10px;
    }

    .call-video-grid,
    .embedded-call-page .call-video-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .call-video-tile,
    .call-video-tile video,
    .embedded-call-page .call-video-tile,
    .embedded-call-page .call-video-tile video {
        min-height: 210px;
    }

    .call-video-tile {
        aspect-ratio: 4 / 3;
    }
}

/* PORTAL DOCK - persistent chat/call widget */
.portal-dock {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 120;
    pointer-events: none;
}

.portal-dock-panel {
    width: min(520px, calc(100vw - 24px));
    height: min(720px, calc(100vh - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    min-width: 320px;
    min-height: 220px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border-top: 4px solid #c90000;
    background: #fff;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
    pointer-events: auto;
    resize: both;
}

.portal-dock-bar {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #dfe3e8;
    cursor: grab;
    user-select: none;
}

.portal-dock-title strong {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-dock-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.portal-dock-chip {
    padding: 10px 12px;
    border: 1px solid #dfe3e8;
    background: #fff;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.portal-dock-chip.active {
    background: #c90000;
    border-color: #c90000;
    color: #fff;
}

.portal-dock-body {
    background: #f3f6f8;
    min-height: 0;
}

.portal-dock-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.portal-dock.is-minimized {
    height: auto;
}

.portal-dock.is-minimized .portal-dock-panel {
    height: 64px;
    min-height: 64px;
    grid-template-rows: auto;
    resize: none;
}

.portal-dock.is-minimized .portal-dock-body {
    display: none;
}

.file-viewer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.file-viewer-head h1 {
    max-width: 980px;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.file-viewer-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.file-viewer-panel {
    background: #f4f6f8;
}

.file-document {
    max-width: 920px;
    margin: 0 auto;
    padding: 34px;
    border: 1px solid #d9dee6;
    background: #fff;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.file-document-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 1px solid #111;
}

.file-document-logo {
    width: auto;
    max-width: 170px;
    height: auto;
}

.file-document-meta {
    color: #111;
    font-size: 13px;
    text-align: right;
}

.file-document h2 {
    margin: 0 0 18px;
    color: #111;
    font-size: 30px;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.file-viewer-frame {
    width: 100%;
    min-height: min(76vh, 900px);
    border: 1px solid #dfe3e8;
    background: #fff;
}

.file-viewer-frame iframe,
.file-viewer-frame video,
.file-viewer-frame img {
    width: 100%;
    min-height: min(76vh, 900px);
    border: 0;
    display: block;
    object-fit: contain;
    background: #fff;
}

.file-viewer-frame audio {
    width: calc(100% - 48px);
    margin: 24px;
}

.file-viewer-native {
    max-width: 720px;
    padding: 52px;
}

.file-viewer-native span {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--ptad-red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.22em;
}

.file-viewer-native h2 {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 46px);
}

.file-viewer-native p {
    max-width: 620px;
    margin-bottom: 26px;
    color: #5a626c;
    line-height: 1.6;
}

.file-viewer-note {
    margin-top: 14px;
}

@media (max-width: 520px) {
    .portal-dock {
        right: 10px;
        bottom: 10px;
    }

    .portal-dock-panel {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: min(720px, calc(100vh - 20px));
        max-height: calc(100vh - 20px);
    }
}

/* PTAD N3 design authority pass 20260520 */
:root {
    --ptad-cabin: #040507;
    --ptad-graphite: #101419;
    --ptad-graphite-2: #171d24;
    --ptad-surface: #fbfcfd;
    --ptad-surface-2: #f1f4f7;
    --ptad-line: #d8dee6;
    --ptad-line-dark: rgba(255,255,255,.1);
    --ptad-red: #c40000;
    --ptad-red-dark: #8d0000;
    --ptad-brass: #b8904f;
    --ptad-text: #0b1118;
    --ptad-muted: #66717f;
    --ptad-shadow-tight: 0 12px 28px rgba(8, 16, 28, .07);
    --ptad-shadow-float: 0 22px 60px rgba(8, 16, 28, .12);
}

body.admin-body,
body.portal-console-body {
    background:
        linear-gradient(180deg, #f7f9fb 0, #eef2f6 100%);
    color: var(--ptad-text);
}

body.admin-body *,
body.portal-console-body * {
    letter-spacing: 0;
}

.admin-body .console-shell,
.portal-console-body .console-shell {
    grid-template-columns: clamp(218px, 12.5vw, 252px) minmax(0, 1fr);
    background: transparent;
}

.admin-body .console-sidebar,
.portal-console-body .console-sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 22%),
        linear-gradient(180deg, var(--ptad-cabin), #07090c 58%, #020304);
    border-right: 1px solid rgba(196,0,0,.28);
    scrollbar-color: rgba(255,255,255,.32) transparent;
}

.admin-body .console-brand,
.portal-console-body .console-brand {
    padding: 18px 18px 20px;
    background: rgba(255,255,255,.018);
}

.admin-body .console-brand strong,
.portal-console-body .console-brand strong {
    font-size: clamp(18px, 1vw, 21px);
    font-weight: 600;
}

.admin-body .console-nav,
.portal-console-body .console-nav {
    padding: 10px 10px 28px;
}

.admin-body .console-nav span,
.portal-console-body .console-nav span {
    margin: 17px 7px 6px;
    color: rgba(255,255,255,.5);
    font-size: 9px;
    letter-spacing: 0;
}

.admin-body .console-nav a,
.admin-body .console-nav button,
.portal-console-body .console-nav a,
.portal-console-body .console-nav button {
    min-height: 32px;
    padding: 8px 10px;
    color: rgba(255,255,255,.82);
    font-size: 12px;
    line-height: 1.2;
}

.admin-body .console-nav a:hover,
.admin-body .console-nav a.active,
.admin-body .console-nav button:hover,
.portal-console-body .console-nav a:hover,
.portal-console-body .console-nav a.active,
.portal-console-body .console-nav button:hover {
    background:
        linear-gradient(90deg, rgba(196,0,0,.18), rgba(255,255,255,.04));
    border-left-color: var(--ptad-red);
}

.admin-body .console-main,
.portal-console-body .console-main {
    background: transparent;
}

.admin-body .console-topbar,
.portal-console-body .console-topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 64px;
    padding: 13px clamp(18px, 1.8vw, 28px);
    background: rgba(255,255,255,.9);
    border-bottom: 1px solid rgba(216,222,230,.88);
    backdrop-filter: blur(18px);
}

.admin-body .console-topbar h1,
.portal-console-body .console-topbar h1 {
    font-size: clamp(21px, 1.65vw, 30px);
    font-weight: 520;
}

.admin-body .console-context,
.portal-console-body .console-context {
    padding: 8px clamp(18px, 1.8vw, 28px);
    background: rgba(232,238,244,.88);
    font-size: 12px;
}

.admin-body .admin-content,
.admin-body .console-page,
.portal-console-body .console-page {
    gap: 14px;
    padding: clamp(16px, 1.55vw, 24px);
}

.admin-content > .console-page {
    padding: 0;
}

.hero-panel,
.admin-header,
.admin-panel,
.panel,
.workspace-panel,
.project-workspace-panel,
.admin-card,
.metric-card,
.portal-card,
.portal-page-panel,
.quote-issue-panel,
.quote-document-shell,
.file-document {
    border-color: var(--ptad-line);
    border-radius: 6px;
    box-shadow: var(--ptad-shadow-tight);
}

.hero-panel,
.admin-header {
    padding: clamp(18px, 1.55vw, 24px);
}

.hero-panel h2,
.admin-header h1,
.workspace-hero h1,
.quote-page-hero h1,
.portal-page-shell h1,
.client-portal-hero h1 {
    font-size: clamp(28px, 2.55vw, 44px);
    line-height: 1.04;
    font-weight: 520;
}

.hero-panel p,
.admin-header-note,
.workspace-hero p,
.quote-page-hero p,
.portal-page-panel p {
    font-size: 13px;
    line-height: 1.48;
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    align-items: stretch;
}

.dashboard-hero-status {
    min-height: 108px;
    display: grid;
    align-content: center;
    border-left: 2px solid var(--ptad-red);
    background: linear-gradient(180deg, #fff, #f5f7f9);
}

.dashboard-hero-status strong {
    font-size: clamp(23px, 2vw, 32px);
}

.dashboard-command-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-command {
    min-height: 118px;
    padding: 15px;
    border-radius: 6px;
    box-shadow: var(--ptad-shadow-tight);
}

.dashboard-command.primary {
    background:
        linear-gradient(135deg, #0b0d10, #171c22 58%, #050607);
    border-color: #11161d;
}

.dashboard-command.primary span {
    color: #ff3131;
}

.dashboard-command strong,
.project-workspace-dashboard .workspace-command-grid .dashboard-command strong {
    margin: 10px 0 7px;
    font-size: clamp(25px, 2.25vw, 38px);
}

.dashboard-command small {
    font-size: 12px;
}

.metrics-grid,
.admin-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
}

.metric-card,
.admin-card {
    min-height: 96px;
    padding: 14px;
    border-radius: 6px;
}

.metric-card strong,
.admin-card strong {
    margin: 9px 0 5px;
    font-size: clamp(24px, 2.1vw, 34px);
}

.metric-card small,
.admin-card small {
    font-size: 11px;
}

.console-tabs,
.admin-portal-tabs,
.portal-subnav {
    gap: 7px;
    padding: 8px;
    border: 1px solid var(--ptad-line);
    border-radius: 8px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 10px 26px rgba(8, 16, 28, .045);
}

.console-tabs a,
.admin-portal-tabs a,
.portal-subnav a {
    min-height: 33px;
    padding: 8px 11px;
    border-radius: 6px;
    border-color: #ced7e2;
    color: #132033;
    font-size: 11px;
    line-height: 1.1;
}

.console-tabs a.active,
.console-tabs a:hover,
.admin-portal-tabs a.active,
.admin-portal-tabs a:hover,
.portal-subnav a.active,
.portal-subnav a:hover {
    background: #0b1118;
    border-color: #0b1118;
    color: #fff;
}

.project-workspace-dashboard .project-workspace-tabs {
    position: sticky;
    top: 64px;
    z-index: 780;
    margin-bottom: 4px;
}

.project-workspace-dashboard {
    gap: 14px;
}

.project-workspace-dashboard .workspace-dashboard-hero {
    padding-bottom: 0;
}

.project-workspace-dashboard .workspace-action-bar {
    margin-top: 0;
    padding: 10px;
    border: 1px solid var(--ptad-line);
    border-radius: 6px;
    background: rgba(255,255,255,.82);
}

.project-workspace-dashboard .admin-flow-grid {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
}

.project-workspace-dashboard .admin-flow-grid a,
.project-workspace-dashboard .admin-flow-grid > div {
    min-height: 78px;
    padding: 12px;
    border-radius: 6px;
}

.project-workspace-dashboard .admin-flow-grid strong {
    font-size: clamp(22px, 1.9vw, 32px);
}

.admin-workspace-grid,
.workspace-section-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 14px;
}

.admin-panel {
    overflow: clip;
}

.admin-panel h2,
.panel h2,
.workspace-panel h2,
.project-workspace-panel h2 {
    font-size: clamp(18px, 1.2vw, 23px);
    line-height: 1.08;
}

.admin-form {
    gap: 12px;
}

.admin-form.compact {
    gap: 10px;
}

.admin-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 10px;
}

.admin-form input,
.admin-form textarea,
.admin-form select,
.login-form input {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.3;
}

.admin-form textarea {
    min-height: 84px;
}

.admin-form button,
.admin-button,
.button,
.console-actions a,
.console-actions button {
    border-radius: 4px;
}

.admin-table {
    border-radius: 6px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    font-size: 12px;
}

.record-row,
.client-record-row,
.portal-room-row,
.gantt-row,
.admin-task-row {
    grid-template-columns: minmax(120px, .8fr) minmax(210px, 1.7fr) minmax(112px, .7fr) auto;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 22px rgba(8, 16, 28, .035);
}

.record-row strong,
.client-record-row strong,
.portal-room-row strong {
    overflow-wrap: anywhere;
}

.record-row a,
.client-record-row a,
.portal-room-row a {
    justify-self: end;
    min-height: 33px;
    padding: 8px 11px;
    border: 1px solid #ced7e2;
    border-radius: 4px;
    background: #fff;
    color: #0b1118;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    text-decoration: none;
}

.record-row a:hover,
.client-record-row a:hover,
.portal-room-row a:hover {
    background: #0b1118;
    color: #fff;
}

.admin-error,
.admin-success,
.console-alert {
    margin: 0;
    padding: 12px 14px;
    border-radius: 6px;
}

.portal-page-shell {
    padding: clamp(22px, 2.6vw, 42px) 0;
}

.portal-page-shell .container,
.client-project-section .container,
.client-portal-hero .container {
    width: min(1380px, calc(100vw - 42px));
}

.portal-page-shell h1 {
    margin: 12px 0 12px;
}

.portal-page-panel {
    padding: clamp(16px, 1.8vw, 24px);
}

.portal-page-panel header {
    margin-bottom: 14px;
}

.portal-page-panel h2 {
    font-size: clamp(22px, 2.2vw, 34px);
}

.portal-metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.portal-mini-grid {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
}

.quote-page {
    max-width: min(1480px, 100%);
}

.quote-page-hero {
    border-radius: 6px;
    box-shadow: var(--ptad-shadow-tight);
}

.quote-document-shell {
    padding: clamp(12px, 1.6vw, 24px);
    background:
        linear-gradient(180deg, #e9edf2, #f4f6f8);
}

.quote-document-shell .quote-document,
.quote-document,
.file-document {
    max-width: 940px;
    border-radius: 6px;
    box-shadow: var(--ptad-shadow-float);
}

.quote-editor-panel,
.workspace-quote-create {
    border-radius: 6px;
}

.file-viewer-head {
    padding: 18px;
    border: 1px solid var(--ptad-line);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--ptad-shadow-tight);
}

.file-viewer-panel {
    border-radius: 6px;
}

.file-viewer-frame {
    border-radius: 6px;
    overflow: hidden;
}

.portal-dock-panel {
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-top: 3px solid var(--ptad-red);
    box-shadow: 0 24px 80px rgba(0,0,0,.34);
}

.portal-dock-bar {
    background: #050812;
    color: #fff;
}

.portal-dock-chip {
    border-radius: 999px;
}

@media (max-width: 980px) {
    .admin-body .console-shell,
    .portal-console-body .console-shell {
        grid-template-columns: 1fr;
    }

    .admin-body .console-sidebar,
    .portal-console-body .console-sidebar {
        position: static;
        height: auto;
        max-height: 46vh;
    }

    .project-workspace-dashboard .project-workspace-tabs {
        top: 0;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .record-row,
    .client-record-row,
    .portal-room-row,
    .gantt-row,
    .admin-task-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-body .console-topbar,
    .portal-console-body .console-topbar {
        position: static;
    }

    .portal-page-shell .container,
    .client-project-section .container,
    .client-portal-hero .container {
        width: min(100% - 24px, 1380px);
    }
}

/* Compact scrollable Gantt viewport */
.portal-gantt-chart {
    width: 100%;
    max-height: min(640px, 62vh);
    overflow: auto;
    border: 1px solid #d7e0eb;
    border-radius: 6px;
    background: #fff;
    scrollbar-gutter: stable both-edges;
}

.portal-gantt-head,
.portal-gantt-line {
    width: max(100%, 820px);
    min-width: 820px;
    grid-template-columns: minmax(180px, .8fr) minmax(420px, 2fr) minmax(170px, .7fr);
}

.portal-gantt-head {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 38px;
    padding: 0;
    align-items: center;
    background: #050607;
}

.portal-gantt-head > span,
.portal-gantt-label,
.portal-gantt-formula {
    padding: 8px 10px;
}

.portal-gantt-head > span:first-child,
.portal-gantt-label {
    position: sticky;
    left: 0;
    border-right: 1px solid #dfe3e8;
}

.portal-gantt-head > span:first-child {
    z-index: 6;
    align-self: stretch;
    display: flex;
    align-items: center;
    background: #050607;
}

.portal-gantt-label {
    z-index: 2;
    min-width: 0;
    background: #fff;
}

.portal-gantt-line {
    min-height: 50px;
}

.portal-gantt-label strong,
.portal-gantt-label span,
.portal-gantt-label small,
.portal-gantt-formula small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.portal-gantt-label strong {
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
}

.portal-gantt-label span,
.portal-gantt-label small,
.portal-gantt-formula small {
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.25;
}

.portal-gantt-formula small:nth-of-type(n+3) {
    display: none;
}

.portal-gantt-scale {
    min-height: 38px;
    padding: 0 10px;
    font-size: 10px;
}

.portal-gantt-trackline {
    min-height: 50px;
}

.portal-gantt-bar {
    top: 18px;
    height: 12px;
    border-radius: 999px;
}

.portal-gantt-baseline {
    top: 34px;
    height: 3px;
}

.portal-gantt-trackline em {
    top: 5px;
    right: 8px;
    font-size: 9px;
}

.portal-gantt-formula .schedule-pill {
    padding: 4px 7px;
    font-size: 9px;
    letter-spacing: .08em;
}

.portal-gantt-empty,
.portal-gantt-unscheduled {
    min-width: 820px;
    padding: 10px;
}

@media (max-width: 640px) {
    .portal-gantt-chart {
        max-height: 58vh;
    }

    .portal-gantt-head,
    .portal-gantt-line,
    .portal-gantt-empty,
    .portal-gantt-unscheduled {
        width: 760px;
        min-width: 760px;
    }

    .portal-gantt-head,
    .portal-gantt-line {
        grid-template-columns: 160px 420px 180px;
    }
}

/* PTD task row action placement */
.project-workspace-dashboard .admin-task-row {
    grid-template-columns: minmax(230px, .72fr) minmax(360px, 1.15fr) minmax(520px, 1.2fr) max-content;
    align-items: start;
}

.admin-task-metrics {
    min-width: 0;
}

.admin-task-maintenance-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.admin-task-maintenance-actions .admin-task-action-form {
    display: inline-flex;
    flex: 0 0 auto;
    margin: 0;
    min-width: 0;
}

.admin-task-maintenance-actions button,
.admin-task-actions button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #c9d7e8;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.admin-task-actions {
    justify-self: end;
    width: auto;
    min-width: max-content;
}

.admin-task-actions .admin-task-action-update {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.admin-task-maintenance-actions .admin-task-action-delete {
    border-color: #ffb3b3;
    color: #a00000;
}

.admin-task-maintenance-actions .admin-task-action-unblock {
    border-color: #f2c066;
    background: #fff8e8;
    color: #7a4a00;
}

@media (max-width: 980px) {
    .project-workspace-dashboard .admin-task-row {
        grid-template-columns: 1fr;
    }

    .admin-task-actions {
        justify-self: start;
    }
}
