/* =========================================================================
   SALC-NOTES · style.css
   Tokens → base → login → shell → desktop → mobile → modais → utilitários
   ========================================================================= */

:root {
  /* superfícies */
  --bg:          #08090F;
  --surface:     #0F1118;
  --surface-2:   #161A24;
  --surface-3:   #1D2230;
  --line:        rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);

  /* texto */
  --text:    #E7EAF2;
  --text-2:  #A2A9BD;
  --text-3:  #6B7288;

  /* acentos: azul = empenho, verde = crédito */
  --ne:      #4D8DF6;
  --ne-dim:  rgba(77, 141, 246, .14);
  --nc:      #34D17A;
  --nc-dim:  rgba(52, 209, 122, .14);
  --warn:    #F5A524;
  --danger:  #F0616D;

  /* formas */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .8);
  --shadow-3: 0 24px 64px -16px rgba(0, 0, 0, .9);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --topbar-h: 52px;
  --dock-h: 128px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ============================== BASE ============================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ne);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

.is-hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
  border: 3px solid var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ============================== BOTÕES ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .08s var(--ease), opacity .16s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }

.btn-primary { background: var(--ne); color: #061020; }
.btn-primary:hover { background: #649cf8; }

.btn-ne { background: var(--ne-dim); color: var(--ne); border-color: rgba(77, 141, 246, .28); }
.btn-ne:hover { background: rgba(77, 141, 246, .22); }

.btn-nc { background: var(--nc-dim); color: var(--nc); border-color: rgba(52, 209, 122, .28); }
.btn-nc:hover { background: rgba(52, 209, 122, .22); }

.btn-danger { background: var(--danger); color: #140406; }
.btn-danger:hover { background: #f4757f; }

.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
  height: 38px;
  font-size: 13px;
  font-weight: 500;
}
.btn-ghost:hover { border-color: var(--line-strong); color: var(--text); }

/* ============================== CAMPOS ============================== */

.field { display: block; margin-bottom: 14px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input:focus,
.field select:focus {
  border-color: rgba(77, 141, 246, .55);
  box-shadow: 0 0 0 3px rgba(77, 141, 246, .12);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%236B7288' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ============================== LOGIN ============================== */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(77, 141, 246, .10), transparent 65%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 34px 28px 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.login-mark {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .18em;
}
.login-mark span { color: var(--ne); }

.login-sub {
  margin: 8px 0 26px;
  color: var(--text-3);
  font-size: 13px;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

/* ============================== SHELL ============================== */

.app { min-height: 100vh; }

.topbar { display: none; }
.dock { display: none; }
.dock-spacer { display: none; }

/* ---------- Desktop ---------- */

@media (min-width: 769px) {

  .app {
    display: grid;
    grid-template-columns: 296px 1fr;
    height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 26px 20px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    overflow-y: auto;
  }

  .brand {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .16em;
  }
  .brand span { color: var(--ne); }

  .identity {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 20px;
  }

  .identity-avatar {
    flex: 0 0 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--r-full);
    background: var(--ne-dim);
    color: var(--ne);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
  }

  .identity-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
  .identity-text strong {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .identity-text span { color: var(--text-3); font-size: 12px; }

  .scope-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
  }

  .scope-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 5px 0;
  }
  .scope-key { color: var(--text-3); font-size: 12px; }
  .scope-val {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--warn);
  }
  .scope-card .btn-ghost { margin-top: 10px; }

  .sidebar-title {
    margin-bottom: 10px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 500;
  }
  .sidebar-section .btn { margin-bottom: 8px; }

  .sidebar-foot { margin-top: auto; }
  .build {
    margin-top: 12px;
    color: var(--text-3);
    font-family: var(--mono);
    font-size: 10px;
    text-align: center;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    padding: 26px 30px 40px;
    overflow-y: auto;
  }

  .workspace-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }

  .head-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
  .head-meta { margin-top: 3px; color: var(--text-3); font-family: var(--mono); font-size: 12px; }

  .head-right { display: flex; align-items: center; gap: 12px; }
}

/* segmented + busca: usados só no desktop */
.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.seg {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.seg:hover { color: var(--text); }
.seg.is-on { background: var(--surface-3); color: var(--text); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-3);
  transition: border-color .16s var(--ease);
}
.search:focus-within { border-color: rgba(77, 141, 246, .5); }

.search input {
  width: 230px;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ============================== PROGRESSO ============================== */

.upload-progress { margin: 18px 0 4px; }

.upload-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
}

.upload-track {
  height: 3px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}

.upload-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ne);
  transition: width .25s var(--ease);
}

/* ============================== SEÇÕES E CARDS ============================== */

.sections { padding-top: 22px; }

.notes-section + .notes-section { margin-top: 34px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.section-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }

