:root {
  --bg: #f4f5f1;
  --paper: #fff;
  --ink: #252a24;
  --muted: #697561;
  --line: #dfe5d9;
  --soft: #eaf0e3;
  --selected: #e1ebd5;
  --green: #435b31;
  --accent: #d9ecb5;
  --button: #293426;
  --button-text: #fff;
  --danger: #a34432;
  --danger-bg: #fbefea;
  --field: #f8faf5;
  --app-height: 100dvh;
  color-scheme: light;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
}
:root[data-theme="dark"] {
  --bg: #151b17;
  --paper: #1e2620;
  --ink: #e2e9dc;
  --muted: #a1b096;
  --line: #344233;
  --soft: #293627;
  --selected: #35472c;
  --green: #c0dba3;
  --accent: #d9ecb5;
  --button: #c8dfa9;
  --button-text: #1a2716;
  --danger: #f1a48e;
  --danger-bg: #3a2723;
  --field: #19211b;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
body:has(.shell:not([hidden])) {
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}
a {
  color: var(--green);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #8ea968;
  outline-offset: 2px;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: none;
}
input,
textarea,
select {
  color: inherit;
}
svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
[hidden] {
  display: none !important;
}
.shell {
  height: var(--app-height);
  min-height: 0;
  width: 100%;
  max-width: 1920px;
  margin: auto;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  overflow: hidden;
}
.sidebar {
  padding: 20px 16px;
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
}
.brand {
  font-size: 23px;
  font-weight: 720;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-name {
  margin-right: auto;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #293426;
  color: #d9ecb5;
  transform: rotate(-7deg);
  flex: none;
}
.brand-mark svg {
  width: 21px;
  height: 21px;
}
.brand-sub {
  font-size: 11px;
  line-height: 1.5;
  margin: 10px 0 0 38px;
  color: var(--muted);
}
.brand .icon-btn {
  min-width: 28px;
  min-height: 30px;
  padding: 2px;
}
.api-settings,
.theme-toggle {
  color: var(--muted);
}
.brand .api-settings svg,
.brand .theme-toggle svg {
  width: 17px;
  height: 17px;
}
.btn {
  border-radius: 9px;
  padding: 8px 12px;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  min-height: 36px;
  white-space: nowrap;
  text-decoration: none;
}
.primary {
  background: var(--button);
  color: var(--button-text);
}
.primary:hover {
  filter: brightness(0.93);
}
.soft {
  background: var(--soft);
  color: var(--green);
}
.outline {
  border: 1px solid var(--line);
  background: var(--paper);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 8px;
}
.icon-btn:hover {
  background: var(--soft);
}
.search {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--soft);
  border-radius: 9px;
  padding: 10px;
}
.search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.search input {
  border: 0;
  background: none;
  width: 100%;
  outline: none;
  min-width: 0;
}
.section-label {
  font-size: 10px;
  letter-spacing: 1.2px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 7px;
}
.groups-section {
  min-height: 0;
  min-width: 0;
  overflow: auto;
}
.groups-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.nav-list {
  display: grid;
  gap: 4px;
}
.nav-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border-radius: 8px;
  color: var(--muted);
  text-align: left;
}
.nav-item.active {
  background: var(--selected);
  color: var(--green);
  font-weight: 600;
}
.group-nav {
  width: 100%;
  min-width: 0;
}
.group-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.group-nav span:last-child {
  font-size: 11px;
}
.group-dot {
  width: 7px;
  height: 7px;
  background: #91aa77;
  border-radius: 3px;
  flex: none;
}
.owner {
  margin-top: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 16px;
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}
.owner-identity {
  min-width: 0;
}
.owner-identity > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.owner small {
  display: block;
  font-size: 10px;
  margin-top: 2px;
}
.avatar {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  background: var(--soft);
  flex: none;
}
.owner #logout {
  margin-left: auto;
  display: flex;
  gap: 5px;
  font-size: 11px;
  align-items: center;
  padding: 5px;
}
.logout-label {
  display: none;
}
.workspace {
  min-width: 0;
  min-height: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-shrink: 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 650;
}
.topbar h1 {
  font-size: 23px;
  letter-spacing: -0.6px;
  margin: 4px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.topbar .hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.workspace-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  flex: 1;
  min-height: 0;
}
.workspace-grid.empty-list {
  grid-template-columns: 1fr;
}
.workspace-grid.empty-list .editor {
  display: none;
}
.note-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: auto;
  min-height: 0;
  height: 100%;
  padding: 1px;
}
.note-card {
  text-align: left;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
  flex-shrink: 0;
}
.note-card:hover {
  background: var(--paper);
}
.note-card.selected {
  border-color: #9bae83;
  background: var(--paper);
}
.note-card h3 {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.note-card p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.note-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}
.note-meta svg {
  width: 13px;
  height: 13px;
}
.meta-files {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  background: var(--soft);
  color: var(--muted);
}
.chip.shared {
  background: var(--selected);
  color: var(--green);
}
.chip svg {
  width: 11px;
  height: 11px;
}
.empty {
  margin: auto;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.8;
  max-width: 460px;
}
.editor {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.editor-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.saved {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.saved i {
  background: #91a86e;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: none;
}
.editor-inner {
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
  min-height: 0;
  overflow: auto;
  flex: 1;
  scrollbar-gutter: stable;
}
.editor-inner > * {
  flex-shrink: 0;
}
.attachments-panel {
  margin-top: auto;
}
.note-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.note-date {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.group-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}
.group-picker select {
  max-width: 190px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 5px;
  color: var(--green);
}
.title-input {
  display: block;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.6px;
  border: 0;
  width: 100%;
  outline: none;
  padding: 0;
  background: transparent;
  line-height: 1.3;
  resize: none;
  overflow-y: auto;
  max-height: 110px;
}
.body-input {
  margin-top: 14px;
  resize: none;
  min-height: 52px;
  max-height: clamp(72px, 24dvh, 180px);
  line-height: 1.7;
  font-size: 14px;
  border: 0;
  width: 100%;
  outline: none;
  background: none;
  padding: 0;
  color: var(--ink);
  overflow-y: auto;
}
.attachment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 10px;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
}
.attachment-heading small {
  font-weight: 400;
  color: var(--muted);
}
.files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-items: start;
}
.file {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.file-delete {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 1;
  background: var(--paper);
  min-width: 28px;
  min-height: 28px;
  border: 1px solid var(--line);
}
.file-delete svg {
  width: 14px;
  height: 14px;
}
.file-preview-link {
  display: block;
  width: 100%;
  padding: 0;
  cursor: zoom-in;
  background: var(--field);
}
.file-preview {
  width: 100%;
  height: 108px;
  object-fit: contain;
  display: block;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px 10px 10px;
  min-width: 0;
  background: var(--paper);
}
.file-icon {
  background: var(--soft);
  color: var(--green);
  width: 28px;
  height: 32px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  flex: none;
}
.file-info strong {
  font-size: 11px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.file-info small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}
.file-info > div:last-child {
  min-width: 0;
}
.file-info a {
  color: inherit;
  text-decoration: none;
}
.dropzone {
  border: 1px dashed var(--line);
  border-radius: 9px;
  margin-top: 12px;
  padding: 13px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  background: var(--field);
}
.dropzone.drag {
  background: var(--selected);
  border-color: #7c985b;
}
.dropzone svg {
  width: 17px;
  height: 17px;
}
.editor-footer {
  border-top: 1px solid var(--line);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.editor-footer svg {
  height: 13px;
  width: 13px;
}
.mobile-back {
  display: none;
}
.delete-note {
  color: var(--muted);
}
.delete-note:hover {
  color: var(--danger);
  background: var(--danger-bg);
}
.error-message {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  max-height: 120px;
  overflow: auto;
  flex-shrink: 0;
}
.text-button {
  font-size: 11px;
  text-decoration: underline;
  color: var(--danger);
}
.upload-jobs {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.upload-job {
  padding: 10px;
  background: var(--soft);
  border-radius: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.upload-job progress {
  width: 100%;
  margin: 7px 0;
}
[data-layout="preset-0"] {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
[data-layout="preset-1"] {
  width: 100%;
}
[data-layout="preset-2"] {
  color: var(--danger);
  font-size: 12px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  width: min(500px, calc(100vw - 24px));
  max-height: calc(var(--app-height) - 24px);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 120px #0003;
  overflow: auto;
}
dialog::backdrop {
  background: #10201888;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dialog-head h2 {
  font-size: 20px;
  letter-spacing: -0.4px;
  margin: 0;
}
.dialog-lead {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
  margin: 14px 0 20px;
}
.share-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--field);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}
.share-note div {
  min-width: 0;
}
.share-note strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.share-note small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.share-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0;
  font-size: 12px;
}
.share-state .chip {
  font-size: 11px;
}
.share-url {
  background: var(--field);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  width: 100%;
  color: var(--green);
  font-size: 12px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  flex-wrap: wrap;
}
.dialog-actions .btn {
  flex: 1;
}
.fine {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  margin-top: 18px;
}
.danger {
  color: var(--danger);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 0;
}
.destructive {
  background: #a64d3a;
  color: white;
}
.destructive:hover {
  background: #8f3f2d;
}
.delete-title {
  font-weight: 600;
  overflow-wrap: anywhere;
  line-height: 1.6;
  margin: 20px 0 0;
}
.agent-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  font:
    12px/1.8 ui-monospace,
    monospace;
  max-height: 45dvh;
  overflow: auto;
}
.group-name {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 9px;
  background: var(--field);
}
.keys-dialog {
  width: min(580px, calc(100vw - 24px));
}
.keys-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.key-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.key-details {
  min-width: 0;
  flex: 1;
}
.key-details strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.key-details code {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.key-details small {
  color: var(--muted);
  font-size: 11px;
}
.key-revoked {
  opacity: 0.65;
}
.secret-key {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 9px;
  font:
    12px/1.6 ui-monospace,
    monospace;
  resize: none;
  word-break: break-all;
}
.scope-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 12px;
  background: var(--soft);
  border-radius: 9px;
  margin: 20px 0;
  line-height: 1.6;
}
.keys-warning {
  color: var(--green);
  font-size: 12px;
  line-height: 1.7;
}
.key-revoke {
  font-size: 11px;
  color: var(--danger);
  min-height: 40px;
}
.skill-download {
  margin: 0 8px 10px 0;
}
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 6px 20px #0002;
  max-width: calc(100vw - 24px);
  font-size: 12px;
  z-index: 20;
  display: none;
}
.toast.show {
  display: block;
}
.login-page {
  height: var(--app-height);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}
