:root {
    --navy: #143f5f;
    --navy-dark: #0f2f47;
    --blue: #2d6f9f;
    --pale: #eaf3fa;
    --border: #d6e0ea;
    --text: #1f2933;
    --muted: #6b7280;
    --surface: #ffffff;
    --page: #f4f7fb;
    --danger: #b42318;
    --success: #176b3a;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page);
    color: var(--text);
}
a { color: inherit; }
.page-head {
    background: linear-gradient(135deg, #fff, #f7fbff);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 26px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    box-shadow: 0 16px 45px rgba(15, 47, 71, .09);
    margin-bottom: 20px;
}
.eyebrow {
    margin: 0 0 7px;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
    font-size: 12px;
}
h1 { margin: 0 0 8px; color: #0b1726; font-size: clamp(26px, 4vw, 38px); }
h2 { margin: 0 0 18px; color: var(--navy); }
p { line-height: 1.55; }
.page-head p { margin: 0; color: var(--muted); max-width: 780px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(15, 47, 71, .08);
    overflow: hidden;
}
.notice {
    padding: 12px 14px;
    border-radius: 12px;
    margin: 0 0 18px;
    border: 1px solid rgba(23,107,58,.2);
    background: #f0fff4;
    color: var(--success);
    font-weight: 700;
}
section {
    padding: 26px;
    border-bottom: 1px solid var(--border);
}
section:last-child { border-bottom: 0; }

.form-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 26px 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.tab-button {
    min-height: 38px;
    border-radius: 999px;
    background: #f7fbff;
    color: var(--navy);
}
.tab-button.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-help {
    margin: -8px 0 18px;
    color: var(--muted);
}
.grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label span,
.radio-title {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
    color: #263445;
}
input[type="text"], input[type="email"], textarea, select {
    width: 100%;
    border: 1px solid #cfdbe7;
    border-radius: 12px;
    padding: 12px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: 3px solid rgba(45,111,159,.16);
    border-color: var(--blue);
}
label.wide { display: block; margin-bottom: 16px; }
small { display: block; color: var(--muted); margin: -8px 0 12px; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 16px;
}
.check span { margin: 0; }
.radio {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fbfdff;
}
.radio label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 3px 14px 3px 0;
}
.download-panel { background: #f8fbfe; }
.buttons,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    background: #fff;
    color: var(--navy);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}
.button:hover,
button:hover { border-color: var(--blue); }
.button.primary,
button.primary {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.button.secondary,
button.secondary { background: #f7fbff; }
.button.small,
button.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}
button.danger {
    color: var(--danger);
    border-color: rgba(180,35,24,.25);
}
.inline-form { display: inline; margin: 0; }
.table-card { padding: 0; overflow-x: auto; }
.list-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}
.list-table th,
.list-table td {
    border-bottom: 1px solid var(--border);
    padding: 14px 14px;
    text-align: left;
    vertical-align: top;
}
.list-table th {
    background: #f2f6fa;
    color: var(--navy);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.list-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}
.actions-col { width: 190px; }
code {
    background: #eef5fb;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 3px 6px;
}
.template-form { padding: 24px; }
.template-form > .grid { margin-bottom: 24px; }
.builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
}
.builder-main,
.placeholder-panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fbfdff;
    overflow: hidden;
}
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f2f6fa;
    border-bottom: 1px solid var(--border);
}
.toolbar select,
.toolbar button { width: auto; min-height: 36px; padding: 7px 10px; }
.editor {
    min-height: 560px;
    margin: 0;
    padding: 30px;
    background: #fff;
    line-height: 1.55;
    outline: none;
}
.editor:focus { box-shadow: inset 0 0 0 3px rgba(45,111,159,.12); }
.placeholder-panel { padding: 18px; max-height: 720px; overflow: auto; }
.placeholder-panel h2 { margin-top: 0; }
.placeholder-panel p { color: var(--muted); margin-top: -8px; }
.placeholder-panel details {
    border-top: 1px solid var(--border);
    padding: 10px 0;
}
.placeholder-panel summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--navy);
}
.placeholder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
}
.placeholder-list button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}
.form-end { margin-top: 22px; }
@media (max-width: 980px) {
    .page-head { flex-direction: column; align-items: flex-start; }
    .grid.two, .grid.three, .builder-layout { grid-template-columns: 1fr; }
}
.empty-state {
    padding: 42px 24px;
    text-align: center;
    background: #fbfdff;
}
.empty-state p { color: var(--muted); }
.empty-row {
    text-align: center;
    padding: 34px 18px !important;
    color: var(--muted);
    background: #fbfdff;
}

.editor table,
.editor .template-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 14px;
}
.editor th,
.editor td {
    border: 1px solid #d6e0ea;
    padding: 8px 10px;
    vertical-align: top;
}
.editor th {
    background: #f2f6fa;
    color: #143f5f;
    text-align: left;
    font-weight: 800;
}
.editor h1,
.editor h2,
.editor h3 { color: #143f5f; }
.editor h1 { font-size: 26px; margin: 0 0 18px; }
.editor h2 { font-size: 18px; margin: 22px 0 10px; }
.editor small { color: #6b7280; }

.toolbar-separator {
    display: inline-block;
    width: 1px;
    min-height: 34px;
    background: #d6e0ea;
    margin: 0 2px;
}
.editor table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    table-layout: fixed;
}
.editor table th,
.editor table td {
    border: 1px solid #cfdbe7;
    padding: 9px 10px;
    min-width: 42px;
    vertical-align: top;
}
.editor table th {
    background: #f2f6fa;
    color: #143f5f;
    font-weight: 800;
    text-align: left;
}
.editor table.key-value th,
.editor table.template-table.key-value th {
    width: 30%;
    background: #f6f8fa;
    color: #334155;
}
.editor table.checklist th {
    text-align: left;
}
.editor table.checklist td:not(:first-child) {
    text-align: center;
}
.editor td:focus,
.editor th:focus {
    outline: 3px solid rgba(45,111,159,.18);
    outline-offset: -3px;
}
.editor .callout {
    border: 1px solid #d6e0ea;
    background: #f5f8fc;
    padding: 12px 16px;
    margin: 14px 0 18px;
    font-weight: 800;
}

.upload-box {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 18px;
    align-items: start;
    border: 1px dashed #9db6c9;
    background: #f5f9fc;
    border-radius: 16px;
    padding: 18px;
    margin: 14px 0 20px;
}
.upload-box h3 {
    margin: 0 0 8px;
    color: #143f5f;
}
.upload-box p {
    margin: 0 0 8px;
    color: #516173;
}
.upload-control input[type="file"] {
    display: block;
    width: 100%;
    border: 1px solid #cfdbe7;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}
.image-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    color: #516173;
    font-size: 13px;
}
.image-preview img {
    width: 110px;
    height: 78px;
    object-fit: contain;
    border: 1px solid #cfdbe7;
    border-radius: 10px;
    background: #fff;
}
.field-error {
    color: #9f1239 !important;
    font-weight: 700;
}
@media (max-width: 840px) {
    .upload-box { grid-template-columns: 1fr; }
}

/* === S.G SURVEYORS METHOD IMAGE PREVIEW PATCH === */
/* Keeps the Method Statement property image preview small and centred after save. */
.upload-box,
.upload-control,
.tab-panel[data-tab-panel="method"] {
    min-width: 0;
    max-width: 100%;
}

.upload-box {
    overflow-x: hidden;
}

.method-image-preview-card,
.upload-box .image-preview,
.upload-control .image-preview {
    width: min(100%, 340px) !important;
    max-width: 340px !important;
    margin: 14px auto 0 !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-align: center !important;
    border: 1px solid #cfdbe7 !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: #516173 !important;
    font-size: 13px !important;
    overflow: hidden !important;
}

.method-image-thumb-frame {
    width: 280px !important;
    max-width: 100% !important;
    height: 180px !important;
    max-height: 180px !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    border: 1px solid #d6e0ea !important;
    border-radius: 12px !important;
    background: #f8fbfe !important;
}

.method-property-preview,
.method-image-preview-card img,
.upload-box .image-preview img,
.upload-control .image-preview img,
.upload-control img[src*="property_image.php"],
.tab-panel[data-tab-panel="method"] img[src*="property_image.php"] {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 170px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
}

/* Reflect the selected PDF rotation in the small browser preview as well.
   Sizes are reduced for rotated thumbnails so they cannot stretch the page. */
.method-image-preview-card.preview-rotate-90 .method-property-preview,
.method-image-preview-card.preview-rotate-90 img[src*="property_image.php"] {
    transform: rotate(90deg) !important;
    max-width: 145px !important;
    max-height: 145px !important;
}
.method-image-preview-card.preview-rotate-180 .method-property-preview,
.method-image-preview-card.preview-rotate-180 img[src*="property_image.php"] {
    transform: rotate(180deg) !important;
}
.method-image-preview-card.preview-rotate-270 .method-property-preview,
.method-image-preview-card.preview-rotate-270 img[src*="property_image.php"] {
    transform: rotate(270deg) !important;
    max-width: 145px !important;
    max-height: 145px !important;
}
.method-image-preview-card.preview-rotate-90::after,
.method-image-preview-card.preview-rotate-180::after,
.method-image-preview-card.preview-rotate-270::after {
    content: "Rotation shown here and applied in the PDF";
    display: block;
    margin-top: 2px;
    color: #6b7280;
    font-size: 12px;
}

@media (max-width: 840px) {
    .method-image-preview-card,
    .upload-box .image-preview,
    .upload-control .image-preview {
        max-width: 100% !important;
    }
    .method-image-thumb-frame {
        width: 240px !important;
        height: 160px !important;
    }
}

/* === S.G SURVEYORS METHOD STATEMENT ROW/COLUMN TABLE PATCH === */
.method-table-field {
    border: 1px solid #d6e0ea;
    border-radius: 16px;
    padding: 16px;
    background: #ffffff;
    margin: 16px 0 22px;
}
.method-table-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.method-table-head h3 {
    margin: 0 0 4px;
    color: #143f5f;
    font-size: 16px;
}
.method-table-head p {
    margin: 0;
    color: #516173;
    font-size: 13px;
    line-height: 1.45;
}
.method-table-scroll {
    overflow-x: auto;
    max-width: 100%;
}
.editable-method-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 760px;
}
.editable-method-table th,
.editable-method-table td {
    border: 1px solid #cfdbe7;
    padding: 8px;
    vertical-align: top;
}
.editable-method-table th {
    background: #eef5fb;
    color: #143f5f;
    text-align: left;
    font-weight: 800;
    font-size: 13px;
}
.editable-method-table td textarea {
    width: 100%;
    min-height: 54px;
    border: 1px solid #d6e0ea;
    border-radius: 10px;
    padding: 9px 10px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    background: #fff;
}
.editable-method-table td textarea.method-cell-editor {
    cursor: pointer;
    resize: none;
    overflow: hidden;
    background: #fbfdff;
}
.editable-method-table td textarea.method-cell-editor:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
    background: #ffffff;
}
.editable-method-table td:first-child textarea {
    min-height: 42px;
    font-weight: 700;
}
.row-action-col,
.editable-method-table .row-actions {
    width: 92px;
    text-align: center;
}
.button.small {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 9px;
}
.button.danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}
.button.danger:hover {
    background: #fecaca;
}
@media (max-width: 840px) {
    .method-table-head {
        flex-direction: column;
    }
    .editable-method-table {
        min-width: 680px;
    }
}


/* === S.G SURVEYORS METHOD STATEMENT CELL POPUP PATCH === */
.cell-edit-hint {
    margin-top: 6px !important;
    color: #64748b !important;
    font-size: 12px !important;
}
.method-cell-modal-backdrop[hidden] {
    display: none !important;
}
.method-cell-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
}
.method-cell-modal {
    width: min(660px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #ffffff;
    border: 1px solid #d6e0ea;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
    padding: 18px;
}
.method-cell-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.method-cell-modal-head .eyebrow {
    margin: 0 0 2px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 800;
}
.method-cell-modal-head h3 {
    margin: 0;
    color: #143f5f;
    font-size: 18px;
    line-height: 1.25;
}
.method-cell-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid #d6e0ea;
    border-radius: 999px;
    background: #f8fbfe;
    color: #143f5f;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.method-cell-modal-label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    color: #334155;
    font-weight: 700;
}
.method-cell-modal-textarea {
    width: 100%;
    min-height: 230px;
    max-height: 46vh;
    border: 1px solid #cfdbe7;
    border-radius: 14px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}
.method-cell-modal-textarea:focus {
    outline: 3px solid rgba(59, 130, 246, .22);
    border-color: #60a5fa;
}
.method-cell-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
body.method-cell-modal-open {
    overflow: hidden;
}
@media (max-width: 720px) {
    .method-cell-modal {
        width: calc(100vw - 20px);
        padding: 14px;
    }
    .method-cell-modal-textarea {
        min-height: 200px;
    }
}

/* === S.G SURVEYORS METHOD TABLE DRAG ROW PATCH START === */
/* Drag handle sits inside the first table column. No extra PDF columns or saved-data
   columns are added; this is only an on-screen editing aid. */
.editable-method-table td.method-row-drag-cell {
    position: relative;
    padding-left: 44px;
}

.editable-method-table td.method-row-drag-cell textarea.method-cell-editor {
    min-height: 54px;
}

.editable-method-table .row-actions {
    white-space: nowrap;
    min-width: 92px;
}

.method-row-drag-handle {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 1px solid #c7d7e8;
    border-radius: 8px;
    background: #f7fbff;
    color: #174765;
    cursor: grab;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.method-row-drag-handle:active {
    cursor: grabbing;
}

.method-row-drag-handle:focus-visible {
    outline: 3px solid rgba(20, 75, 105, 0.22);
    outline-offset: 2px;
}

.editable-method-table tr.method-row-dragging {
    opacity: 0.55;
    outline: 2px dashed #174765;
    outline-offset: -2px;
    background: #eef7ff;
}

.editable-method-table tr.method-row-drag-over td {
    border-top-color: #174765;
}

.method-table-head .method-table-drag-note {
    display: block;
    margin-top: 4px;
    color: #65758a;
    font-size: 12px;
}
/* === S.G SURVEYORS METHOD TABLE DRAG ROW PATCH END === */

/* === S.G SURVEYORS ADDITIONAL PHOTOS PATCH START === */
.additional-photo-uploader {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.photo-upload-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid #d8e3ef;
    border-radius: 16px;
    background: #f8fbfe;
}
.photo-upload-card h3 {
    margin: 0 0 6px;
}
.photo-upload-card p {
    margin: 0;
    color: #64748b;
}
.photo-upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.photo-schedule-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.additional-photo-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    padding: 16px;
    overflow-x: auto;
    border-radius: 18px;
    background: #eef3f8;
}
.additional-photo-page {
    width: min(100%, 820px);
    min-width: 640px;
    aspect-ratio: 210 / 297;
    padding: 28px 34px 38px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #cfd8e3;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}
.photo-page-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    color: #0f172a;
    font-size: 14px;
}
.photo-page-title strong {
    font-size: 20px;
}
.photo-page-title span {
    color: #64748b;
    font-size: 12px;
}
.photo-page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
    border-top: 1px solid #111827;
    border-left: 1px solid #111827;
    height: calc(100% - 42px);
}
.photo-page-grid.photo-grid-4 {
    grid-template-rows: repeat(2, 1fr);
}
.photo-page-grid.photo-grid-6 {
    grid-template-rows: repeat(3, 1fr);
}

