@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0a0a0f;
    --surface:  #12121a;
    --border:   #2a2a3a;
    --accent:   #ffb700;
    --success:  #00ff88;
    --error:    #ff4466;
    --text:     #e8e8f0;
    --muted:    #6060808;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 3rem;
    padding-bottom: 2.5rem;
}


body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Aptos', sans-serif;
    min-height: 100vh;
}

/* =============================================
   NAVBAR
   ============================================= */

.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2.5rem;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
}
.logo-bracket { color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: color .2s;
    text-decoration: none;
}

.nav-links a:hover { color: var(--accent); opacity: 1; }

.nav-cta {
  border: 1px solid var(--accent) !important;
  padding: .3rem .85rem;
  border-radius: 4px;
  color: var(--accent) !important;
}
.nav-cta:hover { background: var(--accent-dim) !important; opacity: 1 !important; }


/* =============================================
   SECTION COMMON
   ============================================= */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 4rem 1rem 4rem;
}

.section-header {
  margin-bottom: 3rem;
}
.section-tag {
  display: block;
  font-size: .8rem;
  color: var(--accent);
  margin-bottom: .5rem;
  letter-spacing: .1em;
}
.section-title {
  display:flex;
  flex-direction:column;
  align-items:center;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  color: var(--text);
}

/* =============================================
   UPLOADS
   ============================================= */

.uploads-grid {
    width: min(900px, 90vw);
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: center;
    display: flex;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 0.5rem;
    flex-direction: column;
}

.upload-download-icon {
    color: var(--accent);
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.upload-download-icon:hover {
    opacity: 0.7;
    color: var(--accent);
}

.upload-card-top {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
}

.upload-icon { font-size: 1.5rem; color: var(--accent); }
.upload-links { display: flex; gap: .75rem; font-size: .78rem; }

.upload-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.upload-desc { font-size: .84rem; color: var(--text-muted); flex: 1; }

.upload-data {
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--text-muted);
    text-align: center;
}

.upload-tags-extended {
    display: grid;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
    box-shadow: 0 8px 30px rgba(87, 65, 156, 0.08);
    align-items: center;
}

.upload-card-extended {
    display: grid;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    align-items: center;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    min-height: 4rem;
}

.upload-tags-extended,
.upload-card-extended {
    grid-template-columns: 2fr 1.5fr 1.4fr 0.8fr 1.1fr 3fr;
}

.upload-card-extended:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 183, 0, 0.08);
}

/* Name cell — inline flex for text + edit button */
.upload-name-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.upload-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 0;
}

.upload-filename {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.upload-edit-btn {
    background: none;
    border: none;
    color: #60608a;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.upload-edit-btn:hover {
    color: var(--accent);
    opacity: 0.7;
}

/* Inline rename input row */
.upload-name-edit {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.upload-rename-input {
    font-size: 0.65rem;
    padding: 0.3rem 0.6rem;
    flex: 1;
    min-width: 0;
}

.upload-rename-btn {
    background: none;
    border: 1.5px solid;
    border-radius: 4px;
    font-size: 0.8rem;
    width: 1.6rem;
    height: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.upload-rename-btn.confirm {
    border-color: var(--success);
    color: var(--success);
}

.upload-rename-btn.confirm:hover {
    background: var(--success);
    color: var(--bg);
}

.upload-rename-btn.cancel {
    border-color: var(--error);
    color: var(--error);
}

.upload-rename-btn.cancel:hover {
    background: var(--error);
    color: var(--bg);
}

/* Notes cell — scrollable, capped height */
.upload-notes-cell {
    min-width: 0;
}

.upload-notes-scroll {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-height: 3.6rem;     /* ~3 lines */
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.upload-notes-scroll::-webkit-scrollbar {
    width: 3px;
}

.upload-notes-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

.upload-notes-empty {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: #3a3a55;
}

/* =============================================
   PAGE PARAMETERS
   ============================================= */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 5.5rem 2rem 2.5rem 2rem;  /* top accounts for navbar height */
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,229,255,0.08) 0%, transparent 60%),
        var(--bg);
}


header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: #60608a;
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

.drop-zone {
    width: min(520px, 90vw);
    min-height: 280px;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 2rem;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,229,255,0.04) 0%, transparent 70%);
    pointer-events: none;
}

.drop-zone.dragging {
    border-color: var(--accent);
    background: rgba(0,229,255,0.04);
    box-shadow: 0 0 40px rgba(0,229,255,0.1), inset 0 0 40px rgba(0,229,255,0.03);
    transform: scale(1.01);
}

