/* =========================================================
   DRAFTX CAD — APP 06
   PROFESSIONAL CAD WORKSPACE
========================================================= */

/* =========================================================
   ROOT VARIABLES
========================================================= */

:root {

    --cad-blue: #38bdf8;
    --cad-blue-dark: #0ea5e9;
    --cad-blue-light: #7dd3fc;
    --cad-blue-soft: rgba(56, 189, 248, 0.12);
    --cad-blue-glow: rgba(56, 189, 248, 0.28);

    --cad-cyan: #22d3ee;
    --cad-cyan-dark: #06b6d4;
    --cad-cyan-light: #67e8f9;

    --cad-amber: #f59e0b;
    --cad-amber-light: #fbbf24;
    --cad-amber-soft: rgba(245, 158, 11, 0.12);

    --cad-green: #22c55e;
    --cad-red: #ef4444;
    --cad-purple: #8b5cf6;

    --bg-main: #071018;
    --bg-sidebar: #09131c;
    --bg-panel: #0b1721;
    --bg-card: #0f1c27;
    --bg-elevated: #13222e;
    --bg-input: #0a141d;
    --bg-hover: #142735;
    --bg-active: #183343;

    --canvas-bg: #081219;
    --canvas-grid: rgba(100, 180, 210, 0.075);
    --canvas-major-grid: rgba(100, 180, 210, 0.14);

    --text-primary: #e8f4fa;
    --text-secondary: #9db1bd;
    --text-muted: #607783;
    --text-dim: #405761;

    --border: rgba(150, 200, 220, 0.10);
    --border-light: rgba(150, 200, 220, 0.16);
    --border-strong: rgba(56, 189, 248, 0.28);

    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.20);
    --shadow-md: 0 12px 35px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 25px 70px rgba(0, 0, 0, 0.42);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --header-height: 58px;
    --tabs-height: 42px;
    --command-height: 42px;
    --status-height: 28px;

    --left-panel-width: 208px;
    --right-panel-width: 292px;

    --transition-fast: 140ms ease;
    --transition-normal: 220ms ease;
    --transition-slow: 350ms ease;

    --font-main: "Inter", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
}


/* =========================================================
   LIGHT MODE
========================================================= */

body.light-mode {

    --bg-main: #edf4f7;
    --bg-sidebar: #f7fbfc;
    --bg-panel: #f8fbfc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-input: #eef5f7;
    --bg-hover: #e5f1f5;
    --bg-active: #d9edf4;

    --canvas-bg: #f7fbfc;
    --canvas-grid: rgba(45, 120, 150, 0.10);
    --canvas-major-grid: rgba(45, 120, 150, 0.18);

    --text-primary: #132630;
    --text-secondary: #506975;
    --text-muted: #718893;
    --text-dim: #9aabb2;

    --border: rgba(30, 80, 100, 0.12);
    --border-light: rgba(30, 80, 100, 0.18);
    --border-strong: rgba(14, 165, 233, 0.30);

    --shadow-sm: 0 4px 14px rgba(20, 70, 90, 0.08);
    --shadow-md: 0 12px 35px rgba(20, 70, 90, 0.12);
    --shadow-lg: 0 25px 70px rgba(20, 70, 90, 0.16);
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100%;
    overflow: hidden;
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    transition:
        background var(--transition-normal),
        color var(--transition-normal);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    outline: 0;
    cursor: pointer;
}

input,
select,
textarea {
    outline: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

svg {
    display: block;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   CUSTOM SCROLLBAR
========================================================= */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-dim) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* =========================================================
   APP LOADER
========================================================= */

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: #050b10;
    transition:
        opacity 500ms ease,
        visibility 500ms ease;
}

.app-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    width: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.loader-logo {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background:
        linear-gradient(
            135deg,
            rgba(56, 189, 248, 0.16),
            rgba(34, 211, 238, 0.04)
        );
    box-shadow:
        0 0 30px var(--cad-blue-glow);
    animation: loaderPulse 1.5s ease-in-out infinite;
}

.loader-logo-main {
    color: var(--cad-blue);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
}

.loader-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.loader-text strong {
    color: #eaf8ff;
    font-size: 15px;
}

.loader-text span {
    color: #637d89;
    font-size: 11px;
}

.loader-progress {
    width: 150px;
    height: 3px;
    overflow: hidden;
    border-radius: 99px;
    background: #14242e;
}

.loader-progress span {
    display: block;
    width: 45%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        var(--cad-blue),
        var(--cad-cyan)
    );
    animation: loaderProgress 1.3s ease-in-out infinite;
}

@keyframes loaderPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--cad-blue-glow);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px var(--cad-blue-glow);
    }
}

@keyframes loaderProgress {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(330%);
    }
}


/* =========================================================
   MAIN APP
========================================================= */

.cad-app {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 520px;
    display: grid;
    grid-template-rows:
        var(--header-height)
        var(--tabs-height)
        minmax(0, 1fr)
        var(--command-height)
        var(--status-height);
    overflow: hidden;
    background: var(--bg-main);
}