.additional-photo-slot {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 34px;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid #111827;
    border-bottom: 1px solid #111827;
    background: #fff;
}
.additional-photo-slot.selected {
    outline: 3px solid rgba(20, 63, 95, 0.35);
    outline-offset: -3px;
}
.additional-photo-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}
.additional-photo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform .15s ease;
    user-select: none;
    pointer-events: none;
}
.additional-photo-placeholder {
    color: #94a3b8;
    font-weight: 700;
    font-size: 13px;
}
.additional-photo-caption {
    width: 100%;
    height: 100%;
    min-height: 34px;
    box-sizing: border-box;
    border: 0;
    border-top: 1px solid #111827;
    border-radius: 0;
    padding: 7px 9px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.25;
    background: #fff;
}
.additional-photo-caption:focus {
    outline: 3px solid rgba(20, 63, 95, .24);
    outline-offset: -3px;
}
.photo-slot-upload {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    border: 1px solid rgba(20, 63, 95, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: #143f5f;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .14);
    cursor: pointer;
}
.additional-photo-slot:not(.empty) .photo-slot-upload {
    left: 9px;
    top: 9px;
    transform: none;
    opacity: 0;
    transition: opacity .12s ease;
}
.additional-photo-slot:hover .photo-slot-upload,
.additional-photo-slot.selected .photo-slot-upload,
.photo-slot-upload:focus {
    opacity: 1;
}
.photo-slot-delete-x {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(153, 27, 27, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: #991b1b;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .14);
}
.photo-slot-delete-x:hover,
.photo-slot-delete-x:focus {
    background: #fee2e2;
}
.photo-slot-controls {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 3;
}
.additional-photo-slot:hover .photo-slot-controls,
.additional-photo-slot.selected .photo-slot-controls,
.photo-slot-controls:focus-within {
    opacity: 1;
    pointer-events: auto;
}
.photo-slot-controls button,
.photo-slot-controls span {
    border: 1px solid rgba(15, 23, 42, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 7px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .10);
}
.photo-slot-controls button {
    cursor: pointer;
}
.photo-slot-controls button:hover {
    background: #eff6ff;
}
@media (max-width: 760px) {
    .photo-upload-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .additional-photo-page {
        min-width: 560px;
    }
}
/* === S.G SURVEYORS ADDITIONAL PHOTOS PATCH END === */

/* === S.G SURVEYORS EVIDENCE PHOTO CONTAINMENT REPAIR START === */
.evidence-photo-uploader .additional-photo-pages {
    max-width: 100% !important;
    overflow-x: auto !important;
}
.evidence-photo-uploader .additional-photo-page {
    max-width: 820px !important;
}
.evidence-photo-uploader .additional-photo-box {
    overflow: hidden !important;
}
.evidence-photo-uploader .additional-photo-box img {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}
.evidence-photo-uploader .photo-page-grid {
    min-height: 0 !important;
}
.evidence-photo-uploader .additional-photo-slot {
    min-height: 0 !important;
}
/* === S.G SURVEYORS EVIDENCE PHOTO CONTAINMENT REPAIR END === */



/* === S.G SURVEYORS AUTOSAVE STATUS PATCH START === */
.save-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #d6e2ee;
    background: #f8fbfe;
    color: #345;
}
.save-status .save-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #b8c8d8;
    border-top-color: transparent;
    display: none;
}
.save-status.saving .save-spinner,
button.is-loading::before {
    display: inline-block;
    animation: sg-spin 0.8s linear infinite;
}
.save-status.saved {
    background: #f0f8f3;
    border-color: #cce8d5;
    color: #24613a;
}
.save-status.dirty {
    background: #fff8e8;
    border-color: #f2dea8;
    color: #76530b;
}
.save-status.saving {
    background: #edf6ff;
    border-color: #c6dff6;
    color: #16486f;
}
.save-status.error {
    background: #fff1f1;
    border-color: #f0c1c1;
    color: #8a1f1f;
}
button.is-loading {
    position: relative;
    opacity: 0.88;
    cursor: wait;
}
button.is-loading::before {
    content: '';
    width: 13px;
    height: 13px;
    margin-right: 7px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
}
@keyframes sg-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* === S.G SURVEYORS AUTOSAVE STATUS PATCH END === */


/* === S.G SURVEYORS ADDITIONAL PHOTOS CLEANUP PATCH START === */
.photo-schedule-tools { display: none !important; }
.field-error:empty { display: none !important; }
/* === S.G SURVEYORS ADDITIONAL PHOTOS CLEANUP PATCH END === */

/* === S.G SURVEYORS SILENT AUTOSAVE NO-RELOAD PATCH START === */
.save-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
}
.save-status .save-spinner,
#manualSaveButton .save-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: none;
    animation: sgSpin 0.75s linear infinite;
}
.save-status.saving .save-spinner,
#manualSaveButton.is-loading .save-spinner {
    display: inline-block;
}
#manualSaveButton.is-loading {
    opacity: 0.78;
    cursor: wait;
}
@keyframes sgSpin { to { transform: rotate(360deg); } }
body.login-page {
    min-height: 100vh;
    background:
        linear-gradient(rgba(248,251,254,.28), rgba(248,251,254,.28)),
        url('login-background.png') center center / cover no-repeat fixed;
    color: #0b1726;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 26px;
}
.login-card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(320px, .72fr);
    overflow: hidden;
    border: 1px solid rgba(214,224,234,.95);
    border-radius: 28px;
    background: rgba(255,255,255,.86);
    box-shadow: 0 24px 90px rgba(15,47,71,.18);
    backdrop-filter: blur(14px);
}
.login-main {
    padding: clamp(28px, 5vw, 54px);
    background: #fff;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}
.login-brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: #fff;
    color: var(--navy);
    font-weight: 900;
    letter-spacing: .02em;
    overflow: hidden;
    border: 1px solid rgba(214,224,234,.95);
    box-shadow: 0 10px 24px rgba(20,63,95,.12);
}
.login-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.login-brand strong {
    display: block;
    font-size: 21px;
    color: #0b1726;
}
.login-brand small {
    display: block;
    margin: 3px 0 0;
    color: #64748b;
}
.login-main h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 5vw, 44px);
    letter-spacing: -.04em;
}
.login-intro {
    margin: 0 0 28px;
    max-width: 520px;
    color: #64748b;
    font-size: 16px;
}
.login-form {
    display: grid;
    gap: 16px;
}
.login-form label span {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #334155;
}
.login-form input {
    width: 100%;
    min-height: 50px;
    border: 1px solid #cfdbe7;
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    color: #0b1726;
    background: #fbfdff;
}
.login-form input:focus {
    outline: 4px solid rgba(45,111,159,.14);
    border-color: var(--blue);
    background: #fff;
}
.login-submit {
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--navy), #2d6f9f);
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(20,63,95,.22);
}
.login-submit:hover {
    filter: brightness(1.04);
}
.login-error {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #9f1239;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 800;
}
.login-side {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(28px, 5vw, 48px);
    background: linear-gradient(160deg, var(--navy) 0%, #0f2f47 54%, #082233 100%);
    color: #fff;
    overflow: hidden;
}
.login-side::before,
.login-side::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
}
.login-side::before {
    width: 220px;
    height: 220px;
    top: -70px;
    right: -70px;
}
.login-side::after {
    width: 140px;
    height: 140px;
    bottom: -45px;
    left: -35px;
}
.login-side > * {
    position: relative;
    z-index: 1;
}
.login-side h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 26px;
    letter-spacing: -.02em;
}
.login-side p {
    margin: 0;
    color: #c6dbec;
}
.login-feature-list {
    display: grid;
    gap: 12px;
    margin: 30px 0 0;
}
.login-feature {
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255,255,255,.08);
}
.login-feature strong {
    display: block;
    margin-bottom: 3px;
}
.login-footnote {
    color: #b7d8ef;
    font-size: 12px;
}
@media (max-width: 860px) {
    .login-card {
        grid-template-columns: 1fr;
    }
    .login-side {
        order: -1;
        padding: 26px;
    }
}
@media (max-width: 980px) {
}
/* === S.G SURVEYORS LOGIN PATCH END === */


/* === S.G SURVEYORS PHOTO PAGE REMOVE PATCH START === */
.photo-page-title-right {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.evidence-remove-page {
    border: 1px solid rgba(153, 27, 27, .22);
    border-radius: 999px;
    background: #fff;
    color: #991b1b;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.evidence-remove-page:hover,
.evidence-remove-page:focus {
    background: #fee2e2;
    border-color: rgba(153, 27, 27, .40);
    outline: none;
}
/* === S.G SURVEYORS PHOTO PAGE REMOVE PATCH END === */

/* === S.G SURVEYORS METHOD REPORT IMPORT PATCH START === */
.method-report-import-panel {
    border: 1px solid #c9d8e8;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 22px;
    box-shadow: 0 10px 24px rgba(15, 55, 90, 0.08);
}
.report-import-badge {
    background: #123f5d;
    color: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.report-import-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}
.report-import-grid .wide { grid-column: span 1; }
.report-import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}
.report-import-status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 10px;
    color: #53657a;
    background: rgba(255,255,255,0.7);
    border: 1px solid #d8e5f2;
}
.report-import-status.ok { color: #11623b; background: #ebfff4; border-color: #bde8d1; }
.report-import-status.error { color: #a3002b; background: #fff0f4; border-color: #f2b8c8; }
.report-import-status.working { color: #0d4775; background: #eef8ff; border-color: #b9dcf5; }
.report-import-notes {
    margin-top: 14px;
    background: rgba(255,255,255,0.76);
    border: 1px solid #d8e5f2;
    border-radius: 12px;
    padding: 10px 12px;
}
.report-import-note-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
    font-size: 13px;
    color: #34495e;
}
.report-import-preview {
    margin-top: 18px;
    background: #fff;
    border: 1px solid #cbd9e8;
    border-radius: 14px;
    padding: 14px;
}
.report-import-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.report-import-stats span {
    border: 1px solid #d5e3f1;
    background: #f7fbff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
}
.report-import-table-scroll { overflow-x: auto; border: 1px solid #d8e5f2; border-radius: 10px; }
.report-import-preview-table, .report-import-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.report-import-preview-table th, .report-import-preview-table td,
.report-import-mini-table th, .report-import-mini-table td {
    border: 1px solid #d8e5f2;
    padding: 7px;
    vertical-align: top;
    text-align: left;
}
.report-import-preview-table th, .report-import-mini-table th {
    background: #edf4fb;
    color: #0b3554;
    font-weight: 700;
}
.report-import-mini-table { margin-bottom: 12px; }
.report-import-mini-table th { width: 180px; }
.report-import-raw {
    white-space: pre-wrap;
    max-height: 260px;
    overflow: auto;
    background: #0f2030;
    color: #f4f9ff;
    border-radius: 10px;
    padding: 12px;
    font-size: 11px;
}
@media (max-width: 1000px) {
    .report-import-grid { grid-template-columns: 1fr; }
    .report-import-note-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .report-import-note-grid { grid-template-columns: 1fr; }
}
/* === S.G SURVEYORS METHOD REPORT IMPORT PATCH END === */



/* === S.G SURVEYORS MODERN METHOD UI + STICKY TABS PATCH START === */
:root {
    --case-tabs-top: 122px;
    --sg-card-shadow: 0 18px 48px rgba(15, 47, 71, .10);
    --sg-soft-shadow: 0 10px 26px rgba(15, 47, 71, .08);
}

/* Keep the case-study editor usable while allowing sticky children to work. */
#propertyForm.form-card {
    overflow: visible !important;
    border-radius: 24px;
    border-color: #d4e2ef;
    box-shadow: 0 18px 54px rgba(15, 47, 71, .10);
}

/* Sticky, cleaner tab bar. */
#propertyForm .form-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin: 0;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(207, 222, 237, .92);
    box-shadow: 0 12px 28px rgba(15, 47, 71, .08);
    border-radius: 24px 24px 0 0;
}

#propertyForm .form-tabs::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, rgba(20,63,95,.18), rgba(45,111,159,.10), rgba(20,63,95,.18));
    pointer-events: none;
}

#propertyForm .tab-button {
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #d6e4f1;
    background: linear-gradient(180deg, #ffffff, #f6faff);
    color: #143f5f;
    font-weight: 800;
    letter-spacing: -.01em;
    box-shadow: 0 6px 15px rgba(15, 47, 71, .05);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

#propertyForm .tab-button:hover,
#propertyForm .tab-button:focus {
    transform: translateY(-1px);
    border-color: #a9cbe5;
    box-shadow: 0 10px 22px rgba(15, 47, 71, .09);
    outline: none;
}

#propertyForm .tab-button.active {
    background: linear-gradient(135deg, #123f5d, #0d314a);
    border-color: #123f5d;
    color: #fff;
    box-shadow: 0 12px 24px rgba(18, 63, 93, .24);
}

/* Modern Method Statement import card. */
#methodReportImportPanel.method-report-import-panel {
    position: relative;
    margin: 8px 0 24px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(188, 211, 232, .95);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: var(--sg-card-shadow);
}

#methodReportImportPanel.method-report-import-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #143f5f, #2d6f9f, #9cc7e6);
}





#methodReportImportPanel .report-import-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 9px 13px;
    background: #143f5f;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .03em;
    box-shadow: 0 10px 22px rgba(20, 63, 95, .22);
}

#methodReportImportPanel .report-import-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #8bd3ff;
    box-shadow: 0 0 0 4px rgba(139, 211, 255, .18);
}

#methodReportImportPanel .report-import-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.35fr) minmax(180px, .85fr) minmax(190px, 1fr) minmax(190px, 1fr);
    gap: 14px;
    align-items: stretch;
    padding: 22px 26px 8px;
}

#methodReportImportPanel .report-import-grid label {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #d8e7f4;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fbfe);
    box-shadow: 0 7px 18px rgba(15, 47, 71, .045);
}

#methodReportImportPanel .report-import-grid label span {
    color: #0b3554;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
}

#methodReportImportPanel input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed #aac7df;
    border-radius: 13px;
    background: #fff;
    color: #31445a;
}

#methodReportImportPanel input[type="text"],
#methodReportImportPanel select {
    min-height: 42px;
    width: 100%;
    border-color: #cfe0ef;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

#methodReportImportPanel .report-import-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 26px 20px;
    margin: 0;
}

#methodReportImportPanel .report-import-actions .button,
#methodReportImportPanel .report-import-actions button {
    min-height: 42px;
    border-radius: 14px;
}

#methodReportImportPanel .report-import-status {
    min-height: 42px;
    padding: 9px 13px;
    border-radius: 14px;
    background: #f6faff;
    border: 1px solid #d8e7f4;
    color: #516477;
    font-weight: 700;
}

#methodReportImportPanel .report-import-notes {
    margin: 0 26px 24px;
    padding: 14px 16px;
    border: 1px solid #d8e7f4;
    border-radius: 18px;
    background: #fbfdff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

#methodReportImportPanel .report-import-notes summary {
    cursor: pointer;
    font-weight: 900;
    color: #0c3552;
}

#methodReportImportPanel .report-import-note-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

#methodReportImportPanel .report-import-note-grid > div {
    border: 1px solid #dce8f3;
    border-radius: 16px;
    padding: 13px;
    background: #fff;
}

#methodReportImportPanel .report-import-preview {
    margin: 0 26px 26px;
    border-radius: 18px;
    border-color: #cbdceb;
    box-shadow: 0 10px 24px rgba(15, 47, 71, .06);
}

/* Cleaner property-image card inside Method Statement. */
.tab-panel[data-tab-panel="method"] .upload-box {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    gap: 20px;
    align-items: start;
    margin: 0 0 24px;
    padding: 22px;
    border: 1px solid #cfe0ef;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(45,111,159,.12), transparent 32%),
        linear-gradient(135deg, #ffffff, #f5faff);
    box-shadow: var(--sg-soft-shadow);
}

.tab-panel[data-tab-panel="method"] .upload-box h3 {
    margin: 0 0 8px;
    color: #0c3552;
    font-size: 21px;
    letter-spacing: -.02em;
}

.tab-panel[data-tab-panel="method"] .upload-box p {
    margin: 0;
    max-width: 680px;
    color: #53667a;
}

.tab-panel[data-tab-panel="method"] .upload-control {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #d8e7f4;
    border-radius: 20px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 8px 20px rgba(15, 47, 71, .055);
}

.tab-panel[data-tab-panel="method"] .upload-control > input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px dashed #aac7df;
    border-radius: 14px;
    background: #fbfdff;
}

.tab-panel[data-tab-panel="method"] .upload-control small {
    display: block;
    margin-top: -6px;
    color: #6b7e90;
    line-height: 1.35;
}

.tab-panel[data-tab-panel="method"] .upload-control label span {
    margin-bottom: 6px;
    color: #0b3554;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* Better section spacing in the Method Statement panel. */
.tab-panel[data-tab-panel="method"] > section:first-child {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

@media (max-width: 1100px) {
    #methodReportImportPanel .report-import-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #methodReportImportPanel .report-import-note-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    #propertyForm .form-tabs {
    }
}

@media (max-width: 760px) {
    #propertyForm .form-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        border-radius: 18px 18px 0 0;
    }
    #propertyForm .tab-button {
        white-space: nowrap;
        flex: 0 0 auto;
    }
    #methodReportImportPanel .report-import-grid,
    .tab-panel[data-tab-panel="method"] .upload-box {
        grid-template-columns: 1fr;
    }
    #methodReportImportPanel .report-import-grid,
    #methodReportImportPanel .report-import-actions,
    #methodReportImportPanel .report-import-notes,
    #methodReportImportPanel .report-import-preview {
        margin-left: 18px;
        margin-right: 18px;
    }
}
/* === S.G SURVEYORS MODERN METHOD UI + STICKY TABS PATCH END === */








