/* =========================================================
   CHOGACH.VN - TILE CALCULATOR
   Compact responsive UI
   ========================================================= */

:root {
    --tc-bg: #020617;
    --tc-panel: #0f172a;
    --tc-panel-2: #111827;
    --tc-panel-3: #172033;
    --tc-border: #263449;
    --tc-border-soft: #334155;
    --tc-text: #f8fafc;
    --tc-text-soft: #cbd5e1;
    --tc-muted: #94a3b8;
    --tc-muted-dark: #64748b;
    --tc-green: #10b981;
    --tc-green-light: #6ee7b7;
    --tc-green-soft: rgba(16, 185, 129, .12);
    --tc-green-border: rgba(16, 185, 129, .34);
    --tc-red-soft: rgba(248, 113, 113, .12);
    --tc-amber: #fbbf24;
    --tc-amber-soft: rgba(245, 158, 11, .12);
    --tc-radius: 10px;
}

.tc-page,
.tc-page *,
.tc-page *::before,
.tc-page *::after {
    box-sizing: border-box;
}

.tc-page button,
.tc-page input,
.tc-page select {
    font: inherit;
}

.tc-page {
    min-height: 100vh;
    padding: 10px 0 24px;
    background: var(--tc-bg);
    color: var(--tc-text);
}

.tc-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 10px;
}

/* Header page */
.tc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    margin-bottom: 8px;
}

.tc-page-header>div {
    min-width: 0;
}

.tc-kicker {
    color: var(--tc-green-light);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
}

/* Main 3-column layout */
.tc-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 270px;
    gap: 8px;
    align-items: start;
    width: 100%;
}

.tc-editor,
.tc-room-card,
.tc-room-content,
.tc-section,
.tc-option-card,
.tc-wall-card {
    min-width: 0;
}

/* Shared panels */
.tc-room-nav,
.tc-summary,
.tc-room-card {
    overflow: hidden;
    border: 1px solid var(--tc-border);
    border-radius: 11px;
    background: var(--tc-panel);
}

.tc-room-nav,
.tc-summary {
    position: sticky;
    top: 68px;
}

.tc-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 7px 9px;
    border-bottom: 1px solid var(--tc-border);
}

.tc-panel-head>div {
    min-width: 0;
    flex: 1;
}

.tc-panel-head h2 {
    margin: 0;
    font-size: 13px;
    line-height: 1.15;
    font-weight: 900;
}

.tc-panel-head small {
    display: block;
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 9px;
}

/* Add-room icon */
.tc-icon-button {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: var(--tc-green);
    color: #022c22;
    cursor: pointer;
}

.tc-icon-button:hover {
    background: #34d399;
}

.tc-icon-button .material-symbols-rounded {
    font-size: 18px;
}

/* Room list */
.tc-room-list {
    display: grid;
    gap: 3px;
    max-height: calc(100vh - 120px);
    padding: 5px;
    overflow-y: auto;
}

.tc-room-list button {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--tc-text);
    text-align: left;
    cursor: pointer;
}

.tc-room-list button:hover,
.tc-room-list button.is-active {
    border-color: var(--tc-green-border);
    background: var(--tc-green-soft);
}

.tc-room-list button>span:last-child {
    min-width: 0;
    flex: 1;
}

.tc-room-list .material-symbols-rounded {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--tc-panel-3);
    color: var(--tc-green-light);
    font-size: 16px;
}

.tc-room-list strong,
.tc-room-list small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-room-list strong {
    font-size: 11px;
}

.tc-room-list small {
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 9px;
}

/* Room header */
.tc-room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 7px 9px;
    border-bottom: 1px solid var(--tc-border);
}

.tc-room-title {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-room-title>.material-symbols-rounded {
    color: var(--tc-green-light);
    font-size: 19px;
}

.room-name {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tc-text);
    font-size: 17px;
    font-weight: 900;
    outline: none;
}

.tc-room-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.duplicate-room,
.delete-room,
.apply-height-button {
    border: 0;
    cursor: pointer;
}

.duplicate-room,
.delete-room {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.duplicate-room {
    gap: 4px;
    padding: 0 8px;
    background: var(--tc-green-soft);
    color: #a7f3d0;
    font-size: 11px;
    font-weight: 800;
}

.duplicate-room .material-symbols-rounded {
    font-size: 16px;
}

.delete-room {
    width: 30px;
    background: var(--tc-red-soft);
    color: #fca5a5;
}

.delete-room .material-symbols-rounded {
    font-size: 17px;
}

/* Editor layout:
   left = step 1
   right = step 2 + 3 */
.tc-room-content {
    display: grid;
    grid-template-columns: minmax(285px, .72fr) minmax(500px, 1.28fr);
    grid-template-areas:
        "step1 step2"
        "step1 step3";
    gap: 8px;
    align-items: start;
    padding: 8px;
}

.tc-step-1 {
    grid-area: step1;
}

.tc-step-2 {
    grid-area: step2;
}

.tc-step-3 {
    grid-area: step3;
}

.tc-section {
    padding: 9px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-bg);
}

.tc-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tc-section-head>div>span {
    color: var(--tc-green-light);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .12em;
}

.tc-section-head h2 {
    margin: 1px 0 0;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 900;
}