.drop-zone.success { border-color: var(--success); }
.drop-zone.error   { border-color: var(--error); }

.drop-icon {
    font-size: 2.5rem;
    line-height: 1;
    transition: transform 0.2s;
}

.drop-zone.success .drop-icon { color: var(--success); font-size: 3rem; }
.drop-zone.error   .drop-icon { color: var(--error);   font-size: 3rem; }

@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes spin  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.pulse { animation: pulse 1s ease-in-out infinite; }
.spin  { animation: spin 1s linear infinite; display: inline-block; }

.drop-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.drop-sub {
    font-family: 'Aptos', sans-serif;
    font-size: 0.8rem;
    color: #60608a;
    text-align: center;
    max-width: 320px;
    line-height: 1.6;
}

.browse-btn {
    font-family: 'Archivo', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    margin-top: 0.5rem;
}

.browse-btn:hover { opacity: 0.85; transform: translateY(-1px); }

.progress-bar {
    width: 80%;
    height: 4px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff8400);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,229,255,0.08) 0%, transparent 60%),
        var(--bg);
}

.login-card {
    width: min(420px, 90vw);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-header {
    text-align: center;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-sub {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
    margin-top: 0.4rem;
}

.login-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #60608a;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.login-input {
    font-family: 'DM Mono', monospace;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    transition: border-color 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: var(--error);
    text-align: center;
}

.login-btn {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    width: 100%;
}

.login-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: translateY(-1px);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-logout {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--error);
    background: none;
    border: 1px solid var(--error);
    border-radius: 4px;
    padding: 0.3rem 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nav-logout:hover {
    background: var(--error);
    color: var(--bg);
}

.users-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-form {
    width: min(800px, 90vw);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-form-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.user-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.user-form-fields .login-input {
    flex: 1;
    min-width: 160px;
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
    cursor: pointer;
}

.user-success {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: var(--success);
}

.role-badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--border);
    color: var(--text);
}

.role-badge.admin {
    background: rgba(255, 183, 0, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.delete-btn {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: none;
    border: 1px solid var(--error);
    border-radius: 4px;
    color: var(--error);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.delete-btn:hover {
    background: var(--error);
    color: var(--bg);
}

.nav-username {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
}

.nav-link-btn {
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
}

.nav-link-btn:hover {
    color: var(--accent);
}

.admin-link:hover {
    opacity: 0.8;
}

.nav-logo {
    cursor: pointer;
}

/* =============================================
   LANDING PAGE
   ============================================= */

.landing-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 320px));
    gap: 2rem;
    justify-content: center;
    padding: 2rem 1rem;
}

.landing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 260px;
    padding: 2.5rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.landing-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(255, 183, 0, 0.12);
}

.landing-card-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.landing-card-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
}

.landing-card-sub {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
    text-align: center;
}

/* =============================================
   CAN DATABASE
   ============================================= */


.can-config-section {
    width: min(800px, 90vw);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    margin: 0 auto;
}

.section-sub {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
    margin-top: 0.4rem;
}

.can-active-db {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    background: var(--surface);
}

.can-db-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.can-db-info.none .can-db-label {
    color: #60608a;
}

.can-db-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #60608a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.can-db-filename {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.can-db-meta {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #60608a;
}


/* =============================================
   POSTGRES DATABASE SELECTOR
   ============================================= */


