/* Coordinates Area Calculator — site-themed, mobile-friendly layout */

.ts-tool .calc-app {
    --calc-gap: 1rem;
    max-width: 100%;
}

/* Intro */
.ts-tool .calc-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.85rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
}

.ts-tool .calc-prompt {
    flex: 1 1 14rem;
    margin: 0;
}

.ts-tool .calc-prompt p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.ts-tool .help-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ts-tool .help-btn:hover {
    border-color: var(--color-primary);
    background: rgba(10, 124, 110, 0.06);
    color: var(--color-primary-hover);
}

/* Workflow chips */
.ts-tool .calc-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.ts-tool .calc-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
}

.ts-tool .calc-step i {
    color: var(--color-primary);
    font-size: 0.72rem;
}

.ts-tool .calc-step--active {
    color: var(--color-text);
    border-color: var(--color-primary);
    background: rgba(10, 124, 110, 0.08);
}

/* Input method tabs */
.ts-tool .input-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.3rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.ts-tool .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
    margin: 0;
    width: 100%;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ts-tool .tab-btn:hover {
    color: var(--color-primary);
    background: var(--color-surface);
    transform: none;
}

.ts-tool .tab-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.ts-tool .tab-btn.active:hover {
    background: var(--color-primary-hover);
    transform: none;
}

/* Two-column workspace */
.ts-tool .cac-workspace,
.ts-tool .calc-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: var(--calc-gap);
    align-items: start;
}

.ts-tool .cac-side-panel {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.ts-tool .cac-panel-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ts-tool .cac-panel-body .input-method-tabs {
    margin-bottom: 0;
}

.ts-tool .cac-panel-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-2);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.88rem;
    color: var(--color-text);
}

.ts-tool .cac-panel-head strong {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
}

.ts-tool .cac-panel-head strong i {
    color: var(--color-primary);
}

.ts-tool .calc-input-col {
    min-width: 0;
}

.ts-tool .cac-map-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    min-height: 320px;
}

.ts-tool .cac-map-chrome {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
}

.ts-tool .cac-map-chrome .cac-map-actions,
.ts-tool .cac-map-chrome .cac-map-chrome__row .cac-tool-btn {
    pointer-events: auto;
}

[data-theme="dark"] .ts-tool .cac-map-chrome {
    background: rgba(22, 30, 25, 0.96);
}

.ts-tool .cac-map-chrome__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.ts-tool .cac-map-status {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.ts-tool .cac-status-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-tool .cac-status-meta {
    font-size: 0.76rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-tool .cac-map-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
}

.ts-tool .cac-fs-exit-hint {
    display: none;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.ts-tool .cac-fs-exit-hint kbd {
    padding: 0.1rem 0.35rem;
    font-family: ui-monospace, monospace;
    font-size: 0.68rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.ts-tool .cac-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    box-shadow: none;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.ts-tool .cac-tool-btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.ts-tool .cac-tool-btn--ghost {
    background: transparent;
}

.ts-tool .cac-tool-btn--warn:hover:not(:disabled) {
    border-color: var(--color-error);
    color: var(--color-error);
}

.ts-tool .cac-floating-toolbar {
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .ts-tool .cac-floating-toolbar {
    background: rgba(22, 30, 25, 0.94);
}

.ts-tool .cac-floating-toolbar .cac-tool-btn {
    min-width: 2.25rem;
}

.ts-tool .cac-floating-toolbar .cac-tool-btn.hidden {
    display: none !important;
}

.ts-tool .cac-floating-toolbar:not(:has(.cac-tool-btn:not(.hidden))) {
    display: none;
}

.ts-tool .calc-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: clamp(0.75rem, 2.5vw, 1.15rem);
    margin-bottom: 0;
}

.ts-tool .calc-section h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-divider);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-text);
}

.ts-tool .calc-section h2 i {
    color: var(--color-primary);
}

.ts-tool .input-section {
    display: none;
}

.ts-tool .input-section.active {
    display: block;
    animation: calcFadeIn 0.25s ease;
}

@keyframes calcFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ts-tool .form-group {
    margin-bottom: 0.85rem;
}

.ts-tool .form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

/* Points table */
.ts-tool .points-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.ts-tool #pointsTable {
    width: 100%;
    min-width: 520px;
    margin: 0;
    border: 0;
}

.ts-tool #pointsTable th {
    background: var(--color-surface-2);
    font-size: 0.8rem;
    white-space: nowrap;
}

.ts-tool #pointsTable td input {
    margin: 0;
    min-width: 0;
}

.ts-tool .point-label {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
}