/* Fields */
.tc-grid {
    display: grid;
    gap: 6px;
    margin-top: 7px;
}

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

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

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

.tc-field {
    min-width: 0;
}

.tc-field>span {
    display: block;
    margin-bottom: 3px;
    color: var(--tc-text-soft);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
}

.tc-field input,
.tc-field select {
    width: 100%;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--tc-border-soft);
    border-radius: 6px;
    background: var(--tc-panel);
    color: var(--tc-text);
    font-size: 12px;
    outline: none;
}

.tc-field input:focus,
.tc-field select:focus {
    border-color: var(--tc-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, .10);
}

.tc-input-unit {
    position: relative;
}

.tc-input-unit input {
    padding-right: 32px;
}

.tc-input-unit b {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    color: var(--tc-muted-dark);
    font-size: 9px;
}

.tc-readonly-value {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    border: 1px solid var(--tc-border-soft);
    border-radius: 6px;
    background: rgba(15, 23, 42, .55);
    color: var(--tc-text-soft);
    font-size: 11px;
    font-weight: 800;
}

/* Room plan */
.tc-plan-card {
    margin-top: 7px;
    padding: 7px;
    border: 1px solid var(--tc-border);
    border-radius: 8px;
    background: var(--tc-panel);
}

.tc-plan-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
}

.tc-plan-meta small {
    display: block;
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 9px;
}

.tc-plan-meta>span {
    color: var(--tc-green-light);
    font-size: 11px;
    font-weight: 900;
}

.plan-svg {
    width: 100%;
    height: auto;
    max-height: 245px;
    display: block;
    margin-top: 0;
}

.plan-pattern rect {
    fill: var(--tc-panel);
}

.plan-pattern path {
    fill: none;
    stroke: var(--tc-border-soft);
    stroke-width: 1;
}

.plan-room {
    fill: url(#plan-pattern);
    stroke: var(--tc-green);
    stroke-width: 4;
}

.plan-wall-label {
    fill: var(--tc-muted);
    font-size: 14px;
    font-weight: 800;
    text-anchor: middle;
}

.plan-room-name {
    fill: var(--tc-text);
    font-size: 21px;
    font-weight: 900;
    text-anchor: middle;
}

.plan-room-size {
    fill: var(--tc-green-light);
    font-size: 14px;
    font-weight: 800;
    text-anchor: middle;
}

/* Floor / skirting */
.tc-surface-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 7px;
}

.tc-option-card {
    padding: 8px;
    border: 1px solid var(--tc-border);
    border-radius: 8px;
    background: var(--tc-panel);
}

.tc-switch-row {
    min-height: 29px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}

.tc-switch-row>span {
    min-width: 0;
}

.tc-switch-row>span strong,
.tc-switch-row>span small {
    display: block;
}

.tc-switch-row>span strong {
    font-size: 12px;
}

.tc-switch-row>span small {
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 9px;
}

.tc-switch-row input,
.tc-main-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tc-switch-row i,
.tc-main-toggle i {
    position: relative;
    width: 32px;
    height: 18px;
    flex: 0 0 32px;
    border-radius: 999px;
    background: var(--tc-border-soft);
}

.tc-switch-row i::after,
.tc-main-toggle i::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s ease;
}

.tc-switch-row input:checked+i,
.tc-main-toggle input:checked+i {
    background: var(--tc-green);
}

.tc-switch-row input:checked+i::after,
.tc-main-toggle input:checked+i::after {
    transform: translateX(14px);
}

.tc-option-fields {
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 6px;
    margin-top: 7px;
}

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

.tc-option-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed var(--tc-border-soft);
    color: var(--tc-muted);
    font-size: 10px;
}

.tc-option-result strong {
    color: var(--tc-text);
    font-size: 11px;
}

.tc-option-card.is-disabled .tc-option-fields,
.tc-option-card.is-disabled .tc-option-result {
    display: none;
}

/* Walls */
.tc-main-toggle {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tc-main-toggle strong {
    font-size: 11px;
}

.tc-wall-settings {
    display: grid;
    grid-template-columns: 1.2fr .8fr .8fr .55fr auto;
    gap: 6px;
    align-items: end;
    margin-top: 7px;
}

.apply-height-button {
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--tc-green-border);
    border-radius: 6px;
    background: var(--tc-green-soft);
    color: #a7f3d0;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.tc-wall-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
}

.tc-wall-card {
    padding: 7px;
    border: 1px solid var(--tc-border);
    border-radius: 8px;
    background: var(--tc-panel);
}

.tc-wall-card.has-door {
    border-color: rgba(245, 158, 11, .55);
}

.tc-wall-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 5px;
}

.tc-wall-card header>div {
    min-width: 0;
}

.tc-wall-card header strong {
    font-size: 11px;
}

.tc-wall-card header small {
    display: block;
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 8px;
}

.tc-wall-card.has-door header::after {
    content: "Cửa";
    margin-left: auto;
    padding: 2px 4px;
    border-radius: 999px;
    background: var(--tc-amber-soft);
    color: var(--tc-amber);
    font-size: 8px;
    font-weight: 900;
    white-space: nowrap;
}

.tc-wall-check {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--tc-text-soft);
    font-size: 8px;
    white-space: nowrap;
}

