:root {
    color-scheme: light;
    --bg: #e7eef5;
    --panel: rgba(255, 255, 255, 0.96);
    --ink: #0f2232;
    --muted: #607181;
    --accent: #0b5f98;
    --accent-strong: #0a4873;
    --accent-soft: #dbe8f3;
    --line: #d4deea;
    --shadow: 0 18px 46px rgba(15, 34, 50, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(11, 95, 152, 0.14), transparent 26%),
        linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
}

.page {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0;
}

body:not(.connected) .page {
    max-width: 760px;
}

body.connected {
    background: #07182b;
    overflow: hidden;
}

body.connected .page {
    max-width: none;
    min-height: 100vh;
    padding: 0;
    background: #07182b;
}

body.connected .page {
    display: grid;
    gap: 10px;
}

body.connected .hero,
body.connected #loginPanel {
    display: none;
}

body.connected #remotePanel {
    gap: 0;
}

body.connected .screen-shell {
    gap: 0;
    padding-top: 0;
    min-height: 100vh;
    background: #07182b;
}

.hero {
    padding: 24px 28px;
    border-radius: 22px;
    background: linear-gradient(135deg, #0f3148, #165a88);
    color: white;
    box-shadow: var(--shadow);
}

body:not(.connected) .hero {
    display: block;
    margin: 28px 0 0;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.hero h1 {
    margin: 0;
    font-size: 38px;
}

.hero-copy {
    margin: 14px 0 0;
    max-width: 760px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.84);
}

.panel {
    margin-top: 18px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

body:not(.connected) {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(11, 95, 152, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(21, 90, 136, 0.12), transparent 26%),
        linear-gradient(180deg, #f7fbff 0%, #e7eef5 100%);
}

body:not(.connected) .page {
    padding: 28px 20px 42px;
}

body:not(.connected) #loginPanel {
    margin-top: 18px;
    padding: 22px 22px 18px;
    border: 1px solid rgba(11, 95, 152, 0.14);
    box-shadow: 0 28px 60px rgba(15, 34, 50, 0.14);
    background: rgba(255, 255, 255, 0.98);
}

body:not(.connected) #loginPanel .section-title {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #0d2740;
}

body:not(.connected) #loginPanel .status {
    margin-top: 14px;
    color: #5d7083;
    font-size: 15px;
}

body:not(.connected) .auth-grid {
    gap: 16px;
    margin-top: 18px;
}

body:not(.connected) .auth-grid label {
    gap: 9px;
}

body:not(.connected) .auth-grid span {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #567086;
}

.section-title,
.group-title,
.pane-title {
    font-weight: 700;
    font-size: 18px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

body:not(.connected) .auth-grid {
    grid-template-columns: 1fr;
}

.auth-grid label {
    display: grid;
    gap: 8px;
}

.auth-grid span,
.pane-path {
    color: var(--muted);
    font-size: 13px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.screen-shell,
.side-stack {
    display: grid;
    gap: 18px;
}

.session-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, #12344a, #0e2b3e);
    color: white;
    position: relative;
}

body.connected .session-toolbar {
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.92);
    position: fixed;
    top: -38px;
    left: 50%;
    right: auto;
    width: min(578px, calc(100vw - 24px));
    z-index: 60;
    transform: translate(-50%, calc(-100% + 20px));
    transition: transform 180ms ease;
}

    body.connected.toolbar-open .session-toolbar,
    body.connected .session-toolbar:focus-within {
        transform: translate(-50%, 0);
        top: 0px!important;
    }

.toolbar-handle {
    display: none;
}

body.connected .toolbar-handle {
    display: inline-grid;
    place-items: center;
    position: absolute;
    left: 50%;
    bottom: -33px;
    transform: translateX(-50%);
    width: 47px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
    color: white;
    font-size: 16px;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.92);
    background: linear-gradient(180deg, #12344a, #0e2b3e);
}

body.connected .toolbar-handle:hover {
    filter: none;
}

.toolbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    background: #f25c54;
    color: white;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

body.connected .toolbar-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.toolbar-brand-title {
    font-weight: 700;
}

body.connected .toolbar-brand-title {
    font-size: 15px;
}

.toolbar-brand-subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.toolbar-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

body.connected .toolbar-strip {
    gap: 8px;
    justify-content: center;
}

.toolbar-status {
    display: flex;
    align-items: center;
    justify-items: end;
    gap: 0;
}

.toolbar-live-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.toolbar-live-dot.live {
    background: #4fe07d;
    box-shadow: 0 0 0 3px rgba(79, 224, 125, 0.18);
}

.toolbar-live-dot.offline {
    background: #ff5d5d;
    box-shadow: 0 0 0 3px rgba(255, 93, 93, 0.18);
}

