.row {
    display:grid;
    grid-template-columns:1fr 1.5fr 1.5fr;
    gap:3rem;
    align-items:start;
    margin-bottom:3rem;
    width:100%;
}

.molecule-details,.jsmol-column,.graph-column {min-width:0}

.jsmol-column,.graph-column {
    width:100%;
    max-width:700px;
    display:flex;
    flex-direction:column;
    gap:.5rem;
}

.file-toolbar {
    display:flex;
    flex-wrap:wrap;
    margin-top: .4rem;
    justify-content: flex-end;
    gap: .75rem;
    margin-bottom: 1rem;
}

.file-toolbar .btn {
    background:#026aa7;
    color:#fff;
    padding:.45rem .9rem;
    border-radius:.3rem;
    text-decoration:none;
    font-size:.9rem;
    transition:background .15s;
}
.file-toolbar .btn:hover {background:#014f7c}

.citation {
    max-width:65ch;
    margin-bottom:1rem;
    line-height:1.35;
    white-space:normal;
    overflow-wrap:anywhere;
}

.meta-inline {
    display:flex;
    flex-wrap:wrap;
    align-items:start;
    gap:.75rem 1.25rem;
    margin-bottom:1.25rem;
}
.meta-inline .citation {flex:1 1 100%;margin:0;max-width:none}
.meta-inline > p {margin:0;white-space:normal}
.meta-inline .cell-info {display:flex;gap:.5rem 1rem}

.cell-info h3 {margin:0 0 .5rem;font-size:1.05rem}
.cell-info > div {display:contents}
.cell-info ul {
    display:flex;
    flex-wrap:wrap;
    gap:.4rem .9rem;
    list-style:none;
    margin:0;
    padding:0;
}
.cell-info li {line-height:1.3}

.polymer-controls,.graph-controls {
    z-index:2;
    background:#f9fafb;
    border:1px solid #ccc;
    padding:.35rem .5rem;
    min-height:2.25rem;
    box-sizing:border-box;
    display:flex;
    align-items:center;
    gap:.5rem;
}
.polymer-controls button {padding:.2rem .55rem;cursor:pointer}
.graph-controls {flex-wrap:wrap}
.graph-controls input[type="text"] {min-width:18rem}
.graph-toggle {display:inline-flex;align-items:center;gap:.25rem}

.jsmol-applet-wrap,.graph-canvas-wrap {
    width:100%;
    aspect-ratio:1/1;
    border:1px solid #cfcfcf;
    background:#fff;
    overflow:hidden;
    box-sizing:border-box;
}
.jsmol-applet-wrap > div,
.graph-canvas-wrap > div,
.graph-canvas-wrap svg {
    width:100%!important;
    height:100%!important;
    display:block;
}

g.node.selected :is(ellipse,circle,polygon,path) {
    stroke:#005fcc!important;
    stroke-width:3px!important;
}

g.edge.incident-edge path {
    stroke:#cc7a00!important;
    stroke-width:1.6px!important;
    fill:none!important;
}
g.edge.incident-edge polygon {
    stroke:#cc7a00!important;
    fill:#cc7a00!important;
}

.details-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2rem;
    row-gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.details-title-nav {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    min-width: 0;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.details-title-nav h1 {
    margin: 0;
}

.viewer-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    border-bottom: 1px solid #ccc;
}

.tab-button {
    padding: 0.55rem 0.9rem;
    border: 1px solid #aaa;
    border-bottom: none;
    background: #f3f3f3;
    cursor: pointer;
    font-size: 1rem;
}

.tab-button.active {
    background: white;
    font-weight: bold;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.combined-toolbar {
    margin-bottom: 0.5rem;
}

.combined-controls-grid,
.combined-view-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.combined-controls-grid {
    margin-bottom: 0.5rem;
}

.combined-left-controls,
.combined-graph-controls {
    width: 100%;
    min-height: 2.25rem;
    box-sizing: border-box;
}

.combined-left-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: #f9fafb;
    border: 1px solid #ccc;
    padding: 0.35rem 0.5rem;
}

.combined-card {
    background: #fff;
    padding: 0;
    border: 0;
    min-width: 0;
}

.combined-card h3 {
    margin: 0;
    padding: 0.45rem 0.5rem;
    border: 1px solid #cfcfcf;
    border-bottom: 0;
    font-size: 1rem;
    background: #fff;
}

.combined-jsmol-wrap,
.combined-graph-wrap {
    width: 100%;
    height: 700px;
    border: 1px solid #cfcfcf;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.combined-graph-wrap {
    position: relative;
}

#combinedGraph3D {
    position: relative;
    width: 100%;
    height: 100%;
}

.combined-graph-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.combined-graph-controls input[type="text"] {
    min-width: 260px;
    flex: 1 1 260px;
}

.combined-graph-status {
    margin: 0.4rem 0;
    font-size: 0.9rem;
    color: #333;
}

@media (max-width: 1100px) {
    .combined-controls-grid,
    .combined-view-grid {
        grid-template-columns: 1fr;
    }
}

.three-node-label {
    padding: 1px 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.8);
    color: #111;
    font-size: 11px;
    font-family: monospace;
    pointer-events: none;
    white-space: nowrap;
}

.three-edge-label {
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    font-size: 12px;
    font-family: monospace;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.25);
    z-index: 20;
}

.three-ghost-node-label {
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.85);
    color: #555;
    font-size: 11px;
    font-family: monospace;
    pointer-events: none;
    white-space: nowrap;
    border: 1px dashed rgba(0, 0, 0, 0.25);
}