.tc-wall-visual {
    height: 48px;
    display: flex;
    align-items: flex-end;
    margin-top: 5px;
    overflow: hidden;
    border: 1px solid var(--tc-border-soft);
    border-radius: 5px;
    background: #07101f;
}

.tc-wall-fill {
    width: 100%;
    min-height: 12px;
    display: grid;
    place-items: center;
    background:
        linear-gradient(to right, transparent 49%, var(--tc-border-soft) 50%, transparent 51%),
        linear-gradient(to bottom, transparent 49%, var(--tc-border-soft) 50%, transparent 51%),
        var(--tc-green-soft);
    background-size: 18px 18px;
}

.tc-wall-fill span {
    display: none;
}

.tc-wall-fill b {
    color: var(--tc-green-light);
    font-size: 8px;
    text-align: center;
}

.tc-wall-card .tc-grid {
    gap: 4px;
    margin-top: 5px;
}

.tc-wall-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    margin-top: 5px;
    color: var(--tc-muted);
    font-size: 8px;
}

.tc-wall-result strong {
    color: var(--tc-text);
    font-size: 9px;
}

.tc-wall-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    padding: 7px 8px;
    border-radius: 7px;
    background: var(--tc-green-soft);
    color: #a7f3d0;
    font-size: 10px;
}

.tc-wall-total strong {
    color: var(--tc-green-light);
    font-size: 14px;
}

.tc-section.is-disabled>.tc-wall-settings,
.tc-section.is-disabled>.tc-wall-grid,
.tc-section.is-disabled>.tc-wall-total {
    display: none;
}

.tc-wall-card:not(.is-enabled) .tc-wall-visual,
.tc-wall-card:not(.is-enabled) .tc-grid,
.tc-wall-card:not(.is-enabled) .tc-wall-result {
    opacity: .35;
}

/* Summary */
.tc-summary-body {
    padding-bottom: 7px;
}

.tc-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 5px 6px 0;
    padding: 7px;
    border-radius: 7px;
    background: var(--tc-bg);
    color: var(--tc-muted);
    font-size: 10px;
}

.tc-total strong {
    color: var(--tc-text);
    font-size: 14px;
}

.tc-total-primary {
    background: var(--tc-green-soft);
    color: #a7f3d0;
}

.tc-total-primary strong {
    color: var(--tc-green-light);
}

.tc-summary h3 {
    margin: 9px 6px 5px;
    font-size: 11px;
}

.tc-summary-list {
    display: grid;
    gap: 4px;
    padding: 0 6px;
}

.tc-summary-item {
    padding: 6px;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    background: var(--tc-bg);
}

.tc-summary-item strong,
.tc-summary-item span {
    display: block;
    overflow-wrap: anywhere;
}

.tc-summary-item strong {
    font-size: 10px;
}

.tc-summary-item span {
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 8px;
    line-height: 1.35;
}

.tc-note {
    margin: 7px 6px 0;
    color: var(--tc-muted-dark);
    font-size: 8px;
    line-height: 1.35;
}

/* Large desktop */
@media (min-width: 1700px) {
    .tc-layout {
        grid-template-columns: 200px minmax(0, 1fr) 285px;
        gap: 10px;
    }

    .tc-room-content {
        grid-template-columns: minmax(310px, .7fr) minmax(600px, 1.3fr);
    }
}

