
/* ===== Global Layout ===== */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #000962;
    color: #333;
}

#maincre {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #000962;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1, h2 {
    color: #f0f2f5;
    text-align: center;
    margin: 20px 0 10px;
}

h3, h4 {
    color: #000962;
    margin: 10px 0;
}

gmp-map {
    display: block;
    width: 100%;
    height: 500px;
}

/* ===== Container Styles ===== */
.base-container,
.table-container,
#chatgpt,
fieldset,
.section-box {
    box-sizing: border-box;
    width: 96%;
    max-width: 2000px;
    margin: 10px auto;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 0;
}

.table-container {
    min-height: 300px;
    max-height: 480px;
    overflow: auto;
}

.base-grid {
    display: grid;
    grid-template-columns: minmax(300px, 40%) minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 0;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}

/* ===== Forms and Inputs ===== */
input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
    font-size: 13px;
    line-height: 1.5;
    padding: 6px 8px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

textarea {
    min-height: 60px;
    resize: vertical;
    overflow: auto;
}

button {
    background-color: #1616b5;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

table button {
    width: auto;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    line-height: 1;
}

/* ===== Table Styles ===== */
table {
    border-collapse: collapse;
}

th, td {
    font-size: 12px;
    padding: 8px;
    border: 1px solid #ddd;
    text-align: center;
}

th {
    background-color: #8686d4;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr.selected {
    background: #c6deee;
}

td.right {
    text-align: right;
}

td.center {
    text-align: center;
}

/* ===== Chat Styles ===== */
#chat-container {
    width: 100%;
    max-height: 300px;
    overflow: auto;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.chatQues,
.chatAnswer {
    min-height: 60px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    word-wrap: break-word;
    max-width: 85%;
}

.chatQues {
    background-color: #dcebf1;
    float: left;
    clear: both;
}

.chatAnswer {
    background-color: #e3f1dc;
    float: right;
    clear: both;
}

#chat-history::after {
    content: "";
    display: block;
    clear: both;
}

/* ===== Radio / Checkbox Groups ===== */
.radio-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
}

.radio-group label {
    display: flex;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.radio-group * {
    text-align: left !important;
}

.check-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
}

.check-group label {
    display: inline-flex;
    text-align: left;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    width: auto;
}

.check-group * {
    text-align: left !important;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    white-space: nowrap;
    padding: 2px 4px;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 0;
    gap: 6px;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    padding: 0;
    width: auto;
    flex-shrink: 0;
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000962;
    padding: 10px 20px;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar a {
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-weight: 500;
    margin-right: 15px;
}

.navbar a:hover {
    background-color: #0056b3;
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.dropdown-content a {
    color: #333;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ===== Footer ===== */
footer {
    width: 100%;
    text-align: center;
    color: white;
    background-color: #000962;
    padding: 15px 20px;
    font-size: 12px;
    margin-top: 40px;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* ===== Generic Sections ===== */
section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 0;
    box-sizing: border-box;
}

/* ===== Proprent Section ===== */
.section-box {
    width: 100%;
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px 30px;
    background-color: #ffffff;
    border-radius: 10px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#proprent-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #1616b5;
}

#proprent-section form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
    justify-content: space-between;
}

#proprent-section label {
    font-weight: 500;
    color: #333;
}

#proprent-section input,
#proprent-section select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

#proprent-section button {
    background-color: #1616b5;
    color: white;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

#proprent-section button:hover {
    background-color: #0056b3;
}

/* ===== Address / Map ===== */
.address-map-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    width: 96%;
    max-width: 1500px;
    margin: 20px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    box-sizing: border-box;
}

.address-panel {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.address-panel input,
.address-panel button {
    width: 95%;
    padding: 8px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#messageBox {
    background-color: #fef9c3;
    color: #92400e;
}

#map {
    flex: 2;
    min-width: 400px;
    height: 800px;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-sizing: border-box;
}

.half-input {
    flex: 1;
}

#propertyTable tr.highlight {
    background-color: #d2ebff;
    font-weight: bold;
}

img {
    max-width: 100%;
    margin-top: 10px;
}

.hidden {
    display: none;
}

/* ===== Asset / Property Layouts ===== */
.asset-summary-grid {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 8px 16px;
    max-width: 1200px;
    padding: 16px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #fdfdfd;
    margin: 16px 0 32px 0;
}

