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

    :root {
      --bg: #f0f2f8;
      --surface: #ffffff;
      --surface2: #f4f5fa;
      --border: #e2e5ef;
      --text: #1e2235;
      --text2: #6b7080;
      --accent1: #667eea;
      --accent2: #764ba2;
      --btn-public-1: #60a5fa;
      --btn-public-2: #3b82f6;
      --btn-private-1: #9ca3af;
      --btn-private-2: #6b7280;
      --btn-default-1: #667eea;
      --btn-default-2: #764ba2;
      --green: #10b981;
      --red: #ef4444;
      --yellow: #f59e0b;
      --shadow: rgba(30, 34, 53, 0.10);
      --topbar-bg: #ffffff;
      --topbar-shadow: rgba(30, 34, 53, 0.13);
    }

    body.dark {
      --bg: #0f1117;
      --surface: #181c27;
      --surface2: #1e2235;
      --border: #2a2f45;
      --text: #e8eaf2;
      --text2: #7a809a;
      --shadow: rgba(0, 0, 0, 0.4);
      --topbar-bg: #13161f;
      --topbar-shadow: rgba(0, 0, 0, 0.5);
    }

    body {
      font-family: 'Segoe UI', system-ui, sans-serif;
      background: var(--bg);
      min-height: 100vh;
      color: var(--text);
      transition: background 0.3s, color 0.3s;
    }

    #topbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 48px;
      background: var(--topbar-bg);
      border-bottom: 1px solid var(--border);
      box-shadow: 0 2px 10px var(--topbar-shadow);
      z-index: 500;
      display: flex;
      align-items: center;
      padding: 0 16px;
      gap: 12px;
    }

    #hamburger {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text);
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      flex-shrink: 0;
    }

    #hamburger:hover { background: var(--surface2); }
    .hamburger-icon { width: 20px; height: 20px; }

    #searchWrap {
      flex: 1;
      max-width: 420px;
      position: relative;
      display: flex;
      align-items: center;
    }

    .search-icon {
      position: absolute;
      left: 10px;
      width: 14px;
      height: 14px;
      color: var(--text2);
      pointer-events: none;
    }

    #searchInput {
      width: 100%;
      padding: 7px 12px 7px 34px;
      border: 1.5px solid var(--border);
      border-radius: 8px;
      background: var(--surface2);
      color: var(--text);
      font-size: 13px;
      outline: none;
    }

    #searchInput:focus { border-color: var(--accent1); }

    #searchType {
      padding: 6px 10px;
      border: 1.5px solid var(--border);
      border-radius: 8px;
      background: var(--surface2);
      color: var(--text);
      font-size: 12px;
      outline: none;
      cursor: pointer;
    }

    #menuOverlay {
      display: none;
      flex-direction: column;
      position: fixed;
      top: 54px;
      left: 12px;
      width: min(280px, calc(100% - 24px));
      background: var(--topbar-bg);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: 0 12px 30px var(--topbar-shadow);
      z-index: 499;
      padding: 12px;
      gap: 10px;
      animation: slideDown 0.18s ease;
    }

    #menuOverlay.open { display: flex; }

    @keyframes slideDown {
      from { opacity: 0; transform: translateY(-8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .menu-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .menu-sep {
      height: 1px;
      background: var(--border);
      margin: -1px 0;
    }

    .menu-btn {
      background: var(--surface2);
      border: 1.5px solid var(--border);
      color: var(--text);
      padding: 9px 14px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 9px;
      width: 100%;
      transition: background 0.2s, border-color 0.2s;
      white-space: nowrap;
    }

    .menu-btn:hover { background: var(--border); border-color: var(--accent1); }
    .menu-btn.active { background: rgba(102,126,234,0.12); border-color: var(--accent1); color: var(--accent1); }

    .menu-icon {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }

    .menu-btn-label { flex: 1; text-align: left; }

    .menu-btn-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--yellow);
      flex-shrink: 0;
      display: none;
    }

    .menu-btn.active .menu-btn-dot { display: block; }

    .menu-btn-danger {
      background: rgba(239,68,68,0.08);
      border-color: rgba(239,68,68,0.35);
      color: var(--red);
    }
    .menu-btn-danger:hover { background: var(--red); border-color: var(--red); color: #ffffff; }

    #main {
      padding: 64px 20px 40px;
      max-width: 1200px;
      margin: 0 auto;
    }

    .section-wrap {
      margin-bottom: 24px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 2px 8px var(--shadow);
    }

    .section-head {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      background: var(--surface2);
      user-select: none;
    }

    .section-collapse-btn,
    .section-add-btn,
    .section-del-btn,
    .section-rename-btn {
      background: none;
      border: none;
      cursor: pointer;
      width: 26px;
      height: 26px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 6px;
      flex-shrink: 0;
    }

    .section-collapse-btn { font-size: 16px; color: var(--text2); transition: background 0.2s, transform 0.2s; }
    .section-collapse-btn:hover { background: var(--border); }
    .section-wrap.collapsed .section-collapse-btn { transform: rotate(-90deg); }

    .section-add-btn { font-size: 15px; color: var(--green); }
    .section-add-btn:hover { background: rgba(16,185,129,0.1); }

    .section-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
    }

    .section-count {
      font-size: 12px;
      color: var(--text2);
      background: var(--border);
      padding: 2px 7px;
      border-radius: 99px;
    }

    .section-del-btn,
    .section-rename-btn { display: none; font-size: 14px; }
    .section-del-btn { color: var(--red); }
    .section-rename-btn { color: var(--yellow); }

    body.edit-mode .section-del-btn,
    body.edit-mode .section-rename-btn { display: flex; }

    .section-body {
      padding: 14px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      min-height: 52px;
    }

    .section-wrap.collapsed .section-body { display: none; }

    .btn-wrap {
      display: inline-flex;
      align-items: stretch;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 1px 4px var(--shadow);
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .btn-wrap:hover { transform: translateY(-2px); box-shadow: 0 4px 12px var(--shadow); }

    body.edit-mode .btn-wrap {
      animation: shake 0.5s ease-in-out infinite;
      cursor: grab;
    }

    body.edit-mode .btn-wrap:hover,
    body.edit-mode .section-wrap:hover .btn-wrap { animation: none; }
    body.edit-mode .btn-wrap.dragging { opacity: 0.4; animation: none; cursor: grabbing; }

    @keyframes shake {
      0%,100% { transform: translate(0,0); }
      25% { transform: translate(-2px,-1px); }
      50% { transform: translate(2px,1px); }
      75% { transform: translate(-2px,1px); }
    }

    .copy-btn {
      border: none;
      padding: 10px 16px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      color: white;
      transition: filter 0.2s;
      display: flex;
      align-items: center;
      gap: 6px;
      position: relative;
      max-width: 340px;
    }

    .copy-btn:hover { filter: brightness(1.08); }
    .copy-btn.copied { filter: brightness(0.85); }
    .copy-btn.vis-public { background: linear-gradient(135deg, var(--btn-public-1), var(--btn-public-2)); }
    .copy-btn.vis-private { background: linear-gradient(135deg, var(--btn-private-1), var(--btn-private-2)); }
    .copy-btn.vis-other { background: linear-gradient(135deg, var(--btn-default-1), var(--btn-default-2)); }

    .copy-btn .btn-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .copy-btn::after {
      content: attr(data-preview);
      position: absolute;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%);
      background: var(--surface);
      color: var(--text);
      padding: 7px 11px;
      border-radius: 7px;
      font-size: 12px;
      line-height: 1.4;
      white-space: pre-wrap;
      max-width: 280px;
      word-wrap: break-word;
      box-shadow: 0 4px 14px var(--shadow);
      border: 1.5px solid var(--accent1);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s;
      z-index: 200;
    }

    .copy-btn.show-tip::after { opacity: 1; }

    .btn-edit,
    .btn-del {
      display: none;
      border: none;
      padding: 0 10px;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .btn-edit { background: rgba(245,158,11,0.10); color: var(--yellow); font-size: 14px; }
    .btn-del { background: rgba(239,68,68,0.10); color: var(--red); font-size: 12px; border-radius: 0 8px 8px 0; }

    body.edit-mode .btn-edit,
    body.edit-mode .btn-del { display: flex; }

    .btn-wrap.search-hidden,
    .section-wrap.search-hidden { display: none; }

    #addSectionBtn {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 8px auto 0;
      background: var(--surface);
      border: 1.5px dashed var(--border);
      color: var(--text2);
      padding: 10px 24px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
    }

    .modal-bg {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 800;
      justify-content: center;
      align-items: center;
    }

    .modal-bg.open { display: flex; }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 28px;
      width: 90%;
      max-width: 460px;
      box-shadow: 0 20px 60px var(--shadow);
    }

    .modal h2 { font-size: 16px; margin-bottom: 18px; color: var(--text); }

    .form-group { margin-bottom: 13px; }
    .form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }

    .form-group input,
    .form-group textarea,
    .form-group select {
      width: 100%;
      padding: 9px 11px;
      border: 1.5px solid var(--border);
      border-radius: 8px;
      background: var(--surface2);
      color: var(--text);
      font-size: 13px;
      outline: none;
    }

    .form-group textarea { resize: vertical; min-height: 130px; }

    .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
    .mbtn { padding: 9px 18px; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
    .mbtn.primary { background: var(--accent1); color: white; }
    .mbtn.secondary { background: var(--border); color: var(--text2); }


    #appVersion {
        position: fixed;
        bottom: 10px;
        left: 12px;
        font-size: 10px;
        color: var(--text2);
        opacity: 0.5;
        background: rgba(0, 0, 0, 0.04);
        padding: 4px 8px;
        border-radius: 6px;
        user-select: none;
        z-index: 1500;
        cursor: default;
        transition: opacity 0.2s;
    }

    #appVersion:hover {
        opacity: 1;
    }

    #appVersion.unsaved {
        opacity: 1;
        color: var(--yellow);
        background: rgba(245, 158, 11, 0.12);
        box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16) inset;
    }

    #tagList { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
    .tag-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface2); border: 1.5px solid var(--border); padding: 4px 10px; border-radius: 99px; font-size: 12px; color: var(--text); }
    .tag-chip button { background: none; border: none; cursor: pointer; color: var(--red); font-size: 12px; padding: 0; line-height: 1; }

    .import-helper {
      margin-top: -4px;
      margin-bottom: 10px;
      font-size: 12px;
      line-height: 1.45;
      color: var(--text2);
    }

    .import-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }

    .import-file-meta {
      font-size: 12px;
      color: var(--text2);
      min-height: 18px;
      word-break: break-word;
    }

    .mbtn.ghost {
      background: var(--surface2);
      color: var(--text);
      border: 1.5px solid var(--border);
    }

    .mbtn.ghost:hover {
      border-color: var(--accent1);
      color: var(--accent1);
      background: rgba(102,126,234,0.06);
    }

    #notifArea { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
    .notif { background: var(--green); color: white; padding: 12px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 14px rgba(0,0,0,0.2); animation: slideIn 0.25s ease; }
    .notif.err { background: var(--red); }

    @keyframes slideIn {
      from { transform: translateX(120%); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }

    .drag-placeholder {
      border: 2px dashed var(--accent1);
      border-radius: 8px;
      background: rgba(102,126,234,0.07);
      min-width: 80px;
      height: 40px;
      pointer-events: none;
    }
  
/* Shift system */
body.shift-mode:not(.shift-locked) .section-wrap{outline:2px dashed #f59e0b}
body.shift-locked .section-wrap{outline:2px dashed #22c55e;box-shadow:0 0 0 1px rgba(34,197,94,.25),0 0 6px rgba(34,197,94,.35)}

body.shift-mode .section-del-btn,
body.shift-mode .section-rename-btn{display:none!important}

.section-move-controls{display:none;margin-left:auto;gap:6px}
body.shift-mode .section-move-controls{display:flex}

.section-move-controls button{border:1px solid var(--border);background:var(--surface2);border-radius:6px;padding:4px 6px;cursor:pointer}

.section-wrap.dragging{opacity:.6}

.drag-placeholder{height:0;border-top:2px dashed #f59e0b;margin:6px 0}
body.shift-locked .drag-placeholder{border-top:2px dashed #22c55e}



/* ShiftLock: reorganização horizontal de botões — [‹] [botão] [›] */
body.shift-locked .btn-wrap.blu-button-shift-row {
  gap: 4px;
  overflow: visible;
  box-shadow: none;
  animation: none;
  align-items: center;
}

body.shift-locked .btn-wrap.blu-button-shift-row:hover {
  transform: none;
  box-shadow: none;
}

body.shift-locked .btn-wrap.blu-button-shift-row .copy-btn {
  border-radius: 8px;
}

.blu-btn-move-horizontal {
  width: 30px;
  min-width: 30px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.blu-btn-move-horizontal:hover:not(:disabled) {
  border-color: var(--accent1);
  filter: brightness(1.08);
}

.blu-btn-move-horizontal:active:not(:disabled) {
  transform: scale(0.96);
}

.blu-btn-move-horizontal:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.blu-button-hidden-in-shiftlock {
  display: none !important;
}

.blu-button-moved-feedback {
  outline: 2px solid #22c55e;
  outline-offset: 2px;
  transition: outline 0.18s ease;
}

/* Lembrete de backup (export pendente) */
#backupBanner {
  position: fixed;
  left: 50%;
  bottom: -160px;
  transform: translateX(-50%);
  z-index: 1800;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--yellow);
  box-shadow: 0 10px 30px var(--shadow);
  padding: 12px 16px;
  border-radius: 12px;
  width: min(420px, calc(100% - 24px));
  box-sizing: border-box;
  transition: bottom 0.3s ease;
}

#backupBanner.show { bottom: 14px; }

.backup-banner-icon { font-size: 18px; flex-shrink: 0; }

.backup-banner-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  flex: 1 1 180px;
  min-width: 0;
}

.backup-banner-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }

.backup-banner-actions button {
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.backup-banner-actions .bb-export { background: var(--yellow); color: #2a1f02; }
.backup-banner-actions .bb-dismiss { background: var(--border); color: var(--text2); }

@media (max-width: 420px) {
  #backupBanner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 12px 14px;
    bottom: -220px;
  }

  #backupBanner.show { bottom: 10px; }

  .backup-banner-actions { margin-left: 0; justify-content: center; }
  .backup-banner-actions button { flex: 1; }
}

/* Diálogo customizado (substitui confirm()/prompt() nativos) */
.mbtn.danger { background: var(--red); color: white; }

#dialogModal .modal { max-width: 400px; }
#dialogMessage { font-size: 13.5px; color: var(--text2); line-height: 1.5; white-space: pre-wrap; }
#dialogInputWrap { margin-top: 14px; }

#shortcutsModal .modal { max-width: 420px; }

.shortcuts-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.shortcuts-table td { padding: 9px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.shortcuts-table tr:last-child td { border-bottom: none; }
.shortcuts-table td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }
.shortcuts-table td:last-child { color: var(--text2); }

kbd {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
  line-height: 1.5;
}
.no-results {
  display: none;
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  padding: 36px 16px;
}

.no-results.show { display: block; }
.no-results strong { color: var(--text); }
