.workspace-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    color: #e5edf8;
}

.workspace-page.ws-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow-y: auto;
    background: #0b1220;
    padding: 18px;
    margin: 0;
}

.ws-overlay-exit {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2100;
    border: 1px solid #334155;
    background: #111c30;
    color: #e5edf8;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}

.workspace-loading,
.workspace-error,
.ws-header,
.ws-summary,
.ws-controls,
.ws-notes-panel,
.ws-canvas-shell {
    border: 1px solid #263449;
    background: #0f172a;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
}

.workspace-loading,
.workspace-error {
    padding: 28px;
}

.ws-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    flex-wrap: wrap;
}

.ws-header-left h1 {
    margin: 4px 0 6px;
    font-size: 32px;
    line-height: 1.1;
}

.ws-back,
.ws-node-head a {
    color: #93c5fd;
    text-decoration: none;
}

.ws-back:hover,
.ws-node-head a:hover {
    text-decoration: underline;
}

.ws-kicker,
.ws-company-name,
.ws-stat span,
.ws-stat small,
.ws-canvas-topbar span,
.ws-node-meta {
    color: #9fb0c7;
}

.ws-header-actions,
.ws-controls,
.ws-legend,
.ws-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ws-header-actions {
    align-items: flex-end;
}

.ws-fullscreen-toggle {
    display: flex;
    gap: 6px;
    width: 100%;
    justify-content: flex-end;
}

.ws-fullscreen-toggle button {
    border: 1px solid #334155;
    background: #0b1220;
    color: #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 12px;
}

.ws-fullscreen-toggle button.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ws-btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.ws-btn:disabled {
    cursor: default;
    opacity: .55;
}

.ws-btn-primary {
    background: #2563eb;
}

.ws-btn-secondary {
    background: #334155;
}

.ws-status {
    padding: 12px 14px;
    border: 1px solid #1d4ed8;
    background: rgba(37, 99, 235, .16);
    border-radius: 12px;
}

.ws-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
    padding: 14px;
}

.ws-stat {
    padding: 14px;
    border: 1px solid #263449;
    background: #111c30;
    border-radius: 12px;
}

.ws-stat span,
.ws-stat small {
    display: block;
}

.ws-stat strong {
    display: block;
    margin: 6px 0;
    font-size: 18px;
}

.ws-controls {
    padding: 14px;
}

.ws-controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #b8c7dc;
}

.ws-controls select {
    min-width: 180px;
    padding: 9px 10px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0b1220;
    color: #e5edf8;
}

.ws-check {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    padding-top: 22px;
}

.ws-notes-panel {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
    padding: 18px;
}

.ws-notes-panel h2 {
    margin: 0;
}

.ws-notes-panel textarea,
.ws-node textarea {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    border: 1px solid #334155;
    border-radius: 12px;
    background: rgba(15, 23, 42, .82);
    color: #e5edf8;
    padding: 10px;
    font: inherit;
    box-sizing: border-box;
}

.ws-canvas-shell {
    overflow: hidden;
}

.ws-canvas-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 18px;
    border-bottom: 1px solid #263449;
    background: #111c30;
}

.ws-legend span {
    font-size: 13px;
    color: #b8c7dc;
}

.ws-selection-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .16);
    border: 1px solid #2563eb;
    color: #e5edf8;
    font-size: 13px;
    white-space: nowrap;
    visibility: hidden;
}

.ws-selection-info.is-visible {
    visibility: visible;
}

.ws-selection-delete {
    border: 0;
    background: transparent;
    color: #fca5a5;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
}

.ws-marquee {
    position: absolute;
    z-index: 40;
    border: 1px solid #2563eb;
    background: rgba(37, 99, 235, .15);
    display: none;
    pointer-events: none;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    margin-right: 5px;
}