/* === S.G SURVEYORS METHOD PROPERTY IMAGE TWO COLUMN LAYOUT PATCH === */
/* Modern two-column layout for the Method Statement first-page property image. */
.method-property-image-panel {
    display: grid !important;
    grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr) !important;
    align-items: stretch !important;
    gap: 22px !important;
    padding: 22px !important;
    border: 1px solid #cfe1f2 !important;
    border-radius: 22px !important;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 58%, #eef6ff 100%) !important;
    box-shadow: 0 16px 40px rgba(15, 52, 82, 0.08) !important;
    overflow: hidden !important;
}
.method-property-image-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.method-panel-heading .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #0f4e7d;
    background: #e8f3ff;
    border: 1px solid #c8def2;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.method-property-image-settings h3 {
    margin: 0 0 8px !important;
    font-size: 22px;
    line-height: 1.2;
    color: #0b3658;
}
.method-property-image-settings p {
    max-width: 560px;
    font-size: 15px;
    line-height: 1.55;
}
.method-image-settings-card {
    display: grid;
    gap: 13px;
    padding: 16px;
    border: 1px solid #d6e5f3;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 28px rgba(15, 52, 82, 0.06);
}
.method-image-settings-card label {
    margin: 0;
}
.method-image-settings-card label span,
.method-file-field span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 900;
    color: #0b3658;
}
.method-image-settings-card input[type="file"] {
    display: block;
    width: 100%;
    margin: 6px 0 0;
    padding: 12px;
    border: 1px dashed #a9c6dd;
    border-radius: 14px;
    background: #f9fcff;
}
.method-image-settings-card small {
    margin-top: -4px;
    color: #637388;
    line-height: 1.45;
}
.method-property-image-preview-panel {
    min-width: 0;
    display: flex;
}
.method-property-image-preview-shell {
    width: 100%;
    min-height: 390px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 1px solid #d6e5f3;
    border-radius: 20px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 12px 30px rgba(15, 52, 82, 0.05);
}
.method-property-image-panel .method-image-preview-card {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 354px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 12px !important;
}
.method-property-image-panel .method-image-thumb-frame {
    width: 100% !important;
    height: 326px !important;
    max-height: 326px !important;
    border: 1px solid #cfdbe7 !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #f3f8fd, #ffffff) !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
}
.method-property-image-panel .method-property-preview,
.method-property-image-panel .method-image-preview-card img,
.method-property-image-panel .upload-box .image-preview img,
.method-property-image-panel .tab-panel[data-tab-panel="method"] img[src*="property_image.php"] {
    max-width: 100% !important;
    max-height: 310px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border: 0 !important;
    border-radius: 12px !important;
}
.method-property-image-panel .method-image-preview-card.preview-rotate-90 .method-property-preview,
.method-property-image-panel .method-image-preview-card.preview-rotate-90 img[src*="property_image.php"],
.method-property-image-panel .method-image-preview-card.preview-rotate-270 .method-property-preview,
.method-property-image-panel .method-image-preview-card.preview-rotate-270 img[src*="property_image.php"] {
    max-width: 250px !important;
    max-height: 250px !important;
}
.method-property-image-panel .method-image-preview-card span {
    color: #41546a;
    font-size: 13px;
}
.method-image-empty-preview {
    width: 100%;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    color: #64748b;
    border: 1px dashed #b8cde0;
    border-radius: 18px;
    background: #f8fbff;
}
.method-image-empty-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e8f3ff;
    color: #143f5f;
    font-size: 24px;
    font-weight: 800;
}
.method-image-empty-preview strong {
    color: #143f5f;
}
@media (max-width: 980px) {
    .method-property-image-panel {
        grid-template-columns: 1fr !important;
    }
    .method-property-image-preview-shell {
        min-height: 300px;
    }
    .method-property-image-panel .method-image-thumb-frame {
        height: 260px !important;
        max-height: 260px !important;
    }
    .method-property-image-panel .method-property-preview,
    .method-property-image-panel .method-image-preview-card img {
        max-height: 245px !important;
    }
}

/* === SG_METHOD_IMAGE_80_PERCENT_PREVIEW_START === */
/* Makes the Method Statement first-page property image fill around 80% of its preview box. */
.method-property-image-panel .method-property-image-preview-shell {
    min-height: 480px !important;
    padding: 20px !important;
}

.method-property-image-panel .method-image-preview-card {
    min-height: 100% !important;
    align-items: stretch !important;
}

.method-property-image-panel .method-image-thumb-frame {
    width: 100% !important;
    min-height: 420px !important;
    height: clamp(420px, 44vw, 520px) !important;
    max-height: none !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
}

.method-property-image-panel .method-property-preview,
.method-property-image-panel .method-image-preview-card img[src*="property_image.php"] {
    width: 80% !important;
    height: 80% !important;
    max-width: 80% !important;
    max-height: 80% !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    margin: auto !important;
}

.method-property-image-panel .method-image-preview-card.preview-rotate-90 .method-property-preview,
.method-property-image-panel .method-image-preview-card.preview-rotate-90 img[src*="property_image.php"],
.method-property-image-panel .method-image-preview-card.preview-rotate-180 .method-property-preview,
.method-property-image-panel .method-image-preview-card.preview-rotate-180 img[src*="property_image.php"],
.method-property-image-panel .method-image-preview-card.preview-rotate-270 .method-property-preview,
.method-property-image-panel .method-image-preview-card.preview-rotate-270 img[src*="property_image.php"] {
    width: 80% !important;
    height: 80% !important;
    max-width: 80% !important;
    max-height: 80% !important;
}

.method-property-image-panel .method-image-preview-card span {
    margin-top: 6px !important;
    text-align: center !important;
}

@media (max-width: 980px) {
    .method-property-image-panel .method-property-image-preview-shell {
        min-height: 390px !important;
    }
    .method-property-image-panel .method-image-thumb-frame {
        min-height: 320px !important;
        height: clamp(320px, 70vw, 420px) !important;
    }
    .method-property-image-panel .method-property-preview,
    .method-property-image-panel .method-image-preview-card img[src*="property_image.php"] {
        width: 80% !important;
        height: 80% !important;
        max-width: 80% !important;
        max-height: 80% !important;
    }
}
/* === SG_METHOD_IMAGE_80_PERCENT_PREVIEW_END === */