/* =========================================================
   APPLICATION HEADER
========================================================= */

.app-header {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 14px;
    background:
        linear-gradient(
            180deg,
            var(--bg-panel),
            var(--bg-sidebar)
        );
    border-bottom: 1px solid var(--border);
}

.app-brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 9px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: #e9faff;
    background:
        linear-gradient(
            135deg,
            #0b6f9d,
            #0c3349
        );
    box-shadow:
        0 0 18px rgba(56, 189, 248, 0.18);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.brand-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.brand-product {
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.8px;
}

.mobile-menu-button {
    display: none;
    width: 34px;
    height: 34px;
    margin-right: 7px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: var(--bg-card);
}

.mobile-menu-button span {
    width: 15px;
    height: 1.5px;
    background: currentColor;
}


/* =========================================================
   APPLICATION MENU
========================================================= */

.app-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 5px;
}

.app-menu-item {
    height: 34px;
    padding: 0 9px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: transparent;
    font-size: 11px;
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.app-menu-item:hover,
.app-menu-item.active {
    color: var(--text-primary);
    background: var(--bg-hover);
}


/* =========================================================
   HEADER SEARCH
========================================================= */

.header-search {
    position: relative;
    width: min(270px, 23vw);
    margin-left: auto;
}

.header-search-icon {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 17px;
    pointer-events: none;
}

.global-search {
    width: 100%;
    height: 34px;
    padding: 0 45px 0 32px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition:
        border var(--transition-fast),
        box-shadow var(--transition-fast);
}

.global-search::placeholder {
    color: var(--text-muted);
}

.global-search:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--cad-blue-soft);
}

.header-search kbd {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 8px;
}


/* =========================================================
   HEADER ACTIONS
========================================================= */

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-action,
.theme-toggle,
.user-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text-secondary);
    background: transparent;
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        border var(--transition-fast),
        transform var(--transition-fast);
}

.header-action {
    font-size: 16px;
}