.login-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.login-card label {
  display: block;
  margin-top: 18px;
  font-size: 13px;
}
.login-card input {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 7px;
  background: var(--field);
}
.login-card .btn {
  width: 100%;
  margin-top: 22px;
}
.public-note {
  max-width: 850px;
  margin: 24px auto;
  padding: 24px;
  background: var(--paper);
  border-radius: 16px;
}
.public-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.8;
}
.public-note li {
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.gallery-dialog {
  width: min(1200px, calc(100vw - 24px));
  height: calc(var(--app-height) - 24px);
  max-height: none;
  padding: 12px;
  overflow: hidden;
}
.gallery-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
}
.gallery-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.gallery-stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
}
.gallery-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-stage.is-zoomed {
  display: block;
  overflow: auto;
}
.gallery-stage.is-zoomed img {
  max-width: none;
  max-height: none;
  object-fit: contain;
}
.gallery-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.gallery-bottom .icon-btn {
  font-size: 28px;
}
.gallery-bottom p {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  margin: 0;
}
.gallery-dialog::backdrop {
  background: #000b;
}
@media (min-width: 1600px) {
  .workspace-grid {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .workspace {
    padding: 24px 30px;
  }
  .sidebar {
    padding: 24px 18px;
  }
  .shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }
}
@media (max-width: 1100px) and (min-width: 701px) {
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sidebar {
    padding: 16px 12px;
    gap: 14px;
  }
  .workspace {
    padding: 16px;
  }
  .workspace-grid {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px;
  }
  .brand {
    font-size: 21px;
    gap: 5px;
  }
  .editor-inner {
    padding: 16px;
  }
  .topbar .hint {
    display: none;
  }
}
@media (max-width: 700px) {
  .shell {
    display: flex;
    flex-direction: column;
    max-width: none;
  }
  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand brand" "create owner" "search search" "groups groups";
    padding: 12px 14px;
    gap: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
    flex: none;
  }
  .brand-block {
    grid-area: brand;
  }
  .brand {
    font-size: 23px;
    gap: 8px;
  }
  .brand .icon-btn {
    min-width: 36px;
    min-height: 36px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .brand-sub {
    display: none;
  }
  .sidebar > #create {
    grid-area: create;
    justify-self: start;
    font-size: 13px;
    min-height: 38px;
    padding: 8px 11px;
  }
  .sidebar > .owner {
    grid-area: owner;
    display: flex;
    padding: 0;
    margin: 0;
    gap: 6px;
    font-size: 12px;
    min-width: 0;
  }
  .owner .avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .owner .owner-identity {
    display: block;
  }
  .owner small {
    display: none;
  }
  .owner-identity > span {
    max-width: 80px;
  }
  .owner #logout {
    min-width: 36px;
    min-height: 36px;
    margin: 0;
  }
  .search {
    grid-area: search;
    padding: 9px 11px;
  }
  .groups-section {
    grid-area: groups;
    overflow: visible;
  }
  .groups-heading {
    margin: 0;
    justify-content: flex-start;
    gap: 8px;
    height: 28px;
  }
  .groups-heading .icon-btn {
    min-width: 30px;
    min-height: 28px;
  }
  .groups-section .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }
  .group-nav {
    width: auto;
    max-width: 240px;
    flex-shrink: 0;
    padding: 8px 10px;
    font-size: 12px;
  }
  .workspace {
    padding: 12px 14px;
    min-height: 0;
    flex: 1;
  }
  .topbar {
    margin-bottom: 12px;
  }
  .topbar h1 {
    font-size: 21px;
  }
  .topbar .hint,
  .eyebrow {
    display: none;
  }
  .workspace-grid {
    display: block;
    min-height: 0;
  }
  .note-list {
    gap: 8px;
    height: 100%;
  }
  .note-card {
    padding: 14px;
  }
  .note-card h3 {
    font-size: 15px;
  }
  .editor {
    display: none;
    height: 100%;
  }
  .editor-open .editor {
    display: flex;
  }
  .editor-open .note-list,
  .editor-open .topbar,
  .editor-open .sidebar > .search,
  .editor-open .groups-section {
    display: none;
  }
  .empty-list .note-list {
    display: flex;
  }
  .editor-open .workspace {
    padding-top: 8px;
  }
  .mobile-back {
    display: inline-grid;
  }
  .editor-toolbar {
    padding: 7px 10px;
    gap: 6px;
  }
  .editor-toolbar .btn {
    font-size: 12px;
    min-height: 36px;
    padding: 8px 10px;
  }
  .saved {
    font-size: 10px;
  }
  .editor-actions {
    gap: 3px;
  }
  .editor-inner {
    padding: 12px 14px;
  }
  .note-context {
    margin-bottom: 10px;
    gap: 6px;
  }
  .note-date {
    display: none;
  }
  .group-picker {
    justify-content: space-between;
    width: 100%;
    font-size: 11px;
  }
  .group-picker select {
    max-width: calc(100% - 70px);
    padding: 4px;
  }
  .title-input {
    font-size: 22px;
    max-height: 92px;
  }
  .body-input {
    font-size: 16px;
    line-height: 1.55;
    min-height: 50px;
    max-height: clamp(62px, 20dvh, 150px);
    margin-top: 10px;
  }
  .attachment-heading {
    margin: 10px 0 6px;
  }
  .files {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .file-preview {
    height: 88px;
  }
  .file-info {
    padding: 8px 25px 8px 8px;
    gap: 6px;
  }
  .file-info strong {
    font-size: 10px;
  }
  .file-icon {
    width: 24px;
    height: 28px;
    font-size: 8px;
  }
  .dropzone {
    margin-top: 9px;
    padding: 11px 7px;
    line-height: 1.5;
    font-size: 10px;
  }
  .editor-footer {
    padding: 7px 12px;
    font-size: 9px;
  }
  .editor-footer svg {
    width: 12px;
    height: 12px;
  }
  .public-note {
    margin: 12px;
    padding: 18px;
  }
  .gallery-dialog {
    padding: 8px;
    gap: 6px;
  }
  .gallery-tools {
    gap: 4px;
  }
  .gallery-tools .btn {
    font-size: 11px;
    padding: 6px 8px;
    min-height: 34px;
  }
  .gallery-toolbar {
    font-size: 11px;
  }
  .gallery-tools .icon-btn {
    min-width: 34px;
    min-height: 34px;
  }
  dialog {
    padding: 20px;
  }
  .dialog-head h2 {
    font-size: 20px;
  }
}
@media (max-width: 380px) {
  .sidebar {
    padding: 10px 12px;
    column-gap: 8px;
  }
  .owner-identity > span {
    max-width: 55px;
  }
  .owner .avatar {
    display: none;
  }
  .sidebar > #create {
    font-size: 12px;
  }
  .workspace {
    padding: 10px 12px;
  }
  .title-input {
    font-size: 21px;
  }
  .editor-footer {
    font-size: 8px;
  }
}
@media (max-height: 700px) and (min-width: 701px) {
  .sidebar {
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 13px;
  }
  .brand-sub {
    margin-top: 6px;
  }
  .workspace {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .topbar {
    margin-bottom: 12px;
  }
  .body-input {
    max-height: 140px;
  }
  .editor-inner {
    padding-top: 14px;
    padding-bottom: 14px;
  }
}

.brand .api-settings svg {
  width: 20px;
  height: 20px;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}
.key-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.key-copy {
  font-size: 11px;
  color: var(--green);
  min-height: 36px;
}
.key-legacy {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: 9px 0 0;
}

.dialog-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
}
.dialog-error:empty {
  display: none;
}