.asset-summary-grid .section-title,
.section-title {
    grid-column: 1 / -1;
    font-weight: bold;
    background: #f3f3f3;
    padding: 6px;
    margin-top: 12px;
}

.asset-summary-grid .section-title {
    font-size: 1.1em;
    color: #333;
}

.grid {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 6px 12px;
}

.grid div:nth-child(odd) {
    font-weight: bold;
}

.red {
    background: #ffd6d6;
}

.grid-container {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 8px 16px;
    max-width: 400px;
    margin-bottom: 30px;
}

.property-detail-grid {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px 16px;
    padding: 16px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fdfdfd;
    border: 1px solid #ccc;
    border-radius: 12px;
    margin: 12px 0;
}

.property-detail-grid .section-title {
    grid-column: 1 / span 2;
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 12px;
    color: #333;
}

.grid-table {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    row-gap: 6px;
    column-gap: 10px;
}

#propertyGrid td:first-child {
    font-weight: bold;
    background: #fafafa;
    width: 200px;
    white-space: nowrap;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 8px;
    margin: 1rem 0;
    border-bottom: 2px solid #ccc;
}

.flow-tab
.tab-btn {
    background: #f0f0f3;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 16px;
    color: #0056b3;
    border-radius: 6px 6px 0 0;
    transition: background 0.2s ease;
}

.flow-tab
.tab-btn:hover {
    background: #e6e6e6;
}

.flow-tab
.tab-btn.active {
    background: #6470b3;
    color: white;
    font-weight: bold;
}

.tab-panel {
    display: none;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.tab-panel.active {
    display: block;
}

/* ===== ACS Modal ===== */
#acsModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 800px;
    max-height: 80%;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

#acsModalHeader {
    cursor: move;
    padding: 12px 20px;
    background: #007bff;
    color: #fff;
    font-size: 18px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#acsModalHeader button {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

#acsContent {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    font-family: Arial, sans-serif;
}

#acsModal section {
    margin-bottom: 15px;
}

#acsModal h4,
#acsContent h4 {
    margin: 10px 0;
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
    color: #333;
}

#acsModal ul,
#acsContent ul {
    list-style: none;
    padding-left: 0;
    margin: 5px 0 0 0;
}

#acsModal ul li,
#acsContent ul li {
    margin: 4px 0;
    padding: 3px 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
}

#acsOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

#acsContent .acs-section {
    margin-bottom: 20px;
}

#acsContent .acs-scrollbox {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #fafafa;
}

#acsContent .acs-disclaimer {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* ===== Override Inputs ===== */
.override-input {
    width: 150px;
    max-width: 200px;
    padding: 4px 6px;
    font-size: 0.9rem;
}

.override-small {
    width: 100px;
}

/* ===== Shared Two Column / Stage Layout ===== */
.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-items: start;
}

.two-col .col {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    border: 1px solid #ccc;
    box-sizing: border-box;
    overflow-x: hidden;
}

.stage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.field > input,
.field > select,
.field > textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    color: #111827;
}

.field > input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin-bottom: 0;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    line-height: 1.2;
}

.hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
    flex: 0 0 auto;
    border: none;
    padding: 0;
}

.object-field {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
}

.param-object-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.param-object-wrap .field {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
}

.param-object-wrap .label-row {
    margin-bottom: 2px;
}

.param-help {
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
    margin-top: 2px;
}

.two-col .stage-grid,
.two-col .param-object-wrap,
.two-col .field,
.two-col input,
.two-col select,
.two-col textarea {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== Charts ===== */
.chart-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
}

.chart-container canvas {
    width: 100% !important;
    height: 400px !important;
}

.chart-wrap-wide {
    height: 500px;
    max-height: 500px;
    position: relative;
}