.header-action:hover,
.theme-toggle:hover {
    border-color: var(--border);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.header-action:active,
.theme-toggle:active {
    transform: scale(0.94);
}

.theme-icon {
    font-size: 15px;
}

.user-avatar {
    margin-left: 5px;
    border-color: var(--border-strong);
    color: #e9faff;
    background:
        linear-gradient(
            135deg,
            #08739f,
            #124257
        );
    font-size: 9px;
    font-weight: 700;
}


/* =========================================================
   DRAWING TABS
========================================================= */

.drawing-tabs-bar {
    z-index: 90;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    min-width: 0;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
}

.drawing-tabs {
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
}

.drawing-tab {
    position: relative;
    min-width: 175px;
    max-width: 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    background: transparent;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.drawing-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.drawing-tab.active {
    color: var(--text-primary);
    background: var(--bg-main);
    box-shadow: inset 0 -2px 0 var(--cad-blue);
}

.drawing-tab-icon {
    color: var(--cad-blue);
    font-size: 12px;
}

.drawing-tab-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}

.drawing-tab-status {
    margin-left: auto;
    color: var(--cad-green);
    font-size: 7px;
}

.drawing-tab-close {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 15px;
}

.drawing-tab-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.new-drawing-tab {
    width: 38px;
    flex: 0 0 38px;
    color: var(--text-muted);
    background: transparent;
    font-size: 19px;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.new-drawing-tab:hover {
    color: var(--cad-blue);
    background: var(--bg-hover);
}

.drawing-tab-actions {
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 3px;
    border-left: 1px solid var(--border);
}

.tab-action {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    color: var(--text-muted);
    background: transparent;
    font-size: 14px;
}

.tab-action:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}


/* =========================================================
   CAD WORKSPACE
========================================================= */

.cad-workspace {
    position: relative;
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-columns:
        var(--left-panel-width)
        minmax(0, 1fr)
        var(--right-panel-width);
    overflow: hidden;
}


/* =========================================================
   LEFT TOOL PANEL
========================================================= */

.left-tool-panel {
    position: relative;
    z-index: 70;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    transition:
        width var(--transition-normal),
        transform var(--transition-normal);
}

.tool-panel-header {
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 12px;
    border-bottom: 1px solid var(--border);
}

.tool-panel-title {
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.panel-collapse-button {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    color: var(--text-muted);
    background: transparent;
    font-size: 17px;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.panel-collapse-button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tool-group {
    padding: 12px 9px 7px;
    border-bottom: 1px solid var(--border);
}

.tool-group-label {
    margin-bottom: 7px;
    padding-left: 3px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.cad-tool {
    min-width: 0;
    height: 57px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    background: transparent;
    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        border var(--transition-fast),
        transform var(--transition-fast);
}

.cad-tool:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-hover);
}

.cad-tool.active {
    border-color: var(--border-strong);
    color: var(--cad-blue-light);
    background: var(--cad-blue-soft);
    box-shadow:
        inset 0 0 15px rgba(56, 189, 248, 0.04);
}

.cad-tool:active {
    transform: scale(0.96);
}

.tool-icon {
    height: 19px;
    display: grid;
    place-items: center;
    color: currentColor;
    font-family: var(--font-mono);
    font-size: 17px;
    line-height: 1;
}

.tool-label {
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px;
}

.tool-group-navigation {
    border-bottom: 0;
}

.tool-panel-footer {
    margin-top: auto;
    padding: 9px;
    border-top: 1px solid var(--border);
}

.tool-footer-button {
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    background: var(--bg-input);
    font-size: 9px;
}

.tool-footer-button:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
    background: var(--bg-hover);
}


/* =========================================================
   LEFT PANEL COLLAPSED
========================================================= */

.left-tool-panel.collapsed {
    width: 54px;
}

.left-tool-panel.collapsed .tool-panel-header {
    justify-content: center;
    padding: 0;
}

.left-tool-panel.collapsed .tool-panel-title,
.left-tool-panel.collapsed .tool-group-label,
.left-tool-panel.collapsed .tool-label,
.left-tool-panel.collapsed .tool-panel-footer span {
    display: none;
}

.left-tool-panel.collapsed .tool-grid {
    grid-template-columns: 1fr;
}

.left-tool-panel.collapsed .cad-tool {
    height: 40px;
}

.left-tool-panel.collapsed .panel-collapse-button {
    transform: rotate(180deg);
}


/* =========================================================
   DRAWING AREA
========================================================= */

.drawing-area {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 38px minmax(0, 1fr) 30px;
    overflow: hidden;
    background: var(--canvas-bg);
}


/* =========================================================
   DRAWING TOOLBAR
========================================================= */

.drawing-toolbar {
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px;
    background: rgba(9, 21, 30, 0.96);
    border-bottom: 1px solid var(--border);
}

body.light-mode .drawing-toolbar {
    background: rgba(248, 251, 252, 0.96);
}

.toolbar-left,
.toolbar-right,
.toolbar-group {
    display: flex;
    align-items: center;
}

.toolbar-group {
    gap: 2px;
}

.toolbar-button {
    height: 27px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    border-radius: 5px;
    color: var(--text-muted);
    background: transparent;
    font-size: 9px;
    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.toolbar-button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.toolbar-button.active {
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
}

.toolbar-divider {
    width: 1px;
    height: 18px;
    margin: 0 7px;
    background: var(--border);
}

.zoom-display {
    min-width: 43px;
    margin-right: 2px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 9px;
    text-align: center;
}


/* =========================================================
   CAD VIEWPORT
========================================================= */

.cad-viewport {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    outline: none;
    background-color: var(--canvas-bg);
    cursor: crosshair;
    user-select: none;
}

.cad-viewport.pan-mode {
    cursor: grab;
}

.cad-viewport.panning {
    cursor: grabbing;
}


/* =========================================================
   CSS GRID
========================================================= */

.cad-grid,
.cad-major-grid {
    position: absolute;
    inset: -50%;
    pointer-events: none;
    transform-origin: center;
}

.cad-grid {
    background-image:
        linear-gradient(
            to right,
            var(--canvas-grid) 1px,
            transparent 1px
        ),
        linear-gradient(
            to bottom,
            var(--canvas-grid) 1px,
            transparent 1px
        );
    background-size: 20px 20px;
}

.cad-major-grid {
    background-image:
        linear-gradient(
            to right,
            var(--canvas-major-grid) 1px,
            transparent 1px
        ),
        linear-gradient(
            to bottom,
            var(--canvas-major-grid) 1px,
            transparent 1px
        );
    background-size: 100px 100px;
}


/* =========================================================
   SVG DRAWING
========================================================= */

.drawing-canvas {
    position: absolute;
    inset: 4%;
    width: 92%;
    height: 92%;
    overflow: visible;
    color: rgba(75, 150, 175, 0.10);
    transform-origin: center;
    transition: transform 120ms linear;
}

.svg-grid {
    opacity: 0.22;
    pointer-events: none;
}

.cad-wall {
    fill: rgba(56, 189, 248, 0.018);
    stroke: #7dd3fc;
    stroke-width: 5;
    vector-effect: non-scaling-stroke;
}

.cad-door {
    fill: none;
    stroke: var(--cad-amber-light);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.cad-window {
    stroke: var(--cad-cyan-light);
    stroke-width: 7;
    vector-effect: non-scaling-stroke;
}

.cad-furniture {
    fill: rgba(139, 92, 246, 0.07);
    stroke: #a78bfa;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.cad-fixture {
    fill: rgba(34, 211, 238, 0.08);
    stroke: var(--cad-cyan-light);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.cad-label {
    fill: rgba(220, 240, 248, 0.65);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 2px;
    text-anchor: middle;
}

.cad-dimension-line {
    stroke: var(--cad-green);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}

.cad-dimension-extension {
    stroke: var(--cad-green);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.cad-dimension-text {
    fill: #4ade80;
    font-family: var(--font-mono);
    font-size: 12px;
    text-anchor: middle;
}

.dimension-vertical {
    text-anchor: middle;
    transform: rotate(90deg);
    transform-origin: 1040px 385px;
}


/* =========================================================
   DRAWING OBJECT INTERACTION
========================================================= */

.drawing-objects [data-object] {
    cursor: pointer;
    transition:
        filter 120ms ease,
        opacity 120ms ease;
}

.drawing-objects [data-object]:hover {
    filter:
        drop-shadow(0 0 5px rgba(56, 189, 248, 0.75));
}

.drawing-objects [data-object].selected {
    filter:
        drop-shadow(0 0 7px rgba(56, 189, 248, 0.9));
}


/* =========================================================
   AXIS
========================================================= */

.x-axis,
.y-axis {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
}

.x-axis {
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(239, 68, 68, 0.65),
            transparent
        );
}

.y-axis {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background:
        linear-gradient(
            180deg,
            transparent,
            rgba(34, 197, 94, 0.65),
            transparent
        );
}

.x-axis span {
    position: absolute;
    right: 10px;
    top: -14px;
    color: #ef4444;
    font-family: var(--font-mono);
    font-size: 8px;
}

.y-axis span {
    position: absolute;
    top: 8px;
    left: 7px;
    color: #22c55e;
    font-family: var(--font-mono);
    font-size: 8px;
}


/* =========================================================
   CROSSHAIR
========================================================= */

.cad-crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 20;
}

.crosshair-horizontal {
    position: absolute;
    top: 0;
    left: -22px;
    width: 44px;
    height: 1px;
    background: rgba(56, 189, 248, 0.75);
}

.crosshair-vertical {
    position: absolute;
    left: 0;
    top: -22px;
    width: 1px;
    height: 44px;
    background: rgba(56, 189, 248, 0.75);
}

.crosshair-center {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 6px;
    height: 6px;
    border: 1px solid var(--cad-blue);
    border-radius: 50%;
    background: var(--canvas-bg);
}


/* =========================================================
   COORDINATE DISPLAY
========================================================= */

.coordinate-display {
    position: absolute;
    left: 13px;
    bottom: 12px;
    z-index: 30;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--cad-blue-light);
    background: rgba(6, 17, 24, 0.88);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-mono);
    font-size: 8px;
    pointer-events: none;
}

body.light-mode .coordinate-display {
    background: rgba(255, 255, 255, 0.9);
}


/* =========================================================
   VIEW CUBE
========================================================= */

.view-cube {
    position: absolute;
    top: 15px;
    right: 17px;
    z-index: 35;
    width: 76px;
    height: 76px;
    transform-style: preserve-3d;
    perspective: 500px;
}

.cube-face {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.30);
    color: var(--cad-blue-light);
    background:
        linear-gradient(
            135deg,
            rgba(20, 55, 70, 0.96),
            rgba(9, 27, 38, 0.96)
        );
    font-family: var(--font-mono);
    font-size: 7px;
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.cube-face:hover {
    color: white;
    background: rgba(20, 75, 100, 0.96);
}

.cube-front {
    left: 10px;
    top: 28px;
    width: 56px;
    height: 40px;
}

.cube-top {
    left: 10px;
    top: 3px;
    width: 56px;
    height: 25px;
    transform: skewX(-28deg);
}

.cube-right {
    right: 0;
    top: 15px;
    width: 17px;
    height: 53px;
    writing-mode: vertical-rl;
}


/* =========================================================
   VIEWPORT NAVIGATION
========================================================= */

.viewport-navigation {
    position: absolute;
    right: 15px;
    bottom: 15px;
    z-index: 35;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.viewport-nav-button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-secondary);
    background: rgba(8, 20, 28, 0.90);
    font-family: var(--font-mono);
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        border var(--transition-fast);
}

