:root {
    --bg: #071726;
    --bg-soft: #0b2235;
    --bg-card: #102b40;

    --border: rgba(255,255,255,.10);

    --text: #eef5fa;
    --muted: #8fa5b5;

    --orange: #f5823d;
    --green: #50b97b;
    --red: #cf5252;

    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}


.app {
    min-height: 100vh;
}


.header {
    min-height: 76px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 24px;

    background: var(--bg-soft);

    border-bottom:
        1px solid var(--border);
}


.brand {
    color: var(--orange);

    font-size: 14px;
    font-weight: 800;

    letter-spacing: .14em;
}


.subtitle {
    margin-top: 4px;

    font-size: 22px;
    font-weight: 700;
}


.status {
    padding: 8px 12px;

    border:
        1px solid var(--border);

    border-radius: 5px;

    font-size: 13px;
    color: var(--muted);
}


.status.ok {
    color: var(--green);

    border-color:
        rgba(80,185,123,.4);
}


.workspace {
    display: grid;

    grid-template-columns:
        270px 1fr;

    min-height:
        calc(100vh - 76px);
}


.sidebar {
    background: var(--bg-soft);

    border-right:
        1px solid var(--border);

    overflow-y: auto;
}


.sidebar-section {
    padding: 20px;

    border-bottom:
        1px solid var(--border);
}


.sidebar h2,
.object-panel h2 {
    margin:
        0 0 14px;

    font-size: 14px;

    color: var(--muted);

    text-transform: uppercase;

    letter-spacing: .07em;
}


.project-list,
.revision-list {
    display: grid;
    gap: 8px;
}


.project-item,
.revision-item {
    width: 100%;

    border:
        1px solid var(--border);

    background: transparent;

    color: var(--text);

    text-align: left;

    padding: 12px;

    cursor: pointer;

    border-radius: 4px;

    transition: .15s ease;
}


.project-item:hover,
.revision-item:hover {
    border-color: var(--green);
}


.project-item.active,
.revision-item.active {
    border-color: var(--orange);

    background:
        rgba(245,130,61,.10);
}


.project-item-code {
    color: var(--orange);

    font-weight: 700;

    margin-bottom: 5px;
}


.project-item-name {
    font-size: 13px;
    line-height: 1.4;
}


.revision-number {
    font-weight: 700;
}


.revision-status {
    margin-top: 5px;

    font-size: 12px;

    color: var(--muted);
}


.empty {
    color: var(--muted);

    font-size: 13px;
}


.hidden {
    display: none !important;
}


.main {
    padding: 24px;

    min-width: 0;
}


.project-header {
    display: flex;

    align-items: flex-end;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 18px;
}


.project-header h1 {
    margin:
        3px 0 7px;

    font-size: 28px;
}


.project-code {
    color: var(--orange);

    font-size: 12px;

    letter-spacing: .12em;

    font-weight: 700;
}


#revision-info {
    color: var(--muted);
}


.stats {
    display: flex;

    flex-wrap: wrap;

    justify-content: flex-end;

    gap: 6px;
}


.stat {
    padding: 7px 9px;

    background: var(--bg-card);

    border:
        1px solid var(--border);

    border-radius: 4px;

    font-size: 12px;
}


.editor-toolbar {
    min-height: 56px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 12px;

    padding: 8px 10px;

    background: var(--bg-soft);

    border:
        1px solid var(--border);

    border-radius: 5px;
}


.toolbar-group {
    display: flex;
    align-items: center;

    gap: 8px;
}


.toolbar-info {
    margin-left: auto;

    color: var(--muted);

    font-size: 12px;
}


.tool-button {
    border:
        1px solid var(--border);

    background: var(--bg);

    color: var(--text);

    min-height: 36px;

    padding: 0 12px;

    border-radius: 4px;

    cursor: pointer;
}


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


.tool-button.active {
    border-color: var(--orange);

    color: var(--orange);
}


.point-tools select,
.point-tools input {
    height: 36px;

    padding: 0 10px;

    border:
        1px solid var(--border);

    border-radius: 4px;

    background: var(--bg);

    color: var(--text);
}


.point-tools input {
    width: 160px;
}


.viewer-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr) 300px;

    gap: 16px;
}


.viewer-panel,
.object-panel {
    border:
        1px solid var(--border);

    background: var(--bg-soft);

    border-radius: 5px;

    overflow: hidden;
}


.viewer-toolbar {
    min-height: 52px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding:
        10px 14px;

    border-bottom:
        1px solid var(--border);

    font-weight: 700;
}


