/* Ensure [hidden] always wins over any display rule in this stylesheet */
[hidden] { display: none !important; }

/* ── Theme tokens ──────────────────────────────────────────────────────────── */

:root {
  --bg:                 #f0f4f8;
  --surface:            #ffffff;
  --surface-2:          #f7f9fc;
  --border:             #dce2ea;
  --text:               #111827;
  --muted:              #6b7280;
  --label:              #374151;
  --placeholder:        #9ca3af;
  --accent:             #0073b1;
  --accent-hover:       #005f8e;
  --accent-light:       #deeef9;
  --success-bg:         #f0fdf4;
  --success-border:     #16a34a;
  --success-text:       #14532d;
  --error-bg:           #fef2f2;
  --error-border:       #dc2626;
  --error-text:         #991b1b;
  --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-md:          0 4px 16px rgba(0, 0, 0, 0.10);
  --radius:             6px;
  --font:               "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* System dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:                 #0d1117;
    --surface:            #161b22;
    --surface-2:          #21262d;
    --border:             #30363d;
    --text:               #e6edf3;
    --muted:              #8b949e;
    --label:              #c9d1d9;
    --placeholder:        #484f58;
    --accent:             #58a6ff;
    --accent-hover:       #79bbff;
    --accent-light:       #1b3a5c;
    --success-bg:         #0d2b1a;
    --success-border:     #3fb950;
    --success-text:       #7ee787;
    --error-bg:           #2d1217;
    --error-border:       #f85149;
    --error-text:         #ff7b72;
    --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.30);
    --shadow-md:          0 4px 16px rgba(0, 0, 0, 0.40);
  }
}

/* JS-applied: Outlook dark theme */
body.theme-dark {
  --bg:                 #0d1117;
  --surface:            #161b22;
  --surface-2:          #21262d;
  --border:             #30363d;
  --text:               #e6edf3;
  --muted:              #8b949e;
  --label:              #c9d1d9;
  --placeholder:        #484f58;
  --accent:             #58a6ff;
  --accent-hover:       #79bbff;
  --accent-light:       #1b3a5c;
  --success-bg:         #0d2b1a;
  --success-border:     #3fb950;
  --success-text:       #7ee787;
  --error-bg:           #2d1217;
  --error-border:       #f85149;
  --error-text:         #ff7b72;
  --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.30);
  --shadow-md:          0 4px 16px rgba(0, 0, 0, 0.40);
}

/* JS-applied: force light even if system is dark */
body.theme-light {
  --bg:                 #f0f4f8;
  --surface:            #ffffff;
  --surface-2:          #f7f9fc;
  --border:             #dce2ea;
  --text:               #111827;
  --muted:              #6b7280;
  --label:              #374151;
  --placeholder:        #9ca3af;
  --accent:             #0073b1;
  --accent-hover:       #005f8e;
  --accent-light:       #deeef9;
  --success-bg:         #f0fdf4;
  --success-border:     #16a34a;
  --success-text:       #14532d;
  --error-bg:           #fef2f2;
  --error-border:       #dc2626;
  --error-text:         #991b1b;
  --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-md:          0 4px 16px rgba(0, 0, 0, 0.10);
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.shell {
  position: relative;
  height: 100%;
}

.user-corner {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 70;
}

.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 56px 16px 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

#mainContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#mainContent[hidden] { display: none; }

.fields-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
}