.toolbar-menu {
    position: relative;
}

.toolbar-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tool-button,
.tool-chip,
button,
input,
select {
    font: inherit;
}

.tool-button {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
    font-size: 20px;
    display: inline-grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.tool-button svg {
    width: 19px;
    height: 19px;
    display: block;
}

body.connected .tool-button {
    /*width: 42px;*/
    height: 42px;
    border-radius: 12px;
    font-size: 17px;
    display: inline-grid;
    place-items: center;
}

body.connected .tool-button svg {
    width: 18px;
    height: 18px;
}

.tool-button.active {
    background: #d45752;
    color: white;
}

button,
.tool-chip {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    background: var(--accent);
    color: white;
    cursor: pointer;
}

button.secondary,
.tool-chip.secondary {
    background: var(--accent-soft);
    color: var(--ink);
}

.tool-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(11, 95, 152, 0.12);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(15, 34, 50, 0.18);
    display: none;
    z-index: 20;
}

.toolbar-menu.open .tool-menu {
    display: grid;
    gap: 8px;
}

.tool-menu-item {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    background: #eef5fb;
    color: var(--ink);
}

.tool-menu-field {
    display: grid;
    gap: 6px;
    padding: 6px 2px;
}

.tool-menu-field span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

button:hover,
.tool-chip:hover,
.tool-button:hover {
    filter: brightness(0.97);
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    background: white;
    color: var(--ink);
}

input::placeholder {
    color: #8ca0b2;
}

body:not(.connected) input,
body:not(.connected) select {
    min-height: 48px;
    border: 1px solid #c6d6e5;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
    color: #10293d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body:not(.connected) input:focus,
body:not(.connected) select:focus {
    outline: none;
    border-color: #0b5f98;
    box-shadow: 0 0 0 4px rgba(11, 95, 152, 0.12);
}

body:not(.connected) #connectButton {
    min-width: 180px;
    padding: 13px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0b5f98, #165a88);
    box-shadow: 0 12px 26px rgba(11, 95, 152, 0.22);
}

.screen-panel {
    padding: 14px;
    min-height: calc(100vh - 110px);
}

body.connected .screen-panel {
    margin-top: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    background: #07182b;
    box-shadow: none;
    overflow: hidden;
}

.screen {
    width: 100%;
    min-height: calc(100vh - 150px);
    display: block;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid #c5d3e1;
    background: #dfe8ef;
    cursor: default;
    outline: none;
}

body.connected .screen {
    height: 100vh;
    width: 100vw;
    min-height: 0;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
    background: #07182b;
    object-position: center top;
}

body.connected #status {
    display: none;
}

.compact-panel {
    display: grid;
    gap: 10px;
}

.button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.button-row.narrow {
    max-width: 240px;
    margin-top: 14px;
}

body:not(.connected) .button-row.narrow {
    max-width: 100%;
}

body:not(.connected) #loginPanel {
    margin-top: 48px;
}

.status {
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.hidden {
    display: none;
}

.overlay-panel.hidden,
#filesPanel.hidden,
#chatPanel.hidden,
#controlsPanel.hidden {
    display: none;
}

.overlay-panel {
    position: fixed;
    z-index: 40;
}

.overlay-card {
    margin-top: 0;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#controlsPanel {
    top: 90px;
    right: 12px;
    width: min(360px, calc(100vw - 24px));
}

#chatPanel {
    top: 90px;
    right: 12px;
    width: min(360px, calc(100vw - 24px));
}

#filesPanel {
    top: 90px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    overflow: hidden;
}

.transfer-panel {
    display: grid;
    gap: 10px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.transfer-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.transfer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.transfer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
    min-height: 0;
}

.file-pane {
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    background: #ffffff;
    padding: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 0;
    min-height: 0;
    overflow: hidden;
}

.pane-device {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf1f5;
    background: #ffffff;
}

.pane-device-title {
    font-weight: 700;
    font-size: 14px;
    color: #12a000;
}

.pane-toolbar {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
}

.file-grid-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 158px 126px;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid #edf1f5;
    border-bottom: 1px solid #edf1f5;
    background: #fafbfd;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transfer-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.transfer-button {
    min-height: 46px;
    font-size: 20px;
    border-radius: 14px;
}

.file-grid {
    display: grid;
    gap: 6px;
    overflow: auto;
    align-content: start;
    min-height: 0;
    padding: 8px 12px 12px;
    background: #ffffff;
}

.file-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 158px 126px;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #edf1f5;
    background: #ffffff;
}

.file-card.selected {
    border-color: #6ea4cc;
    background: #eaf4fb;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.file-meta {
    font-size: 11px;
    color: var(--muted);
}