/* Small desktop / tablet landscape */
@media (max-width: 1280px) {
    .tc-layout {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .tc-summary {
        position: static;
        grid-column: 1 / -1;
    }

    .tc-summary-body {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 6px;
    }

    .tc-summary-body>.tc-total {
        margin: 0;
    }

    .tc-summary-body>h3,
    .tc-summary-list,
    .tc-note {
        grid-column: 1 / -1;
    }

    .tc-summary-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0;
    }

    .tc-note {
        margin: 0;
    }

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

/* Tablet portrait */
@media (max-width: 980px) {
    .tc-shell {
        padding: 0 7px;
    }

    .tc-layout {
        grid-template-columns: 1fr;
    }

    .tc-room-nav,
    .tc-summary {
        position: static;
    }

    .tc-room-list {
        display: flex;
        gap: 5px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .tc-room-list button {
        min-width: 145px;
    }

    .tc-room-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "step1"
            "step2"
            "step3";
    }

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

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

    .plan-svg {
        max-height: 215px;
    }
}

/* Mobile */
@media (max-width: 700px) {
    .tc-page {
        padding-top: 6px;
    }

    .tc-shell {
        padding: 0 5px;
    }

    .tc-layout {
        gap: 6px;
    }

    .tc-room-header {
        padding: 7px;
    }

    .room-name {
        font-size: 16px;
    }

    .duplicate-room {
        width: 30px;
        padding: 0;
        font-size: 0;
    }

    .tc-room-content {
        gap: 6px;
        padding: 6px;
    }

    .tc-section {
        padding: 8px;
    }

    .tc-step-1 .tc-grid-3,
    .tc-grid-3,
    .tc-grid-2,
    .tc-option-fields,
    .skirting-fields,
    .tc-wall-settings,
    .tc-surface-grid,
    .tc-wall-grid {
        grid-template-columns: 1fr;
    }

    .tc-field input,
    .tc-field select {
        height: 42px;
        font-size: 16px;
    }

    .tc-readonly-value {
        min-height: 42px;
        font-size: 14px;
    }

    .tc-switch-row,
    .tc-main-toggle {
        min-height: 38px;
    }

    .tc-wall-visual {
        height: 60px;
    }

    .tc-wall-fill span {
        display: block;
        font-size: 10px;
    }

    .tc-wall-fill b {
        font-size: 10px;
    }

    .tc-wall-card header strong {
        font-size: 13px;
    }

    .tc-wall-card header small,
    .tc-wall-check,
    .tc-wall-result {
        font-size: 10px;
    }

    .tc-summary-body {
        grid-template-columns: 1fr;
    }

    .tc-summary-body>h3,
    .tc-summary-list,
    .tc-note {
        grid-column: auto;
    }

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

    .plan-svg {
        max-height: 205px;
    }
}

/* Small mobile */
@media (max-width: 430px) {
    .tc-page-header {
        margin-bottom: 5px;
    }

    .tc-panel-head {
        padding: 6px 7px;
    }

    .tc-room-list button {
        min-width: 135px;
    }

    .tc-room-content {
        padding: 5px;
    }

    .tc-section {
        padding: 7px;
    }

    .tc-plan-card,
    .tc-option-card,
    .tc-wall-card {
        padding: 6px;
    }

    .plan-svg {
        max-height: 185px;
    }
}

/* =========================================================
   WINDOW OPENING
   HTML is ready; JavaScript will calculate later.
   ========================================================= */

.tc-window-panel {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    margin-top: 7px;
    padding: 7px;
    border: 1px solid var(--tc-border);
    border-radius: 8px;
    background: var(--tc-panel);
}

.tc-window-toggle {
    min-width: 0;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tc-window-toggle>input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tc-window-toggle>.material-symbols-rounded {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--tc-panel-3);
    color: var(--tc-green-light);
    font-size: 16px;
}

.tc-window-toggle>span:nth-of-type(2) {
    min-width: 0;
}

.tc-window-toggle strong,
.tc-window-toggle small {
    display: block;
}

.tc-window-toggle strong {
    font-size: 11px;
}

.tc-window-toggle small {
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 8px;
    line-height: 1.25;
}

.tc-window-toggle i {
    position: relative;
    width: 32px;
    height: 18px;
    border-radius: 999px;
    background: var(--tc-border-soft);
}

.tc-window-toggle i::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s ease;
}

.tc-window-toggle input:checked~i {
    background: var(--tc-green);
}

.tc-window-toggle input:checked~i::after {
    transform: translateX(14px);
}

.tc-window-fields {
    min-width: 0;
    display: grid;
    grid-template-columns: 1.15fr .65fr .65fr .55fr .75fr;
    gap: 6px;
    align-items: end;
}

.tc-window-result {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 0 7px;
    border: 1px solid var(--tc-green-border);
    border-radius: 6px;
    background: var(--tc-green-soft);
    color: #a7f3d0;
    font-size: 9px;
}

.tc-window-result strong {
    color: var(--tc-green-light);
    font-size: 11px;
    white-space: nowrap;
}

.tc-window-panel.is-disabled .tc-window-fields {
    display: none;
}

.tc-wall-window-deduction {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    padding: 4px 5px;
    border-radius: 5px;
    background: rgba(59, 130, 246, .08);
    color: var(--tc-muted);
    font-size: 8px;
}

.tc-wall-window-deduction .material-symbols-rounded {
    color: #93c5fd;
    font-size: 12px;
}

.tc-wall-window-deduction strong {
    margin-left: auto;
    color: #bfdbfe;
    font-size: 9px;
}

.tc-wall-card.has-window {
    border-color: rgba(59, 130, 246, .55);
}

.tc-wall-card.has-window header::before {
    content: "Cửa sổ";
    order: 3;
    margin-left: auto;
    padding: 2px 4px;
    border-radius: 999px;
    background: rgba(59, 130, 246, .12);
    color: #93c5fd;
    font-size: 8px;
    font-weight: 900;
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .tc-window-panel {
        grid-template-columns: 140px minmax(0, 1fr);
    }

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

    .tc-window-result {
        grid-column: 1 / -1;
    }
}

@media (max-width: 980px) {
    .tc-window-panel {
        grid-template-columns: 1fr;
    }

    .tc-window-toggle {
        grid-template-columns: 24px minmax(0, 1fr) 32px;
    }
}

@media (max-width: 700px) {
    .tc-window-panel {
        padding: 7px;
    }

    .tc-window-toggle {
        min-height: 38px;
    }

    .tc-window-toggle strong {
        font-size: 13px;
    }

    .tc-window-toggle small {
        font-size: 10px;
    }

    .tc-window-fields {
        grid-template-columns: 1fr 1fr;
    }

    .tc-window-fields .tc-field:first-child,
    .tc-window-result {
        grid-column: 1 / -1;
    }

    .tc-window-result {
        min-height: 42px;
        font-size: 11px;
    }

    .tc-window-result strong {
        font-size: 14px;
    }

    .tc-wall-window-deduction {
        font-size: 10px;
    }

    .tc-wall-window-deduction strong {
        font-size: 10px;
    }
}

@media (max-width: 430px) {
    .tc-window-fields {
        grid-template-columns: 1fr;
    }

    .tc-window-fields .tc-field:first-child,
    .tc-window-result {
        grid-column: auto;
    }
}

