.palette-backdrop,
.shortcut-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--bg) 52%, transparent);
  
}

.palette,
.shortcut-sheet {
  position: relative;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
border-radius: var(--radius-xl, 8px);
  
  animation: palette-enter 120ms ease-out;
}

.palette::before,
.shortcut-sheet::before {
  display: none;
}

.palette {
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: min(660px, calc(100vh - 48px));
  overflow: hidden;
}

.palette-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
}

.palette-search-icon {
  display: inline-flex;
  color: var(--text-muted);
}

.palette-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--text);
  font: 15px/1.5 var(--font);
  background: transparent;
  border: 0;
  outline: 0;
}

.palette-input::placeholder { color: var(--text-faint); }

.palette-mode {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--text-muted);
  font: 500 12px/16px var(--font);
  letter-spacing: 0;
  
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.palette-results {
  flex: 1 1 auto;
  min-height: 128px;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.palette-group-title {
  padding: 12px 12px 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 8px 8px;
  color: var(--text-2);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.palette-row:hover { color: var(--text); background: var(--bg-hover); }

.palette-row.selected {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  
}

.palette-row:disabled { opacity: .45; }

.palette-row-icon {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.palette-row.selected .palette-row-icon {
  color: var(--text);
  border-color: var(--border-subtle);
  background: var(--bg-element);
}

.palette-row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.palette-row-title {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.palette-row-detail {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.palette-keys { display: inline-flex; flex: 0 0 auto; gap: 4px; }

.palette-key,
.shortcut-sheet-key {
  display: inline-block;
  min-width: 20px;
  padding: 4px 8px;
  color: var(--text-muted);
  font: 12px/17px var(--mono);
  text-align: center;
  white-space: nowrap;
  background: color-mix(in srgb, var(--bg) 36%, var(--bg-element));
  border: 1px solid var(--border);
  border-bottom-color: color-mix(in srgb, var(--border) 70%, var(--text));
  border-radius: 5px;
}

.palette-unassigned {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 12px;
}

.palette-empty {
  padding: 24px 12px 28px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.palette-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 16px;
  color: var(--text-faint);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
}

.shortcut-sheet {
  display: flex;
  flex-direction: column;
  width: min(820px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
}

.shortcut-sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.shortcut-sheet-mark {
  display: inline-flex;
  flex: 0 0 16px;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.shortcut-sheet-copy { flex: 1; min-width: 0; }
.shortcut-sheet-title { font-size: 15px; font-weight: 600; }
.shortcut-sheet-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.shortcut-sheet-close { flex: 0 0 auto; }

.shortcut-sheet-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.shortcut-sheet-group {
  align-self: start;
  padding: 8px;
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.shortcut-sheet-group-title {
  padding: 4px 8px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  
}

.shortcut-sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 4px 8px;
  color: var(--text-2);
  font-size: 12px;
  border-radius: var(--radius-s);
}

.shortcut-sheet-row:hover { color: var(--text); background: var(--bg-hover); }
.shortcut-sheet-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shortcut-sheet-keys { display: inline-flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.shortcut-sheet-key.unassigned { color: var(--text-faint); font-family: var(--font); }

.palette-row:focus-visible,
.shortcut-sheet-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

@keyframes palette-enter {
  from { opacity: 0; transform: translateY(5px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 620px) {
  .palette-backdrop,
  .shortcut-sheet-backdrop { padding: 12px 8px; }
  .palette,
  .shortcut-sheet { max-height: calc(100vh - 20px); border-radius: var(--radius-l); }
  .palette-search { padding: 12px; }
  .palette-footer { gap: 8px; }
  .shortcut-sheet-body { grid-template-columns: 1fr; padding: 12px 12px 16px; }
  .shortcut-sheet-head { padding: 12px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .palette,
  .shortcut-sheet { animation: none; }
  .palette-row { transition: none; }
}

/* Shared type and surface scale. Spacing, type, width and radius tokens live
   once in app.css so the Font size setting has a single rem source. */
:root, :root[data-theme] {
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: none;
}
body {
  font-weight: 400;
}
h1, h2, h3, h4, h5, h6,
.settings-title, .page-title, .group-title {
  font-weight: 600;
}
strong, b, .row-title {
  font-weight: 500;
}
.composer .send-btn {
  border-radius: 50%;
}