.post-footer {
  flex-shrink: 0;
  padding: 10px 0 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.post-footer-actions {
  display: flex;
  gap: 8px;
}
.post-footer-actions .btn-primary {
  width: auto;
  flex: 1;
  margin-top: 0;
}
.btn-draft {
  flex: 1;
  margin-top: 0;
  padding: 11px 16px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-draft:hover   { background: var(--accent); color: #fff; }
.btn-draft:active  { opacity: 0.9; }
.btn-draft:disabled { opacity: 0.55; cursor: not-allowed; }

.worker-share {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.worker-share[hidden] { display: none; }

.share-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
}

.share-tab {
  padding: 3px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.share-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.searchable-select__item--two-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.worker-item__name {
  font-size: 13px;
  color: var(--fg);
}

.worker-item__sub {
  font-size: 11px;
  color: var(--muted);
}

/* ── Entity hierarchy ─────────────────────────────────────────────────────── */

.searchable-select__group-header {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: default;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.searchable-select__group-header:first-child {
  border-top: none;
  margin-top: 0;
}

.searchable-select__sub-header {
  padding: 5px 10px 3px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: default;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.searchable-select__sub-header::before {
  content: '';
  display: inline-block;
  width: 2px;
  height: 11px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.5;
  flex-shrink: 0;
}

.searchable-select__item--indented {
  padding-left: 22px;
  border-left: 2px solid transparent;
  transition: border-color 0.1s;
}

.searchable-select__item--indented:hover:not([aria-disabled="true"]) {
  border-left-color: var(--accent);
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.main-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 20px;
  flex-shrink: 0;
}

.main-header__icon {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

.main-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

/* ── Sign-in screen ───────────────────────────────────────────────────────── */

/* ── Welcome screen ─────────────────────────────────────────────────── */
.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 24px 28px 48px;
  background: var(--bg);
}

.welcome-screen[hidden] { display: none; }

.welcome-screen__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: welcome-fade-up 0.6s ease both;
}

.welcome-screen__eog-logo {
  height: 24px;
  width: auto;
  opacity: 0.7;
  margin-bottom: 28px;
  animation: welcome-fade-up 0.5s ease 0.1s both;
}
body.theme-dark .welcome-screen__eog-logo {
  filter: invert(1) hue-rotate(180deg);
  opacity: 1;
}

.welcome-screen__logo {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  animation: welcome-logo-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.welcome-screen__eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
  animation: welcome-fade-up 0.5s ease 0.4s both;
}

.welcome-screen__title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin: 0 0 10px;
  animation: welcome-fade-up 0.5s ease 0.5s both;
}

.welcome-screen__sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 220px;
  margin: 0 0 32px;
  animation: welcome-fade-up 0.5s ease 0.6s both;
}

.welcome-screen__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  animation: welcome-fade-up 0.5s ease 0.75s both;
}
.welcome-screen__btn:hover { background: #106ebe; }
.welcome-screen__btn:hover .welcome-screen__btn-arrow { transform: translateX(4px); }

.welcome-screen__btn-arrow {
  transition: transform 0.2s ease;
  animation: welcome-arrow-pulse 1.4s ease 1.4s infinite;
}

@keyframes welcome-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes welcome-logo-pop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes welcome-arrow-pulse {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(5px); }
}

.sign-in-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 24px 28px 48px;
  text-align: center;
}

.sign-in-screen[hidden] { display: none; }

.sign-in-screen__eog-logo {
  height: 28px;
  width: auto;
  margin-bottom: 32px;
  opacity: 0.85;
}

@media (prefers-color-scheme: dark) {
  .sign-in-screen__eog-logo {
    filter: invert(1) hue-rotate(180deg);
    opacity: 1;
  }
}
body.theme-dark .sign-in-screen__eog-logo {
  filter: invert(1) hue-rotate(180deg);
  opacity: 1;
}
body.theme-light .sign-in-screen__eog-logo {
  filter: none;
  opacity: 0.85;
}

.sign-in-screen__logo {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}

.sign-in-screen__title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.sign-in-screen__sub {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 240px;
}

.sign-in-screen__btn {
  width: auto;
  min-width: 140px;
  font-size: 14px;
  padding: 11px 28px;
}

.sign-in-screen__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.sign-in-screen__loading[hidden] { display: none; }

.sign-in-screen__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.sign-in-screen__loading-text {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.not-office-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Fields ───────────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 14px;
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 5px;
}
.req-star {
  color: var(--error-border);
  margin-left: 1px;
  font-weight: 700;
}
.field--filled .req-star { display: none; }

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.field-header .label {
  margin-bottom: 0;
}

/* ── Form controls ────────────────────────────────────────────────────────── */

.select,
.input,
.textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.select {
  cursor: pointer;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.55;
}

/* ── Rich text editor ─────────────────────────────────────────────────────── */

.editor-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.editor-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--label);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  user-select: none;
}