/* ===== Login ===== */
.login-wrapper {
    width: 100%;
    max-width: 380px;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-wrapper h2 {
    color: #1a73e8;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

/* ===== AI Chat ===== */
.ai-chat-header {
    background: #f9fafb;
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    height: 20vh;
    overflow-y: auto;
    font-family: 'Roboto', sans-serif;
}

.ai-chat-header button {
    margin-top: 10px;
    margin-right: 8px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #0077cc;
    color: #fff;
    cursor: pointer;
}

.ai-chat-header button:hover {
    background: #005fa3;
}

.ai-input-row {
    display: flex;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
}

.ai-input-row textarea {
    flex: 1;
    resize: none;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: 'Roboto', sans-serif;
}

.ai-input-row button {
    height: 100%;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #0077cc;
    color: white;
    cursor: pointer;
}

.ai-input-row button:hover {
    background: #005fa3;
}

/* ===== Labels / Small UI ===== */
label {
    display: block;
    font-size: 12px;
    margin-top: 6px;
    margin-bottom: 2px;
    color: #374151;
}

.field-row-inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.small-text {
    font-size: 11px;
    color: #6b7280;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    background: #e5e7eb;
    color: #374151;
}

.badge-sale { background: #f97316; color: #fff; }
.badge-lease { background: #22c55e; color: #fff; }
.badge-assessment { background: #6366f1; color: #fff; }
.badge-note { background: #6b7280; color: #fff; }
.badge-file { background: #0ea5e9; color: #fff; }

.message {
    font-size: 12px;
    margin-top: 4px;
}

.message.error { color: #b91c1c; }
.message.success { color: #15803d; }

/* ===== Model Data ===== */
.md-wrap { font-size: 12px; color: #111827; }
.md-sub { color: #6b7280; font-size: 11px; margin: 4px 0 10px; }

.md-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
    background: #fff;
}

.md-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    align-items: baseline;
}

.md-title { font-weight: 800; font-size: 13px; }
.md-key { color: #9ca3af; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.md-meta { margin-top: 6px; color: #6b7280; font-size: 11px; }
.md-meta b { color: #111827; font-weight: 700; }

.md-row { margin-top: 10px; }
.md-row > .lbl { color: #6b7280; font-size: 11px; margin-bottom: 4px; }
.md-row > .val { color: #111827; font-weight: 600; }

.md-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.md-pill {
    border: 1px solid #eef2f7;
    background: #fafafa;
    border-radius: 10px;
    padding: 8px;
}

.md-pill .k { color: #6b7280; font-size: 10.5px; }
.md-pill .v { font-weight: 700; margin-top: 2px; }

.md-details { margin-top: 10px; }
.md-details summary { cursor: pointer; color: #374151; font-weight: 700; font-size: 11.5px; }

.md-details .md-box {
    margin-top: 8px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 10px;
    background: #fafafa;
}

.md-muted { color: #6b7280; font-weight: 500; }

/* ===== Diagnostics Panel ===== */
:root {
    --diag-bg: #ffffff;
    --diag-card: #f8fafc;
    --diag-border: #e5e7eb;
    --diag-text: #111827;
    --diag-muted: #6b7280;
    --diag-accent: #2563eb;
    --diag-accent-soft: #dbeafe;
    --diag-green: #059669;
    --diag-shadow: 0 4px 18px rgba(0,0,0,.06);
}

.diag-panel {
    background: var(--diag-bg);
    border: 1px solid var(--diag-border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--diag-shadow);
    color: var(--diag-text);
}

.diag-title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .2px;
}

.diag-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diag-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--diag-card);
    border: 1px solid var(--diag-border);
    border-radius: 12px;
}

.diag-label-strong {
    font-weight: 600;
    min-width: 100px;
}

.diag-hint {
    color: var(--diag-muted);
    font-size: 12px;
}

.diag-spacer {
    margin-left: auto;
}

.diag-select,
.diag-select-sm,
.diag-input-num {
    background: #ffffff;
    border: 1px solid var(--diag-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--diag-text);
}

.diag-select { min-width: 200px; }
.diag-select-sm { min-width: 150px; }
.diag-input-num { width: 80px; }

.diag-select:focus,
.diag-select-sm:focus,
.diag-input-num:focus {
    outline: none;
    border-color: var(--diag-accent);
    box-shadow: 0 0 0 3px var(--diag-accent-soft);
}

.diag-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--diag-muted);
}

.diag-toggle input {
    accent-color: var(--diag-accent);
}

#btnRunBacktest,
#btnSendRecsToConfig,
#pkgExpandAll,
#pkgCollapseAll {
    border: 1px solid var(--diag-border);
    background: var(--diag-accent);
    color: white;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

#btnRunBacktest:hover,
#pkgExpandAll:hover,
#pkgCollapseAll:hover {
    opacity: .92;
    transform: translateY(-1px);
}

#btnSendRecsToConfig {
    background: var(--diag-green);
}

.diag-chart-wrap {
    background: #ffffff;
    border: 1px solid var(--diag-border);
    border-radius: 12px;
    padding: 12px;
    height: 260px;
    max-height: 260px;
    position: relative;
}

#wfChart {
    width: 100% !important;
    height: 280px !important;
}

.diag-status {
    font-size: 12px;
    color: var(--diag-muted);
    padding: 8px 10px;
    background: #f9fafb;
    border: 1px solid var(--diag-border);
    border-radius: 10px;
}

.diag-grid-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.diag-raw {
    max-height: 320px;
    overflow: auto;
    background: #f3f4f6;
    border: 1px solid var(--diag-border);
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.diag-debug {
    margin-top: 18px;
    background: #ffffff;
    border: 1px solid var(--diag-border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--diag-shadow);
}

.diag-debug-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.diag-debug-toolbar select,
.diag-debug-search {
    border: 1px solid var(--diag-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
}

.diag-debug-search {
    flex: 1 1 260px;
}

.diag-debug-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.diag-card {
    background: #f9fafb;
    border: 1px solid var(--diag-border);
    border-radius: 10px;
    padding: 10px;
}

.diag-card-tree {
    flex: 1 1 420px;
    min-width: 300px;
    max-height: 420px;
    overflow: auto;
}

.diag-card-selected,
.diag-card-diff {
    max-height: 420px;
    overflow: auto;
    font-size: 12px;
    white-space: pre-wrap;
}

.diag-row-wf {
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== Flow / Sticky Tabs ===== */
.flow-step {
    background-color: #f1f1f1;
}

#flowTabs {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin: 0 0 14px 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.flow-tab {
    border: 1px solid #d7dbe3;
    background: linear-gradient(to bottom, #ffffff, #f5f7fa);
    color: #2f3a4a;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

.flow-tab:hover {
    background: linear-gradient(to bottom, #ffffff, #eef3f8);
    border-color: #bfc8d6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.flow-tab:active {
    transform: translateY(0);
}

.flow-tab.active {
    background: linear-gradient(to bottom, #1f6feb, #195ec9);
    color: #fff;
    border-color: #195ec9;
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.28);
}

.flow-tab.complete {
    background: linear-gradient(to bottom, #eaf7ee, #dff2e5);
    border-color: #b9ddc3;
    color: #1f6a34;
}

#flowStatus {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f5f7;
    border: 1px solid #e1e5ea;
    font-size: 12px;
    font-weight: 600;
    color: #5b6573;
}

.flow-step,
section {
    scroll-margin-top: 90px;
}

/* ===== Compare Tables ===== */
.compare-table .row-label {
    font-weight: 700;
    background: #7d9ddb;
    min-width: 180px;
    position: sticky;
    left: 0;
    z-index: 1;
}

.compare-table thead th:first-child {
    left: 0;
    z-index: 3;
}

/* ===== Regressor Tables ===== */
.reg-table tr.reg-scope-user td {
    background-color: rgba(88, 101, 242, 0.06);
}

.reg-table tr.reg-scope-user:hover td {
    background-color: rgba(88, 101, 242, 0.12);
}

.reg-table tr.reg-scope-user td:nth-child(2) {
    font-weight: 600;
}

/* ===== Agreement Modal ===== */
.agreement-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 999999;
}

.agreement-overlay.hidden {
    display: none;
}

.agreement-card {
    width: min(980px, 100%);
    max-height: 92vh;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.agreement-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.agreement-header h2 {
    margin: 0;
}

.agreement-version {
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

.agreement-meta {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
}

.agreement-body {
    padding: 20px 24px;
    overflow-y: auto;
    line-height: 1.65;
    color: #111827;
    background: #fff;
}

.agreement-footer {
    border-top: 1px solid #e5e7eb;
    padding: 16px 24px 20px;
    background: #fff;
}

.agreement-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #334155;
}

.agreement-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.agreement-status {
    margin-top: 10px;
    min-height: 18px;
    font-size: 13px;
    color: #475569;
}

/* ===== Responsive ===== */
@media (max-width: 1400px) {
    .diag-grid-1 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    #flowTabs {
        top: 0;
        gap: 8px;
        padding: 10px;
    }

    .flow-tab {
        padding: 9px 12px;
        font-size: 13px;
    }

    .two-col,
    .stage-grid,
    .param-object-wrap,
    .field-row-inline {
        grid-template-columns: 1fr;
    }

    .object-field {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    #proprent-section form {
        flex-direction: column;
    }

    #proprent-section input,
    #proprent-section select {
        max-width: 100%;
    }
}