.viewer-toolbar select {
    max-width: 300px;

    background: var(--bg);

    color: var(--text);

    border:
        1px solid var(--border);

    padding: 8px 10px;

    border-radius: 4px;
}


.plan-container {
    height:
        calc(100vh - 285px);

    min-height: 520px;

    overflow: hidden;

    background:
        #f6f7f8;

    position: relative;
}


.plan-container.add-mode {
    cursor: crosshair;
}


.empty-view {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #67737c;
}


.plan-svg {
    width: 100%;
    height: 100%;

    display: block;

    background: #f8fafb;
}


.grid-line {
    stroke: #dfe5e8;

    stroke-width: 3;

    pointer-events: none;
}


.route {
    fill: none;

    stroke: #e16f2d;

    stroke-width: 35;

    stroke-linecap: round;
    stroke-linejoin: round;

    cursor: pointer;
}


.route:hover {
    stroke: #36a56c;
}


.point {
    fill: #f5823d;

    stroke: #071726;

    stroke-width: 20;

    cursor: grab;
}


.point:hover {
    fill: #50b97b;
}


.point.dragging {
    fill: #50b97b;

    cursor: grabbing;
}


.point.selected {
    stroke: #50b97b;

    stroke-width: 35;
}


.panel {
    fill: #071726;

    stroke: #f5823d;

    stroke-width: 25;

    cursor: pointer;
}


.panel:hover {
    stroke: #50b97b;
}


.plan-label {
    font-size: 170px;

    font-family:
        Arial,
        sans-serif;

    fill: #071726;

    pointer-events: none;
}


.object-panel {
    padding: 18px;

    overflow-y: auto;

    max-height:
        calc(100vh - 168px);
}


.object-details {
    display: grid;
    gap: 12px;
}


.detail-group {
    padding-bottom: 12px;

    border-bottom:
        1px solid var(--border);
}


.detail-label {
    margin-bottom: 4px;

    color: var(--muted);

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: .05em;
}


.detail-value {
    font-size: 14px;

    word-break: break-word;
}


.detail-title {
    color: var(--orange);

    font-size: 18px;

    font-weight: 700;
}


.danger-button {
    width: 100%;

    margin-top: 18px;

    padding: 10px 12px;

    border:
        1px solid rgba(207,82,82,.6);

    background:
        rgba(207,82,82,.10);

    color: #ff8f8f;

    border-radius: 4px;

    cursor: pointer;
}


.danger-button:hover {
    background:
        rgba(207,82,82,.20);
}


@media (max-width: 1100px) {

    .workspace {
        grid-template-columns:
            220px 1fr;
    }

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

    .object-panel {
        max-height: none;
    }

    .editor-toolbar {
        align-items: flex-start;

        flex-direction: column;
    }

    .toolbar-info {
        margin-left: 0;
    }
}


@media (max-width: 760px) {

    .workspace {
        display: block;
    }

    .sidebar {
        border-right: 0;

        border-bottom:
            1px solid var(--border);
    }

    .project-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .stats {
        justify-content: flex-start;
    }

    .main {
        padding: 14px;
    }

    .plan-container {
        height: 65vh;
        min-height: 420px;
    }

    .point-tools {
        width: 100%;

        flex-wrap: wrap;
    }

    .point-tools input,
    .point-tools select {
        flex: 1 1 180px;

        width: auto;
    }
}

.panel-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;

    margin: -18px -18px 18px;

    border-bottom: 1px solid var(--border);
}

.panel-tab {
    padding: 13px 8px;

    border: 0;

    background: transparent;
    color: var(--muted);

    cursor: pointer;
}

.panel-tab.active {
    background: rgba(245,130,61,.08);
    color: var(--orange);

    box-shadow:
        inset 0 -2px 0 var(--orange);
}


.engineering-section {
    padding-bottom: 16px;
    margin-bottom: 16px;

    border-bottom:
        1px solid var(--border);
}


.engineering-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 8px;

    margin-bottom: 10px;
}


.engineering-title {
    font-size: 12px;
    font-weight: 700;

    color: var(--muted);

    text-transform: uppercase;

    letter-spacing: .06em;
}


.engineering-list {
    display: grid;
    gap: 7px;

    margin-top: 10px;
}


.engineering-item {
    padding: 10px;

    border:
        1px solid var(--border);

    border-radius: 4px;

    background:
        rgba(255,255,255,.025);

    cursor: pointer;
}


.engineering-item:hover {
    border-color: var(--green);
}


.engineering-item.active {
    border-color: var(--orange);

    background:
        rgba(245,130,61,.08);
}


.engineering-item-title {
    font-weight: 700;

    margin-bottom: 4px;
}