/* Buttons */
.ts-tool .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ts-tool .calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    margin: 0;
    width: auto;
    box-shadow: none;
}

.ts-tool .calc-btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.ts-tool .calc-btn--primary:hover {
    background: var(--color-primary-hover);
    transform: none;
}

.ts-tool .calc-btn--secondary {
    background: var(--color-surface-2);
    border-color: var(--color-border);
    color: var(--color-text);
}

.ts-tool .calc-btn--secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: none;
}

.ts-tool .calc-btn--outline {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

.ts-tool .calc-btn--outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: none;
}

.ts-tool .calc-btn--danger {
    background: transparent;
    border-color: var(--color-error-border);
    color: var(--color-error);
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
}

.ts-tool .calc-btn--danger:hover {
    background: var(--color-error-bg);
    transform: none;
}

.ts-tool .calc-btn--icon {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
}

/* Map panel */
.ts-tool .calc-map-col {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.ts-tool .calc-map-stack {
    position: relative;
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    min-width: 0;
}

.ts-tool .calc-map-stack > #coord-calc-map,
.ts-tool .calc-map-stack > .cac-floating-toolbar,
.ts-tool .calc-map-stack > .map-results {
    grid-area: 1 / 1;
    min-width: 0;
}

.ts-tool .calc-map-stack > .cac-floating-toolbar {
    align-self: start;
    justify-self: end;
    margin: 0.55rem;
    width: max-content;
    max-width: calc(100% - 5rem);
    pointer-events: auto;
}

.ts-tool .calc-map-stack > .map-results {
    align-self: end;
    justify-self: stretch;
    margin: 0 0.55rem 0.55rem;
    max-width: calc(100% - 1.1rem);
    pointer-events: auto;
}

.ts-tool .calc-map-head__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.ts-tool .calc-map-head__copy {
    min-width: 0;
    flex: 1;
}

.ts-tool .calc-map-head h3 {
    margin: 0 0 0.25rem;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text);
}

.ts-tool .calc-map-hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.ts-tool #coord-calc-map {
    position: relative;
    width: 100%;
    height: min(52vh, 480px);
    min-height: 280px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface-2);
    z-index: 1;
}

.ts-tool .map-empty-hint {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    pointer-events: none;
    background: rgba(248, 250, 249, 0.88);
}

.ts-tool .map-empty-hint i {
    font-size: 2rem;
    color: var(--color-primary);
    opacity: 0.65;
}

.ts-tool .map-empty-hint.hidden {
    display: none;
}

.ts-tool .map-results {
    position: relative;
    z-index: 999;
    width: auto;
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.45;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .ts-tool .map-results {
    background: rgba(22, 30, 25, 0.94);
}

.ts-tool #coord-calc-map .leaflet-top.leaflet-left {
    top: 0.45rem;
    left: 0.45rem;
}

.ts-tool #coord-calc-map .leaflet-top.leaflet-right {
    top: 4.35rem;
    right: 0.45rem;
}

.ts-tool #coord-calc-map .leaflet-bottom.leaflet-left {
    bottom: 3.75rem;
    left: 0.45rem;
}

.ts-tool #coord-calc-map .leaflet-bottom.leaflet-right {
    bottom: 0.45rem;
    right: 0.45rem;
}

.ts-tool .map-results:empty::before,
.ts-tool .map-results.calc-results--empty {
    color: var(--color-text-muted);
    font-weight: 500;
}

.ts-tool .map-results div + div {
    margin-top: 0.25rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

/* Results / export bar */
.ts-tool .calc-results-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    box-shadow: var(--shadow-sm);
}

.ts-tool .calc-results-bar .controls {
    margin-top: 0;
    align-items: center;
}

.ts-tool .unit-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.ts-tool .unit-group label {
    margin: 0;
    font-size: 0.82rem;
    white-space: nowrap;
}

.ts-tool select.unit-selector {
    width: auto;
    min-width: 8rem;
    flex: 1 1 8rem;
}

.ts-tool #convertSection {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-divider);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.ts-tool #convertSection label {
    margin: 0;
    font-size: 0.82rem;
}

.ts-tool .file-upload-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.ts-tool .hidden {
    display: none !important;
}

/* How it works */
.ts-tool .calc-help {
    margin-top: 1.5rem;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.ts-tool .calc-help > h2 {
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 3vw, 1.45rem);
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
    color: var(--color-text);
}

.ts-tool .calc-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: 0.75rem;
}