mini-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.mini-button {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    color: #cbd5f5;
    white-space: nowrap;
}

    .mini-button:hover {
        background: rgba(59,130,246,0.4);
    }

.queue-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    padding: 10px 12px;
    min-height: 0;
}

.queue-list {
    margin-top: 8px;
    display: grid;
    gap: 6px;
    max-height: 160px;
    overflow: auto;
}

.queue-item {
    padding: 8px 10px;
    border-radius: 10px;
    background: #f6fafc;
    border: 1px solid var(--line);
}

.queue-title {
    font-weight: 600;
}

.queue-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.queue-progress {
    margin-top: 8px;
    height: 9px;
    border-radius: 999px;
    background: #d9e7f3;
    overflow: hidden;
}

.queue-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0b5f98, #3da3db);
    transition: width 160ms ease;
}

.chat-list {
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
}

.chat-item {
    padding: 10px 12px;
    border-radius: 14px;
    background: #f7fafc;
    border: 1px solid var(--line);
}

.chat-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.chat-attachment {
    margin-top: 10px;
    padding: 10px 12px;
    background: #eef4fa;
    border-radius: 12px;
}

.chat-attachment-name {
    font-weight: 600;
    color: #10293d;
}

.chat-attachment-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.chat-attachment-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.hidden-file-input {
    display: none;
}

@media (max-width: 1100px) {
    .transfer-layout {
        grid-template-columns: 1fr;
    }

    .transfer-center {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .auth-grid,
    .session-toolbar {
        grid-template-columns: 1fr;
    }

    .toolbar-status {
        justify-items: start;
    }

    #controlsPanel,
    #chatPanel,
    #filesPanel {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
    }

    .button-row,
    .file-grid-header,
    .file-card {
        grid-template-columns: minmax(0, 1fr) 90px 140px 100px;
    }
}

/*new css*/

/* ===== FORCE DARK MODE (REMOVE WHITE) ===== */
#filesPanel,
.transfer-panel,
.file-pane,
.file-grid,
.queue-panel {
    background: rgba(255,255,255,0.03) !important;
}

/* ===== MAIN PANEL ===== */
.transfer-panel {
    width: 600px;
    height: 600px;
    background: linear-gradient(180deg, #0f2a3a, #081923);
    border-radius: 16px;
    padding: 10px;
    color: #dbeafe;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* ===== LAYOUT FIX ===== */
.transfer-layout {
    display: grid;
    grid-template-columns: 1fr 70px 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

/* ===== FILE PANES ===== */
.file-pane {
    background: rgba(255,255,255,0.04) !important;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== HEADER ===== */
.pane-device {
    background: rgba(255,255,255,0.06) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.pane-device-title {
    color: #4ade80;
}

/* ===== INPUT FIX ===== */
body.connected input,
body.connected input[type="file"] {
    background: rgba(255,255,255,0.08) !important;
    color: white !important;
    border: none !important;
    font-size: 11px;
    overflow: hidden;
}

    /* File button */
    body.connected input[type="file"]::file-selector-button {
        background: #334155;
        color: white;
        border: none;
        border-radius: 6px;
        padding: 4px 8px;
    }

/* ===== GRID HEADER ===== */
.file-grid-header {
    background: rgba(255,255,255,0.05) !important;
    color: #93c5fd;
}

/* ===== FILE LIST ===== */
.file-grid {
    background: rgba(255,255,255,0.03) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Empty message styling */
    .file-grid:empty::before {
        content: "No files selected";
        color: #94a3b8;
        font-size: 12px;
    }
    .file-grid:empty::before {
        content: "Choose files to upload";
    }
/* ===== FILE CARD ===== */
.file-card {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.08);
    color: #e2e8f0;
}

    .file-card:hover {
        background: rgba(59,130,246,0.2);
    }

    .file-card.selected {
        background: rgba(59,130,246,0.35);
        border-color: #3b82f6;
    }

/* ===== TRANSFER BUTTON ===== */
.transfer-button {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(59,130,246,0.5);
}

    .transfer-button.secondary {
        background: rgba(255,255,255,0.1);
    }

/* ===== QUEUE ===== */
.queue-panel {
    background: rgba(255,255,255,0.04) !important;
    border-radius: 10px;
    padding: 8px;
}

/* ===== PROGRESS ===== */
.queue-progress {
    background: rgba(255,255,255,0.1);
}

.queue-progress-bar {
    background: linear-gradient(90deg, #38bdf8, #3b82f6);
}

/* ===== SCROLLBAR ===== */
.file-grid::-webkit-scrollbar {
    width: 6px;
}

.file-grid::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #cbd5f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

    .icon-btn:hover {
        background: rgba(59,130,246,0.4);
        transform: scale(1.05);
    }