.engineering-item-meta {
    font-size: 12px;

    color: var(--muted);
}


.engineering-form {
    display: grid;

    gap: 8px;

    padding: 12px;

    margin-bottom: 16px;

    border:
        1px solid var(--border);

    background:
        rgba(255,255,255,.025);

    border-radius: 4px;
}


.engineering-form input,
.engineering-form select,
.engineering-section select,
.full-select {
    width: 100%;

    min-height: 36px;

    padding: 0 9px;

    border:
        1px solid var(--border);

    border-radius: 4px;

    background: var(--bg);

    color: var(--text);
}


.form-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 8px;
}


.primary-button,
.mini-button {
    border:
        1px solid var(--orange);

    background:
        rgba(245,130,61,.10);

    color: var(--orange);

    border-radius: 4px;

    cursor: pointer;
}


.primary-button {
    min-height: 38px;

    padding: 8px 12px;

    margin-top: 8px;
}


.mini-button {
    padding: 5px 7px;

    font-size: 11px;
}


.primary-button:hover,
.mini-button:hover {
    border-color: var(--green);

    color: var(--green);
}


.engineering-point {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 8px;

    padding: 8px;

    border:
        1px solid var(--border);

    border-radius: 4px;
}


.unlink-button {
    border: 0;

    background: transparent;

    color: #ff8f8f;

    cursor: pointer;
}

/* ============================================================
   FIX: RIGHT PANEL TABS CLICKABILITY
   ============================================================ */

.object-panel {
    position: relative;
}

.panel-tabs {
    position: relative;
    z-index: 100;

    pointer-events: auto;
}

.panel-tab {
    position: relative;
    z-index: 101;

    pointer-events: auto;

    cursor: pointer;
}

.panel-tab * {
    pointer-events: none;
}

#object-tab-content,
#engineering-tab-content {
    position: relative;
    z-index: 1;
}


/* ============================================================
   v0.7.0 — GROUP WIZARD
   ============================================================ */

.point.multi-selected {
    fill: #50b97b;
    stroke: #071726;
    stroke-width: 40;
}

.modal {
    position: fixed;
    inset: 0;

    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background:
        rgba(3, 13, 22, .82);
}

.modal-card {
    width: min(850px, 100%);

    max-height: 90vh;
    overflow-y: auto;

    padding: 24px;

    border:
        1px solid var(--border);

    border-radius: 6px;

    background: var(--bg-soft);

    box-shadow:
        0 25px 80px rgba(0,0,0,.45);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 5px 0 0;

    font-size: 24px;
}

.modal-close {
    width: 36px;
    height: 36px;

    border:
        1px solid var(--border);

    background: transparent;

    color: var(--text);

    font-size: 24px;

    cursor: pointer;
}

.wizard-section {
    margin-bottom: 22px;
    padding-bottom: 22px;

    border-bottom:
        1px solid var(--border);
}

.wizard-section h3 {
    margin:
        0 0 13px;

    color: var(--orange);

    font-size: 15px;
}

.wizard-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}

.wizard-grid label {
    display: grid;

    gap: 6px;

    color: var(--muted);

    font-size: 12px;
}

.wizard-grid input,
.wizard-grid select {
    min-height: 40px;

    padding: 0 10px;

    border:
        1px solid var(--border);

    border-radius: 4px;

    background: var(--bg);

    color: var(--text);
}

.wizard-submit {
    width: 100%;

    min-height: 46px;

    font-size: 14px;
    font-weight: 700;
}

#wizard-selected-points {
    display: flex;
    flex-wrap: wrap;

    gap: 6px;
}

.wizard-point {
    padding: 6px 8px;

    border:
        1px solid var(--green);

    border-radius: 4px;

    color: var(--green);

    font-size: 12px;
}

@media (max-width: 700px) {

    .wizard-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 10px;
    }

}

/* ============================================================
   v0.8.1 — BUILDING / WALL EDITOR
   ============================================================ */

.wall-line {
    stroke: #627789;
    stroke-linecap: square;
    cursor: pointer;
    pointer-events: stroke;
}

.wall-line:hover {
    stroke: #f5823d;
}

.wall-draft {
    fill: none;
    stroke: #f5823d;
    stroke-width: 55;
    stroke-dasharray: 140 80;
    stroke-linecap: round;
    pointer-events: none;
}

.wall-label {
    fill: #314657;
    font-size: 150px;
    font-weight: 700;
    pointer-events: none;
}

#wall-tools {
    flex-wrap: wrap;
}

#wall-tools label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

#wall-tools input,
#wall-tools select {
    min-height: 34px;
    max-width: 145px;
}