.ts-tool .guide-step {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.ts-tool .guide-icon-wrapper {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(10, 124, 110, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.ts-tool .guide-icon-wrapper i {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.ts-tool .guide-step h3 {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    color: var(--color-text);
}

.ts-tool .guide-step p,
.ts-tool .guide-step li {
    font-size: 0.84rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0 0 0.45rem;
}

.ts-tool .guide-step ul {
    margin: 0.5rem 0 0;
    padding-left: 1.15rem;
}

.ts-tool .mobile-label {
    display: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

[data-theme="dark"] .ts-tool .map-empty-hint {
    background: rgba(22, 30, 25, 0.9);
}

/* Fullscreen map — edge-to-edge with zoned floating UI */
body.cac-fs-open {
    overflow: hidden;
}

body.cac-fs-open .cac-workspace {
    display: block;
}

.ts-tool .cac-map-stage.is-fullscreen {
    --cac-fs-pad: 1rem;
    --cac-fs-panel-w: min(22rem, calc(100dvw - 2rem));
    --cac-fs-collapsed-w: 11rem;
    --cac-fs-stack-left: var(--cac-fs-pad);
    --cac-fs-stack-right: var(--cac-fs-pad);
    --cac-fs-chrome-h: 4rem;
    --cac-fs-toolbar-h: 3.25rem;
    --cac-fs-results-overlay: 3.75rem;
    position: fixed;
    inset: 0;
    z-index: 9990;
    width: 100%;
    height: 100dvh;
    min-height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    gap: 0;
    border-radius: 0;
    border: 0;
    background: #eef3f1;
    overflow: hidden;
}

body.cac-fs-open:not(.cac-panel-collapsed) .ts-tool .cac-map-stage.is-fullscreen {
    --cac-fs-stack-right: calc(var(--cac-fs-panel-w) + var(--cac-fs-pad) + 0.35rem);
}

body.cac-fs-open.cac-panel-collapsed .ts-tool .cac-map-stage.is-fullscreen {
    --cac-fs-stack-right: calc(var(--cac-fs-collapsed-w) + var(--cac-fs-pad) + 0.35rem);
}

[data-theme="dark"] .ts-tool .cac-map-stage.is-fullscreen {
    background: #0f1714;
}

.ts-tool .cac-map-stage.is-fullscreen .cac-map-chrome {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    position: absolute;
    top: var(--cac-fs-pad);
    left: var(--cac-fs-stack-left);
    right: auto;
    z-index: 20;
    width: min(20rem, calc(100dvw - var(--cac-fs-stack-left) - var(--cac-fs-stack-right) - 7rem));
    max-width: calc(100dvw - var(--cac-fs-stack-left) - var(--cac-fs-stack-right) - 7rem);
    padding: 0.5rem 0.65rem;
    margin: 0;
    pointer-events: auto;
}

.ts-tool .cac-map-stage.is-fullscreen .cac-map-chrome__row .cac-tool-btn {
    flex-shrink: 0;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0.35rem 0.5rem;
}

.ts-tool .cac-map-chrome #cacFullscreenChrome {
    display: none;
}

.ts-tool .cac-map-stage.is-fullscreen .cac-map-chrome #cacFullscreenChrome {
    display: inline-flex;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-map-head {
    display: none;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-map-col {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-map-stack {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
}

.ts-tool .cac-map-stage.is-fullscreen #coord-calc-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-map-stack > .cac-floating-toolbar {
    align-self: start;
    justify-self: end;
    margin: var(--cac-fs-pad) var(--cac-fs-stack-right) auto auto;
    max-width: min(14rem, calc(100% - var(--cac-fs-stack-left) - var(--cac-fs-stack-right) - 1rem));
    z-index: 19;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-map-stack > .map-results {
    align-self: end;
    margin: 0 var(--cac-fs-stack-right) 0.5rem var(--cac-fs-stack-left);
    max-width: none;
    z-index: 17;
}

.ts-tool .cac-map-stage.is-fullscreen .calc-results-bar {
    position: relative;
    flex-shrink: 0;
    margin: 0 var(--cac-fs-stack-right) var(--cac-fs-pad) var(--cac-fs-stack-left);
    z-index: 17;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ts-tool .cac-map-stage.is-fullscreen #coord-calc-map .leaflet-top.leaflet-left {
    top: calc(var(--cac-fs-pad) + var(--cac-fs-chrome-h));
    left: var(--cac-fs-stack-left);
}

.ts-tool .cac-map-stage.is-fullscreen #coord-calc-map .leaflet-top.leaflet-right {
    top: calc(var(--cac-fs-pad) + var(--cac-fs-toolbar-h) + 0.35rem);
    right: var(--cac-fs-stack-right);
    left: auto;
}

.ts-tool .cac-map-stage.is-fullscreen #coord-calc-map .leaflet-bottom.leaflet-left {
    bottom: var(--cac-fs-results-overlay);
    left: var(--cac-fs-stack-left);
}

.ts-tool .cac-map-stage.is-fullscreen #coord-calc-map .leaflet-bottom.leaflet-right {
    bottom: 0.5rem;
    right: var(--cac-fs-stack-right);
}

body.cac-fs-open .cac-side-panel {
    position: fixed;
    top: var(--cac-fs-pad, 1rem);
    right: var(--cac-fs-pad, 1rem);
    bottom: var(--cac-fs-pad, 1rem);
    left: auto;
    width: var(--cac-fs-panel-w, min(22rem, calc(100dvw - 2rem)));
    min-height: 0;
    max-height: calc(100vh - 2rem);
    z-index: 9995;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}

[data-theme="dark"] body.cac-fs-open .cac-side-panel {
    background: rgba(22, 30, 25, 0.98);
}

body.cac-fs-open .cac-side-panel.is-fs-collapsed {
    top: auto;
    bottom: var(--cac-fs-pad, 1rem);
    width: min(11rem, calc(100dvw - 2rem));
    height: auto;
    min-height: 0;
    max-height: 2.85rem;
    overflow: hidden;
}

body.cac-fs-open .cac-side-panel.is-fs-collapsed .cac-panel-body {
    display: none;
}

body.cac-fs-open .cac-panel-head {
    display: flex;
    flex-shrink: 0;
}

body.cac-fs-open .cac-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.65rem 0.75rem 0.75rem;
    gap: 0.65rem;
}

body.cac-fs-open .cac-panel-body .input-method-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-bottom: 0;
    background: var(--color-surface-2);
}

body.cac-fs-open .cac-panel-body .calc-section {
    margin-bottom: 0;
}

@media (max-width: 991px) {
    .ts-tool .cac-workspace,
    .ts-tool .calc-workspace {
        grid-template-columns: 1fr;
    }

    body.cac-fs-open .cac-side-panel {
        --cac-fs-panel-w: min(18rem, calc(100dvw - 1.25rem));
        right: 0.65rem;
        top: 0.65rem;
        bottom: 0.65rem;
    }

    .ts-tool .cac-map-stage.is-fullscreen {
        --cac-fs-pad: 0.65rem;
    }

    .ts-tool .cac-map-stage.is-fullscreen .cac-map-chrome {
        width: min(17rem, calc(100dvw - var(--cac-fs-stack-left) - var(--cac-fs-stack-right) - 5rem));
        max-width: calc(100dvw - var(--cac-fs-stack-left) - var(--cac-fs-stack-right) - 5rem);
    }

    .ts-tool .cac-map-stage.is-fullscreen .cac-map-chrome .cac-tool-label {
        display: none;
    }

    .ts-tool .cac-map-stage.is-fullscreen .cac-floating-toolbar .cac-tool-label {
        display: none;
    }

    .ts-tool #coord-calc-map {
        height: min(45vh, 400px);
        min-height: 260px;
    }
}