/* =========================================================
   REPORT / PDF / SHARE
   ========================================================= */

.tc-report-panel {
    margin: 7px 6px 0;
    padding: 7px;
    border: 1px solid var(--tc-border);
    border-radius: 7px;
    background: var(--tc-bg);
}

.tc-report-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tc-report-panel-head strong,
.tc-report-panel-head small {
    display: block;
}

.tc-report-panel-head strong {
    font-size: 11px;
}

.tc-report-panel-head small {
    margin-top: 1px;
    color: var(--tc-muted);
    font-size: 8px;
}

.tc-report-panel-head>.material-symbols-rounded {
    color: var(--tc-green-light);
    font-size: 17px;
}

.tc-report-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
}

.tc-report-fields textarea {
    width: 100%;
    min-height: 48px;
    resize: vertical;
    padding: 7px 8px;
    border: 1px solid var(--tc-border-soft);
    border-radius: 6px;
    background: var(--tc-panel);
    color: var(--tc-text);
    font-size: 11px;
    line-height: 1.4;
    outline: none;
}

.tc-report-fields textarea:focus {
    border-color: var(--tc-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, .10);
}

.tc-report-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.tc-report-actions .tc-report-button {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .tc-report-actions {
        gap: 6px;
    }

    .tc-report-actions .tc-report-button {
        font-size: 9px;
        padding: 9px 5px;
    }

    .tc-report-actions .material-symbols-rounded {
        font-size: 12px;
    }
}

.tc-report-button {
    min-height: 33px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 7px;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    background: var(--tc-panel-3);
    color: var(--tc-text);
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
}

.tc-report-button:hover {
    border-color: var(--tc-green-border);
}

.tc-report-button .material-symbols-rounded {
    font-size: 14px;
}

.tc-report-button-primary {
    border-color: var(--tc-green-border);
    background: var(--tc-green);
    color: #022c22;
}

.tc-report-button:disabled {
    opacity: .55;
    cursor: wait;
}

.tc-report-status {
    min-height: 14px;
    margin: 5px 0 0;
    color: var(--tc-muted);
    font-size: 8px;
    line-height: 1.35;
}

.tc-report-status.is-error {
    color: #fca5a5;
}

.tc-report-status.is-success {
    color: var(--tc-green-light);
}

/* =========================================================
   PDF REPORT
   Fixed A4 layout, compact spacing, mobile-safe rendering
   ========================================================= */

/*
 * html2pdf/html2canvas must render from a fixed desktop-sized source.
 * Keep this host outside the viewport, but never use display:none or
 * visibility:hidden because canvas measurement would become unreliable.
 */
.tc-pdf-host {
    position: fixed !important;
    top: 0 !important;
    left: -10000px !important;
    z-index: -1 !important;

    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: visible !important;
    pointer-events: none !important;

    background: #fff !important;
    color: #111827 !important;
}

.tc-pdf-report {
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;

    margin: 0 !important;
    padding: 18px 24px 16px !important;

    overflow: visible !important;
    transform: none !important;
    zoom: 1 !important;

    box-sizing: border-box !important;

    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 10px !important;
    line-height: 1.22 !important;

    color: #1f2937 !important;
    background: #fff !important;
}

.tc-pdf-report,
.tc-pdf-report *,
.tc-pdf-report *::before,
.tc-pdf-report *::after {
    box-sizing: border-box !important;
}

.tc-pdf-report table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
}

.tc-pdf-report th,
.tc-pdf-report td {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

/* Header */
.tc-pdf-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 14px !important;

    margin: 0 0 8px !important;
    padding: 0 0 7px !important;

    border-bottom: 2px solid #10b981 !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-header>div:first-child {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.tc-pdf-brand {
    margin: 0 0 1px !important;

    color: #047857 !important;
    font-size: 16px !important;
    line-height: 1.05 !important;
    font-weight: 900 !important;
}

.tc-pdf-title {
    margin: 0 !important;

    color: #111827 !important;
    font-size: 18px !important;
    line-height: 1.1 !important;
    font-weight: 700 !important;
}

.tc-pdf-date {
    flex: 0 0 150px !important;

    color: #6b7280 !important;
    font-size: 9px !important;
    line-height: 1.25 !important;
    text-align: right !important;
}

/* Project information */
.tc-pdf-project {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px 10px !important;

    margin: 0 0 8px !important;
    padding: 7px 9px !important;

    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;

    background: #f9fafb !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-project>div {
    min-width: 0 !important;
}

.tc-pdf-project span,
.tc-pdf-project strong {
    display: block !important;
}

.tc-pdf-project span {
    margin: 0 0 1px !important;

    color: #6b7280 !important;
    font-size: 8px !important;
    line-height: 1.15 !important;
}

.tc-pdf-project strong {
    margin: 0 !important;

    color: #111827 !important;
    font-size: 9.5px !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;

    overflow-wrap: anywhere !important;
}

.tc-pdf-project .tc-pdf-project-note {
    grid-column: 1 / -1 !important;
}