body.light-mode .viewport-nav-button {
    background: rgba(255, 255, 255, 0.9);
}

.viewport-nav-button:hover {
    border-color: var(--border-strong);
    color: var(--cad-blue);
    background: var(--bg-hover);
}


/* =========================================================
   UCS INDICATOR
========================================================= */

.ucs-indicator {
    position: absolute;
    left: 18px;
    top: 16px;
    z-index: 35;
    width: 45px;
    height: 45px;
}

.ucs-origin {
    position: absolute;
    left: 21px;
    top: 21px;
    width: 5px;
    height: 5px;
    border: 1px solid white;
    border-radius: 50%;
}

.ucs-x {
    position: absolute;
    right: 1px;
    top: 18px;
    color: #ef4444;
    font-family: var(--font-mono);
    font-size: 8px;
}

.ucs-y {
    position: absolute;
    left: 20px;
    top: 1px;
    color: #22c55e;
    font-family: var(--font-mono);
    font-size: 8px;
}

.ucs-indicator::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 23px;
    width: 18px;
    height: 1px;
    background: #ef4444;
    transform-origin: left center;
}

.ucs-indicator::after {
    content: "";
    position: absolute;
    left: 23px;
    top: 23px;
    width: 1px;
    height: 18px;
    background: #22c55e;
    transform-origin: top center;
}


/* =========================================================
   DRAWING FOOTER
========================================================= */