.dot { width: 7px; height: 7px; border-radius: var(--r-full); }
.dot-nc { background: var(--nc); }
.dot-ne { background: var(--ne); }

.count {
  padding: 1px 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
}

.section-empty {
  padding: 22px 0;
  color: var(--text-3);
  font-size: 13px;
}

.notes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .1s var(--ease);
}
.note-card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.note-card:active { transform: scale(.99); }

.note-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 54px;
  border: 1px solid;
  border-radius: 6px;
}
.note-card[data-tipo="NC"] .note-icon { border-color: rgba(52, 209, 122, .3); color: var(--nc); background: var(--nc-dim); }
.note-card[data-tipo="NE"] .note-icon { border-color: rgba(77, 141, 246, .3); color: var(--ne); background: var(--ne-dim); }

.note-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-all;
  color: var(--text);
}

.note-meta {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
}

.note-open {
  width: 100%;
  height: 32px;
  margin-top: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.note-card:hover .note-open { background: var(--ne); border-color: var(--ne); color: #061020; }

.note-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-3);
  opacity: 0;
  transition: opacity .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.note-gear {
  position: absolute;
  top: 8px;
  right: 38px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-3);
  opacity: 0;
  transition: opacity .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.note-card:hover .note-gear { opacity: 1; }
.note-gear:hover, .note-gear:focus-visible {
  opacity: 1;
  background: rgba(91, 140, 245, .16);
  color: var(--ne);
}
.note-card:hover .note-delete { opacity: 1; }
.note-delete:hover, .note-delete:focus-visible {
  opacity: 1;
  background: rgba(240, 97, 109, .16);
  color: var(--danger);
}

.note-card.is-hit {
  border-color: var(--nc);
  box-shadow: 0 0 0 3px rgba(52, 209, 122, .18);
}

/* esqueleto de carregamento */
.skeleton {
  height: 168px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 260% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -160% 0; } }

.global-empty { padding: 60px 0; text-align: center; }
.global-empty-title { font-size: 15px; font-weight: 600; }
.global-empty-text { margin-top: 6px; color: var(--text-3); font-size: 13px; }

/* ============================== MODAIS ============================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 9, .7);
  backdrop-filter: blur(6px);
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.sheet, .dialog {
  width: 100%;
  max-width: 400px;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: rise .2s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.sheet-grip { display: none; }

.sheet-title, .dialog-title {
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.sheet .btn-block + .btn-block { margin-top: 8px; }
.sheet .btn-primary { margin-top: 6px; }

/* seletores próprios (substituem o <select> nativo, que abre popup do SO) */
.picker { margin-bottom: 18px; }

.chips { display: flex; gap: 8px; }

.chip {
  flex: 1;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.chip:hover { color: var(--text); }
.chip[aria-checked="true"] {
  background: var(--ne-dim);
  border-color: rgba(77, 141, 246, .55);
  color: var(--ne);
}

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

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  text-align: left;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.opt:hover { border-color: var(--line-strong); }
.opt[aria-checked="true"] { background: var(--ne-dim); border-color: rgba(77, 141, 246, .45); }

.opt-mark {
  flex: 0 0 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-full);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.opt[aria-checked="true"] .opt-mark {
  border-color: var(--ne);
  box-shadow: inset 0 0 0 3px var(--ne);
}

.opt-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.opt-num { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); }
.opt-nome { font-size: 12px; color: var(--text-3); }

.sheet-upload { margin-bottom: 16px; }
.sheet-upload-row { display: flex; gap: 8px; }
.sheet-upload-row .btn { flex: 1; }