.toolbar-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.toolbar-btn--active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.toolbar-btn--bold   { font-weight: 700; font-size: 13px; }
.toolbar-btn--italic { font-style: italic; font-size: 13px; }
.toolbar-btn--clear  { font-size: 11px; letter-spacing: -0.5px; }

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.rich-editor {
  width: 100%;
  min-height: 130px;
  max-height: 260px;
  overflow-y: auto;
  padding: 9px 11px;
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  outline: none;
  word-break: break-word;
  cursor: text;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--placeholder);
  pointer-events: none;
  display: block;
}

/* Rendered Markdown content */
.rich-editor h1, .rich-editor h2, .rich-editor h3,
.rich-editor h4, .rich-editor h5, .rich-editor h6 {
  margin: 0.5em 0 0.25em;
  font-weight: 600;
  line-height: 1.3;
}
.rich-editor h1 { font-size: 1.25em; }
.rich-editor h2 { font-size: 1.1em; }
.rich-editor h3 { font-size: 1em; }
.rich-editor p  { margin: 0.35em 0; }
.rich-editor p:first-child { margin-top: 0; }
.rich-editor p:last-child  { margin-bottom: 0; }
.rich-editor ul, .rich-editor ol { padding-left: 1.4em; margin: 0.3em 0; }
.rich-editor li { margin: 0.1em 0; }
.rich-editor strong, .rich-editor b { font-weight: 600; }
.rich-editor em, .rich-editor i     { font-style: italic; }
.rich-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin: 0.5em 0;
  color: var(--muted);
}
.rich-editor a { color: var(--accent); }
.rich-editor code {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
}
.rich-editor pre {
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.4em 0;
}
.rich-editor pre code { background: none; padding: 0; }
.rich-editor hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75em 0;
}
.rich-editor img { max-width: 100%; height: auto; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  margin-top: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover  { background: var(--accent-hover); }
.btn-primary:active { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }

.btn-sm { font-size: 11px; padding: 3px 9px; }

/* ── Privacy toggle ───────────────────────────────────────────────────────── */

.privacy-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-top: 8px;
  margin-bottom: 10px;
}

.privacy-toggle__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.2px;
}

.privacy-toggle__btn + .privacy-toggle__btn {
  border-left: 1px solid var(--border);
}

.privacy-toggle__btn--active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.privacy-toggle__btn:not(.privacy-toggle__btn--active):hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Custom select (App dropdown) ────────────────────────────────────────── */

.custom-select {
  position: relative;
}

.custom-select__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.custom-select__btn:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.custom-select__btn[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.custom-select__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.custom-select__chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s;
}

.custom-select__btn[aria-expanded="true"] .custom-select__chevron {
  transform: rotate(180deg);
}

.custom-select__list {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
}

.custom-select__list[hidden] { display: none; }

.custom-select__item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}

.custom-select__item:hover:not([aria-disabled="true"]) {
  background: var(--accent-light);
  color: var(--accent);
}

.custom-select__item[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
}

.custom-select__item[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
  font-style: italic;
}

/* ── Searchable select ────────────────────────────────────────────────────── */

.searchable-select {
  position: relative;
}
.searchable-select__wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.searchable-select__wrap .input {
  width: 100%;
  padding-right: 28px;
}
.searchable-select__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  line-height: 1;
}
.searchable-select__clear:hover { color: var(--text); }
.searchable-select__clear[hidden] { display: none; }

.searchable-select__list {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
}

.searchable-select__list--above {
  top: auto;
  bottom: calc(100% + 3px);
}

