.drop-zone { padding: 12px; border-bottom: 1px dashed #cbd5e1; font-size: 12px; text-align: center; color: #64748b; }
.drop-zone label { color: #1a5c83; cursor: pointer; text-decoration: underline; }
.drop-zone input { display: none; }
.column.drag-over { outline: 3px solid #1a5c83; background: #e0f2fe; }
.file-name { border: 0; background: transparent; color: inherit; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; font: inherit; }
.file-actions { display: flex; gap: 8px; margin-top: 8px; }
.file-actions button { padding: 4px 7px; border: 1px solid #cbd5e1; border-radius: 4px; background: white; cursor: pointer; }
.file-actions .delete-file { color: #b91c1c; }
.file-item { flex-direction: column; align-items: stretch !important; }
.main-container { overflow-x: auto !important; }
.column { min-width: 210px; }

  body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #1e293b;
  }
  
  .header {
    background-color: #ffffff;
    padding: 20px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
    z-index: 10;
  }

  .input-group {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .input-group label {
    font-weight: 600;
    font-size: 14px;
    color: #475569;
  }

  .input-group input, 
  .input-group select {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    width: 250px;
    font-size: 14px;
    outline: none;
    background-color: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
    font-family: 'Inter', system-ui, sans-serif;
  }

  .input-group input:focus,
  .input-group select:focus {
    border-color: #1a5c83;
    box-shadow: 0 0 0 3px rgba(26, 92, 131, 0.15);
    background-color: #ffffff;
  }
  
  .input-group input[readonly] {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
  }

  .toggle-group {
    display: flex;
    align-items: center;
    gap: 15px;
  }

  .toggle-label {
    font-weight: 600;
    font-size: 14px;
    color: #475569;
  }

  .toggle-switch {
    position: relative;
    width: 280px;
    height: 40px;
    background-color: #f1f5f9;
    border-radius: 20px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid #e2e8f0;
  }

  .toggle-switch.readonly {
    opacity: 0.8;
    pointer-events: none;
  }

  .toggle-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  .toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: 32px;
    background-color: #1a5c83;
    border-radius: 16px;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  .toggle-switch[data-state="right"] .toggle-thumb {
    transform: translateX(100%);
    background-color: #1e293b;
  }

  .toggle-text {
    position: relative;
    z-index: 3;
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    transition: color 0.3s;
  }

  .toggle-text.active {
    color: #ffffff;
  }

  #app-content {
    flex-direction: column;
    flex: 1;
    height: 100vh;
  }

  .main-container {
    display: flex;
    flex: 1;
    flex-grow: 1;
    min-height: 400px;
    padding: 30px 40px;
    gap: 24px;
    background-color: transparent;
    overflow: hidden;
  }

  .column {
    flex: 1;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
  }

  .column h2 {
    font-size: 15px;
    text-align: center;
    margin: 0;
    padding: 16px 12px;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .file-list {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    padding: 16px;
    background-color: #ffffff;
  }

  .file-item {
    background-color: #f8fafc;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 6px;
    word-break: break-word;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
  }
  
  .file-item::before {
    content: "📄";
    margin-right: 8px;
    font-size: 14px;
    opacity: 0.7;
  }
  
  .file-item:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  }
  
  .loading-state {
    text-align: center;
    font-style: italic;
    color: #94a3b8;
    margin-top: 30px;
    font-size: 13px;
  }

  .footer {
    display: flex;
    flex-direction: column;
    padding: 0 40px 30px 40px;
    gap: 20px;
    background-color: transparent;
  }

  .button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
  }

  .action-btn {
    background-color: #1a5c83;
    color: white;
    border: none;
    padding: 14px 0;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 350px;
    box-shadow: 0 4px 6px -1px rgba(26, 92, 131, 0.2), 0 2px 4px -2px rgba(26, 92, 131, 0.2);
    font-family: 'Inter', system-ui, sans-serif;
  }

  .action-btn:hover:not(:disabled) {
    background-color: #12405d;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(26, 92, 131, 0.3), 0 4px 6px -2px rgba(26, 92, 131, 0.3);
  }

  .action-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 4px -1px rgba(26, 92, 131, 0.2);
  }

  .action-btn:disabled,
  .action-btn:disabled:hover {
    background-color: #94a3b8;
    color: #f1f5f9;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .console {
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 16px 24px;
    border-radius: 12px;
    height: 250px;
    flex-shrink: 0;
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    border: 1px solid #1e293b;
  }

  .console h3 {
    margin: 0 0 12px 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  
  .console h3::before {
    content: "●";
    margin-right: 8px;
    color: #10b981;
    font-size: 10px;
  }

  #log-output {
    flex: 1;
    background-color: #020617;
    padding: 16px;
    margin: 0;
    overflow-y: auto;
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    border-left: 3px solid #10b981;
    color: #10b981;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  }

  .settings-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .settings-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
  }

  /* Custom Scrollbar for modern look */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  
  #log-output::-webkit-scrollbar-thumb {
    background: #334155;
  }
  #log-output::-webkit-scrollbar-thumb:hover {
    background: #475569;
  }

  /* Modal podglądu pliku */
  .modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: hidden; 
    background-color: rgba(15, 23, 42, 0.6); 
    backdrop-filter: blur(6px);
  }

  .modal-content {
    background-color: #ffffff;
    margin: 2% auto; 
    padding: 0;
    border: none;
    width: 90%; 
    height: 90%;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    background-color: #f8fafc;
  }

  .close-btn {
    color: #64748b;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0 8px;
    border-radius: 4px;
  }

  .close-btn:hover,
  .close-btn:focus {
    color: #0f172a;
    background-color: #e2e8f0;
    text-decoration: none;
  }

  #file-preview-iframe {
    width: 100%;
    flex: 1;
    border: none;
    background-color: #f1f5f9;
  }

  /* --- LOGIN OVERLAY --- */
  #login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f7f9;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .login-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    text-align: center;
  }
  .login-card h2 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
  }
  .login-card .input-group {
    margin-bottom: 20px;
    text-align: left;
    display: block;
    align-items: normal;
  }
  .login-card .input-group label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 8px;
    color: #475569;
  }
  .login-card .input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    font-family: 'Inter', system-ui, sans-serif;
  }
  .login-card .input-group input:focus {
    border-color: #1a5c83;
    box-shadow: 0 0 0 3px rgba(26, 92, 131, 0.15);
    background-color: #ffffff;
  }
  .error-msg {
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    background-color: #fef2f2;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    display: none;
  }
  .login-btn {
    width: 100%;
    background-color: #1a5c83;
    color: white;
    border: none;
    padding: 14px 0;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', system-ui, sans-serif;
    box-shadow: 0 4px 6px -1px rgba(26, 92, 131, 0.2);
  }
  .login-btn:hover {
    background-color: #12405d;
    box-shadow: 0 6px 8px -1px rgba(26, 92, 131, 0.3);
  }
  .login-card .logo {
    width: 48px;
    height: 48px;
    background-color: #1a5c83;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    margin: 0 auto 20px auto;
  }

  /* Shared controls and layouts — retain the existing navy / blue / light-card palette. */
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  button, input, select, textarea { font: inherit; }
  button { cursor: pointer; }
  button:disabled { cursor: not-allowed; opacity: .55; }
  :focus-visible { outline: 3px solid #7db8da; outline-offset: 3px; }
  body { min-height: 100vh; height: 100vh; font-size: 14px; line-height: 1.5; margin: 0; overflow: hidden; }
  #app-content { display: flex; flex-direction: column; height: 100vh; max-height: 100vh; overflow: hidden; }
  .header { padding: 12px 32px; flex-wrap: wrap; gap: 16px; box-shadow: none; border-bottom: 1px solid #edf2f7; flex-shrink: 0; }
  .header-inputs { display: flex; flex: 1; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; }
  .header-inputs .input-group { flex-wrap: wrap; gap: 10px; }
  .header-inputs input { width: 220px; }
  .header-inputs select { width: 270px; }
  .input-group input, .input-group select { min-height: 38px; }
  .client-properties { padding: 8px 32px; gap: 24px; flex-shrink: 0; }
  .source-settings { padding: 8px 32px; flex-shrink: 0; }
  .btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 8px 14px; min-height: 38px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; transition: background .15s, border-color .15s; }
  .btn:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
  .btn-primary { color: #fff; background: #1a5c83; border-color: #1a5c83; }
  .btn-primary:hover:not(:disabled) { background: #12405d; border-color: #12405d; }
  .btn-danger { color: #b91c1c; border-color: #e9bfc3; }
  .btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #dc2626; }
  .main-container { flex: 1 1 0%; min-height: 0; padding: 14px 32px 8px; gap: 16px; align-items: stretch; overflow-x: auto; overflow-y: hidden; }
  .column { min-width: 210px; height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .column h2 { min-height: 48px; display: flex; align-items: center; justify-content: center; font-size: 13px; padding: 10px; flex-shrink: 0; }
  .drop-zone { min-height: 48px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; font-size: 12px; flex-shrink: 0; }
  .choose-files { border: none; background: none; color: #1a5c83; padding: 0; text-decoration: underline; font-size: inherit; }
  .file-list { flex: 1 1 0%; min-height: 0; padding: 10px; overflow-y: auto; }
  .file-item { padding: 10px 12px; font-weight: 500; font-size: 13px; cursor: default; }
  .file-item::before { content: none; }
  .file-name { line-height: 1.45; font-weight: 600; }
  .file-name:hover { color: #1a5c83; text-decoration: underline; }
  .file-actions { flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .file-actions .btn { padding: 5px 8px; min-height: 30px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 500; }
  .empty-state { padding: 24px 8px; color: #64748b; text-align: center; font-size: 13px; }
  .footer { margin-top: auto; padding: 6px 32px 14px; gap: 10px; flex-shrink: 0; }
  .button-group { display: flex; gap: 16px; justify-content: center; flex-shrink: 0; }
  .action-btn { padding: 10px 0; min-height: 40px; font-size: 14px; max-width: 320px; }
  .queue-progress { min-height: 0; margin: 0; text-align: center; color: #475569; overflow-wrap: anywhere; }
  .queue-progress:empty { display: none; }
  .console { height: 125px; padding: 10px 20px; border-radius: 10px; display: flex; flex-direction: column; flex-shrink: 0; }
  .console h3 { margin: 0 0 6px 0; font-size: 11px; letter-spacing: 0.5px; }
  #log-output { flex: 1 1 0%; min-height: 0; padding: 8px 12px; font-size: 12px; line-height: 1.45; border-radius: 6px; }
  .console:has(.operator-question:not([hidden])) { height: auto; min-height: 220px; }
  .operator-question { margin: 0 14px 14px; padding: 14px; border: 1px solid #f59e0b; border-radius: 8px; background: #fffbeb; color: #78350f; }
  .operator-question strong, .operator-question small { display: block; margin-bottom: 8px; }
  .operator-answer-row { display: flex; gap: 8px; }
  .operator-answer-row input { flex: 1; min-width: 120px; padding: 9px 11px; border: 1px solid #d6a43b; border-radius: 7px; background: white; }
  .operator-question-error { display: block; margin-top: 8px; color: #b91c1c; font-weight: 600; }
  .modal { overflow-y: auto; padding: 24px; }
  .modal-content { width: min(1200px, 100%); height: calc(100dvh - 48px); margin: 0 auto; }
  .form-modal { max-width: 540px; height: auto; max-height: calc(100dvh - 48px); margin: 4vh auto; overflow-y: auto; }
  .modal-header { align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-shrink: 0; }
  .modal-header h3 { font-size: 18px; margin: 0; color: #0f172a; }
  #preview-title, #editor-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .close-btn { background: transparent; border: none; font-size: 26px; width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .modal-body { padding: 20px; }
  .modal-body p { margin: 0 0 16px; color: #475569; }
  .modal-body .input-group { flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 16px; }
  .modal-body .input-group input, .modal-body .input-group select { width: 100%; }
  .modal-body small { color: #64748b; font-size: 12px; }
  .modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
  #file-preview-text { flex: 1; min-height: 0; overflow: auto; padding: 24px; margin: 0; background: #f8fafc; color: #1e293b; white-space: pre; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; tab-size: 2; }
  #file-preview-iframe { min-height: 0; }
  .editor-toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding: 10px 20px; color: #64748b; font-size: 12px; border-bottom: 1px solid #e2e8f0; }
  #editor-state { font-weight: 600; color: #1a5c83; }
  #editor-error { margin: 12px 20px 0; flex-shrink: 0; }

  /* Syntax Highlighting Tokens */
  .tok-tag { color: #1d4ed8; font-weight: 600; }
  .tok-attr-name { color: #0d9488; }
  .tok-attr-val { color: #d97706; }
  .tok-comment, .tok-decl { color: #64748b; font-style: italic; }
  .tok-key { color: #0369a1; font-weight: 600; }
  .tok-str { color: #16a34a; }
  .tok-num { color: #7c3aed; }
  .tok-bool { color: #dc2626; font-weight: 600; }
  .tok-null { color: #9333ea; font-style: italic; font-weight: 600; }
  .tok-text { color: #0f172a; }
  .tok-punct { color: #64748b; }

  /* Overlay Code Editor */
  .editor-code-container {
    position: relative;
    flex: 1;
    min-height: 250px;
    background: #f8fafc;
    overflow: hidden;
  }
  #editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
    font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    tab-size: 2;
    pointer-events: none;
    box-sizing: border-box;
    color: #1e293b;
  }
  #file-editor-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 20px;
    border: none;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: #0f172a;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
    overflow: auto;
    font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    tab-size: 2;
    outline: none;
    box-sizing: border-box;
    -webkit-text-fill-color: transparent;
  }
  #file-editor-text::selection {
    background: rgba(3, 105, 161, 0.22);
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
  .editor-actions { margin: 0; padding: 14px 20px; border-top: 1px solid #e2e8f0; }
  .login-card { margin: 20px; }
  @media (max-width: 900px) {
    .header { padding: 16px 20px; }
    .header-inputs { justify-content: flex-start; }
    .header-inputs .input-group { width: 100%; }
    .header-inputs input, .header-inputs select { flex: 1; width: auto; min-width: 180px; }
    .client-properties { justify-content: flex-start; }
    .main-container { padding: 20px; gap: 14px; }
    .footer { padding: 0 20px 20px; }
  }
  @media (max-width: 550px) {
    .header-inputs .input-group label { width: 100%; }
    .header-inputs select { flex-basis: 100%; }
    .toggle-group { flex-wrap: wrap; gap: 8px; }
    .toggle-switch { width: 260px; }
    .source-settings .input-group { flex-wrap: wrap; width: 100%; }
    .source-settings select { width: 100%; }
    .button-group { flex-direction: column; gap: 10px; }
    .action-btn { max-width: none; }
    .modal { padding: 10px; }
    .modal-content { height: calc(100dvh - 20px); }
    .form-modal { height: auto; max-height: calc(100dvh - 20px); margin: 0 auto; }
    .modal-header { padding: 12px; flex-wrap: wrap; }
    .modal-body { padding: 16px; }
    .editor-toolbar { padding: 10px 12px; }
  }
  @media (max-height: 680px) {
    body, #app-content {
      height: auto;
      min-height: 100vh;
      overflow-y: auto;
    }
    .main-container {
      min-height: 350px;
      overflow-y: visible;
    }
    .column {
      height: 350px;
    }
  }