.drawing-footer {
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    font-size: 8px;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: 3px;
}

.status-button {
    height: 22px;
    padding: 0 7px;
    border-radius: 4px;
    color: var(--text-muted);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 7px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.status-button:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.status-button.active {
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
}

.cursor-mode,
.drawing-unit,
.viewport-size,
.drawing-status {
    color: var(--text-muted);
}

.cursor-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--cad-green);
}

.drawing-unit {
    margin-left: 10px;
}

.drawing-status {
    color: var(--cad-green);
}


/* =========================================================
   RIGHT PANEL
========================================================= */

.right-panel {
    position: relative;
    z-index: 70;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    transition:
        width var(--transition-normal),
        transform var(--transition-normal);
}

.right-panel-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px 7px 13px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    display: block;
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 700;
}

.panel-subtitle {
    display: block;
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 8px;
}

.inspector-section {
    border-bottom: 1px solid var(--border);
}

.inspector-section-header {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 12px;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
}

.section-actions {
    display: flex;
    gap: 2px;
}

.section-action {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    color: var(--text-muted);
    background: transparent;
    font-size: 13px;
}

.section-action:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}


/* =========================================================
   PROPERTY PANEL
========================================================= */

.properties-panel {
    padding: 0 10px 12px;
}

.property-empty {
    min-height: 105px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 7px;
    color: var(--text-muted);
    text-align: center;
}

.property-empty-icon {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    margin-bottom: 7px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-dim);
    font-size: 14px;
}

.property-empty p {
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
}

.property-empty span {
    max-width: 190px;
    margin-top: 3px;
    font-size: 8px;
    line-height: 1.5;
}