.searchable-select__list[hidden] { display: none; }

.searchable-select__item {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}

.searchable-select__item:hover,
.searchable-select__item--focused {
  background: var(--accent-light);
  color: var(--accent);
}

.searchable-select__item--disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
}
.searchable-select__item--disabled:hover { background: none; color: var(--muted); }

.searchable-select__empty {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */

.field-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.field-spinner[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Entity chips ─────────────────────────────────────────────────────────── */

.entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.entity-chips:empty { display: none; }

.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px 3px 9px;
  background: var(--accent-light);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.4;
}

.entity-chip__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--accent);
  opacity: 0.7;
  flex-shrink: 0;
}

.entity-chip__remove:hover { opacity: 1; color: var(--text); }

.chip-more-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px dashed var(--accent);
  border-radius: 20px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.chip-more-btn:hover { background: var(--accent-light); color: var(--accent); }

.chip-overflow-popup {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px 0;
  max-height: 240px;
  overflow-y: auto;
  min-width: 180px;
}

.chip-overflow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  gap: 8px;
}
.chip-overflow-row:hover { background: var(--surface-2); }

.chip-overflow-label {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-overflow-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0 2px;
}
.chip-overflow-remove:hover { color: var(--text); }

/* ── Status & source ──────────────────────────────────────────────────────── */

.content-status {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  min-height: 15px;
}

.content-status--error { color: var(--error-text); }

.content-source {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-original-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-style: normal;
  padding: 1px 7px;
  flex-shrink: 0;
}
.view-original-btn:hover { background: var(--accent-light); }
.view-original-btn[hidden] { display: none; }

.original-email-frame {
  width: 100%;
  height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin-top: 6px;
}
.original-email-frame[hidden] { display: none; }

/* ── Attachments ──────────────────────────────────────────────────────────── */

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

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.attachment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  flex-shrink: 0;
  background: var(--muted);
}