/* Overall totals */
.tc-pdf-summary {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;

    margin: 0 0 8px !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-summary-item {
    min-width: 0 !important;
    padding: 6px 8px !important;

    border: 1px solid #d1fae5 !important;
    border-radius: 6px !important;

    background: #ecfdf5 !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-summary-item span,
.tc-pdf-summary-item strong {
    display: block !important;
}

.tc-pdf-summary-item span {
    margin: 0 0 1px !important;

    color: #4b5563 !important;
    font-size: 8px !important;
    line-height: 1.15 !important;
}

.tc-pdf-summary-item strong {
    margin: 0 !important;

    color: #047857 !important;
    font-size: 13px !important;
    line-height: 1.1 !important;
}

/*
 * A room is allowed to split across pages. Keeping the whole room unbroken
 * caused the very large blank spaces visible in the old PDF.
 */
.tc-pdf-room {
    width: 100% !important;
    max-width: 100% !important;

    margin: 0 0 8px !important;
    padding: 7px 8px 8px !important;

    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;

    background: #fff !important;

    break-inside: auto !important;
    page-break-inside: auto !important;
}

.tc-pdf-room-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;

    margin: 0 0 5px !important;
    padding: 0 0 4px !important;

    border-bottom: 1px solid #e5e7eb !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
}

.tc-pdf-room-title h2 {
    min-width: 0 !important;
    margin: 0 !important;

    color: #111827 !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
}

.tc-pdf-room-title span {
    flex: 0 0 auto !important;

    color: #047857 !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

/* Room table */
.tc-pdf-table {
    margin: 0 0 5px !important;

    font-size: 9px !important;
    line-height: 1.15 !important;
}

.tc-pdf-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-table th,
.tc-pdf-table td {
    padding: 3px 5px !important;

    border: 1px solid #e5e7eb !important;

    text-align: left !important;
    vertical-align: top !important;
}

.tc-pdf-table th {
    width: 29% !important;

    background: #f3f4f6 !important;
    color: #111827 !important;
    font-weight: 700 !important;
}

.tc-pdf-table td {
    width: 71% !important;

    background: #fff !important;
    color: #1f2937 !important;
}

/* Per-wall details */
.tc-pdf-wall-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;

    margin: 0 !important;
}

.tc-pdf-wall {
    min-width: 0 !important;
    max-width: 100% !important;

    padding: 4px 5px !important;

    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;

    background: #f9fafb !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

.tc-pdf-wall strong {
    display: block !important;
    margin: 0 0 1px !important;

    color: #111827 !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
}

.tc-pdf-wall span {
    display: inline !important;
    margin: 0 !important;

    color: #6b7280 !important;
    font-size: 8px !important;
    line-height: 1.15 !important;
}

.tc-pdf-wall span+span::before {
    content: " · ";
}

/* Footer */
.tc-pdf-footer {
    margin: 5px 0 0 !important;
    padding: 5px 0 0 !important;

    border-top: 1px solid #d1d5db !important;

    color: #6b7280 !important;
    font-size: 7.5px !important;
    line-height: 1.25 !important;
    text-align: center !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

/*
 * Explicitly neutralize mobile responsive rules while html2canvas is
 * rendering. The PDF source remains 794px wide on every device.
 */
@media screen and (max-width: 768px) {

    .tc-pdf-host,
    .tc-pdf-report {
        width: 794px !important;
        min-width: 794px !important;
        max-width: 794px !important;
    }

    .tc-pdf-report {
        padding: 18px 24px 16px !important;
        font-size: 10px !important;
        transform: none !important;
        zoom: 1 !important;
    }

    .tc-pdf-header {
        display: flex !important;
        flex-direction: row !important;
    }

    .tc-pdf-project {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .tc-pdf-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .tc-pdf-wall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 700px) {
    .tc-report-button {
        min-height: 42px;
        font-size: 11px;
    }

    .tc-report-button .material-symbols-rounded {
        font-size: 17px;
    }

    .tc-report-fields textarea {
        min-height: 64px;
        font-size: 16px;
    }

    .tc-report-status {
        font-size: 10px;
    }
}

.tc-clear-draft-button {
    margin-left: auto;
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

.tc-clear-draft-button:hover {
    background: rgba(248, 113, 113, 0.22);
}

.thermal-print-host {
    display: none;
}

@media print {
    @page {
        size: 58mm auto;
        margin: 2mm;
    }

    body.is-printing-thermal * {
        visibility: hidden !important;
    }

    body.is-printing-thermal {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body.is-printing-thermal .thermal-print-host,
    body.is-printing-thermal .thermal-print-host * {
        visibility: visible !important;
    }

    body.is-printing-thermal .thermal-print-host {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 54mm;
        margin: 0;
        padding: 0;
        background: #fff;
        color: #000;
    }

    .thermal-receipt {
        width: 54mm;
        margin: 0;
        padding: 0;
        font-family:
            Arial,
            Helvetica,
            sans-serif;
        font-size: 10px;
        line-height: 1.35;
        color: #000;
    }

    .thermal-header {
        text-align: center;
        font-size: 11px;
    }

    .thermal-header strong {
        display: block;
        font-size: 16px;
        margin-bottom: 2px;
    }

    .thermal-divider {
        margin: 5px 0;
        border-top: 1px dashed #000;
    }

    .thermal-info>div,
    .thermal-line {
        margin-bottom: 2px;
    }

    .thermal-room {
        padding: 4px 0;
        border-bottom: 1px dotted #000;
        break-inside: avoid;
    }

    .thermal-room:last-child {
        border-bottom: 0;
    }

    .thermal-room-title {
        font-weight: 700;
        font-size: 11px;
        margin-bottom: 2px;
    }

    .thermal-small {
        padding-left: 6px;
        font-size: 9px;
    }

    .thermal-total {
        font-size: 11px;
        font-weight: 700;
    }

    .thermal-total>div {
        display: flex;
        justify-content: space-between;
        gap: 5px;
        margin-bottom: 3px;
    }

    .thermal-note {
        margin-top: 5px;
        font-size: 9px;
    }

    .thermal-footer {
        text-align: center;
        font-size: 9px;
    }
}

/* =========================================================
   FINAL RESPONSIVE OVERRIDES
   Cân bằng hiển thị desktop, tablet và mobile
   ========================================================= */

/* Tránh tràn ngang do nội dung dài hoặc phần tử grid */
.tc-page,
.tc-shell,
.tc-layout,
.tc-editor,
.tc-summary,
.tc-room-card,
.tc-room-content,
.tc-section,
.tc-report-panel {
    min-width: 0;
}

.tc-page {
    overflow-x: clip;
}

.tc-page img,
.tc-page svg,
.tc-page canvas {
    max-width: 100%;
}

/* Nút thao tác báo cáo: luôn cùng hàng, kích thước cân đối */
.tc-report-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
}

.tc-report-actions .tc-report-button {
    min-width: 0;
    min-height: 34px;
    padding: 0 5px;
    gap: 3px;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.15;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tc-report-actions .tc-report-button .material-symbols-rounded {
    flex: 0 0 auto;
    font-size: 14px;
}

/* Tablet ngang và laptop nhỏ */
@media screen and (min-width: 981px) and (max-width: 1366px) {
    .tc-layout {
        grid-template-columns: 175px minmax(0, 1fr);
        gap: 7px;
    }

    .tc-summary {
        grid-column: 1 / -1;
    }

    .tc-room-content {
        grid-template-columns: minmax(270px, .78fr) minmax(460px, 1.22fr);
        gap: 7px;
    }

    .tc-wall-settings {
        grid-template-columns: 1.2fr .8fr .8fr .55fr;
    }

    .tc-wall-settings .apply-height-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* Tablet dọc */
@media screen and (min-width: 701px) and (max-width: 980px) {
    .tc-shell {
        padding-inline: 8px;
    }

    .tc-room-content {
        padding: 7px;
    }

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

    .tc-grid-2,
    .tc-surface-grid,
    .tc-wall-grid,
    .tc-window-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .tc-wall-settings .apply-height-button {
        width: 100%;
    }

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

    .tc-report-note-field {
        grid-column: 1 / -1;
    }

    .tc-report-actions .tc-report-button {
        min-height: 38px;
        font-size: 10px;
    }
}

/* Mobile và điện thoại ngang */
@media screen and (max-width: 700px) {
    .tc-page {
        padding: 5px 0 16px;
    }

    .tc-shell {
        padding-inline: 5px;
    }

    .tc-page-header {
        align-items: flex-start;
        gap: 6px;
    }

    .tc-layout {
        gap: 6px;
    }

    .tc-panel-head,
    .tc-room-header {
        min-height: 44px;
    }

    .tc-room-list {
        scrollbar-width: thin;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
    }

    .tc-room-list button {
        scroll-snap-align: start;
    }

    .tc-room-content {
        padding: 6px;
    }

    .tc-section {
        padding: 8px;
    }

    .tc-field>span {
        font-size: 11px;
    }

    .tc-field input,
    .tc-field select,
    .tc-report-fields textarea {
        font-size: 16px;
    }

    .tc-grid-2,
    .tc-surface-grid,
    .tc-window-fields,
    .tc-wall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tc-grid-3,
    .tc-step-1 .tc-grid-3,
    .skirting-fields,
    .tc-wall-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tc-grid-3> :last-child,
    .tc-step-1 .tc-grid-3> :last-child,
    .skirting-fields> :last-child,
    .tc-wall-settings .apply-height-button {
        grid-column: 1 / -1;
    }

    .tc-window-fields .tc-field:first-child,
    .tc-window-result {
        grid-column: 1 / -1;
    }

    .tc-report-fields {
        grid-template-columns: 1fr;
    }

    .tc-report-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .tc-report-actions .tc-report-button {
        min-height: 40px;
        padding: 0 4px;
        font-size: 10px;
    }

    .tc-report-actions .tc-report-button .material-symbols-rounded {
        font-size: 15px;
    }

    .tc-report-status {
        font-size: 10px;
    }
}

/* Điện thoại nhỏ */
@media screen and (max-width: 430px) {
    .tc-shell {
        padding-inline: 4px;
    }

    .tc-room-header {
        gap: 5px;
        padding: 6px;
    }

    .room-name {
        font-size: 15px;
    }

    .tc-room-actions {
        gap: 4px;
    }

    .duplicate-room,
    .delete-room {
        min-height: 32px;
    }

    .tc-room-content {
        padding: 5px;
    }

    .tc-section,
    .tc-option-card,
    .tc-wall-card,
    .tc-window-panel,
    .tc-report-panel {
        padding: 7px;
    }

    .tc-grid-2,
    .tc-grid-3,
    .tc-step-1 .tc-grid-3,
    .tc-surface-grid,
    .tc-option-fields,
    .skirting-fields,
    .tc-wall-settings,
    .tc-window-fields {
        grid-template-columns: 1fr;
    }

    .tc-grid-3> :last-child,
    .tc-step-1 .tc-grid-3> :last-child,
    .skirting-fields> :last-child,
    .tc-wall-settings .apply-height-button,
    .tc-window-fields .tc-field:first-child,
    .tc-window-result {
        grid-column: auto;
    }

    .tc-wall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .tc-wall-card {
        padding: 6px;
    }

    .tc-wall-card header {
        flex-wrap: wrap;
    }

    .tc-wall-card.has-door header::after,
    .tc-wall-card.has-window header::before {
        margin-left: 0;
    }

    .tc-report-actions {
        gap: 4px;
    }

    .tc-report-actions .tc-report-button {
        min-height: 38px;
        padding: 0 3px;
        gap: 2px;
        font-size: 9px;
    }

    .tc-report-actions .tc-report-button .material-symbols-rounded {
        font-size: 14px;
    }
}

/* Màn hình cực nhỏ: vẫn giữ 3 nút trên một hàng */
@media screen and (max-width: 350px) {
    .tc-report-actions {
        gap: 3px;
    }

    .tc-report-actions .tc-report-button {
        min-height: 36px;
        padding-inline: 2px;
        font-size: 8px;
        letter-spacing: -.01em;
    }

    .tc-report-actions .tc-report-button .material-symbols-rounded {
        font-size: 13px;
    }

    .tc-wall-grid {
        grid-template-columns: 1fr;
    }
}

/* Chỉ áp dụng hiệu ứng hover trên thiết bị có chuột */
@media (hover: hover) and (pointer: fine) {

    .tc-icon-button,
    .tc-report-button,
    .duplicate-room,
    .delete-room,
    .apply-height-button,
    .tc-room-list button {
        transition: background-color .18s ease,
            border-color .18s ease,
            color .18s ease,
            transform .18s ease;
    }

    .tc-report-button:hover,
    .tc-icon-button:hover,
    .duplicate-room:hover,
    .apply-height-button:hover {
        transform: translateY(-1px);
    }
}

/* Tôn trọng cài đặt giảm chuyển động của người dùng */
@media (prefers-reduced-motion: reduce) {

    .tc-page *,
    .tc-page *::before,
    .tc-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Dài - Rộng - Cao luôn nằm trên một hàng */
@media screen and (max-width: 700px) {
    .tc-room-dimensions {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px;
    }

    .tc-room-dimensions>.tc-field {
        min-width: 0;
    }

    .tc-room-dimensions .tc-field>span {
        font-size: 10px;
    }

    .tc-room-dimensions .tc-field input {
        width: 100%;
        min-width: 0;
        height: 40px;
        padding-left: 7px;
        padding-right: 25px;
        font-size: 14px;
    }

    .tc-room-dimensions .tc-input-unit b {
        right: 6px;
        font-size: 9px;
    }
}

/* Chọn kích thước gạch nền + hao hụt: mobile vẫn 2 cột */
@media screen and (max-width: 700px) {
    .floor-fields {
        grid-template-columns: minmax(0, 1.45fr) minmax(85px, 0.55fr) !important;
        gap: 6px;
    }

    .floor-fields>.tc-field {
        min-width: 0;
    }

    .floor-fields .tc-field>span {
        font-size: 10px;
        line-height: 1.2;
    }

    .floor-fields .tc-field select,
    .floor-fields .tc-field input {
        width: 100%;
        min-width: 0;
        height: 42px;
        font-size: 14px;
    }

    .floor-fields .floor-waste {
        padding-right: 26px;
    }
}

/* Thiết lập gạch ốp tường: mobile chia 2 cột */
@media screen and (max-width: 700px) {
    .tc-wall-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px;
        align-items: end;
    }

    .tc-wall-settings>.tc-field {
        min-width: 0;
    }

    .tc-wall-settings .tc-field>span {
        font-size: 10px;
        line-height: 1.2;
    }

    .tc-wall-settings .tc-field input,
    .tc-wall-settings .tc-field select {
        width: 100%;
        min-width: 0;
        height: 42px;
        font-size: 14px;
    }

    .tc-wall-settings .apply-height-button {
        grid-column: 1 / -1;
        width: 100%;
        height: 42px;
        margin: 0;
        font-size: 12px;
    }
}

/* Chiều rộng cửa - chiều cao cửa - hao hụt: mobile 3 cột */
@media screen and (max-width: 700px) {
    .skirting-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px;
    }

    .skirting-fields> :last-child {
        grid-column: auto !important;
    }

    .skirting-fields>.tc-field {
        min-width: 0;
    }

    .skirting-fields .tc-field>span {
        font-size: 10px;
        line-height: 1.15;
    }

    .skirting-fields .tc-field input {
        width: 100%;
        min-width: 0;
        height: 42px;
        padding-left: 7px;
        padding-right: 24px;
        font-size: 14px;
    }

    .skirting-fields .tc-input-unit b {
        right: 6px;
        font-size: 9px;
    }
}