  .tools-hero { padding: 130px var(--gutter) 24px; }
  .tools-hero .eyebrow { display:block; }
  .tools-hero h1 { font-family: var(--f-display); font-weight:700; font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin-top:10px; }
  .tools-hero p { color: var(--c-grey); font-size:0.92rem; margin-top:8px; max-width:70ch; }

  .tools-shell {
    max-width: 1680px; margin: 0 auto; padding: 0 var(--gutter) 100px;
    display:grid; grid-template-columns: 240px 1fr; gap: 22px; align-items:start;
  }

  /* Master menu — persistent, always visible, never collapses on desktop */
  .tool-sidebar {
    position: sticky; top: 104px;
    display:flex; flex-direction:column; gap:2px;
    border:1px solid var(--c-line); border-radius:16px; background:var(--c-surface); padding:10px;
  }
  .tool-sidebar__label { font-family: var(--f-mono); font-size:0.63rem; letter-spacing:0.14em; text-transform:uppercase; color: var(--c-grey-dim); padding: 8px 12px 4px; }
  .tool-nav-item { display:flex; flex-direction:column; gap:2px; text-align:left; width:100%; padding:10px 13px; border-radius:10px; border:none; border-left:2px solid transparent; background:none; color:var(--c-grey); cursor:pointer; transition: all .2s ease; }
  .tool-nav-item:hover { background: rgba(139,0,0,0.08); color:var(--c-white); }
  .tool-nav-item.is-active { background: rgba(139,0,0,0.16); color:var(--c-white); border-left-color: var(--c-red); }
  .tool-nav-item__label { font-family: var(--f-body); font-weight:600; font-size:0.86rem; }
  .tool-nav-item__desc { font-size:0.7rem; color: var(--c-grey-dim); line-height:1.4; }

  .tool-main { min-width:0; }
  .tool-panel-head { margin-bottom: 14px; }
  .tool-panel-head h2 { font-family: var(--f-display); font-weight:700; font-size:1.25rem; }
  .tool-panel-head p { color: var(--c-grey); font-size:0.85rem; margin-top:4px; }

  .tool-card { border:1px solid var(--c-line); border-radius:18px; background:var(--c-surface); padding:24px; width:100%; }

  .workspace-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
  .workspace-actions { display:flex; gap:8px; flex-wrap:wrap; }
  .workspace-count { font-family: var(--f-mono); font-size:0.72rem; color:var(--c-grey-dim); }

  textarea.tool-textarea {
    width:100%; min-height: 46vh; background:var(--c-black-deep); border:1px solid var(--c-line); border-radius:12px;
    color:var(--c-white); font-family: var(--f-mono); font-size:0.92rem; line-height:1.7; padding:20px; resize:vertical; outline:none;
  }
  textarea.tool-textarea:focus { border-color: var(--c-red); }

  .btn-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap:8px; margin-top:16px; }
  .tool-btn {
    font-family: var(--f-body); font-size:0.82rem; padding:11px 13px; border-radius:9px; border:1px solid var(--c-line);
    background: var(--c-black-deep); color:var(--c-white); cursor:pointer; transition: all .2s ease; text-align:left;
  }
  .tool-btn:hover { border-color: var(--c-line-red); background: rgba(139,0,0,0.12); }

  .tf-input, .tf-textarea-sm {
    background:var(--c-black-deep); border:1px solid var(--c-line); border-radius:9px; color:var(--c-white);
    font-family: var(--f-body); font-size:0.9rem; padding:11px 13px; outline:none;
  }
  .tf-input:focus, .tf-textarea-sm:focus { border-color: var(--c-red); }
  .tf-checks { display:flex; gap:16px; margin-top:10px; flex-wrap:wrap; }
  .tf-check { display:flex; align-items:center; gap:7px; font-size:0.84rem; color:var(--c-grey); }
  .tf-check input { accent-color: var(--c-red); }
  .tf-actions { display:flex; gap:10px; margin-top:14px; flex-wrap:wrap; }
  .tf-results {
    margin-top:12px; background:var(--c-black-deep); border:1px solid var(--c-line); border-radius:10px; padding:14px;
    font-family: var(--f-mono); font-size:0.82rem; color:var(--c-grey); min-height:60px; white-space:pre-wrap; max-height:320px; overflow:auto;
  }
  .stat-grid { display:flex; flex-direction:column; margin-top:16px; }
  .stat-row { display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--c-line); font-size:0.88rem; }
  .tf-subhead { font-family: var(--f-mono); font-size:0.66rem; letter-spacing:0.1em; text-transform:uppercase; color: var(--c-grey-dim); margin-top:22px; margin-bottom:8px; }
  #img2b64-preview img, #b642img-preview img { max-width:100%; max-height:220px; border-radius:10px; border:1px solid var(--c-line); }

  .gen-block { border-top:1px solid var(--c-line); padding-top:22px; margin-top:22px; }
  .gen-block:first-child { border-top:none; padding-top:0; margin-top:0; }
  .gen-block h3 { font-family: var(--f-display); font-weight:700; font-size:1.02rem; margin-bottom:12px; }
  .gen-row { display:flex; gap:10px; flex-wrap:wrap; }
  .gen-row .tf-input { flex:1; min-width:160px; }
  .gen-output { margin-top:12px; min-height:44px; }
  .gen-grid { display:grid; grid-template-columns: 1fr 1fr; gap:22px; }
  @media (max-width:900px){ .gen-grid { grid-template-columns: 1fr; } }

  .tool-panel { display:none; }
  code.inline { font-family: var(--f-mono); background: var(--c-black-deep); border:1px solid var(--c-line); border-radius:5px; padding:1px 6px; font-size:0.85em; }

  @media (max-width: 900px) {
    .tools-shell { grid-template-columns: 1fr; }
    .tool-sidebar { position: static; flex-direction:row; overflow-x:auto; gap:8px; padding:10px; -webkit-overflow-scrolling: touch; }
    .tool-sidebar__label { display:none; }
    .tool-nav-item { flex-direction:row; align-items:center; white-space:nowrap; border-left:none; border-bottom:2px solid transparent; flex-shrink:0; }
    .tool-nav-item.is-active { border-left-color:transparent; border-bottom-color: var(--c-red); }
    .tool-nav-item__desc { display:none; }
    textarea.tool-textarea { min-height: 260px; }
  }