.sheet-logout {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.dialog-text { color: var(--text-2); font-size: 14px; }

.dialog-file {
  margin: 14px 0 20px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

/* ============================== TOASTS ============================== */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: min(92vw, 380px);
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  animation: rise .2s var(--ease);
}
.toast-error { border-color: rgba(240, 97, 109, .45); color: #ffc3c8; }
.toast-ok { border-color: rgba(52, 209, 122, .4); color: #b6f2d1; }
.toast.is-out { opacity: 0; transition: opacity .25s var(--ease); }

/* =========================================================================
   MOBILE — layout próprio, não é o desktop encolhido
   ========================================================================= */

@media (max-width: 768px) {

  body { font-size: 14px; }

  .app {
    display: block;
    padding-top: var(--topbar-h);
    padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
  }

  .sidebar { display: none; }

  /* ---------- Topo fixo ---------- */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--topbar-h);
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 9, 15, .86);
    backdrop-filter: blur(14px);
  }

  .topbar-mark {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .3em;
    text-indent: .3em;
  }
  .topbar-mark span { color: var(--ne); }

  .topbar-exit {
    position: absolute;
    right: 8px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: var(--r-full);
    background: none;
    color: var(--text-3);
  }
  .topbar-exit:active { background: var(--surface-2); color: var(--text); }

  /* ---------- Conteúdo ---------- */
  .workspace { padding: 14px 12px 0; }
  .workspace-head { display: none; }
  .sections { padding-top: 0; }

  .notes-section + .notes-section { margin-top: 22px; }

  .section-head { margin-bottom: 10px; }
  .section-head h2 { font-size: 12px; font-weight: 500; color: var(--text-2); }

  .notes-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .note-card {
    gap: 8px;
    min-height: 116px;
    padding: 14px 6px 12px;
    border-color: rgba(255, 255, 255, .045);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-1);
  }
  .note-card:active { transform: scale(.955); background: var(--surface-2); }

  .note-icon { width: 30px; height: 38px; border-radius: 5px; }
  .note-icon svg { width: 15px; height: 15px; }

  .note-name {
    font-size: 8.5px;
    line-height: 1.35;
    padding: 0 2px;
    color: var(--text-2);
  }
  .note-card[data-tipo="NC"] .note-name { color: #86e6b2; }
  .note-card[data-tipo="NE"] .note-name { color: #9cc3fb; }

  .note-meta, .note-open { display: none; }

  .note-delete {
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    opacity: .5;
  }
  .note-gear {
    top: 2px;
    right: 26px;
    width: 22px;
    height: 22px;
    opacity: .5;
  }

  .skeleton { height: 116px; border-radius: 14px; }

  .global-empty { padding: 40px 10px; }

  .dock-spacer { display: block; height: 8px; }

  /* ---------- Dock inferior ---------- */
  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--bg) 62%, rgba(8, 9, 15, .92));
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .dock-handle {
    display: grid;
    place-items: center;
    width: 84px;
    height: 34px;
    border: 0;
    background: none;
    color: var(--text-2);
    -webkit-tap-highlight-color: transparent;
  }
  .dock-handle svg { display: block; overflow: visible; }
  .dock-handle:active { opacity: .55; }
  .dock-handle[aria-expanded="true"] { color: var(--ne); }

  .dock-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
  }

  .pill {
    flex: 0 0 46px;
    height: 46px;
    border-radius: var(--r-full);
    border: 1px solid;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    transition: background .16s var(--ease), border-color .16s var(--ease), transform .1s var(--ease);
    -webkit-tap-highlight-color: transparent;
  }
  .pill:active { transform: scale(.92); }

  .pill-ne { background: rgba(77, 141, 246, .06); border-color: rgba(77, 141, 246, .22); color: var(--ne); }
  .pill-ne[aria-pressed="true"] {
    background: rgba(77, 141, 246, .2);
    border-color: rgba(77, 141, 246, .7);
    box-shadow: 0 0 16px rgba(77, 141, 246, .22);
  }

  .pill-nc { background: rgba(52, 209, 122, .06); border-color: rgba(52, 209, 122, .22); color: var(--nc); }
  .pill-nc[aria-pressed="true"] {
    background: rgba(52, 209, 122, .2);
    border-color: rgba(52, 209, 122, .7);
    box-shadow: 0 0 16px rgba(52, 209, 122, .22);
  }

  .dock-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--text-3);
    transition: border-color .16s var(--ease);
  }
  .dock-search:focus-within { border-color: rgba(77, 141, 246, .45); }

  .dock-search svg { flex: 0 0 auto; margin-right: 9px; }

  .dock-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 12.5px;
    caret-color: var(--ne);
  }
  .dock-search input::placeholder { color: var(--text-3); }
  .dock-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

  .dock-clear {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-left: 6px;
    border: 0;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .08);
    color: var(--text-2);
    font-size: 15px;
    line-height: 1;
  }
  .dock-clear:active { background: rgba(255, 255, 255, .16); color: var(--text); }

  /* ---------- Modal vira bottom sheet ---------- */
  .overlay:not(.overlay-center) { align-items: flex-end; padding: 0; }

  .overlay:not(.overlay-center) .sheet {
    max-width: none;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 12px 20px calc(26px + env(safe-area-inset-bottom, 0px));
    max-height: 88vh;
    overflow-y: auto;
    animation: sheet-up .24s cubic-bezier(.32, .72, 0, 1);
  }
  @keyframes sheet-up { from { transform: translateY(100%); } }

  .sheet-grip {
    display: block;
    width: 38px;
    height: 4px;
    margin: 0 auto 16px;
    border-radius: var(--r-full);
    background: var(--line-strong);
  }

  .toast-host { bottom: calc(var(--dock-h) + 16px); }
}

/* telas muito estreitas */
@media (max-width: 340px) {
  .notes-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pill { flex-basis: 42px; height: 42px; }
}