.attachment-badge--pdf   { background: #e53935; }
.attachment-badge--doc,
.attachment-badge--docx  { background: #1976d2; }
.attachment-badge--xls,
.attachment-badge--xlsx  { background: #388e3c; }
.attachment-badge--ppt,
.attachment-badge--pptx  { background: #f57c00; }
.attachment-badge--png,
.attachment-badge--jpg,
.attachment-badge--jpeg,
.attachment-badge--gif,
.attachment-badge--webp  { background: #8e24aa; }
.attachment-badge--zip,
.attachment-badge--rar,
.attachment-badge--7z    { background: #5d4037; }
.attachment-badge--txt,
.attachment-badge--csv   { background: #546e7a; }

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.attachment-thumb {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  cursor: pointer;
}

.attachment-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  margin-left: auto;
}

.attachment-remove:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ── Busy overlay ─────────────────────────────────────────────────────────── */

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.busy-overlay[hidden] { display: none; }

.busy-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 36px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.busy-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.busy-message {
  font-size: 13px;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
}

/* ── Success overlay ──────────────────────────────────────────────────────── */

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.success-overlay[hidden] { display: none; }

.success-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
  min-width: 210px;
}

.success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  color: var(--success-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.success-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.success-skipped {
  margin-top: 10px;
  padding: 8px 10px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  font-size: 12px;
  color: #92400e;
  line-height: 1.4;
  text-align: left;
}
.success-skipped[hidden] { display: none; }

.success-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.success-ok-btn {
  min-width: 100px;
}

.success-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  text-decoration: none;
}

.success-view-btn[hidden] { display: none; }

/* ── Banner ───────────────────────────────────────────────────────────────── */

.banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: var(--success-bg);
  color: var(--success-text);
  border-bottom: 2px solid var(--success-border);
  letter-spacing: 0.1px;
}

.banner--hidden { display: none; }

.banner--error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

/* ── User corner ──────────────────────────────────────────────────────────── */

.user-anchor {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--label);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--label);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.user-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}

.user-icon-btn:hover               { background: var(--accent-hover); }
.user-icon-btn[aria-expanded="true"]{ background: var(--accent-hover); }
.user-icon-btn:focus               { outline: 2px solid var(--accent); outline-offset: 2px; }

.user-initials {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1;
  pointer-events: none;
}

/* ── User popover ─────────────────────────────────────────────────────────── */

.user-popover {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 210px;
  max-width: min(270px, calc(100vw - 24px));
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.user-popover[hidden] { display: none !important; }

.user-popover__line {
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 3px;
  color: var(--muted);
  word-break: break-word;
}

.user-popover__line--strong {
  font-weight: 600;
  color: var(--text);
}

.user-popover__divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.user-popover__note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.btn-sign-out {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.btn-sign-out:hover { background: var(--surface-2); }

.user-popover__debug-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 4px;
}
.user-popover__debug-label {
  font-size: 12px;
  color: var(--muted);
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch__track {
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: var(--border);
  transition: background 0.2s;
  position: relative;
}
.toggle-switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-switch__track { background: var(--accent); }
.toggle-switch input:checked + .toggle-switch__track::after { transform: translateX(14px); }

/* ── Debug panel ──────────────────────────────────────────────────────────── */

.debug-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.debug-panel[hidden] { display: none; }

.debug-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.debug-panel__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.debug-panel__copy-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
}

.debug-panel__token-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.debug-panel__token-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.debug-panel__token-val {
  font-size: 10px;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.debug-panel__log {
  margin: 0;
  padding: 8px 10px;
  font-size: 11px;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
}

/* ── Summarize controls ──────────────────────────────────────────────────── */
.summarize-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-summarize {
  padding: 3px 10px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-summarize:hover  { background: var(--accent-hover); }
.btn-summarize:active { opacity: 0.85; }
.btn-summarize:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-summarize-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-summarize-gear:hover,
.btn-summarize-gear--active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Summarize AI settings panel ─────────────────────────────────────────── */
.summarize-settings {
  margin: 6px 0 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summarize-settings[hidden] { display: none; }

.summarize-settings__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.summarize-settings__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  width: 44px;
  flex-shrink: 0;
  padding-top: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.summarize-settings__input-wrap {
  flex: 1;
  min-width: 0;
}
.summarize-settings__prompt {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  resize: vertical;
  min-height: 56px;
}

/* Vendor group header inside model list */
.model-vendor-header {
  padding: 5px 10px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
  cursor: default;
  pointer-events: none;
}
.model-vendor-header:first-child { border-top: none; }

/* ── Document attachment row ─────────────────────────────────────────────── */
.doc-attach-row { margin-top: 6px; }
.doc-attach-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.doc-attach-label:hover { color: var(--text); }
.doc-attach-label input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.doc-attach-icon { flex-shrink: 0; opacity: 0.7; }
.doc-attach-name { font-weight: 500; color: var(--text); }
.doc-attach-size { color: var(--muted); font-size: 11px; }
.doc-attach-loading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.doc-attach-loading[hidden] { display: none; }
.doc-attach-spinner { animation: doc-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes doc-spin { to { transform: rotate(360deg); } }

/* ── My Posts button (experimental, in main header) ──────────────────────── */
/* ── Preset scroll wrapper (header + posts tabs) ──────────────── */
/* ── Inline preset scroll (append picker tabs) ───────────────────────────── */
.preset-scroll-wrapper {
  display: flex;
  align-items: center;
  gap: 2px;
}
.preset-scroll-wrapper--inline {
  padding: 6px 6px 0;
}
.preset-scroll-wrapper[hidden] { display: none; }

.preset-scroll-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.preset-scroll-btn:hover { background: var(--surface-2); color: var(--accent); }
.preset-scroll-btn[hidden] { display: none; }

.preset-btn__label { white-space: nowrap; max-width: 56px; overflow: hidden; text-overflow: ellipsis; }
.preset-btn__badge {
  position: absolute;
  top: 3px;
  right: 4px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  padding: 0 4px;
  line-height: 14px;
  min-width: 14px;
  text-align: center;
}

/* ── Append banner (shown in compose when a post is selected for append) ─── */
.append-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  font-size: 12px;
  color: var(--text);
  flex-shrink: 0;
}
.append-banner[hidden] { display: none; }
.append-banner__text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.append-banner__cancel {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.append-banner__cancel:hover { color: var(--text); }

/* ── Mode toggle (Create / Append) ──────────────────────────────────────── */
.mode-toggle-section {
  padding: 8px 12px;
}
.mode-toggle-section[hidden] { display: none; }

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
}

.mode-toggle__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
}
.mode-toggle__btn + .mode-toggle__btn {
  border-left: 1px solid var(--border);
}
.mode-toggle__btn:hover:not(.mode-toggle__btn--active) {
  background: var(--surface-2);
  color: var(--text);
}
.mode-toggle__btn--active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 500;
}

/* ── Inline append picker ────────────────────────────────────────────────── */
.append-picker-section {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.append-picker-section[hidden] { display: none; }
.append-picker-section .preset-scroll-wrapper--inline {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin-top: 0;
}
.append-picker-section .posts-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.append-picker-section .posts-pagination {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* ── Append-mode full-height layout ─────────────────────────────────────── */
.fields-scroll--append {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.posts-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  flex: 1;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.posts-tabs::-webkit-scrollbar { display: none; }

.posts-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  min-width: 52px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
  font: inherit;
  font-size: 10px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  position: relative;
}
.posts-tab svg { opacity: 0.7; }
.posts-tab:hover:not([aria-disabled="true"]) { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.posts-tab:hover:not([aria-disabled="true"]) svg { opacity: 1; }
.posts-tab--active {
  background: var(--accent-bg, #e8f1fb);
  border-color: var(--accent);
  color: var(--accent);
}
.posts-tab--active svg { opacity: 1; }

.posts-list {
  flex: 1;
  overflow-y: auto;
}
.posts-list-empty,
.posts-list-loading,
.posts-list-error {
  padding: 24px 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.posts-list-error { color: var(--error, #c0392b); }

.posts-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.posts-item:last-child { border-bottom: none; }
.posts-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.posts-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.posts-item__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

.posts-item__owner {
  font-weight: 500;
  color: var(--text);
  font-size: 11px;
}

.posts-item__meta-sep {
  color: var(--border);
}

.posts-item__draft-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.posts-item__entities {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 1px;
}

.posts-item__entity-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.posts-item__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.posts-item__header-left {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.posts-item__owner-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.posts-item__header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.posts-item__date {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.posts-item__body {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.posts-item__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}
.btn-append {
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-append:hover  { background: var(--accent); color: #fff; }
.btn-append:active { opacity: 0.85; }
.btn-append:disabled { opacity: 0.5; cursor: not-allowed; }

.posts-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.posts-pagination[hidden] { display: none; }

/* ── @ Mention popover ───────────────────────────────────────────────────── */
.mention-popover {
  position: fixed;
  z-index: 9999;
  min-width: 220px;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  padding: 4px 0;
}
.mention-popover[hidden] { display: none; }

.mention-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: background 0.1s;
}
.mention-item:hover,
.mention-item--focused {
  background: var(--accent-light);
  color: var(--accent);
}
.mention-item--focused .mention-item__sub,
.mention-item:hover .mention-item__sub {
  color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.mention-loading {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.mention-item__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.mention-item__avatar--icon {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.mention-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mention-item__name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item__sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mention chip (inside editor) ────────────────────────────────────────── */
.mention-chip {
  display: inline;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 500;
  font-size: inherit;
  cursor: default;
  user-select: all;
}
.posts-pagination__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: none;
  font: inherit;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.posts-pagination__btn:hover:not(:disabled) { background: var(--surface-2); }
.posts-pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.posts-pagination__info {
  font-size: 11px;
  color: var(--muted);
}