/* === S.G SURVEYORS METHOD IMAGE AND REPORT IMPORT VISUAL FIX START === */
/* Make the Method Statement first-page property photo genuinely fill the preview area. */
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-property-image-preview-panel,
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-property-image-preview-shell {
    width: 100% !important;
    min-width: 0 !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-property-image-preview-shell {
    min-height: 520px !important;
    padding: 18px !important;
    display: grid !important;
    place-items: center !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card {
    width: 100% !important;
    max-width: none !important;
    min-height: 484px !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 10px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-thumb-frame,
html body .method-property-image-panel .method-image-thumb-frame.sg-method-image-large-frame {
    width: 100% !important;
    max-width: none !important;
    min-height: 450px !important;
    height: clamp(450px, 42vw, 620px) !important;
    max-height: none !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    padding: 0 !important;
    border: 1px solid #cfdbe7 !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #f3f8fd, #ffffff) !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel img.method-property-preview,
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel img[src*="property_image.php"],
html body .method-property-image-panel img.sg-method-large-property-image {
    width: 88% !important;
    height: 88% !important;
    max-width: 88% !important;
    max-height: 88% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    margin: auto !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-90 img.method-property-preview,
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-90 img[src*="property_image.php"],
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-180 img.method-property-preview,
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-180 img[src*="property_image.php"],
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-270 img.method-property-preview,
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card.preview-rotate-270 img[src*="property_image.php"] {
    width: 88% !important;
    height: 88% !important;
    max-width: 88% !important;
    max-height: 88% !important;
}
html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card span {
    text-align: center !important;
    margin-top: 4px !important;
}
@media (max-width: 980px) {
    html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-property-image-preview-shell {
        min-height: 390px !important;
    }
    html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-preview-card {
        min-height: 354px !important;
    }
    html body .tab-panel[data-tab-panel="method"] .method-property-image-panel .method-image-thumb-frame {
        min-height: 320px !important;
        height: clamp(320px, 70vw, 460px) !important;
    }
}

/* Strong visual markings for rows/fields changed by Report Import. */
#reportImportChangeLegend,
.sg-report-import-change-legend {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 14px 0 !important;
    padding: 12px 14px !important;
    border: 1px solid #d5e4f2 !important;
    border-radius: 14px !important;
    background: #f8fbff !important;
    color: #143f5f !important;
    font-size: 13px !important;
}
#reportImportChangeLegend .legend-chip,
.sg-report-import-change-legend .legend-chip {
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 999px !important;
    padding: 4px 9px !important;
    border: 1px solid transparent !important;
    font-weight: 800 !important;
    font-size: 12px !important;
}
#reportImportChangeLegend .legend-overwritten,
.sg-report-import-change-legend .legend-overwritten {
    color: #92400e !important;
    background: #fff7ed !important;
    border-color: #fdba74 !important;
}
#reportImportChangeLegend .legend-added,
#reportImportChangeLegend .legend-filled,
.sg-report-import-change-legend .legend-added,
.sg-report-import-change-legend .legend-filled {
    color: #065f46 !important;
    background: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
}
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-overwritten > td,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-overwritten > td,
html body table.editable-method-table tbody tr[data-report-import-change="overwritten"] > td {
    background: #fff7ed !important;
    border-color: #f59e0b !important;
    box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.65) !important;
}
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-overwritten > td:first-child,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-overwritten > td:first-child,
html body table.editable-method-table tbody tr[data-report-import-change="overwritten"] > td:first-child {
    box-shadow: inset 6px 0 0 #f97316, inset 0 0 0 2px rgba(245, 158, 11, 0.65) !important;
}
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-added > td,
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-filled > td,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-added > td,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-filled > td,
html body table.editable-method-table tbody tr[data-report-import-change="added"] > td,
html body table.editable-method-table tbody tr[data-report-import-change="filled"] > td {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.50) !important;
}
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-added > td:first-child,
html body .method-table-field table.editable-method-table tbody tr.sg-report-import-filled > td:first-child,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-added > td:first-child,
html body .method-table-field table.editable-method-table tbody tr.report-import-change-filled > td:first-child,
html body table.editable-method-table tbody tr[data-report-import-change="added"] > td:first-child,
html body table.editable-method-table tbody tr[data-report-import-change="filled"] > td:first-child {
    box-shadow: inset 6px 0 0 #059669, inset 0 0 0 2px rgba(16, 185, 129, 0.50) !important;
}
html body .method-table-field textarea.sg-report-import-overwritten,
html body .method-table-field textarea.report-import-field-overwritten,
html body .method-table-field textarea[data-report-import-change="overwritten"],
html body textarea.sg-report-import-field-overwritten {
    background: #fffaf3 !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.20) !important;
}
html body .method-table-field textarea.sg-report-import-added,
html body .method-table-field textarea.sg-report-import-filled,
html body .method-table-field textarea.report-import-field-added,
html body .method-table-field textarea.report-import-field-filled,
html body .method-table-field textarea[data-report-import-change="added"],
html body .method-table-field textarea[data-report-import-change="filled"],
html body textarea.sg-report-import-field-added,
html body textarea.sg-report-import-field-filled {
    background: #f0fdf4 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.16) !important;
}
html body input.sg-report-import-field-overwritten,
html body textarea.sg-report-import-field-overwritten,
html body select.sg-report-import-field-overwritten,
html body input.report-import-field-overwritten,
html body textarea.report-import-field-overwritten,
html body select.report-import-field-overwritten {
    background: #fff7ed !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18) !important;
}
html body input.sg-report-import-field-added,
html body input.sg-report-import-field-filled,
html body textarea.sg-report-import-field-added,
html body textarea.sg-report-import-field-filled,
html body select.sg-report-import-field-added,
html body select.sg-report-import-field-filled,
html body input.report-import-field-added,
html body input.report-import-field-filled,
html body textarea.report-import-field-added,
html body textarea.report-import-field-filled,
html body select.report-import-field-added,
html body select.report-import-field-filled {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14) !important;
}
/* === S.G SURVEYORS METHOD IMAGE AND REPORT IMPORT VISUAL FIX END === */

/* === S.G SURVEYORS METHOD ALPHANUMERIC ROW SORT PATCH START === */
.method-table-head .sg-sort-method-rows {
    margin-right: 8px;
    white-space: nowrap;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 999px;
}
.method-table-field[data-alpha-sorted="1"] .editable-method-table tbody tr {
    transition: background-color .18s ease, border-color .18s ease;
}
@media (max-width: 760px) {
    .method-table-head .sg-sort-method-rows {
        width: 100%;
        margin: 8px 0 0 0;
    }
}
/* === S.G SURVEYORS METHOD ALPHANUMERIC ROW SORT PATCH END === */

/* === S.G SURVEYORS METHOD STICKY TABLE SECTIONS PATCH START === */
:root {
    --method-table-sticky-top: calc(var(--case-tabs-top, 72px) + var(--case-tabs-height, 50px) + 12px);
}

/* Keep each Method Statement table title/action bar visible while its own
   table is being edited. Because the sticky element is inside each table
   container, it automatically releases when the next table reaches it. */
#propertyForm .tab-panel[data-tab-panel="method"] .method-table-field {
    position: relative;
    scroll-margin-top: calc(var(--method-table-sticky-top, 134px) + 16px);
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head {
    position: sticky !important;
    top: var(--method-table-sticky-top, 134px) !important;
    z-index: 64 !important;
    margin: -16px -16px 12px !important;
    padding: 10px 16px !important;
    border-bottom: 1px solid #d5e4f2 !important;
    border-radius: 16px 16px 0 0 !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(247, 251, 255, .98)) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.06);
    backdrop-filter: blur(14px) saturate(1.06);
    box-shadow: 0 8px 18px rgba(15, 47, 71, 0.06);
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-field.sg-method-table-active .method-table-head {
    border-bottom-color: #9cc4e2 !important;
    box-shadow: 0 12px 26px rgba(15, 47, 71, 0.12) !important;
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head h3 {
    margin-bottom: 3px !important;
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head p {
    max-width: 900px;
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head .button,
#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head button,
#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head .sg-sort-method-rows {
    min-height: 32px !important;
    padding: 7px 10px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
}

#propertyForm .tab-panel[data-tab-panel="method"] .method-table-head .cell-edit-hint {
    margin-top: 4px !important;
}

@media (max-width: 760px) {
    #propertyForm .tab-panel[data-tab-panel="method"] .method-table-head {
        top: var(--method-table-sticky-top, 126px) !important;
        padding: 10px 12px !important;
    }
}
/* === S.G SURVEYORS METHOD STICKY TABLE SECTIONS PATCH END === */

/* === S.G SURVEYORS AI REPORT IMPORT + PHOTO SAVE PATCH START === */
.sg-ai-key-field small,
.sg-ai-import-note {
    color: #52677d;
    font-size: 0.88rem;
    line-height: 1.45;
}
.sg-ai-report-button {
    box-shadow: 0 10px 24px rgba(12, 65, 99, 0.18);
}
.method-report-import-panel .sg-ai-remember-field {
    align-self: end;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}
.method-report-import-panel .sg-ai-remember-field input {
    width: auto;
}
.report-import-status.working::before,
.save-status.saving .save-status-text::before {
    content: '';
    display: inline-block;
    width: 0.75em;
    height: 0.75em;
    margin-right: 0.45em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 999px;
    animation: sg-spin 0.8s linear infinite;
    vertical-align: -0.08em;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }
.settings-card code {
    background: #eef6ff;
    border: 1px solid #d4e7f8;
    border-radius: 6px;
    padding: 1px 6px;
    color: #0b3f63;
}
.settings-section-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.settings-status-pill {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    font-size: 12px;
    border: 1px solid #d7e5f1;
    background: #f8fbff;
    color: #174461;
}
.settings-status-pill.ok {
    color: #11613a;
    border-color: #bfe8cf;
    background: #effbf4;
}
.settings-status-pill.warn {
    color: #8a4b00;
    border-color: #f4d7a5;
    background: #fff8ea;
}
.settings-key-summary {
    display: flex;
    gap: 8px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: 12px 0;
    border: 1px solid #d7e5f1;
    background: #f8fbff;
    border-radius: 12px;
    padding: 10px 12px;
    color: #17334a;
}
.settings-clear-key {
    margin: 12px 0 18px;
}
.sg-ai-import-note a,
.method-report-import-panel a {
    color: #0f4d78;
    font-weight: 800;
}
@media (max-width: 800px) {
    .settings-section-head {
        flex-direction: column;
    }
}
.method-report-import-panel.sg-report-import-clean {
    border: 1px solid #c9dff3;
    border-radius: 18px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef7ff 100%);
    box-shadow: 0 12px 28px rgba(16, 73, 111, 0.08);
}
.sg-report-import-head-clean .section-help,
#sgAiImportNote,
.sg-ai-import-note {
    display: none !important;
}
.sg-report-import-grid-clean {
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(210px, 1fr);
    gap: 14px 22px;
    margin-top: 16px;
}
.sg-report-import-grid-clean label {
    background: #ffffff;
    border: 1px solid #cfe0ef;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 8px 18px rgba(16, 73, 111, 0.05);
}
.sg-report-import-grid-clean label > span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #123f61;
    margin-bottom: 8px;
}
.sg-report-import-grid-clean input[type="text"],
.sg-report-import-grid-clean select {
    width: 100%;
    min-height: 42px;
    border-radius: 12px;
}
.sg-report-import-actions-clean {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.sg-report-import-actions-clean .button {
    min-height: 40px;
    border-radius: 12px;
}
.sg-report-import-notes-clean {
    margin-top: 12px;
    border-radius: 13px;
    background: #fff;
}
.report-import-warnings {
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #f4c36b;
    border-left: 5px solid #f59e0b;
    border-radius: 12px;
    background: #fff8eb;
    color: #6b4100;
}
.report-import-warnings ul {
    margin: 6px 0 0 18px;
    padding: 0;
}
.sg-report-import-overwritten,
.report-import-change-overwritten textarea,
.sg-report-import-field-overwritten {
    background: #fff4d9 !important;
    outline: 2px solid #f59e0b !important;
    outline-offset: -2px;
}
.sg-report-import-added,
.report-import-change-added textarea,
.sg-report-import-field-added,
.sg-report-import-filled,
.report-import-change-filled textarea,
.sg-report-import-field-filled {
    background: #e9fbef !important;
    outline: 2px solid #10b981 !important;
    outline-offset: -2px;
}
@media (max-width: 900px) {
    .sg-report-import-grid-clean {
        grid-template-columns: 1fr;
    }
}
/* === S.G SURVEYORS METHOD IMPORT CLEANUP PATCH END === */

/* === S.G SURVEYORS METHOD RATING TALLY + IMPORT HIGHLIGHTS START === */
.sg-ai-updated-field,
textarea.sg-ai-updated-field,
.method-table-field.sg-ai-updated-field {
    outline: 3px solid rgba(245, 158, 11, .85) !important;
    box-shadow: 0 0 0 6px rgba(245, 158, 11, .16) !important;
}

/* Existing imported-row review colours retained after removing the obsolete drawer CSS. */
.report-import-updated,
.report-import-updated-row,
.sg-import-updated,
tr.sg-import-updated,
tr[data-import-status="updated"] {
    background: #fff7ed !important;
    outline: 3px solid #f59e0b !important;
    outline-offset: -3px !important;
}
.report-import-added,
.report-import-added-row,
.sg-import-added,
tr.sg-import-added,
tr[data-import-status="added"] {
    background: #ecfdf5 !important;
    outline: 3px solid #10b981 !important;
    outline-offset: -3px !important;
}
.report-import-updated textarea,
.report-import-updated-row textarea,
.sg-import-updated textarea,
tr[data-import-status="updated"] textarea {
    border-color: #f59e0b !important;
    background: #fffaf2 !important;
}
.report-import-added textarea,
.report-import-added-row textarea,
.sg-import-added textarea,
tr[data-import-status="added"] textarea {
    border-color: #10b981 !important;
    background: #f0fdf4 !important;
}
/* === S.G SURVEYORS METHOD RATING TALLY + IMPORT HIGHLIGHTS END === */

/* === S.G SURVEYORS METHOD SECTION AI DRAWER PATCH START === */
.sg-ai-assist-button {
    min-height: 38px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    color: #0f4c81;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0;
    padding: 9px 12px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 76, 129, .10);
}
.sg-ai-assist-button:hover { background: #dbeafe; }
.sg-ai-inline-button { margin: 6px 0 10px 0; display: inline-flex; align-items: center; gap: 4px; }
.sg-ai-cell-host { position: relative; padding-right: 38px !important; }
.sg-ai-cell-host .sg-ai-assist-button { position: absolute; right: 7px; top: 8px; z-index: 3; }
.sg-method-ai-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: rgba(15, 23, 42, 0);
    transition: background .18s ease;
}
.sg-method-ai-drawer.open {
    pointer-events: auto;
    background: rgba(15, 23, 42, .16);
}
.sg-method-ai-drawer-card {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(560px, 96vw);
    background: #fff;
    border-left: 1px solid #c7dff7;
    box-shadow: -20px 0 55px rgba(2, 32, 71, .20);
    transform: translateX(102%);
    transition: transform .22s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sg-method-ai-drawer.open .sg-method-ai-drawer-card { transform: translateX(0); }
.sg-method-ai-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 22px 16px;
    background: linear-gradient(135deg, #f8fbff, #eef7ff);
    border-bottom: 1px solid #d8e7f6;
}
.sg-method-ai-head h2 { margin: 2px 0 4px; color: #073b63; font-size: 22px; }
.sg-method-ai-target-label { margin: 0; color: #52677d; font-size: 13px; }
.sg-method-ai-close {
    width: 36px; height: 36px; border-radius: 999px; border: 1px solid #cbdff2;
    background: #fff; font-size: 24px; line-height: 1; color: #0f3554; cursor: pointer;
}
.sg-method-ai-current, .sg-method-ai-chat-label, .sg-method-ai-result-label, .sg-method-ai-actions, .sg-method-ai-send-row, .sg-method-ai-bottom {
    margin: 14px 20px 0;
}
.sg-method-ai-current label, .sg-method-ai-chat-label, .sg-method-ai-result-label { display: block; }
.sg-method-ai-current span, .sg-method-ai-chat-label span, .sg-method-ai-result-label span {
    display: block; font-size: 12px; font-weight: 800; color: #0b3556; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.sg-method-ai-drawer textarea {
    width: 100%; border: 1px solid #cbdff2; border-radius: 14px; padding: 11px 13px; resize: vertical;
    font: inherit; color: #132033; background: #fbfdff;
}
.sg-method-ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sg-method-ai-drawer .button,
.sg-method-ai-drawer button:not(.sg-method-ai-close) {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.1;
    font-weight: 700;
}
.sg-method-ai-send-row, .sg-method-ai-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sg-method-ai-status { font-size: 13px; color: #52677d; }
.sg-method-ai-chat {
    margin: 14px 20px 0;
    padding: 10px;
    min-height: 84px;
    max-height: 190px;
    overflow: auto;
    border: 1px solid #e0ecf8;
    border-radius: 14px;
    background: #f8fbff;
}
.sg-method-ai-message { white-space: pre-wrap; padding: 9px 11px; border-radius: 12px; margin: 7px 0; font-size: 13px; line-height: 1.45; }
.sg-method-ai-message.user { background: #e6f1ff; color: #0a3558; }
.sg-method-ai-message.assistant { background: #fff; border: 1px solid #e0ecf8; color: #132033; }
.sg-method-ai-result-label { flex: 1; min-height: 0; }
.sg-method-ai-result-label textarea { min-height: 170px; }
.sg-method-ai-bottom { padding-bottom: 22px; }
body.sg-method-ai-open { overflow: hidden; }
.sg-report-import-change-legend .legend-note { display: inline-block; margin-left: 6px; color: #52677d; }
@media (max-width: 720px) {
    .sg-method-ai-drawer-card { width: 100vw; }
    .sg-method-ai-actions, .sg-method-ai-send-row, .sg-method-ai-bottom { margin-left: 14px; margin-right: 14px; }
    .sg-method-ai-current, .sg-method-ai-chat-label, .sg-method-ai-result-label, .sg-method-ai-chat { margin-left: 14px; margin-right: 14px; }
}
/* === S.G SURVEYORS METHOD SECTION AI DRAWER PATCH END === */

/* === SAM KNOWLEDGE BASE WORKSPACE START === */
.sam-kb-workspace{
    display:grid;
    gap:16px;
    min-width:0;
}
.sam-kb-stats{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:12px;
}
.sam-kb-stat-card{
    margin:0!important;
    min-width:0;
    padding:16px!important;
    display:grid;
    gap:5px;
}
.sam-kb-stat-card>span{
    font-size:12px;
    font-weight:800;
    opacity:.72;
}
.sam-kb-stat-card>strong{
    font-size:24px;
    line-height:1.05;
}
.sam-kb-stat-card>small{
    font-size:11.5px;
    line-height:1.35;
    opacity:.68;
}
.sam-kb-library-card{
    margin:0!important;
    padding:0!important;
    overflow:hidden;
}
.sam-kb-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:14px 16px;
    border-bottom:1px solid color-mix(in srgb,var(--brand) 16%,transparent);
}
.sam-kb-toolbar-left{
    display:flex;
    align-items:center;
    gap:9px;
    flex-wrap:wrap;
}
.sam-kb-toolbar-meta{
    display:flex;
    align-items:baseline;
    gap:5px;
    font-size:12px;
    opacity:.72;
}
.sam-kb-toolbar-meta strong{
    font-size:15px;
    opacity:1;
}
.sam-kb-workspace .button,
.sam-kb-workspace button.button{
    min-height:38px;
    padding:8px 12px;
    border-radius:8px;
    font-size:12px;
    font-weight:700;
}
.sam-kb-add-panel{
    padding:14px 16px 16px;
    border-bottom:1px solid color-mix(in srgb,var(--brand) 16%,transparent);
    background:color-mix(in srgb,var(--brand) 4%,transparent);
}
.sam-kb-add-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
}
.sam-kb-add-card{
    border:1px solid color-mix(in srgb,var(--brand) 16%,transparent);
    border-radius:12px;
    padding:14px;
    min-width:0;
    background:var(--surface,#fff);
}
.sam-kb-add-card h3{
    margin:2px 0 5px;
    font-size:15px;
}
.sam-kb-add-card p:not(.eyebrow){
    margin:0 0 12px;
    font-size:12px;
    line-height:1.45;
    opacity:.72;
}
.sam-kb-inline-upload,
.sam-kb-note-fields{
    display:grid;
    gap:9px;
}
.sam-kb-inline-upload{
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
}
.sam-kb-inline-upload input[type="file"],
.sam-kb-note-fields input,
.sam-kb-note-fields textarea{
    width:100%;
    min-width:0;
    font:inherit;
}
.sam-kb-inline-upload input[type="file"],
.sam-kb-note-fields input{
    min-height:39px;
}
.sam-kb-note-fields textarea{
    resize:vertical;
}
.sam-kb-table-wrap{
    width:100%;
    overflow-x:auto;
}
.sam-kb-table{
    width:100%;
    border-collapse:collapse;
    table-layout:auto;
}
.sam-kb-table th,
.sam-kb-table td{
    padding:11px 12px;
    text-align:left;
    vertical-align:middle;
    border-bottom:1px solid color-mix(in srgb,var(--brand) 12%,transparent);
    font-size:12px;
}
.sam-kb-table thead th{
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.04em;
    opacity:.72;
    white-space:nowrap;
}
.sam-kb-table tbody tr:last-child td{
    border-bottom:0;
}
.sam-kb-check-col{
    width:46px;
    text-align:center!important;
}
.sam-kb-check-col input[type="checkbox"]{
    width:18px;
    height:18px;
    margin:0;
    vertical-align:middle;
}
.sam-kb-action-col{
    width:90px;
    text-align:right!important;
}
.sam-kb-file-cell{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:220px;
}
.sam-kb-file-cell>div{
    min-width:0;
    display:grid;
    gap:2px;
}
.sam-kb-file-cell strong{
    overflow-wrap:anywhere;
}
.sam-kb-file-cell small{
    font-size:10.5px;
    opacity:.62;
}
.sam-kb-file-icon{
    display:inline-grid;
    place-items:center;
    width:36px;
    height:36px;
    flex:0 0 36px;
    border-radius:9px;
    border:1px solid color-mix(in srgb,var(--brand) 18%,transparent);
    background:color-mix(in srgb,var(--brand) 6%,transparent);
    font-size:9px;
    font-weight:900;
    letter-spacing:.03em;
}
.sam-kb-type-pill{
    display:inline-flex;
    align-items:center;
    min-height:24px;
    padding:3px 8px;
    border-radius:999px;
    border:1px solid color-mix(in srgb,var(--brand) 17%,transparent);
    font-size:10px;
    font-weight:800;
}
.sam-kb-view-button{
    min-width:62px;
}
.sam-kb-empty-state{
    min-height:130px;
    display:grid;
    place-content:center;
    gap:5px;
    text-align:center;
}
.sam-kb-empty-state span{
    font-size:12px;
    opacity:.68;
}
.sam-kb-drawer-layer{
    position:fixed;
    top:54px;
    right:0;
    bottom:0;
    left:0;
    z-index:1200;
}
.sam-kb-drawer-scrim{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    border:0;
    padding:0;
    background:color-mix(in srgb,var(--brand) 28%,transparent);
    cursor:default;
}
.sam-kb-drawer{
    position:absolute;
    top:0;
    right:0;
    width:90vw;
    max-width:90vw;
    min-width:0;
    height:100%;
    display:grid;
    grid-template-rows:auto auto minmax(0,1fr) auto;
    background:var(--surface,#fff);
    border-left:1px solid color-mix(in srgb,var(--brand) 18%,transparent);
    box-shadow:-18px 0 42px color-mix(in srgb,var(--brand) 16%,transparent);
    overflow:hidden;
}
.sam-kb-drawer-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding:16px;
    border-bottom:1px solid color-mix(in srgb,var(--brand) 14%,transparent);
}
.sam-kb-drawer-head h3{
    margin:2px 0 0;
    font-size:16px;
    overflow-wrap:anywhere;
}
.sam-kb-drawer-close{
    flex:0 0 auto;
}
.sam-kb-drawer-meta{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:1px;
    border-bottom:1px solid color-mix(in srgb,var(--brand) 14%,transparent);
    background:color-mix(in srgb,var(--brand) 10%,transparent);
}
.sam-kb-drawer-meta>div{
    min-width:0;
    display:grid;
    gap:3px;
    padding:10px 12px;
    background:var(--surface,#fff);
}
.sam-kb-drawer-meta span{
    font-size:9.5px;
    text-transform:uppercase;
    letter-spacing:.05em;
    font-weight:800;
    opacity:.62;
}
.sam-kb-drawer-meta strong{
    font-size:11.5px;
    overflow-wrap:anywhere;
}
.sam-kb-preview-shell{
    min-height:0;
    padding:12px;
    background:color-mix(in srgb,var(--brand) 4%,transparent);
}
.sam-kb-preview-shell iframe{
    display:block;
    width:100%;
    height:100%;
    min-height:480px;
    border:1px solid color-mix(in srgb,var(--brand) 14%,transparent);
    border-radius:10px;
    background:var(--surface,#fff);
}
.sam-kb-text-editor{
    max-height:48vh;
    overflow:auto;
    padding:12px 16px 16px;
    border-top:1px solid color-mix(in srgb,var(--brand) 14%,transparent);
}
.sam-kb-text-editor label{
    display:grid;
    gap:6px;
}
.sam-kb-text-editor label>span{
    font-size:11.5px;
    font-weight:800;
}
.sam-kb-text-editor textarea{
    width:100%;
    min-height:220px;
    resize:vertical;
    font:inherit;
    font-size:12px;
    line-height:1.5;
}
.sam-kb-drawer-actions{
    display:flex;
    justify-content:flex-end;
    margin-top:10px;
}
body.sam-kb-drawer-open{
    overflow:hidden;
}
@media(max-width:980px){
    .sam-kb-stats{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}
@media(max-width:760px){
    .sam-kb-add-grid{
        grid-template-columns:1fr;
    }
    .sam-kb-inline-upload{
        grid-template-columns:1fr;
    }
    .sam-kb-toolbar{
        align-items:flex-start;
    }
    .sam-kb-drawer{
        width:100vw;
        max-width:100vw;
    }
}
@media(max-width:540px){
    .sam-kb-stats{
        grid-template-columns:1fr;
    }
    .sam-kb-toolbar{
        flex-direction:column;
    }
    .sam-kb-drawer-meta{
        grid-template-columns:1fr;
    }
}
/* === SAM KNOWLEDGE BASE WORKSPACE END === */
/* === S.G persistent report-import review highlights START === */
.sg-import-persistent-notice {
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid #f2c77b;
    background: #fff8e8;
    color: #50350b;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.45;
}
.sg-import-persistent-notice strong { color: #143f5f; }
html body table.editable-method-table tbody tr[data-report-import-review="unseen"] > td,
html body .method-table-field table.editable-method-table tbody tr[data-report-import-review="unseen"] > td {
    background: #fff6e6 !important;
    box-shadow: inset 0 0 0 2px #f59e0b !important;
}
html body table.editable-method-table tbody tr[data-report-import-review="unseen"][data-report-import-change="added"] > td,
html body table.editable-method-table tbody tr.sg-report-import-added[data-report-import-review="unseen"] > td,
html body table.editable-method-table tbody tr.sg-report-import-filled[data-report-import-review="unseen"] > td {
    background: #eafbf1 !important;
    box-shadow: inset 0 0 0 2px #10b981 !important;
}
html body table.editable-method-table tbody tr[data-report-import-review="unseen"] td:first-child {
    border-left: 5px solid #f59e0b !important;
}
html body table.editable-method-table tbody tr[data-report-import-review="unseen"][data-report-import-change="added"] td:first-child,
html body table.editable-method-table tbody tr.sg-report-import-added[data-report-import-review="unseen"] td:first-child,
html body table.editable-method-table tbody tr.sg-report-import-filled[data-report-import-review="unseen"] td:first-child {
    border-left-color: #10b981 !important;
}
html body textarea[data-report-import-review="unseen"],
html body input[data-report-import-review="unseen"],
html body select[data-report-import-review="unseen"] {
    background: #fff6e6 !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .24) !important;
}
html body textarea.sg-report-import-field-added[data-report-import-review="unseen"],
html body textarea.sg-report-import-field-filled[data-report-import-review="unseen"],
html body input.sg-report-import-field-added[data-report-import-review="unseen"],
html body input.sg-report-import-field-filled[data-report-import-review="unseen"] {
    background: #eafbf1 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .22) !important;
}
.sg-import-reviewed-fade {
    transition: background .35s ease, box-shadow .35s ease, border-color .35s ease;
}
/* === S.G persistent report-import review highlights END === */


/* === S.G valuation tab START === */
.valuation-panel{border:1px solid #d2e4f3;background:#fff;border-radius:18px;padding:18px;margin:16px 0;box-shadow:0 10px 28px rgba(15,55,84,.06)}
.valuation-panel-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}.valuation-panel h2,.valuation-panel h3{margin:0 0 8px;color:#0b3b5a}.valuation-toggle-card{min-width:310px;border:1px solid #d9e8f5;background:#f7fbff;border-radius:16px;padding:12px}.valuation-import-grid{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:14px;margin-top:16px}.valuation-actions-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:14px}.valuation-status{font-size:.9rem;color:#536b7d}.valuation-section-title{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px}.valuation-rank-list{display:grid;gap:18px}.valuation-rank-card{border:1px solid #d4e4f1;background:linear-gradient(180deg,#fbfdff,#fff);border-radius:18px;padding:14px}.valuation-rank-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:10px;border-bottom:1px solid #e4eef6;margin-bottom:12px}.valuation-rank-badge{display:inline-flex;align-items:center;border-radius:999px;background:#e9f5ff;color:#0c466c;border:1px solid #c8e1f4;font-weight:800;font-size:.78rem;letter-spacing:.04em;text-transform:uppercase;padding:6px 10px;margin-right:8px}.valuation-grid.four{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.valuation-image-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:12px 0}.valuation-image-box{border:1px dashed #bdd8ee;background:#f8fbfe;border-radius:16px;padding:12px;display:grid;gap:10px}.valuation-image-preview{min-height:190px;border:1px solid #d6e6f3;background:#fff;border-radius:14px;display:flex;align-items:center;justify-content:center;overflow:hidden;color:#7a91a5;font-weight:700}.valuation-image-preview img{width:100%;height:100%;object-fit:contain;display:block}.valuation-import-applied{background:#eafbf1!important;box-shadow:0 0 0 3px rgba(16,185,129,.18)!important;border-color:#10b981!important}@media(max-width:980px){.valuation-panel-head{display:block}.valuation-toggle-card{min-width:0;margin-top:12px}.valuation-import-grid,.valuation-grid.four,.valuation-image-row{grid-template-columns:1fr}}
/* === S.G valuation tab END === */
/* Valuation inline AI edit buttons for comparable notes and valuation wording boxes */
.valuation-ai-textarea{display:block;position:relative;margin-bottom:12px;}
.valuation-ai-textarea .valuation-ai-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:7px;}
.valuation-ai-textarea .valuation-ai-label-row>span{font-weight:800;color:#0b3b5a;line-height:1.25;}
.valuation-ai-textarea textarea{width:100%;box-sizing:border-box;}
.button.valuation-ai-inline-button{white-space:nowrap;}
@media(max-width:760px){.valuation-ai-textarea .valuation-ai-label-row{align-items:flex-start;flex-direction:column}.button.valuation-ai-inline-button{width:100%;}}


/* === S.G valuation PDF/rules/highlights UI START === */
#propertyForm .tab-panel[data-tab-panel="valuation"]{font-size:12px;line-height:1.4}
#propertyForm .tab-panel[data-tab-panel="valuation"] .section-help,
#propertyForm .tab-panel[data-tab-panel="valuation"] small,
#propertyForm .tab-panel[data-tab-panel="valuation"] .valuation-status{font-size:12px;line-height:1.4}
#propertyForm .tab-panel[data-tab-panel="valuation"] .valuation-toggle-card .check{font-size:12px;line-height:1.35}
#propertyForm .tab-panel[data-tab-panel="valuation"] .valuation-import-grid input[type="file"]{min-height:39px;padding:8px 10px;border-radius:8px;font-size:12px}

.valuation-ai-rules-panel{margin:14px 0 6px;padding:0;border:1px solid #cfe1ef;border-radius:12px;background:#fff;overflow:hidden}
.valuation-ai-rules-panel>summary{list-style:none}
.valuation-ai-rules-panel>summary::-webkit-details-marker{display:none}
.valuation-ai-rules-summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;background:#f8fbff;cursor:pointer;user-select:none}
.valuation-ai-rules-panel[open] .valuation-ai-rules-summary{border-bottom:1px solid #cfe1ef}
.valuation-ai-rules-summary:focus-visible{outline:2px solid rgba(23,105,224,.18);outline-offset:-2px}
.valuation-ai-rules-summary .eyebrow{margin:0 0 4px;font-size:9px;line-height:1;color:#1769e0;letter-spacing:.08em;text-transform:uppercase}
.valuation-ai-rules-summary strong{display:block;margin:0 0 4px;color:#102a43;font-size:13px;line-height:1.2}
.valuation-ai-rules-summary>div:first-child>span{display:block;color:#58708a;font-size:11px;line-height:1.4;font-weight:400;letter-spacing:0}
.valuation-ai-rules-meta{display:flex;align-items:center;gap:9px;flex:0 0 auto}
.valuation-ai-reference-pill{display:inline-flex;align-items:center;min-height:28px;padding:5px 9px;border:1px solid #d5dfeb;border-radius:999px;background:#fff;color:#58708a;font-size:10.5px;font-weight:700;letter-spacing:0;white-space:nowrap}
.valuation-ai-rules-chevron{width:10px;height:10px;flex:0 0 auto;border-right:2px solid #58708a;border-bottom:2px solid #58708a;transform:rotate(45deg);transition:transform .16s ease;margin-right:3px}
.valuation-ai-rules-panel[open] .valuation-ai-rules-chevron{transform:rotate(225deg);margin-top:5px}
.valuation-ai-rules-body{padding:12px 14px 14px}
.valuation-ai-rules-help{margin:0 0 9px;color:#58708a;font-size:11px;line-height:1.45}
.valuation-ai-rules-panel textarea{width:100%;min-height:220px;border:1px solid #bdd4e8;border-radius:8px;padding:9px 11px;font:inherit;font-size:12px;line-height:1.4;resize:vertical;background:#fff}
.valuation-ai-rules-panel textarea:focus{outline:2px solid rgba(23,105,224,.15);outline-offset:1px;border-color:#1769e0}
.valuation-ai-rules-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.valuation-ai-rules-actions .button{min-height:38px!important;padding:9px 12px!important;border-radius:8px!important;font-size:12px!important;line-height:1.1!important}
@media(max-width:760px){.valuation-ai-rules-summary{align-items:flex-start;flex-direction:column}.valuation-ai-rules-meta{width:100%;justify-content:space-between}.valuation-ai-reference-pill{max-width:calc(100% - 28px);overflow:hidden;text-overflow:ellipsis}}

.valuation-persist-highlight,.valuation-import-applied{background:#ecfff4!important;border-color:#19b979!important;box-shadow:0 0 0 3px rgba(25,185,121,.18)!important}.valuation-rank-card:has(.valuation-persist-highlight),.valuation-rank-card.valuation-card-review-needed{outline:3px solid rgba(25,185,121,.22);background:linear-gradient(180deg,#f3fff8,#ffffff)}
.valuation-review-legend{display:inline-flex;align-items:center;gap:8px;margin-left:8px;padding:8px 10px;border:1px solid #bde6cf;border-radius:999px;background:#effcf5;color:#0e6b3d;font-size:.86rem;font-weight:700}.valuation-review-legend:before{content:'';width:10px;height:10px;border-radius:50%;background:#19b979;display:inline-block}
/* === S.G valuation PDF/rules/highlights UI END === */

/* === S.G strict case tabs CSS START 20260819 === */
.tab-panel[data-tab-panel] { display: none; }
.tab-panel[data-tab-panel].active,
.tab-panel[data-tab-panel].is-active { display: block; }
button.tab-button[data-tab] { cursor: pointer; }
/* === S.G strict case tabs CSS END 20260819 === */

/* === SG_CLIENT_PROPERTY_AUTOFILL_DOM_20260820_START === */
.sg-autofill-checkline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .45rem;
  padding: .38rem .55rem;
  border: 1px solid #cfe0f1;
  border-radius: 999px;
  background: #f6fbff;
  color: #23435f;
  font-size: .84rem;
  line-height: 1.2;
  width: fit-content;
}
.sg-autofill-checkline input {
  width: auto;
  height: auto;
  margin: 0;
}
/* === SG_CLIENT_PROPERTY_AUTOFILL_DOM_20260820_END === */

/* === SAM UI CANONICAL SHELL STAGE1 START === */
:root{
  --sg-sidebar-w:168px;
  --sg-sidebar-collapsed-w:68px;
  --sg-topbar-h:54px;
  --sg-page-bg:#f1f4f8;
  --sg-panel:#ffffff;
  --sg-line:#d5dfeb;
  --sg-text:#102a43;
  --sg-muted:#58708a;
  --sg-primary:#1769e0;
}
.app-shell{min-height:100vh;display:grid;grid-template-columns:var(--sg-sidebar-w) minmax(0,1fr);grid-template-rows:var(--sg-topbar-h) minmax(calc(100vh - var(--sg-topbar-h)),auto);background:var(--nav,#2b2f33);transition:grid-template-columns .2s ease}
.sg-topbar{grid-column:1/-1;grid-row:1;display:grid;grid-template-columns:var(--sg-sidebar-w) minmax(220px,1fr) auto;align-items:center;position:sticky;top:0;z-index:100;background:var(--topbar-bg,var(--nav,#2b2f33));color:var(--topbar-text,#fff);transition:grid-template-columns .2s ease}
.sg-topbar-left{height:100%;display:flex;align-items:center;min-width:0;padding-left:8px}
.sg-topbar-brand-button{width:auto;min-width:38px;max-width:calc(var(--sg-sidebar-w) - 16px);height:40px;border:0;background:transparent;color:var(--topbar-text,#fff);display:flex;align-items:center;justify-content:flex-start;gap:8px;padding:0 6px 0 0;overflow:hidden;cursor:pointer;border-radius:9px;font:inherit}
.sg-topbar-brand-button:hover,.sg-topbar-brand-button:focus-visible{background:color-mix(in srgb,var(--topbar-text,#fff) 12%,transparent);outline:none}
.sg-topbar-brand-logo{width:32px;height:32px;object-fit:contain;border-radius:7px;background:#fff;padding:3px;flex:0 0 auto}
.sg-topbar-brand-mark{width:32px;height:32px;border-radius:7px;background:#fff;color:var(--topbar-bg,var(--nav,#2b2f33));display:grid;place-items:center;font-weight:800;font-size:10px;flex:0 0 auto}
.sg-topbar-brand-name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--topbar-text,#fff);font-weight:800;font-size:14px;line-height:1}
.sg-topbar-context{min-width:0;padding:0 18px;display:flex;flex-direction:column;gap:1px;line-height:1.15}
.sg-topbar-context span{font-size:10px;text-transform:uppercase;letter-spacing:.08em;opacity:.72;font-weight:800}
.sg-topbar-context strong{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sg-topbar-actions{height:100%;display:flex;align-items:center;justify-content:flex-end;padding-right:10px;position:relative}
.sg-profile-menu{position:relative}
.sg-profile-trigger{height:38px;max-width:220px;border:0;border-radius:11px;background:transparent;color:var(--topbar-text,#fff);display:flex;align-items:center;gap:8px;padding:0 9px;cursor:pointer;font:inherit}
.sg-profile-trigger:hover,.sg-profile-trigger:focus-visible,.sg-profile-trigger[aria-expanded="true"]{background:color-mix(in srgb,var(--topbar-text,#fff) 12%,transparent);outline:none}
.sg-profile-avatar{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:color-mix(in srgb,var(--topbar-text,#fff) 16%,transparent);flex:0 0 auto}
.sg-profile-avatar svg{width:16px;height:16px}
.sg-profile-name{max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:800}
.sg-profile-chevron{width:14px;height:14px;transition:transform .16s ease}
.sg-profile-trigger[aria-expanded="true"] .sg-profile-chevron{transform:rotate(180deg)}
.sg-profile-dropdown{position:absolute;right:0;top:44px;width:184px;padding:6px;background:#fff;color:var(--sg-text);border:1px solid var(--sg-line);border-radius:12px;box-shadow:0 16px 38px rgba(16,42,67,.18);z-index:130}
.sg-profile-dropdown[hidden]{display:none}
.sg-profile-dropdown a{display:flex;align-items:center;gap:9px;min-height:38px;padding:0 10px;border-radius:9px;text-decoration:none;color:var(--sg-text);font-size:13px;font-weight:750}
.sg-profile-dropdown a:hover,.sg-profile-dropdown a:focus-visible{background:#f1f5f9;outline:none}
.sg-profile-dropdown svg{width:17px;height:17px;flex:0 0 auto;color:var(--sg-muted)}
.sidebar{grid-column:1;grid-row:2;position:sticky;top:var(--sg-topbar-h);width:var(--sg-sidebar-w);height:calc(100vh - var(--sg-topbar-h));padding:12px 7px 10px;background:var(--nav,#2b2f33);color:var(--nav-text,#fff);overflow:visible;z-index:80;background-clip:padding-box;box-shadow:none;transition:width .2s ease,padding .2s ease;display:flex;flex-direction:column}
.sidebar nav{width:100%;overflow:visible;padding:2px 0 0;display:block}
.sidebar nav a{position:relative;display:grid;grid-template-columns:18px minmax(0,1fr);column-gap:7px;align-items:center;width:100%;height:36px;min-height:36px;margin:2px 0;padding:0 8px;box-sizing:border-box;color:var(--nav-text,#fff);text-decoration:none;border-radius:12px;white-space:nowrap;overflow:hidden;font-size:12px;font-weight:700;line-height:1.2;border:0;background:transparent}
.sidebar nav a:hover,.sidebar nav a.active,.sidebar nav a:focus-visible{background:color-mix(in srgb,var(--nav-text,#fff) 19%,transparent);outline:none}
.sidebar nav a::before{content:"";width:17px;height:17px;display:block;background:currentColor;opacity:.95;align-self:center;justify-self:center;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 5h16v14H4z'/%3E%3Cpath d='M8 9h8M8 13h8M8 17h5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 5h16v14H4z'/%3E%3Cpath d='M8 9h8M8 13h8M8 17h5'/%3E%3C/svg%3E") center/contain no-repeat}
.sidebar nav a.sidebar-home-link::before{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M9 20v-6h6v6'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M9 20v-6h6v6'/%3E%3C/svg%3E") center/contain no-repeat}
.sidebar nav a.sidebar-case-link::before{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h6l2 2h8v10H4z'/%3E%3Cpath d='M4 7V5h6l2 2'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h6l2 2h8v10H4z'/%3E%3Cpath d='M4 7V5h6l2 2'/%3E%3C/svg%3E") center/contain no-repeat}
.sidebar nav a.sidebar-templates-link::before{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 3h9l3 3v15H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 12h6M9 16h6'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 3h9l3 3v15H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 12h6M9 16h6'/%3E%3C/svg%3E") center/contain no-repeat}
.sidebar-nav-divider{height:1px;margin:8px 8px 9px;background:color-mix(in srgb,var(--nav-text,#fff) 18%,transparent)}
.sidebar-spacer{flex:1 1 auto;min-height:32px}
.sidebar-bottom{margin-top:auto;padding:8px 4px 5px}
.sidebar-user{display:flex;align-items:center;gap:9px;min-width:0;padding:9px 7px;color:var(--nav-text,#fff);border-radius:11px}
.sidebar-user-dot{width:9px;height:9px;border-radius:999px;background:#31d158;box-shadow:0 0 0 4px rgba(49,209,88,.14);flex:0 0 auto}
.sidebar-user>div{min-width:0}
.sidebar-user small{display:block;margin:0 0 1px;font-size:9px;line-height:1.2;text-transform:uppercase;letter-spacing:.065em;opacity:.68;font-weight:800;white-space:nowrap}
.sidebar-user strong{display:block;max-width:118px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.25;color:inherit}
.sidebar-collapse{position:absolute;right:8px;bottom:65px;width:34px;height:34px;border:0;border-radius:50%;display:grid;place-items:center;background:color-mix(in srgb,var(--nav-text,#fff) 20%,transparent);color:var(--nav-text,#fff);cursor:pointer;opacity:0;pointer-events:none;transition:opacity .16s,transform .2s;z-index:90}
.sidebar:hover .sidebar-collapse,.sidebar:focus-within .sidebar-collapse{opacity:1;pointer-events:auto}
.sidebar-collapse:hover,.sidebar-collapse:focus-visible{background:color-mix(in srgb,var(--nav-text,#fff) 30%,transparent);outline:none}
.sidebar-collapse svg{width:18px;height:18px}
.workspace{grid-column:2;grid-row:2;min-width:0;min-height:calc(100vh - var(--sg-topbar-h));padding:24px;background:var(--sg-page-bg);color:var(--sg-text);border-top-left-radius:22px;position:relative;z-index:1}
.app-shell.sidebar-collapsed{grid-template-columns:var(--sg-sidebar-collapsed-w) minmax(0,1fr)}
.app-shell.sidebar-collapsed .sg-topbar{grid-template-columns:var(--sg-sidebar-collapsed-w) minmax(220px,1fr) auto}
.app-shell.sidebar-collapsed .sidebar{width:var(--sg-sidebar-collapsed-w);padding-left:7px;padding-right:7px}
.app-shell.sidebar-collapsed .sg-topbar-brand-name{display:none}
.app-shell.sidebar-collapsed .sg-topbar-brand-button{width:40px;max-width:40px;padding:0;justify-content:center}
.app-shell.sidebar-collapsed .sidebar nav a{grid-template-columns:1fr;padding:9px 7px;justify-items:center;font-size:0}
.app-shell.sidebar-collapsed .sidebar-nav-divider{margin-left:7px;margin-right:7px}
.app-shell.sidebar-collapsed .sidebar-user{justify-content:center;padding-left:0;padding-right:0}
.app-shell.sidebar-collapsed .sidebar-user>div{display:none}
.app-shell.sidebar-collapsed .sidebar-collapse{right:17px;transform:rotate(180deg)}
.sg-branding-settings{margin:0 0 22px;padding:0;color:var(--sg-text)}
.sg-branding-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:14px}
.sg-branding-heading h1{margin:2px 0 5px;font-size:24px;line-height:1.2}
.sg-branding-heading p{margin:0;color:var(--sg-muted);max-width:720px}
.sg-settings-eyebrow{font-size:11px;text-transform:uppercase;letter-spacing:.08em;font-weight:800;color:var(--sg-primary)}
.sg-branding-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
.sg-branding-card{background:var(--sg-panel);border:1px solid var(--sg-line);border-radius:14px;padding:18px;box-shadow:0 8px 28px rgba(16,42,67,.06)}
.sg-branding-card-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:15px}
.sg-branding-card-head h2{margin:0 0 4px;font-size:17px}.sg-branding-card-head p{margin:0;color:var(--sg-muted);font-size:13px}
.sg-brand-field,.sg-colour-field{display:grid;gap:7px;margin:0 0 14px;font-size:13px;font-weight:700}.sg-brand-field input[type=text],.sg-brand-field input[type=file],.sg-colour-field input[type=text]{width:100%;box-sizing:border-box;border:1px solid var(--sg-line);border-radius:8px;padding:10px 11px;background:#fff;color:var(--sg-text);font:inherit}
.sg-colour-field>div{display:grid;grid-template-columns:48px minmax(0,1fr);gap:8px}.sg-colour-field input[type=color]{width:48px;height:42px;padding:3px;border:1px solid var(--sg-line);border-radius:8px;background:#fff}
.sg-brand-check{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--sg-muted);margin:8px 0 14px}.sg-brand-check input{width:16px;height:16px}
.sg-brand-preview,.sg-favicon-preview{display:flex;align-items:center;gap:12px;padding:10px;border:1px solid var(--sg-line);border-radius:10px;background:#f8fbff;margin:-4px 0 14px}.sg-brand-preview img{max-width:160px;max-height:56px;object-fit:contain}.sg-favicon-preview img{width:32px;height:32px;object-fit:contain}.sg-brand-preview .sg-brand-check,.sg-favicon-preview .sg-brand-check{margin:0}
.sg-nav-preview{display:grid;grid-template-columns:92px 1fr;grid-template-rows:38px 96px;border:1px solid var(--sg-line);border-radius:12px;overflow:hidden;margin-top:16px;font-size:11px;font-weight:800}.sg-preview-top{grid-column:1/-1;background:var(--topbar-bg);color:var(--topbar-text);display:flex;align-items:center;padding:0 12px}.sg-preview-side{background:var(--nav);color:var(--nav-text);display:flex;align-items:flex-start;padding:12px 9px}.sg-preview-content{background:var(--sg-page-bg);color:var(--sg-muted);padding:12px}
.sg-branding-actions{display:flex;justify-content:flex-end;margin-top:14px}.sg-branding-flash{border-radius:10px;padding:11px 13px;margin:0 0 14px;font-weight:700;font-size:13px}.sg-branding-flash.is-success{background:#ecfff4;border:1px solid #a7e0bf;color:#11623b}.sg-branding-flash.is-error{background:#fff0f0;border:1px solid #ffb2b2;color:#9f1d1d}
@media(max-width:900px){
  .app-shell,.app-shell.sidebar-collapsed{grid-template-columns:1fr;grid-template-rows:var(--sg-topbar-h) auto}
  .sg-topbar,.app-shell.sidebar-collapsed .sg-topbar{grid-template-columns:54px minmax(0,1fr) 54px}
  .sg-topbar-left{padding-left:8px}.sg-topbar-brand-button,.app-shell.sidebar-collapsed .sg-topbar-brand-button{width:40px;max-width:40px;padding:0;justify-content:center}.sg-topbar-brand-name,.app-shell.sidebar-collapsed .sg-topbar-brand-name{display:none}
  .sg-topbar-actions{padding-right:7px}.sg-profile-trigger{width:40px;max-width:40px;padding:0;justify-content:center}.sg-profile-name,.sg-profile-chevron{display:none}.sg-profile-dropdown{right:0}
  .sidebar,.app-shell.sidebar-collapsed .sidebar{position:fixed;left:-280px;top:var(--sg-topbar-h);width:260px;height:calc(100vh - var(--sg-topbar-h));padding:14px 12px 12px;overflow:auto;transition:left .2s;box-shadow:8px 0 30px #0004}.sidebar.open,.app-shell.sidebar-collapsed .sidebar.open{left:0}
  .sidebar nav a,.app-shell.sidebar-collapsed .sidebar nav a{grid-template-columns:22px minmax(0,1fr);gap:9px;width:100%;height:42px;min-height:42px;margin:3px 0;padding:0 10px;font-size:13px;justify-items:stretch}.sidebar-collapse{display:none}
  .app-shell.sidebar-collapsed .sidebar-user{justify-content:flex-start;padding:9px 7px}.app-shell.sidebar-collapsed .sidebar-user>div{display:block}
  .workspace{grid-column:1;grid-row:2;border-top-left-radius:0;padding:18px}.sg-branding-grid{grid-template-columns:1fr}
}
@media(max-width:560px){.sg-topbar-context{padding:0 8px}.sg-topbar-context span{display:none}.sg-topbar-context strong{font-size:12px}.workspace{padding:14px}.sg-branding-card{padding:14px}.sg-branding-heading h1{font-size:21px}}

/* === SAM CASE STUDY COMPACT UI START === */
/*
 * Canonical Case Study presentation aligned to the approved Client & Property
 * reference. Existing field names, endpoints and functional behaviour remain
 * unchanged.
 */
.workspace:has(#propertyForm){
  padding:14px 16px 20px!important;
}

/* Case overview header */
.page-head.case-study-topbar.case-overview-head{
  min-height:94px!important;
  margin:0 0 10px!important;
  padding:12px 14px!important;
  display:grid!important;
  grid-template-columns:minmax(250px,1.15fr) minmax(280px,1.25fr) minmax(130px,.65fr) minmax(130px,.65fr) auto!important;
  align-items:center!important;
  gap:0!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:14px!important;
  background:rgba(255,255,255,.98)!important;
  -webkit-backdrop-filter:blur(14px) saturate(1.04)!important;
  backdrop-filter:blur(14px) saturate(1.04)!important;
  box-shadow:0 7px 22px rgba(16,42,67,.055)!important;
  overflow:visible!important;
}
.page-head.case-study-topbar.case-overview-head::after{display:none!important}

.case-overview-title{
  min-width:0;
  padding:0 16px 0 2px;
}
.case-overview-title .eyebrow{
  margin:0 0 4px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:9px!important;
  line-height:1!important;
  letter-spacing:.085em!important;
}
.case-overview-title h1{
  margin:0 0 6px!important;
  color:var(--sg-text,#102a43)!important;
  font-size:20px!important;
  line-height:1.15!important;
  letter-spacing:-.018em!important;
  white-space:nowrap!important;
}
.case-ref-badge{
  display:inline-flex!important;
  align-items:center!important;
  min-height:24px!important;
  max-width:100%!important;
  padding:4px 9px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:999px!important;
  background:#f4f7fb!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:10.5px!important;
  line-height:1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.case-ref-badge strong{color:var(--sg-text,#102a43)!important}

.case-overview-stat{
  min-width:0;
  min-height:52px;
  display:grid;
  grid-template-columns:30px minmax(0,1fr);
  align-items:center;
  gap:9px;
  padding:0 14px;
  border-left:1px solid var(--sg-line,#d5dfeb);
}
.case-overview-stat > div{min-width:0}
.case-overview-icon{
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  color:#6e84a0;
}
.case-overview-icon svg{width:21px;height:21px}
.case-overview-stat span:not(.case-overview-icon){
  display:block;
  margin:0 0 4px;
  color:var(--sg-muted,#58708a);
  font-size:9.5px;
  line-height:1.1;
  font-weight:750;
}
.case-overview-stat strong{
  display:block;
  min-width:0;
  color:var(--sg-text,#102a43);
  font-size:11px;
  line-height:1.35;
  font-weight:800;
}
.case-overview-property strong{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
}

.case-study-topbar-actions{
  min-width:max-content!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:6px!important;
  padding-left:12px!important;
  margin:0!important;
  border-left:1px solid var(--sg-line,#d5dfeb)!important;
}
.case-study-topbar-actions .save-status{
  min-height:28px!important;
  margin:0!important;
  padding:5px 8px!important;
  border-radius:999px!important;
  font-size:9.5px!important;
  line-height:1!important;
}
.case-study-topbar-actions .button,
.case-study-topbar-actions button{
  min-height:32px!important;
  padding:6px 9px!important;
  border-radius:8px!important;
  font-size:10.5px!important;
  line-height:1.1!important;
  white-space:nowrap!important;
}

/* Main form and tabs */
#propertyForm{
  overflow:visible!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}
#propertyForm .form-tabs{
  min-height:46px!important;
  margin:0 0 12px!important;
  padding:5px 7px!important;
  display:flex!important;
  gap:4px!important;
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  border:0!important;
  border-bottom:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:0!important;
  background:rgba(247,250,253,.96)!important;
  -webkit-backdrop-filter:blur(12px) saturate(1.03)!important;
  backdrop-filter:blur(12px) saturate(1.03)!important;
  box-shadow:none!important;
  scrollbar-width:thin;
}
#propertyForm .form-tabs::before{display:none!important}
#propertyForm .tab-button{
  position:relative!important;
  min-height:34px!important;
  flex:0 0 auto!important;
  padding:7px 12px!important;
  border:0!important;
  border-radius:8px 8px 0 0!important;
  background:transparent!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:11px!important;
  line-height:1!important;
  font-weight:750!important;
  white-space:nowrap!important;
}
#propertyForm .tab-button::after{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  bottom:-6px;
  height:2px;
  border-radius:2px;
  background:transparent;
}
#propertyForm .tab-button:hover,
#propertyForm .tab-button:focus-visible{
  background:#eef4fb!important;
  outline:none!important;
}
#propertyForm .tab-button.active{
  color:var(--sg-primary,#1769e0)!important;
  background:#f2f7fe!important;
}
#propertyForm .tab-button.active::after{
  background:var(--sg-primary,#1769e0)!important;
}

/* === SAM CLIENT PROPERTY AUTOFILL STATUS START === */
#propertyForm .sg-cpa-auto-status {
    display: inline;
    margin-left: 5px;
    color: var(--success, #16803a);
    font-size: 11px;
    font-weight: 800;
    line-height: inherit;
    white-space: nowrap;
}
/* === SAM CLIENT PROPERTY AUTOFILL STATUS END === */
/* Client & Property two-column workspace */
#propertyForm .tab-panel[data-tab-panel="main"].active{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 228px!important;
  gap:16px!important;
  align-items:start!important;
  padding:0!important;
}
#propertyForm .case-main-stack{
  grid-column:1!important;
  min-width:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:8px!important;
}
#propertyForm .case-main-stack > section{
  grid-column:1;
  min-width:0;
  margin:0!important;
  padding:14px 16px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:12px!important;
  background:var(--sg-panel,#fff)!important;
  box-shadow:0 5px 16px rgba(16,42,67,.035)!important;
}
#propertyForm .case-main-stack > section h2{
  margin:0 0 12px!important;
  padding:0 0 10px!important;
  border-bottom:1px solid var(--sg-line,#d5dfeb)!important;
  color:var(--sg-text,#102a43)!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:850!important;
}

#propertyForm .tab-panel[data-tab-panel="main"] .grid{
  display:grid!important;
  gap:10px 12px!important;
  margin-bottom:10px!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] .grid.two{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] .grid.three{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] .grid.four{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
#propertyForm .case-main-stack > section .grid:last-child{margin-bottom:0!important}

#propertyForm .tab-panel[data-tab-panel="main"] label{min-width:0!important}
#propertyForm .tab-panel[data-tab-panel="main"] label > span:first-child,
#propertyForm .tab-panel[data-tab-panel="main"] .radio-title{
  display:block!important;
  margin:0 0 4px!important;
  color:var(--sg-text,#102a43)!important;
  font-size:10px!important;
  line-height:1.2!important;
  font-weight:800!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] input[type="text"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="email"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="tel"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="date"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="time"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="number"],
#propertyForm .tab-panel[data-tab-panel="main"] input[type="url"],
#propertyForm .tab-panel[data-tab-panel="main"] select{
  width:100%!important;
  min-width:0!important;
  min-height:34px!important;
  height:34px!important;
  margin:0!important;
  padding:6px 8px!important;
  border:1px solid var(--sg-line,#cbd8e6)!important;
  border-radius:7px!important;
  background:#fff!important;
  color:var(--sg-text,#102a43)!important;
  font-size:10.5px!important;
  line-height:1.2!important;
  box-shadow:none!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] textarea{
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:7px 9px!important;
  border:1px solid var(--sg-line,#cbd8e6)!important;
  border-radius:7px!important;
  background:#fff!important;
  color:var(--sg-text,#102a43)!important;
  font-size:10.5px!important;
  line-height:1.35!important;
  box-shadow:none!important;
  resize:vertical!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] input:focus,
#propertyForm .tab-panel[data-tab-panel="main"] select:focus,
#propertyForm .tab-panel[data-tab-panel="main"] textarea:focus{
  outline:2px solid rgba(23,105,224,.15)!important;
  outline-offset:1px!important;
  border-color:var(--sg-primary,#1769e0)!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] small{
  display:block!important;
  margin-top:4px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:9px!important;
  line-height:1.35!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] .checkbox-inline{
  min-height:28px!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:7px!important;
  margin:4px 0 0!important;
  font-size:10px!important;
}
#propertyForm .tab-panel[data-tab-panel="main"] .checkbox-inline input{
  flex:0 0 auto!important;
  width:14px!important;
  height:14px!important;
  min-height:14px!important;
  margin:0!important;
}


/* Conflict checklist: compact card language matching Client & Property */
#propertyForm .case-conflict-card .conflict-check-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:9px!important;
  margin:0 0 10px!important;
}
#propertyForm .case-conflict-card .conflict-check-grid .radio{
  min-width:0!important;
  margin:0!important;
  padding:10px 11px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:10px!important;
  background:#f8fbfe!important;
}
#propertyForm .case-conflict-card .conflict-check-grid .radio:last-child{
  grid-column:1/-1!important;
}
#propertyForm .case-conflict-card .radio-title{
  display:block!important;
  margin:0 0 7px!important;
  color:var(--sg-text,#102a43)!important;
  font-size:10px!important;
  line-height:1.25!important;
  font-weight:850!important;
}
#propertyForm .case-conflict-card .radio label{
  display:inline-flex!important;
  align-items:center!important;
  gap:5px!important;
  min-height:27px!important;
  margin:0 4px 4px 0!important;
  padding:4px 8px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:999px!important;
  background:#fff!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:9.5px!important;
  line-height:1!important;
  font-weight:750!important;
  cursor:pointer!important;
}
#propertyForm .case-conflict-card .radio label:has(input:checked){
  border-color:var(--sg-primary,#1769e0)!important;
  background:#eef5ff!important;
  color:var(--sg-primary,#1769e0)!important;
}
#propertyForm .case-conflict-card .radio input[type="radio"]{
  width:13px!important;
  height:13px!important;
  min-height:13px!important;
  margin:0!important;
  accent-color:var(--sg-primary,#1769e0)!important;
}
#propertyForm .case-conflict-card .conflict-measures-panel{
  margin-top:2px!important;
  padding-top:10px!important;
  border-top:1px solid var(--sg-line,#d5dfeb)!important;
}
#propertyForm .case-conflict-card .conflict-measures-panel label{
  margin-bottom:0!important;
}

/* Right summary rail */
.case-summary-rail{
  grid-column:2!important;
  grid-row:1!important;
  position:sticky!important;
  top:var(--sg-case-tabs-top,154px)!important;
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  min-width:0!important;
}
.case-summary-card{
  margin:0!important;
  padding:14px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:12px!important;
  background:var(--sg-panel,#fff)!important;
  box-shadow:0 5px 16px rgba(16,42,67,.035)!important;
}
.case-summary-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  margin:0 0 12px;
  padding:0 0 10px;
  border-bottom:1px solid var(--sg-line,#d5dfeb);
}
.case-summary-card-head .eyebrow{
  margin:0 0 3px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:8.5px!important;
  line-height:1!important;
  letter-spacing:.08em!important;
}
.case-summary-card-head h3{
  margin:0!important;
  color:var(--sg-text,#102a43)!important;
  font-size:11px!important;
  line-height:1.2!important;
  font-weight:850!important;
}

.case-progress-card{
  --case-progress-blue:var(--sg-primary,#1769e0);
  --case-progress-green:#1f9d59;
  --case-progress-grey:#d7e1eb;
}
.case-progress-overview{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}
.case-progress-ring{
  --case-progress:0deg;
  width:58px;
  height:58px;
  flex:0 0 auto;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:
    radial-gradient(circle at center,#fff 58%,transparent 59%),
    conic-gradient(var(--case-progress-blue) var(--case-progress),#e6edf5 0);
}
.case-progress-ring > div{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#fff;
}
.case-progress-ring strong{
  color:var(--case-progress-blue)!important;
  font-size:11.5px!important;
  line-height:1!important;
  font-weight:850!important;
}
.case-progress-overview p{margin:0}
.case-progress-overview p strong{
  display:block;
  color:var(--sg-text,#102a43);
  font-size:10px;
  line-height:1.25;
}
.case-progress-overview p span{
  display:block;
  margin-top:2px;
  color:var(--sg-muted,#58708a);
  font-size:9px;
  line-height:1.25;
}

.case-progress-list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:10px;
}
.case-progress-list li{
  display:grid;
  grid-template-columns:15px minmax(0,1fr);
  gap:8px;
  align-items:center;
  color:var(--sg-muted,#58708a);
}
.case-progress-list li > span{
  width:15px;
  height:15px;
  display:grid;
  place-items:center;
  border:1.5px solid var(--case-progress-grey);
  border-radius:50%;
  background:#fff;
}
.case-progress-list li > span::after{
  content:"";
  display:block;
}
.case-progress-list li strong{
  font-size:9.5px;
  line-height:1.25;
  font-weight:700;
}
.case-progress-list li.is-complete{
  color:var(--sg-text,#102a43);
}
.case-progress-list li.is-complete > span{
  border-color:var(--case-progress-green)!important;
  background:var(--case-progress-green)!important;
}
.case-progress-list li.is-complete > span::after{
  content:"✓";
  color:#fff;
  font-size:9px;
  line-height:1;
  font-weight:900;
}
.case-progress-list li.is-current{
  color:var(--sg-text,#102a43);
}
.case-progress-list li.is-current > span{
  border:2px solid var(--case-progress-blue)!important;
  background:#fff!important;
}
.case-progress-list li.is-current strong{
  font-weight:800;
}

.case-quick-summary dl{margin:0}
.case-quick-summary dl > div{
  padding:8px 0;
  border-bottom:1px solid #e7edf3;
}
.case-quick-summary dl > div:first-child{padding-top:0}
.case-quick-summary dl > div:last-child{padding-bottom:0;border-bottom:0}
.case-quick-summary dt{
  margin:0 0 3px;
  color:var(--sg-muted,#58708a);
  font-size:8.5px;
  line-height:1.2;
  font-weight:700;
}
.case-quick-summary dd{
  margin:0;
  color:var(--sg-text,#102a43);
  font-size:9.5px;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.case-summary-updated{
  margin:0!important;
  padding:2px 4px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:8.5px!important;
  line-height:1.3!important;
  text-align:center!important;
}

/* Other tabs keep compact canonical density */
#propertyForm .tab-panel:not([data-tab-panel="main"]).active{padding:0!important}
#propertyForm .tab-panel:not([data-tab-panel="main"]) > section{
  margin-bottom:10px!important;
  padding:14px 16px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:12px!important;
  background:var(--sg-panel,#fff)!important;
  box-shadow:none!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) > section:last-child{margin-bottom:0!important}
#propertyForm .tab-panel:not([data-tab-panel="main"]) .grid{
  gap:10px 12px!important;
  margin-bottom:10px!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) h2{
  margin-top:0!important;
  margin-bottom:8px!important;
  font-size:15px!important;
  line-height:1.2!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) h3{
  margin-top:0!important;
  margin-bottom:6px!important;
  font-size:13px!important;
  line-height:1.25!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) label > span:first-child,
#propertyForm .tab-panel:not([data-tab-panel="main"]) .radio-title{
  margin-bottom:4px!important;
  font-size:11.5px!important;
  line-height:1.25!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="text"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="email"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="tel"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="date"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="time"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="number"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) input[type="url"],
#propertyForm .tab-panel:not([data-tab-panel="main"]) select{
  min-height:39px!important;
  padding:8px 10px!important;
  border-radius:8px!important;
  font-size:12px!important;
  line-height:1.2!important;
}
#propertyForm .tab-panel:not([data-tab-panel="main"]) textarea{
  padding:9px 11px!important;
  border-radius:8px!important;
  font-size:12px!important;
  line-height:1.4!important;
}
/* Save/download footer: same visual system as the Case Study cards */
#propertyForm .case-download-footer{
  position:static!important;
  inset:auto!important;
  z-index:auto!important;
  display:grid!important;
  grid-template-columns:minmax(260px,.78fr) minmax(0,1.55fr)!important;
  gap:14px!important;
  align-items:start!important;
  margin:10px 0 0!important;
  padding:14px 16px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:12px!important;
  background:var(--sg-panel,#fff)!important;
  box-shadow:0 5px 16px rgba(16,42,67,.035)!important;
}
#propertyForm .case-download-footer > div:first-child{
  min-width:0!important;
  padding-right:14px!important;
  border-right:1px solid var(--sg-line,#d5dfeb)!important;
}
#propertyForm .case-download-footer h2{
  margin:0 0 6px!important;
  color:var(--sg-text,#102a43)!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:850!important;
}
#propertyForm .case-download-footer p{
  margin:0 0 8px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:9.5px!important;
  line-height:1.45!important;
}
#propertyForm .case-download-footer .save-status-secondary{
  width:max-content!important;
  max-width:100%!important;
  min-height:25px!important;
  margin:0 0 8px!important;
  padding:4px 8px!important;
  border-radius:999px!important;
  font-size:9px!important;
  line-height:1!important;
}
#propertyForm .case-download-footer .check{
  min-height:26px!important;
  display:flex!important;
  align-items:flex-start!important;
  gap:7px!important;
  margin:0!important;
  padding:7px 8px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:8px!important;
  background:#f8fbfe!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:9.5px!important;
  line-height:1.35!important;
}
#propertyForm .case-download-footer .check input{
  flex:0 0 auto!important;
  width:13px!important;
  height:13px!important;
  min-height:13px!important;
  margin:1px 0 0!important;
  accent-color:var(--sg-primary,#1769e0)!important;
}
#propertyForm .case-download-footer .buttons{
  min-width:0!important;
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:flex-start!important;
  align-content:flex-start!important;
  gap:6px!important;
  margin:0!important;
  padding:0!important;
}
#propertyForm .case-download-footer .buttons button{
  min-height:34px!important;
  margin:0!important;
  padding:7px 10px!important;
  border-radius:8px!important;
  font-size:10px!important;
  line-height:1.1!important;
  white-space:nowrap!important;
}
#propertyForm .case-download-footer .buttons button.primary{
  background:var(--nav,#143f5f)!important;
  border-color:var(--nav,#143f5f)!important;
  color:#fff!important;
}

@media(max-width:1280px){
  .page-head.case-study-topbar.case-overview-head{
    grid-template-columns:minmax(230px,1fr) minmax(250px,1.1fr) minmax(115px,.58fr) minmax(115px,.58fr)!important;
  }
  .case-study-topbar-actions{
    grid-column:1/-1!important;
    justify-content:flex-end!important;
    padding:8px 0 0!important;
    border-left:0!important;
    border-top:1px solid var(--sg-line,#d5dfeb)!important;
  }
}
@media(max-width:1040px){
  #propertyForm .tab-panel[data-tab-panel="main"] .grid.four{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
@media(max-width:980px){
  .workspace:has(#propertyForm){padding:12px!important}
  .page-head.case-study-topbar.case-overview-head{
    grid-template-columns:1fr 1fr!important;
    gap:0!important;
  }
  .case-overview-title{
    grid-column:1/-1!important;
    padding:0 0 10px!important;
  }
  .case-overview-stat{
    border-left:0!important;
    border-top:1px solid var(--sg-line,#d5dfeb)!important;
    padding:9px 10px!important;
  }
  .case-overview-stat:nth-of-type(even){
    border-left:1px solid var(--sg-line,#d5dfeb)!important;
  }
  .case-study-topbar-actions{grid-column:1/-1!important}
  #propertyForm .tab-panel[data-tab-panel="main"].active{
    grid-template-columns:1fr!important;
  }
  #propertyForm .case-download-footer{
    grid-template-columns:1fr!important;
  }
  #propertyForm .case-download-footer > div:first-child{
    padding-right:0!important;
    padding-bottom:12px!important;
    border-right:0!important;
    border-bottom:1px solid var(--sg-line,#d5dfeb)!important;
  }
  .case-summary-rail{
    grid-column:1!important;
    grid-row:auto!important;
    position:static!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }
  .case-summary-updated{grid-column:1/-1!important}
}
@media(max-width:640px){
  .page-head.case-study-topbar.case-overview-head{
    grid-template-columns:1fr!important;
    padding:10px!important;
  }
  .case-overview-stat{
    border-left:0!important;
    border-top:1px solid var(--sg-line,#d5dfeb)!important;
  }
  .case-overview-stat:nth-of-type(even){border-left:0!important}
  .case-study-topbar-actions{
    justify-content:flex-start!important;
    flex-wrap:wrap!important;
  }
  #propertyForm .case-main-stack > section{padding:12px!important}
  #propertyForm .case-conflict-card .conflict-check-grid{
    grid-template-columns:1fr!important;
  }
  #propertyForm .case-conflict-card .conflict-check-grid .radio:last-child{
    grid-column:auto!important;
  }
  #propertyForm .case-download-footer{
    padding:12px!important;
  }
  #propertyForm .tab-panel[data-tab-panel="main"] .grid.two,
  #propertyForm .tab-panel[data-tab-panel="main"] .grid.three,
  #propertyForm .tab-panel[data-tab-panel="main"] .grid.four{
    grid-template-columns:1fr!important;
  }
  .case-summary-rail{grid-template-columns:1fr!important}
  .case-summary-updated{grid-column:auto!important}
}

/* Shared Case Study action-button comfort size. */
#propertyForm .tab-panel .button:not(.method-row-drag-handle):not(.method-cell-modal-close):not(.sg-method-ai-close),
#propertyForm .tab-panel button:not(.method-row-drag-handle):not(.method-cell-modal-close):not(.sg-method-ai-close){
  min-height:38px!important;
  padding:9px 12px!important;
  border-radius:8px!important;
  font-size:12px!important;
  line-height:1.1!important;
  font-weight:700!important;
}
/* === SAM CASE STUDY COMPACT UI END === */

/* === SAM CASE STUDY STICKY STACK START === */
.page-head.case-study-topbar{
  position:sticky!important;
  top:var(--sg-topbar-h)!important;
  z-index:95!important;
}
#propertyForm .form-tabs{
  position:sticky!important;
  top:var(--sg-case-tabs-top,calc(var(--sg-topbar-h) + 96px))!important;
  z-index:94!important;
}
/* === SAM CASE STUDY STICKY STACK END === */
/* === SAM SETTINGS WORKSPACE START === */
.sam-settings-page-head{
  margin-bottom:14px!important;
  padding:18px 20px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:14px!important;
  background:var(--sg-panel,#fff)!important;
  box-shadow:0 8px 24px rgba(16,42,67,.05)!important;
}
.sam-settings-page-head .eyebrow{
  margin:0 0 3px!important;
  font-size:10px!important;
  line-height:1!important;
  letter-spacing:.08em!important;
}
.sam-settings-page-head h1{
  margin:0 0 4px!important;
  font-size:23px!important;
  line-height:1.15!important;
  letter-spacing:-.015em!important;
}
.sam-settings-page-head p{
  margin:0!important;
  max-width:820px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:12.5px!important;
  line-height:1.45!important;
}

.sam-settings-shell{
  display:grid;
  grid-template-columns:210px minmax(0,1fr);
  gap:16px;
  align-items:start;
  width:100%;
  min-width:0;
}

.sam-settings-nav-card{
  position:sticky;
  top:calc(var(--sg-topbar-h,54px) + 14px);
  min-width:0;
  overflow:hidden;
  border:1px solid var(--sg-line,#d5dfeb);
  border-radius:14px;
  background:var(--sg-panel,#fff);
  box-shadow:0 8px 22px rgba(16,42,67,.045);
}
.sam-settings-nav-title{
  padding:13px 14px 10px;
  border-bottom:1px solid var(--sg-line,#d5dfeb);
}
.sam-settings-nav-title span{
  display:block;
  color:var(--sg-text,#102a43);
  font-size:13px;
  line-height:1.2;
  font-weight:850;
}
.sam-settings-nav-title small{
  display:block;
  margin:2px 0 0;
  color:var(--sg-muted,#58708a);
  font-size:9px;
  line-height:1.2;
  text-transform:uppercase;
  letter-spacing:.075em;
  font-weight:800;
}
.sam-settings-nav{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding:8px;
}
.sam-settings-nav a{
  display:grid;
  grid-template-columns:18px minmax(0,1fr);
  gap:8px;
  align-items:center;
  min-height:36px;
  padding:7px 9px;
  border-radius:9px;
  color:var(--sg-text,#102a43);
  text-decoration:none;
  font-size:12px;
  line-height:1.2;
  font-weight:750;
}
.sam-settings-nav a svg{
  width:17px;
  height:17px;
  color:var(--sg-muted,#58708a);
}
.sam-settings-nav a:hover,
.sam-settings-nav a:focus-visible{
  background:color-mix(in srgb,var(--nav,#2b2f33) 7%,transparent);
  outline:none;
}
.sam-settings-nav a.active{
  background:color-mix(in srgb,var(--nav,#2b2f33) 11%,transparent);
  color:var(--sg-text,#102a43);
}
.sam-settings-nav a.active svg{color:var(--nav,#2b2f33)}

.sam-settings-content{
  min-width:0;
  width:100%;
}
.sam-settings-panel{
  min-width:0;
  width:100%;
}
.sam-settings-content-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin:0 0 12px;
  padding:4px 2px 0;
}
.sam-settings-content-head > div{
  min-width:0;
}
.sam-settings-content-head .eyebrow{
  margin:0 0 3px!important;
  font-size:10px!important;
  line-height:1!important;
  letter-spacing:.08em!important;
}
.sam-settings-content-head h2{
  margin:0 0 4px!important;
  font-size:21px!important;
  line-height:1.15!important;
  letter-spacing:-.01em!important;
}
.sam-settings-content-head p{
  margin:0!important;
  max-width:720px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:12px!important;
  line-height:1.45!important;
}
.sam-settings-scope-pill,
.sam-settings-content-head .settings-status-pill{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:5px 10px!important;
  border-radius:999px!important;
  font-size:10.5px!important;
  line-height:1!important;
  font-weight:850!important;
  white-space:nowrap;
}

.sam-settings-content .card,
.sam-settings-content .form-card,
.sam-company-settings-form,
.sam-settings-content .settings-card,
.sam-settings-content .sg-branding-card,
.sam-settings-content .settings-card{
  overflow:visible!important;
}
.sam-settings-content .settings-card > section,
.sam-company-settings-form > section{
  padding:18px!important;
}
.sam-settings-content .settings-card > section + section,
.sam-company-settings-form > section + section{
  border-top:1px solid var(--sg-line,#d5dfeb)!important;
}

.sam-settings-content .settings-section-head{
  display:flex!important;
  justify-content:space-between!important;
  align-items:flex-start!important;
  gap:14px!important;
  margin:0 0 18px!important;
}
.sam-settings-content .settings-section-head .eyebrow{
  margin:0 0 4px!important;
  font-size:10px!important;
  line-height:1!important;
  letter-spacing:.08em!important;
}
.sam-settings-content .settings-section-head h2,
.sam-settings-content .settings-section-head h3{
  margin:0 0 5px!important;
  font-size:18px!important;
  line-height:1.2!important;
  letter-spacing:-.01em!important;
}
.sam-settings-content .settings-section-head .section-help{
  margin:0!important;
  max-width:780px!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:12px!important;
  line-height:1.5!important;
}

/* API + settings form controls: keep labels, inputs and helper text separated. */
.sam-settings-content .settings-grid,
.sam-settings-content .grid.two.settings-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:18px!important;
  align-items:start!important;
  margin:0!important;
}
.sam-settings-content .settings-card label,
.sam-settings-content .sam-company-settings-form label{
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:6px!important;
  min-width:0!important;
  margin:0!important;
}
.sam-settings-content .settings-card label > span:first-child,
.sam-settings-content .sam-company-settings-form label > span:first-child{
  display:block!important;
  margin:0!important;
  color:var(--sg-text,#102a43)!important;
  font-size:12px!important;
  line-height:1.3!important;
  font-weight:800!important;
}
.sam-settings-content .settings-card input[type="text"],
.sam-settings-content .settings-card input[type="password"],
.sam-settings-content .settings-card input[type="email"],
.sam-settings-content .settings-card input[type="tel"],
.sam-settings-content .settings-card input[type="number"],
.sam-settings-content .settings-card select,
.sam-settings-content .sam-company-settings-form input[type="text"],
.sam-settings-content .sam-company-settings-form input[type="email"],
.sam-settings-content .sam-company-settings-form input[type="tel"],
.sam-settings-content .sam-company-settings-form select{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  padding:9px 11px!important;
  border:1px solid var(--sg-line,#cbd8e6)!important;
  border-radius:9px!important;
  background:#fff!important;
  color:var(--sg-text,#102a43)!important;
  font-size:12.5px!important;
  line-height:1.2!important;
  box-shadow:none!important;
}
.sam-settings-content .settings-card input:focus,
.sam-settings-content .settings-card select:focus,
.sam-settings-content .settings-card textarea:focus,
.sam-settings-content .sam-company-settings-form input:focus,
.sam-settings-content .sam-company-settings-form textarea:focus{
  outline:2px solid color-mix(in srgb,var(--nav,#2b2f33) 18%,transparent)!important;
  outline-offset:1px!important;
  border-color:color-mix(in srgb,var(--nav,#2b2f33) 35%,var(--sg-line,#cbd8e6))!important;
}
.sam-settings-content .settings-card label > small,
.sam-settings-content .sam-company-settings-form label > small{
  display:block!important;
  position:static!important;
  inset:auto!important;
  width:auto!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:10.5px!important;
  line-height:1.4!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}

.sam-settings-content .settings-key-summary{
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  gap:8px!important;
  align-items:center!important;
  width:100%!important;
  max-width:100%!important;
  margin:18px 0 12px!important;
  padding:10px 12px!important;
  border:1px solid var(--sg-line,#d5dfeb)!important;
  border-radius:10px!important;
  background:#f7faff!important;
  color:var(--sg-text,#102a43)!important;
  font-size:11.5px!important;
  line-height:1.3!important;
}
.sam-settings-content .settings-key-summary strong{
  font-weight:850!important;
  white-space:nowrap!important;
}
.sam-settings-content .settings-key-summary span{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace!important;
  color:var(--sg-muted,#58708a)!important;
}

.sam-settings-content .settings-clear-key{
  display:inline-flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:8px!important;
  width:auto!important;
  margin:0 0 16px!important;
  padding:0!important;
  font-size:11.5px!important;
  line-height:1.25!important;
}
.sam-settings-content .settings-clear-key input[type="checkbox"]{
  flex:0 0 auto!important;
  width:15px!important;
  height:15px!important;
  min-height:15px!important;
  margin:0!important;
}
.sam-settings-content .settings-clear-key span{
  margin:0!important;
  font-size:11.5px!important;
  font-weight:700!important;
}

.sam-settings-content .form-actions,
.sam-settings-content .compact-actions{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:center!important;
  gap:8px!important;
  margin:0!important;
}
.sam-settings-content .form-actions .button,
.sam-settings-content .compact-actions .button,
.sam-settings-content .form-actions button,
.sam-settings-content .compact-actions button{
  min-height:36px!important;
  padding:8px 12px!important;
  border-radius:9px!important;
  font-size:11.5px!important;
  line-height:1.1!important;
}

.sam-settings-content .sg-branding-settings{margin:0!important}
.sam-settings-content .sg-branding-heading{
  margin:0 0 12px!important;
  padding:3px 2px 0!important;
}
.sam-settings-content .sg-branding-heading h1{
  margin:0 0 4px!important;
  font-size:21px!important;
  line-height:1.15!important;
}
.sam-settings-content .sg-branding-heading p{
  margin:0!important;
  color:var(--sg-muted,#58708a)!important;
  font-size:12px!important;
}
.sam-settings-content .sg-branding-grid{
  gap:14px!important;
}
.sam-settings-content .sg-branding-card{
  padding:16px!important;
}

.sam-company-settings-form h3{
  margin:0 0 12px!important;
  font-size:15px!important;
  line-height:1.2!important;
}
.sam-company-settings-form textarea{
  width:100%!important;
  min-height:92px!important;
  margin:0!important;
  padding:9px 11px!important;
  border:1px solid var(--sg-line,#cbd8e6)!important;
  border-radius:9px!important;
  background:#fff!important;
  font-size:12.5px!important;
  line-height:1.4!important;
}
.sam-settings-flash{
  margin:0 0 10px;
  padding:9px 11px;
  border-radius:9px;
  font-size:11.5px;
  font-weight:750;
}
.sam-settings-flash.success{
  border:1px solid #a7e0bf;
  background:#ecfff4;
  color:#11623b;
}
.sam-settings-flash.error{
  border:1px solid #ffb2b2;
  background:#fff0f0;
  color:#9f1d1d;
}

.sam-settings-content .kb-textarea-label textarea{
  min-height:440px!important;
}

@media(max-width:980px){
  .sam-settings-shell{grid-template-columns:190px minmax(0,1fr)}
  .sam-settings-content .settings-grid,
  .sam-settings-content .grid.two.settings-grid{
    gap:14px!important;
  }
}
@media(max-width:820px){
  .sam-settings-shell{grid-template-columns:1fr}
  .sam-settings-nav-card{position:static}
  .sam-settings-nav{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    overflow-x:auto;
  }
  .sam-settings-nav a{
    grid-template-columns:1fr;
    justify-items:center;
    text-align:center;
    min-width:105px;
  }
  .sam-settings-nav-title{display:none}
  .sam-settings-content .settings-grid,
  .sam-settings-content .grid.two.settings-grid{
    grid-template-columns:1fr!important;
  }
  }
@media(max-width:560px){
  .sam-settings-page-head{padding:15px!important}
  .sam-settings-nav{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sam-settings-content-head{flex-direction:column}
  .sam-settings-content .settings-card > section,
  .sam-company-settings-form > section{padding:14px!important}
  .sam-settings-content .settings-key-summary{
    grid-template-columns:1fr!important;
  }
  .sam-settings-content .settings-key-summary strong,
  .sam-settings-content .settings-key-summary span{
    white-space:normal!important;
  }
}
/* === SAM SETTINGS WORKSPACE END === */

/* === SAM UI CANONICAL SHELL STAGE1 END === */

/* === SAM METHOD STATEMENT HEADER UI START === */
#propertyForm .tab-panel[data-tab-panel="method"] .method-statement-header{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:16px;
  align-items:start;
  margin:0 0 12px;
  padding:14px 16px;
  border:1px solid var(--sg-line,#d5dfeb);
  border-radius:12px;
  background:linear-gradient(135deg,#f8fbff,#eef6fd);
}
#propertyForm .tab-panel[data-tab-panel="method"] .method-statement-header .eyebrow{
  margin:0 0 4px;
  color:var(--sg-primary,#1769e0);
  font-size:10px;
  line-height:1;
  font-weight:850;
  letter-spacing:.08em;
  text-transform:uppercase;
}
#propertyForm .tab-panel[data-tab-panel="method"] .method-statement-header h2{
  margin:0 0 5px!important;
  color:var(--sg-text,#102a43)!important;
  font-size:19px!important;
  line-height:1.2!important;
  letter-spacing:-.015em;
}
#propertyForm .tab-panel[data-tab-panel="method"] .method-statement-header .section-help{
  margin:0!important;
  max-width:900px;
  color:var(--sg-muted,#58708a);
  font-size:12px;
  line-height:1.45;
}
.method-statement-header-badge{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:5px 10px;
  border:1px solid #b9d7f2;
  border-radius:999px;
  background:#eef6ff;
  color:#1769e0;
  font-size:10px;
  line-height:1;
  font-weight:850;
  white-space:nowrap;
}

#propertyForm .tab-panel[data-tab-panel="method"] > section > .method-section-title{
  display:flex;
  align-items:center;
  min-height:42px;
  margin:0 0 12px!important;
  padding:9px 12px!important;
  border:1px solid var(--sg-line,#d5dfeb);
  border-left:4px solid var(--sg-primary,#1769e0);
  border-radius:9px;
  background:#f7faff;
  color:var(--sg-text,#102a43)!important;
  font-size:15px!important;
  line-height:1.25!important;
  font-weight:850!important;
  letter-spacing:-.005em;
}

#methodReportImportPanel .method-report-import-head.sg-report-import-head-clean{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:14px;
  align-items:center;
  margin:0;
  padding:14px 16px;
  border-bottom:1px solid var(--sg-line,#d5dfeb);
  background:linear-gradient(135deg,#f7fbff,#eef6fd);
}
#methodReportImportPanel .method-report-import-head.sg-report-import-head-clean .eyebrow{
  margin:0 0 4px;
  color:#1769e0;
  font-size:9.5px;
  line-height:1;
  font-weight:850;
  letter-spacing:.08em;
  text-transform:uppercase;
}
#methodReportImportPanel .method-report-import-head.sg-report-import-head-clean h2{
  margin:0!important;
  color:var(--sg-text,#102a43)!important;
  font-size:16px!important;
  line-height:1.2!important;
  letter-spacing:-.01em;
}
#methodReportImportPanel .report-import-badge{
  min-height:28px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--nav,#143f5f);
  color:#fff;
  font-size:10px;
  line-height:1;
  font-weight:850;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.method-ai-rules-card{
  margin:10px 0 14px;
  padding:0;
  overflow:hidden;
  border:1px solid var(--sg-line,#d5dfeb);
  border-radius:12px;
  background:#fff;
}
.method-ai-rules-card > summary{
  list-style:none;
}
.method-ai-rules-card > summary::-webkit-details-marker{
  display:none;
}
.method-ai-rules-card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  background:#f8fbff;
  cursor:pointer;
  user-select:none;
}
.method-ai-rules-card[open] .method-ai-rules-card-head{
  border-bottom:1px solid var(--sg-line,#d5dfeb);
}
.method-ai-rules-card-head:focus-visible{
  outline:2px solid rgba(23,105,224,.18);
  outline-offset:-2px;
}
.method-ai-rules-card-head .eyebrow{
  margin:0 0 4px;
  color:#1769e0;
  font-size:9px;
  line-height:1;
  font-weight:850;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.method-ai-rules-card-head h3{
  margin:0 0 4px;
  color:var(--sg-text,#102a43);
  font-size:14px;
  line-height:1.2;
}
.method-ai-rules-card-head p{
  margin:0;
  color:var(--sg-muted,#58708a);
  font-size:10.5px;
  line-height:1.4;
}
.method-ai-rules-summary-copy{
  min-width:0;
}
.method-ai-rules-summary-meta{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}
.method-ai-rules-chevron{
  width:10px;
  height:10px;
  flex:0 0 auto;
  border-right:2px solid var(--sg-muted,#58708a);
  border-bottom:2px solid var(--sg-muted,#58708a);
  transform:rotate(45deg);
  transition:transform .16s ease;
  margin-right:3px;
}
.method-ai-rules-card[open] .method-ai-rules-chevron{
  transform:rotate(225deg);
  margin-top:5px;
}
.method-ai-reference-pill{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  min-height:27px;
  max-width:340px;
  padding:5px 9px;
  border:1px solid #b9e8cb;
  border-radius:999px;
  background:#eefaf3;
  color:#138a4d;
  font-size:9.5px;
  line-height:1.2;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.method-ai-rules-card-body{
  padding:12px 14px 14px;
}
.method-ai-rules-help{
  margin:0 0 9px;
  color:var(--sg-muted,#58708a);
  font-size:10.5px;
  line-height:1.45;
}
#methodStatementAiRules{
  width:100%;
  min-height:220px;
  margin:0;
  padding:9px 11px;
  border:1px solid var(--sg-line,#cbd8e6);
  border-radius:8px;
  background:#fff;
  color:var(--sg-text,#102a43);
  font:inherit;
  font-size:12px;
  line-height:1.45;
  resize:vertical;
}
#methodStatementAiRules:focus{
  outline:2px solid rgba(23,105,224,.15);
  outline-offset:1px;
  border-color:#1769e0;
}
.method-ai-rules-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-top:9px;
}
.method-ai-rules-actions .button,
.method-ai-rules-actions button{
  min-height:38px;
  padding:9px 12px;
  border-radius:8px;
  font-size:12px;
  line-height:1.1;
  font-weight:700;
}
.method-ai-rules-status{
  color:var(--sg-muted,#58708a);
  font-size:10px;
  line-height:1.3;
}
.method-ai-rules-status.saving{color:#1769e0}
.method-ai-rules-status.saved{color:#138a4d}
.method-ai-rules-status.error{color:#b42318}

@media(max-width:720px){
  #propertyForm .tab-panel[data-tab-panel="method"] .method-statement-header,
  #methodReportImportPanel .method-report-import-head.sg-report-import-head-clean{
    grid-template-columns:1fr;
  }
  .method-statement-header-badge,
  .method-ai-reference-pill{
    width:max-content;
    max-width:100%;
  }
  .method-ai-rules-card-head{
    align-items:flex-start;
  }
  .method-ai-rules-summary-meta{
    width:100%;
    justify-content:space-between;
  }
}
/* === SAM METHOD STATEMENT HEADER UI END === */

/* === SAM SHARED CASE AI BUSY UI START === */
body.sg-case-ai-busy{
  overflow:hidden!important;
  cursor:wait!important;
}
.sg-case-ai-busy-overlay{
  position:fixed;
  inset:0;
  z-index:40000;
  display:grid;
  place-items:center;
  padding:24px;
  background:rgba(239,245,250,.86);
  -webkit-backdrop-filter:blur(5px);
  backdrop-filter:blur(5px);
  opacity:0;
  pointer-events:auto;
  transition:opacity .12s ease;
}
.sg-case-ai-busy-overlay[hidden]{
  display:none!important;
}
.sg-case-ai-busy-overlay.is-visible{
  opacity:1;
}
.sg-case-ai-busy-card{
  width:min(390px,calc(100vw - 36px));
  min-height:132px;
  display:flex;
  align-items:center;
  gap:18px;
  padding:22px 24px;
  border:1px solid var(--sg-line,#d5dfeb);
  border-radius:16px;
  background:rgba(255,255,255,.98);
  box-shadow:0 22px 70px rgba(16,42,67,.20);
}
.sg-case-ai-busy-spinner{
  width:54px;
  height:54px;
  flex:0 0 54px;
  border:5px solid #d9e5ef;
  border-top-color:var(--sg-primary,#1769e0);
  border-radius:50%;
  animation:sg-case-ai-spin .78s linear infinite;
}
.sg-case-ai-busy-copy{
  min-width:0;
  display:grid;
  gap:6px;
}
.sg-case-ai-busy-copy strong{
  color:var(--sg-text,#102a43);
  font-size:15px;
  line-height:1.2;
  font-weight:850;
}
.sg-case-ai-busy-copy span{
  color:var(--sg-muted,#58708a);
  font-size:12px;
  line-height:1.45;
  font-weight:600;
}
@keyframes sg-case-ai-spin{
  to{transform:rotate(360deg)}
}
@media(prefers-reduced-motion:reduce){
  .sg-case-ai-busy-spinner{animation-duration:1.6s}
  .sg-case-ai-busy-overlay{transition:none}
}
/* === SAM SHARED CASE AI BUSY UI END === */