.property-group {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.property-group:last-child {
    border-bottom: 0;
}

.property-group-title {
    margin-bottom: 5px;
    color: var(--cad-blue);
    font-family: var(--font-mono);
    font-size: 7px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.property-row {
    min-height: 29px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 5px;
}

.property-row > span {
    color: var(--text-muted);
    font-size: 8px;
}

.property-row input,
.property-row select {
    width: 100%;
    height: 24px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    background: var(--bg-input);
    font-family: var(--font-mono);
    font-size: 8px;
}

.property-row input:focus,
.property-row select:focus {
    border-color: var(--border-strong);
    color: var(--text-primary);
}


/* =========================================================
   LAYERS
========================================================= */

.layers-section {
    min-height: 0;
}

.layer-search {
    position: relative;
    margin: 0 10px 7px;
}

.layer-search > span {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

.layer-search input {
    width: 100%;
    height: 28px;
    padding: 0 8px 0 25px;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    background: var(--bg-input);
    font-size: 8px;
}

.layer-search input::placeholder {
    color: var(--text-muted);
}

.layers-list {
    max-height: 190px;
    overflow-y: auto;
    padding: 0 7px 8px;
}

.layer-item {
    min-height: 31px;
    display: grid;
    grid-template-columns: 21px 12px minmax(0, 1fr) 20px 20px;
    align-items: center;
    gap: 5px;
    padding: 0 4px;
    border-radius: 5px;
    color: var(--text-muted);
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.layer-item:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.layer-item.active {
    color: var(--text-primary);
    background: var(--cad-blue-soft);
}

.layer-visibility {
    width: 20px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--cad-green);
    background: transparent;
    font-size: 8px;
}

.layer-visibility.hidden-layer {
    color: var(--text-dim);
}

.layer-color {
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.layer-color[data-layer-color="cyan"] {
    background: var(--cad-cyan);
}

.layer-color[data-layer-color="amber"] {
    background: var(--cad-amber);
}

.layer-color[data-layer-color="blue"] {
    background: var(--cad-blue);
}

.layer-color[data-layer-color="yellow"] {
    background: #fde047;
}

.layer-color[data-layer-color="green"] {
    background: var(--cad-green);
}

.layer-color[data-layer-color="white"] {
    background: #f8fafc;
}

.layer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px;
}

.layer-count {
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 7px;
    text-align: center;
}

.layer-more {
    width: 20px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    background: transparent;
    font-size: 12px;
}

.layer-more:hover {
    color: var(--text-primary);
}


/* =========================================================
   DRAWING INFO
========================================================= */

.drawing-info-content {
    padding: 0 12px 11px;
}

.info-row {
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.info-row span {
    color: var(--text-muted);
    font-size: 8px;
}

.info-row strong {
    overflow: hidden;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   RIGHT PANEL COLLAPSED
========================================================= */

.right-panel.collapsed {
    width: 48px;
}

.right-panel.collapsed > *:not(.right-panel-header) {
    display: none;
}

.right-panel.collapsed .right-panel-header {
    height: 100%;
    padding: 0;
    justify-content: center;
}

.right-panel.collapsed .right-panel-header > div {
    display: none;
}

.right-panel.collapsed .panel-collapse-button {
    transform: rotate(180deg);
}


/* =========================================================
   COMMAND BAR
========================================================= */

.command-bar {
    position: relative;
    z-index: 80;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    background: #07131c;
    border-top: 1px solid var(--border);
}

body.light-mode .command-bar {
    background: #edf5f8;
}

.command-prompt {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.command-symbol {
    flex: 0 0 auto;
    color: var(--cad-blue);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
}

.command-input {
    width: 100%;
    min-width: 0;
    height: 27px;
    border: 0;
    color: var(--text-primary);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 9px;
}

.command-input::placeholder {
    color: var(--text-dim);
}

.command-history-button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    color: var(--text-muted);
    background: transparent;
}

.command-history-button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.command-suggestions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.command-suggestions button {
    height: 24px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 7px;
}

.command-suggestions button:hover {
    border-color: var(--border-strong);
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
}


/* =========================================================
   APPLICATION STATUS BAR
========================================================= */

.app-status-bar {
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    overflow: hidden;
    background: #050d13;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 7px;
}

body.light-mode .app-status-bar {
    background: #e1edf1;
}

.status-left,
.status-center,
.status-right {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.status-left > span:not(.status-indicator):not(.status-separator),
.status-right > span {
    white-space: nowrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-indicator > span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cad-green);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.status-separator {
    width: 1px;
    height: 11px;
    background: var(--border);
}

.status-center strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.status-control {
    height: 20px;
    padding: 0 5px;
    border-radius: 3px;
    color: var(--text-muted);
    background: transparent;
    font-family: var(--font-mono);
    font-size: 7px;
}

.status-control:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.app-version {
    color: var(--text-dim);
}


/* =========================================================
   SEARCH OVERLAY
========================================================= */

.overlay,
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(1, 7, 11, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-dialog {
    width: min(590px, 100%);
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    animation: dialogIn 180ms ease both;
}

.search-dialog-header,
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.dialog-eyebrow,
.modal-eyebrow {
    color: var(--cad-blue);
    font-family: var(--font-mono);
    font-size: 7px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.search-dialog-header h2,
.modal-header h2 {
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 16px;
    letter-spacing: -0.4px;
}

.dialog-close,
.modal-close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    color: var(--text-muted);
    background: transparent;
    font-size: 18px;
}

.dialog-close:hover,
.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.search-dialog-input {
    position: relative;
    display: flex;
    align-items: center;
    margin: 13px 18px 9px;
}

.search-dialog-input > span {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 16px;
}

.command-search-input {
    width: 100%;
    height: 40px;
    padding: 0 55px 0 34px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    color: var(--text-primary);
    background: var(--bg-input);
    font-size: 11px;
}

.command-search-input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--cad-blue-soft);
}

.search-dialog-input kbd {
    position: absolute;
    right: 8px;
    padding: 3px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 7px;
}

.search-results {
    max-height: 350px;
    overflow-y: auto;
    padding: 5px 10px 12px;
}

.search-result {
    width: 100%;
    min-height: 52px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 5px 8px;
    border-radius: 6px;
    text-align: left;
    color: var(--text-primary);
    background: transparent;
}

.search-result:hover {
    background: var(--bg-hover);
}

.result-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
    font-family: var(--font-mono);
}

.result-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.result-content strong {
    font-size: 9px;
}

.result-content small {
    margin-top: 2px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result > kbd {
    padding: 3px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 7px;
}


/* =========================================================
   MODALS
========================================================= */

.cad-modal {
    width: min(430px, 100%);
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    animation: dialogIn 180ms ease both;
}

.new-drawing-form {
    padding: 17px 18px 18px;
}

.form-field {
    display: block;
    margin-bottom: 13px;
}

.form-field > span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 600;
}

.form-field input,
.form-field select {
    width: 100%;
    height: 37px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    background: var(--bg-input);
    font-size: 9px;
}

.form-field input::placeholder {
    color: var(--text-muted);
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--cad-blue-soft);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 18px;
}

.button {
    height: 35px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 600;
    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        border var(--transition-fast);
}

.button:active {
    transform: scale(0.97);
}

.button-secondary {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
}

.button-secondary:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.button-primary {
    color: #021018;
    background: var(--cad-blue);
    box-shadow: 0 5px 20px rgba(56, 189, 248, 0.15);
}

.button-primary:hover {
    background: var(--cad-blue-light);
}


/* =========================================================
   EXPORT OPTIONS
========================================================= */

.export-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 18px 18px;
}

.export-option {
    width: 100%;
    min-height: 60px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-primary);
    background: var(--bg-card);
    text-align: left;
    transition:
        border var(--transition-fast),
        background var(--transition-fast),
        transform var(--transition-fast);
}

.export-option:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
    transform: translateX(2px);
}

.export-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 700;
}

.export-option strong,
.export-option small {
    display: block;
}

.export-option strong {
    font-size: 9px;
}

.export-option small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 8px;
}

.export-arrow {
    color: var(--text-muted);
}


/* =========================================================
   PROFILE MENU
========================================================= */

.profile-menu {
    position: fixed;
    top: 49px;
    right: 12px;
    z-index: 600;
    width: 220px;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    animation: menuIn 160ms ease both;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px;
}