@media (max-width: 767px) {
    .ts-tool .calc-steps {
        display: none;
    }

    .ts-tool .input-method-tabs {
        grid-template-columns: 1fr;
    }

    .ts-tool .form-row-2 {
        grid-template-columns: 1fr;
    }

    .ts-tool .controls .calc-btn {
        flex: 1 1 100%;
    }

    .ts-tool .points-table-wrap {
        border: 0;
        overflow: visible;
    }

    .ts-tool #pointsTable {
        min-width: 0;
    }

    .ts-tool #pointsTable,
    .ts-tool #pointsTable thead,
    .ts-tool #pointsTable tbody,
    .ts-tool #pointsTable th,
    .ts-tool #pointsTable td,
    .ts-tool #pointsTable tr {
        display: block;
        width: 100%;
    }

    .ts-tool #pointsTable thead {
        display: none;
    }

    .ts-tool #pointsTable tbody {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }

    .ts-tool #pointsTable tbody tr {
        padding: 0.75rem;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
    }

    .ts-tool #pointsTable td {
        border: 0;
        padding: 0.35rem 0;
    }

    .ts-tool .mobile-label {
        display: block;
    }

    .ts-tool .map-results {
        font-size: 0.82rem;
        padding: 0.55rem 0.65rem;
    }

    .ts-tool .cac-map-stage.is-fullscreen {
        --cac-fs-chrome-h: 4.5rem;
        --cac-fs-toolbar-h: 3rem;
        --cac-fs-results-overlay: 4.25rem;
    }
}