.legend-dot.unread { background: #f59e0b; }
.legend-dot.locked { background: #64748b; }
.legend-dot.annulled { background: #ef4444; }
.legend-dot.violation { background: #a855f7; }

.ws-board-body {
    display: flex;
    height: calc(100vh - 320px);
    min-height: 680px;
    max-height: 1100px;
}

.ws-toolbox {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px;
    background: #111c30;
    border-right: 1px solid #263449;
    min-height: 0;
    overflow-y: auto;
}

.ws-toolbox button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0b1220;
    color: #e5edf8;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ws-toolbox button:disabled {
    opacity: .5;
    cursor: default;
}

.ws-toolbox button.active {
    background: #2563eb;
    border-color: #2563eb;
}

.ws-toolbox hr {
    width: 100%;
    border: none;
    border-top: 1px solid #263449;
    margin: 4px 0;
}

.ws-viewport {
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
    cursor: default;
    background-color: #0b1220;
    background-image:
        linear-gradient(rgba(148, 163, 184, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .04) 1px, transparent 1px);
    background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
    user-select: none;
    touch-action: none;
}

.ws-viewport.tool-pan { cursor: grab; }
.ws-viewport.tool-pan.is-panning { cursor: grabbing; }
.ws-viewport.tool-zoom { cursor: zoom-in; }
.ws-viewport.tool-connect,
.ws-viewport.tool-draw,
.ws-viewport.tool-note { cursor: crosshair; }
.ws-viewport.tool-erase { cursor: not-allowed; }
.ws-viewport.tool-pan .ws-node,
.ws-viewport.tool-zoom .ws-node,
.ws-viewport.tool-connect .ws-node,
.ws-viewport.tool-draw .ws-node,
.ws-viewport.tool-erase .ws-node,
.ws-viewport.tool-note .ws-node { cursor: inherit; }

.ws-board-area:fullscreen {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: #0b1220;
}

.ws-board-area:fullscreen .ws-board-body {
    flex: 1;
    min-height: 0;
}

.ws-board-area:fullscreen .ws-viewport {
    height: 100% !important;
    max-height: none !important;
}

.ws-canvas {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    user-select: none;
    touch-action: none;
}

.ws-edges {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    overflow: visible;
}

.ws-edges path {
    fill: none;
    stroke: rgba(147, 197, 253, .58);
    stroke-width: 2.5;
    marker-end: url(#ws-arrow);
}

.ws-arrow-head {
    fill: rgba(147, 197, 253, .85);
}

.ws-arrow-head-manual {
    fill: rgba(52, 211, 153, .9);
}

.ws-edge-linked { stroke: rgba(96, 165, 250, .85) !important; }

.ws-edge-manual {
    stroke: rgba(52, 211, 153, .85) !important;
    stroke-dasharray: 6 4;
    marker-end: url(#ws-arrow-manual) !important;
}

.ws-drawing {
    fill: none !important;
    stroke: rgba(251, 191, 36, .92) !important;
    stroke-width: 3 !important;
    stroke-linecap: round;
    stroke-linejoin: round;
    marker-end: none !important;
    pointer-events: none;
}

.ws-drawing-preview {
    opacity: .85;
}

.ws-viewport.tool-erase .ws-edge-manual,
.ws-viewport.tool-erase .ws-drawing {
    stroke-width: 12px !important;
    pointer-events: stroke;
    cursor: pointer;
}

.ws-node.is-connect-source {
    border-color: #34d399;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, .55), 0 18px 40px rgba(0, 0, 0, .32);
}

.ws-anchor {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #0b1220;
    z-index: 8;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease;
}

.ws-viewport.tool-connect .ws-anchor {
    opacity: 1;
    pointer-events: auto;
    cursor: crosshair;
}

.ws-viewport.tool-connect .ws-anchor:hover {
    transform: scale(1.3);
    background: #3b82f6;
}

.ws-anchor.is-connect-source-anchor {
    background: #34d399 !important;
    transform: scale(1.35);
}

.ws-anchor-top { top: -7px; left: 50%; transform: translateX(-50%); }
.ws-anchor-bottom { bottom: -7px; left: 50%; transform: translateX(-50%); }
.ws-anchor-left { left: -7px; top: 50%; transform: translateY(-50%); }
.ws-anchor-right { right: -7px; top: 50%; transform: translateY(-50%); }

.ws-anchor.is-connect-source-anchor.ws-anchor-top,
.ws-anchor.is-connect-source-anchor.ws-anchor-bottom { transform: translateX(-50%) scale(1.35); }
.ws-anchor.is-connect-source-anchor.ws-anchor-left,
.ws-anchor.is-connect-source-anchor.ws-anchor-right { transform: translateY(-50%) scale(1.35); }

.group-note { border-color: rgba(244, 114, 182, .6); }

.ws-note-title {
    width: 100%;
    margin: 8px 0 6px;
    padding: 6px 8px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: rgba(15, 23, 42, .82);
    color: #e5edf8;
    font: inherit;
    font-weight: 700;
    box-sizing: border-box;
}

.ws-note-description {
    width: 100%;
    min-height: 60px;
    margin-bottom: 6px;
    padding: 6px 8px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: rgba(15, 23, 42, .82);
    color: #e5edf8;
    font: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.ws-note-date {
    padding: 5px 8px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: rgba(15, 23, 42, .82);
    color: #e5edf8;
    font: inherit;
    font-size: 12px;
}

.ws-node {
    position: absolute;
    z-index: 5;
    border: 1px solid #334155;
    border-radius: 16px;
    background: rgba(17, 28, 48, .96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .32);
    padding: 14px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-sizing: border-box;
}

.ws-node.is-unread {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, .22), 0 18px 40px rgba(0, 0, 0, .32);
}

.ws-node.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .45), 0 18px 40px rgba(0, 0, 0, .32);
}

.ws-node.is-dragging {
    z-index: 20;
    cursor: grabbing;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .48);
}

.ws-node-head,
.ws-node-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.ws-node-head {
    font-weight: 800;
    font-size: 13px;
}

.ws-icon-btn {
    border: 0;
    background: transparent;
    color: #93c5fd;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
}

.ws-node h3 {
    margin: 10px 0;
    font-size: 15px;
    line-height: 1.32;
}

.ws-node-meta {
    font-size: 12px;
    margin-bottom: 10px;
}

.ws-badges {
    gap: 6px;
    margin-bottom: 10px;
}

.ws-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 800;
}

.badge-unread { background: #f59e0b; color: #111827; }
.badge-locked { background: #475569; color: #e5edf8; }
.badge-annulled { background: #dc2626; color: #fff; }
.badge-violation { background: #7e22ce; color: #fff; }
.badge-company { background: #0ea5e9; color: #05202e; }

.ws-group-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.ws-group-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    color: #cbd5e1;
    background: #16223a;
}

.group-court { border-color: rgba(96, 165, 250, .72); }
.group-report { border-color: rgba(52, 211, 153, .58); }
.group-meeting { border-color: rgba(251, 191, 36, .58); }
.group-demand { border-color: rgba(248, 113, 113, .58); }
.group-deal { border-color: rgba(192, 132, 252, .64); }
.group-file { border-color: rgba(56, 189, 248, .6); }

.ws-node-file h3 {
    font-size: 14px;
    word-break: break-word;
}

.ws-node-hint {
    font-size: 11px;
    color: #9fb0c7;
}

.wsf-icon {
    font-size: 16px;
}

@media (max-width: 1100px) {
    .ws-header,
    .ws-canvas-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .ws-summary {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .ws-notes-panel {
        grid-template-columns: 1fr;
    }

    .ws-board-body {
        flex-direction: column;
    }

    .ws-toolbox {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #263449;
    }
}