.profile-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #eaffff;
    background: linear-gradient(
        135deg,
        #08739f,
        #124257
    );
    font-size: 9px;
    font-weight: 700;
}

.profile-header strong,
.profile-header span {
    display: block;
}

.profile-header strong {
    color: var(--text-primary);
    font-size: 9px;
}

.profile-header span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 8px;
}

.profile-divider {
    height: 1px;
    margin: 5px 0;
    background: var(--border);
}

.profile-item {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    border-radius: 5px;
    color: var(--text-secondary);
    background: transparent;
    text-align: left;
    font-size: 8px;
}

.profile-item > span {
    width: 18px;
    color: var(--text-muted);
    text-align: center;
}

.profile-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.profile-item.danger:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}


/* =========================================================
   TOAST SYSTEM
========================================================= */

.toast-container {
    position: fixed;
    right: 15px;
    bottom: 50px;
    z-index: 1000;
    width: min(320px, calc(100vw - 30px));
    display: flex;
    flex-direction: column;
    gap: 7px;
    pointer-events: none;
}

.toast {
    position: relative;
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 8px;
    min-height: 53px;
    padding: 7px 9px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toastIn 220ms ease both;
}

.toast.removing {
    animation: toastOut 180ms ease forwards;
}

.toast-icon {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    color: var(--cad-blue);
    background: var(--cad-blue-soft);
}

.toast-content strong,
.toast-content span {
    display: block;
}

.toast-content strong {
    color: var(--text-primary);
    font-size: 8px;
}

.toast-content span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 7px;
}

.toast-close {
    color: var(--text-muted);
    background: transparent;
    font-size: 14px;
}

.toast-close:hover {
    color: var(--text-primary);
}


/* =========================================================
   SIDEBAR OVERLAY
========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}


/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes dialogIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes menuIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}


/* =========================================================
   RIPPLE EFFECT
========================================================= */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.28);
    transform: scale(0);
    animation: rippleAnimation 550ms ease-out;
}

@keyframes rippleAnimation {
    to {
        opacity: 0;
        transform: scale(35);
    }
}


/* =========================================================
   FOCUS STATES
========================================================= */

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--cad-blue);
    outline-offset: 2px;
}


/* =========================================================
   TOOLTIP SUPPORT
========================================================= */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    z-index: 900;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    font-size: 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(3px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* =========================================================
   RESPONSIVE — LARGE TABLETS / SMALL DESKTOP
========================================================= */

@media (max-width: 1250px) {

    :root {
        --left-panel-width: 188px;
        --right-panel-width: 260px;
    }

    .app-menu {
        gap: 0;
    }

    .app-menu-item {
        padding: 0 7px;
    }

    .header-search {
        width: 210px;
    }

    .cad-tool {
        height: 53px;
    }

    .tool-icon {
        font-size: 15px;
    }

    .tool-label {
        font-size: 7px;
    }
}


/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 1050px) {

    :root {
        --left-panel-width: 175px;
        --right-panel-width: 235px;
    }

    .brand-name {
        display: none;
    }

    .app-menu-item:nth-child(n + 5) {
        display: none;
    }

    .header-search {
        width: min(230px, 28vw);
    }

    .right-panel-header {
        padding-left: 9px;
    }

    .cad-tool {
        height: 50px;
    }

    .drawing-tab {
        min-width: 150px;
    }

    .command-suggestions button:nth-child(n + 4) {
        display: none;
    }

    .status-center {
        display: none;
    }
}


/* =========================================================
   RESPONSIVE — TABLET / MOBILE WORKSPACE
========================================================= */

@media (max-width: 820px) {

    :root {
        --header-height: 52px;
        --tabs-height: 39px;
        --command-height: 42px;
        --status-height: 27px;
    }

    .cad-app {
        grid-template-rows:
            var(--header-height)
            var(--tabs-height)
            minmax(0, 1fr)
            var(--command-height)
            var(--status-height);
    }

    .mobile-menu-button {
        display: flex;
    }

    .app-header {
        gap: 8px;
        padding: 0 9px;
    }

    .app-menu {
        display: none;
    }

    .header-search {
        width: min(260px, 42vw);
    }

    .header-search kbd {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .header-action:nth-child(1),
    .header-action:nth-child(2) {
        display: none;
    }

    .cad-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .left-tool-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 100;
        width: 210px;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .left-tool-panel.mobile-open {
        transform: translateX(0);
    }

    .right-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        z-index: 100;
        width: 275px;
        transform: translateX(100%);
        box-shadow: var(--shadow-lg);
    }

    .right-panel.mobile-open {
        transform: translateX(0);
    }

    .drawing-area {
        width: 100%;
    }

    .drawing-toolbar {
        padding: 0 6px;
    }

    .toolbar-group .toolbar-button:nth-child(n + 4) {
        display: none;
    }

    .drawing-footer {
        padding: 0 6px;
    }

    .footer-left .status-button:nth-child(n + 5) {
        display: none;
    }

    .footer-center {
        display: none;
    }

    .command-suggestions {
        display: none;
    }

    .status-left > span:nth-child(3),
    .status-left .status-separator {
        display: none;
    }
}