.db-selector {
    width: min(520px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.db-selector-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.db-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.db-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
    background: var(--surface);
}

.db-option input[type="radio"] {
    display: none;
}

.db-option.selected {
    border-color: var(--accent);
    background: rgba(255, 183, 0, 0.08);
    color: var(--accent);
}

.db-option:hover {
    border-color: var(--accent);
}

.db-selector-empty {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: #60608a;
}

.drop-zone.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.creds-prompt {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* =============================================
   FOOTER
   ============================================= */

.footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 2.5rem;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
}

.footer-copy {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: #60608a;
    letter-spacing: 0.05em;
}

/* =============================================
   CAN CONFIG
   ============================================= */

.can-versions {
    width: min(800px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.can-assignments {
    width: min(800px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.can-assignment-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
}

.can-assignment-db {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
}

/* =============================================
   DATABASE DELETION
   ============================================= */

.db-deleted-msg {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: var(--error);
    text-align: center;
}

@keyframes card-pop {
    0%   { transform: scale(1);    opacity: 1; }
    40%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(0.85); opacity: 0; }
}

.card-pop {
    animation: card-pop 0.4s ease-in forwards;
    pointer-events: none;
}

@keyframes card-pop-in {
    0%   { transform: scale(0.85); opacity: 0; }
    60%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

.card-pop-in {
    animation: card-pop-in 0.4s ease-out forwards;
}

/* =============================================
   FRONT PAGE NOTES
   ============================================= */
.upload-notes {
    width: min(600px, 90vw);
    min-height: 80px;
    max-height: 300px;
    resize: vertical;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    padding: 0.75rem 0.75rem 0.25rem 0.75rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    line-height: 1.6;
    transition: border-color 0.2s;
    outline: none;
}

.upload-notes:focus {
    border-color: var(--accent);
}

.upload-notes::placeholder {
    color: #60608a;
}

/* =============================================
   VISUALS PAGE
   ============================================= */

.visuals-page {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding-top: 0rem;
}

/* Controls bar */
.visuals-controls {
    width: min(900px, 95vw);
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.vis-control-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    gap: 0.4rem;
    flex: 1;
    min-width: 180px;
}

.vis-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: #60608a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vis-select {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    transition: border-color 0.2s;
    cursor: pointer;
}


.vis-select:focus {
    outline: none;
    border-color: var(--accent);
}

.vis-multiselect {
    min-height: 100px;
    max-height: 160px;
}

.vis-multiselect-signal {
    min-height: 100px;
    max-height: 240px;
}

.vis-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Graph grid */
.visuals-grid {
    width: min(1440px, 95vw);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding-bottom: 4rem;
}

.vis-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* col-span-2 takes the full row */
.vis-span-2 {
    grid-column: span 2;
}

.vis-span-1 {
    grid-column: span 1;
}

.vis-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

.vis-panel-title {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.vis-graph-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.vis-canvas {
    width: 100%;
    max-width: 700px;
    border-radius: 8px;
    display: block;
}

.vis-graph-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.vis-count {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #60608a;
}

.vis-warn {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--error);
}

/* Responsive: stack to single column on narrow screens */
@media (max-width: 720px) {
    .visuals-grid {
        grid-template-columns: 1fr;
    }
    .vis-span-2 {
        grid-column: span 1;
    }
}


/* =============================================
   UPLOAD CARDS — extended layout
   ============================================= */


/* Status badge */
.status-badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    width: 5.5rem;
    white-space: nowrap;
}

.status-pending {
    background: rgba(255, 183, 0, 0.12);
    color: var(--accent);
    border: 1px solid rgba(255, 183, 0, 0.3);
}

.status-processing {
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.status-completed {
    background: rgba(0, 255, 136, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-failed {
    background: rgba(255, 68, 102, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 68, 102, 0.3);
}



/* =============================================
   VISUALS — draggable floating control panel
   ============================================= */

.visuals-controls-floating {
    position: fixed;
    z-index: 200;
    width: min(260px, 15vw);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(18, 18, 26, 0.92);
    backdrop-filter: blur(14px);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    overflow: hidden;
}

/* Snapped to left edge */
.vis-controls-snap-left {
    left: 1rem;
    right: auto;
}

/* Snapped to right edge */
.vis-controls-snap-right {
    right: 1rem;
    left: auto;
}

/* Drag handle strip at the top */
.vis-drag-handle {
    position: absolute;
    top: 0.3rem;
    right: 0.4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 1.25rem;
    width: 1.25rem;
    cursor: grab;
    border-radius: 6px;
    margin: 0;                  /* remove the old negative margins */
    transition: background 0.15s;
    z-index: 1;
}

.vis-drag-handle:active {
    cursor: grabbing;
}

.vis-drag-handle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vis-drag-dots {
    font-size: 1rem;
    color: #40405a;
    letter-spacing: 0.1em;
    transition: color 0.15s;
}

.vis-drag-handle:hover .vis-drag-dots {
    color: #60608a;
}

/* Give the graph grid full width since panel is now floating */
.visuals-grid {
    width: 90vw;
    max-width: 1440px;
    margin-top: 1rem;
}

.vis-resize-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 1.25rem;
    min-height: 1.25rem;
    width: 100%;               /* add this */
    align-self: stretch;       /* add this */
    cursor: ns-resize;
    border-radius: 0 0 10px 10px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.15s;
    flex-shrink: 0;
    box-sizing: border-box;    /* add this */
}
 
.vis-resize-handle:hover { background: rgba(255, 255, 255, 0.05); }

 
.vis-resize-dots {
    font-size: 0.7rem;
    color: #40405a;
    letter-spacing: 0.15em;
    line-height: 1;
    transition: color 0.15s;
}
 
.vis-resize-handle:hover .vis-resize-dots { color: #60608a; }

.visuals-controls-floating .vis-control-group {
    min-width: unset;
    flex: unset;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
 
.visuals-controls-floating .vis-multiselect {
    min-height: 80px;
    max-height: 200px;
}

.visuals-controls-floating .vis-select {
    width: 100%;
    box-sizing: border-box;
}
 
.visuals-controls-floating .vis-actions {
    flex-direction: column;
    gap: 0.4rem;
}
 
.visuals-controls-floating .vis-actions .browse-btn {
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.78rem;
}

.vis-controls-scroll {
    flex: 1;
    min-height: 0;        /* critical — allows flex child to shrink */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.75rem 1rem 0.75rem 1rem;  /* increase top padding slightly */
}

.vis-search-input {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    padding: 0.4rem 0.65rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
    outline: none;
}

.vis-search-input:focus {
    border-color: var(--accent);
}

.vis-search-input::placeholder {
    color: #40405a;
}

.vis-multiselect-wrap {
    resize: vertical;
    overflow: hidden;
    min-height: 100px;
    max-height: 400px;
    height: 160px;
    display: flex;
    flex-direction: column;
}

.vis-multiselect-wrap .vis-multiselect-signal {
    flex: 1;
    min-height: 0;
    max-height: unset;
    height: 100%;
}

/* =============================================
   CAN CONFIG AND DATABASES CARDS
   ============================================= */


.upload-tags,
.upload-card {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.4fr 0.8fr;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
    align-items: center;
}

.upload-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    transition: border-color .2s, transform .2s;
}

.upload-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* =============================================
   VISUALS — TABLE
   ============================================= */

.vis-table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.vis-table-scroll {
    width: 100%;
    max-height: 420px;
    overflow: auto;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.vis-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
}

.vis-th {
    position: sticky;
    top: 0;
    background: var(--surface);
    color: var(--accent);
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    z-index: 1;
}

.vis-tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.vis-tr:hover {
    background: rgba(255, 183, 0, 0.04);
}

.vis-td {
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
    color: var(--text);
    white-space: nowrap;
}

.vis-td-mono {
    color: #a0a0c0;
}

/* ── Hardpoint page layout ──────────────────────────────────────────────── */
.page-hardpoint {
    display: grid;
    grid-template-columns: 1fr 280px;
    height: 100%;
    overflow: hidden;
}

/* ── wgpu container ─────────────────────────────────────────────────────── */
.wgpu-container {
    position: relative;
    background: #0d0d10;
    overflow: hidden;
}

.wgpu-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    cursor: crosshair;
}

/* ── Tool palette (overlay on canvas) ──────────────────────────────────── */
.tool-palette {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(17,17,20,0.90);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: blur(8px);
    z-index: 10;
    min-width: 148px;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text1);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px 10px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tool-btn:hover  { background: var(--bg3); color: var(--text0); }
.tool-btn.active {
    background: var(--bg3);
    border-color: var(--cyan);
    color: var(--cyan);
}

.tool-sep { border: none; border-top: 1px solid var(--line); margin: 2px 0; }

.tool-hint {
    color: var(--text2);
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 2px 6px;
    line-height: 1.4;
}

/* ── Info panel (right sidebar) ─────────────────────────────────────────── */
.info-panel {
    background: var(--bg1);
    border-left: 1px solid var(--line);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.info-panel.empty {
    align-items: center;
    justify-content: center;
}

.info-hint {
    color: var(--text2);
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
}

.info-title {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--cyan);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.info-field > span {
    font-size: 11px;
    color: var(--text2);
    letter-spacing: 0.04em;
}
.info-field input[type="text"],
.info-field input[type="number"] {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--text0);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px 9px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.info-field input:focus { border-color: var(--cyan); }

.info-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.coord-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.coord-field > span {
    font-size: 10px;
    color: var(--text2);
    letter-spacing: 0.04em;
}
.coord-field input {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--text0);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 7px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.coord-field input:focus { border-color: var(--cyan); }

.info-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.info-check > span {
    font-size: 12px;
    color: var(--text1);
}
.info-check input[type="checkbox"] {
    accent-color: var(--cyan);
    width: 14px;
    height: 14px;
}

.info-static {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}
.info-label { font-size: 11px; color: var(--text2); }
.info-value { font-family: var(--font-mono); font-size: 11px; color: var(--text1); }

.apply-btn {
    margin-top: auto;
    background: transparent;
    border: 1px solid var(--cyan);
    border-radius: 6px;
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    padding: 9px 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
}
.apply-btn:hover {
    background: var(--cyan);
    color: var(--bg0);
}