/* server-picker styles now live in the shared dashboard.css, since
     both Files and Terminal use this same toolbar component */

  /* ---------- LAYOUT ---------- */

  .fe-layout{
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    height: calc(100vh - 260px);
    min-height: 380px;
  }

  .fe-explorer{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  }

  .fe-explorer-head{
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .fe-explorer-title{
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .fe-explorer-hint{
    font-size: 11px;
    color: var(--muted);
    opacity: 0.7;
  }

  .fe-tree-item.multi-selected{
    background: rgba(108,99,255,0.1);
    box-shadow: inset 2px 0 0 var(--accent);
  }

  .fe-multiselect-bar{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
  }
  .fe-multiselect-bar #feMultiSelectCount{
    color: var(--text);
    font-weight: 600;
    margin-right: auto;
  }

  .fe-multiselect-move-row{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
  }
  .fe-multiselect-move-input{
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--mono);
    padding: 5px 8px;
  }
  .fe-multiselect-move-input:focus{ border-color: var(--accent); outline: none; }

  .fe-tree{
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
  }

  .fe-tree-item{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  }

  .fe-tree-item:hover{
    background: var(--surface2);
    box-shadow: inset 2px 0 0 var(--border);
  }

  .fe-tree-item.selected{
    background: var(--surface2);
    color: var(--accent);
    box-shadow: inset 2px 0 0 var(--accent);
  }

  .tree-icon{
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tree-icon svg{ width: 15px; height: 15px; }

  .fe-tree-item .tree-icon{
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .fe-tree-item .tree-icon svg{ width: 15px; height: 15px; }

  .fe-tree-item .tree-name{
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }

  /* rename/delete: hidden until the row is actually hovered/focused,
     same "reveal on hover" treatment as row-actions elsewhere in the
     app, so a tree that's mostly for browsing doesn't read as cluttered
     with two icon buttons on every single row all the time. */
  .tree-actions{
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s var(--ease);
  }
  .fe-tree-item:hover .tree-actions,
  .fe-tree-item:focus-within .tree-actions{
    opacity: 1;
  }

  .tree-action-btn{
    background: transparent;
    border: none;
    color: var(--muted);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.1s, color 0.1s;
  }
  .tree-action-btn svg{ width: 13px; height: 13px; }

  /* 20x20 is comfortable with a mouse and too small for a thumb. on a
     touch device the hit area grows without the icon changing size, so
     nothing about the look shifts on desktop. */
  @media (pointer: coarse){
    .tree-action-btn{ width: 30px; height: 30px; }
  }
  .tree-action-btn:hover{ background: var(--border); color: var(--text); }
  .tree-action-btn.danger:hover{ background: rgba(229,72,77,0.15); color: var(--danger); }

  .tree-rename-input{
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--sans);
    padding: 1px 4px;
  }

  .fe-tree-empty, .fe-tree-loading{
    padding: 20px 14px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
  }

  .fe-tree-empty a{
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    text-decoration: none;
  }

  .fe-tree-empty a:hover{ text-decoration: underline; }

  /* how to open a folder beyond the workspace: on the machine, not here */
  .fe-roots-help{
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--muted);
  }
  .fe-roots-help[hidden]{ display: none; }
  .fe-roots-help summary{
    cursor: pointer;
    font-family: var(--mono);
    color: var(--text);
  }
  .fe-roots-help p{ margin: 8px 0; line-height: 1.5; }
  .fe-roots-cmd{
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }
  .fe-roots-cmd code{
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 11px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    word-break: break-all;
    user-select: all;
  }

  /* ---------- EDITOR PANEL ---------- */

  .fe-panel{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  }

  .fe-tabs{
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
    background: var(--surface2);
  }

  .fe-tab{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    border-right: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
  }

  .fe-tab:hover{ background: var(--surface); color: var(--text); }

  .fe-tab.active{
    background: var(--bg);
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .fe-tab .dirty-dot{
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 5px rgba(108,99,255,0.7);
    flex-shrink: 0;
  }

  .fe-tab .tab-close{
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
  }

  .fe-tab .tab-close:hover{ color: var(--danger); background: rgba(229,72,77,0.12); }

  .fe-toolbar{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
  }

  .fe-toolbar-path{
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
  }

  .fe-toolbar-status{
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    transition: color 0.2s var(--ease);
  }

  .fe-toolbar-status.dirty{ color: var(--accent); }

  .fe-body{
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
  }

  .fe-line-numbers{
    padding: 14px 12px;
    text-align: right;
    color: var(--border);
    background: var(--bg);
    user-select: none;
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    overflow: hidden;
    /* the numbers are one text node joined with "\n" (files-editor.js
       updateLineNumbers); without this they collapse onto one line and
       the gutter grows sideways across half the editor (DBT6) */
    white-space: pre;
  }

  .fe-textarea{
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    padding: 14px 18px;
    white-space: pre;
    overflow: auto;
  }

  .fe-empty{
    margin: auto;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
  }

  .fe-empty .fe-empty-icon{
    font-family: var(--mono);
    font-size: 26px;
    color: var(--border);
    margin-bottom: 8px;
  }

  /* ---------- RESPONSIVE ---------- */

  @media (max-width: 760px){
    .fe-layout{
      grid-template-columns: 1fr;
      grid-template-rows: 180px 1fr;
      height: auto;
    }
    .fe-explorer{ min-height: 180px; }
    .fe-panel{ min-height: 320px; }
  }