/* =========================================================
   RESPONSIVE — MOBILE
========================================================= */

@media (max-width: 600px) {

    body {
        font-size: 12px;
    }

    .app-header {
        padding: 0 7px;
    }

    .brand-product {
        display: none;
    }

    .header-search {
        flex: 1;
        width: auto;
        max-width: none;
    }

    .global-search {
        height: 31px;
        padding-left: 30px;
    }

    .header-action,
    .theme-toggle,
    .user-avatar {
        width: 29px;
        height: 29px;
    }

    .header-action:nth-child(4) {
        display: none;
    }

    .drawing-tab {
        min-width: 145px;
    }

    .drawing-tab-name {
        font-size: 9px;
    }

    .drawing-tab-actions {
        display: none;
    }

    .drawing-toolbar {
        grid-template-columns: 1fr auto;
    }

    .toolbar-left .toolbar-group:first-child {
        display: none;
    }

    .toolbar-divider {
        display: none;
    }

    .toolbar-right .toolbar-button:last-child {
        display: none;
    }

    .zoom-display {
        display: none;
    }

    .cad-viewport {
        cursor: default;
    }

    .view-cube {
        transform: scale(0.82);
        transform-origin: top right;
        top: 8px;
        right: 8px;
    }

    .ucs-indicator {
        transform: scale(0.8);
        transform-origin: top left;
        top: 8px;
        left: 8px;
    }

    .coordinate-display {
        left: 8px;
        bottom: 8px;
        font-size: 7px;
    }

    .viewport-navigation {
        right: 8px;
        bottom: 8px;
    }

    .drawing-footer {
        overflow-x: auto;
    }

    .footer-left {
        flex: 0 0 auto;
    }

    .footer-right {
        margin-left: auto;
        flex: 0 0 auto;
    }

    .viewport-size {
        display: none;
    }

    .drawing-status {
        font-size: 7px;
    }

    .command-bar {
        grid-template-columns: 1fr;
        padding: 0 7px;
    }

    .command-history-button {
        display: none;
    }

    .profile-menu {
        top: 47px;
        right: 7px;
    }

    .toast-container {
        right: 8px;
        bottom: 43px;
        width: calc(100vw - 16px);
    }
}


/* =========================================================
   RESPONSIVE — SMALL MOBILE
========================================================= */

@media (max-width: 420px) {

    .mobile-menu-button {
        width: 30px;
        height: 30px;
        margin-right: 3px;
    }

    .brand-mark {
        width: 30px;
        height: 30px;
        font-size: 9px;
    }

    .header-search {
        min-width: 0;
    }

    .header-search-icon {
        left: 8px;
    }

    .global-search {
        padding-left: 27px;
        padding-right: 6px;
        font-size: 9px;
    }

    .theme-toggle {
        display: none;
    }

    .user-avatar {
        margin-left: 0;
    }

    .drawing-tab {
        min-width: 130px;
    }

    .drawing-tab-icon {
        display: none;
    }

    .drawing-tab-name {
        font-size: 8px;
    }

    .new-drawing-tab {
        width: 32px;
        flex-basis: 32px;
    }

    .toolbar-left .toolbar-group:last-child .toolbar-button:nth-child(n + 3) {
        display: none;
    }

    .toolbar-right .toolbar-button:nth-child(3) {
        display: none;
    }

    .footer-left .status-button {
        padding: 0 5px;
        font-size: 6px;
    }

    .status-left .status-indicator {
        display: none;
    }

    .app-version {
        display: none;
    }
}


/* =========================================================
   LANDSCAPE MOBILE
========================================================= */

@media (max-height: 620px) and (max-width: 820px) {

    :root {
        --header-height: 48px;
        --tabs-height: 35px;
        --command-height: 38px;
        --status-height: 24px;
    }

    .tool-panel-header {
        height: 35px;
        flex-basis: 35px;
    }

    .tool-group {
        padding-top: 7px;
        padding-bottom: 5px;
    }

    .cad-tool {
        height: 42px;
    }

    .tool-icon {
        font-size: 13px;
    }

    .tool-label {
        font-size: 6px;
    }

    .drawing-area {
        grid-template-rows: 34px minmax(0, 1fr) 26px;
    }

    .drawing-footer {
        height: 26px;
    }
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* =========================================================
   PRINT
========================================================= */

@media print {

    .app-header,
    .drawing-tabs-bar,
    .left-tool-panel,
    .right-panel,
    .command-bar,
    .app-status-bar,
    .drawing-toolbar,
    .drawing-footer,
    .view-cube,
    .viewport-navigation,
    .coordinate-display,
    .ucs-indicator,
    .cad-crosshair {
        display: none !important;
    }

    .cad-app,
    .cad-workspace,
    .drawing-area,
    .cad-viewport {
        width: 100%;
        height: 100%;
        display: block;
        overflow: visible;
    }

    .drawing-canvas {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
    }
}