/* Secure Info Store – Dark-first Security UI */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-elevated: #111827;
  --card: #151c2b;
  --card-hover: #1a2336;
  --text: #f5f7fc;
  --muted: #c7d4eb;
  --border: #2a3548;
  --border-strong: #3a4861;
  --accent: #5b8cff;
  --accent-hover: #7aa3ff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-ring: rgba(91, 140, 255, 0.45);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.14);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.14);
  --danger: #f07178;
  --danger-soft: rgba(240, 113, 120, 0.14);
  --info: #7aa3ff;
  --info-soft: rgba(122, 163, 255, 0.14);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: Arial, Helvetica, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --topbar-h: 56px;
  --actions-h: 52px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-ring);
  --quill-stroke: #c5d0e6;
  --input-bg: #0e1420;
  --skeleton: #1e283c;
  --skeleton-shine: #28344d;
  --overlay: rgba(4, 8, 16, 0.72);
  --toast-bg: #1c2638;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-elevated: #f7f8fb;
  --card: #ffffff;
  --card-hover: #f3f6fc;
  --text: #152033;
  --muted: #5c6b82;
  --border: #d5dce8;
  --border-strong: #b8c3d6;
  --accent: #2f6fed;
  --accent-hover: #2557bd;
  --accent-soft: rgba(47, 111, 237, 0.1);
  --accent-ring: rgba(47, 111, 237, 0.4);
  --ok: #1e8a4c;
  --ok-soft: rgba(30, 138, 76, 0.12);
  --warn: #b58105;
  --warn-soft: rgba(181, 129, 5, 0.12);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.1);
  --info: #2f6fed;
  --info-soft: rgba(47, 111, 237, 0.1);
  --shadow: 0 12px 36px rgba(21, 32, 51, 0.12);
  --shadow-sm: 0 4px 14px rgba(21, 32, 51, 0.08);
  --quill-stroke: #3a4a66;
  --input-bg: #ffffff;
  --skeleton: #e4e9f2;
  --skeleton-shine: #eef2f8;
  --overlay: rgba(15, 23, 42, 0.45);
  --toast-bg: #1c2330;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    color-scheme: light;
    --bg: #eef1f7;
    --bg-elevated: #f7f8fb;
    --card: #ffffff;
    --card-hover: #f3f6fc;
    --text: #152033;
    --muted: #5c6b82;
    --border: #d5dce8;
    --border-strong: #b8c3d6;
    --accent: #2f6fed;
    --accent-hover: #2557bd;
    --accent-soft: rgba(47, 111, 237, 0.1);
    --accent-ring: rgba(47, 111, 237, 0.4);
    --ok: #1e8a4c;
    --ok-soft: rgba(30, 138, 76, 0.12);
    --warn: #b58105;
    --warn-soft: rgba(181, 129, 5, 0.12);
    --danger: #c0392b;
    --danger-soft: rgba(192, 57, 43, 0.1);
    --info: #2f6fed;
    --info-soft: rgba(47, 111, 237, 0.1);
    --shadow: 0 12px 36px rgba(21, 32, 51, 0.12);
    --shadow-sm: 0 4px 14px rgba(21, 32, 51, 0.08);
    --quill-stroke: #3a4a66;
    --input-bg: #ffffff;
    --skeleton: #e4e9f2;
    --skeleton-shine: #eef2f8;
    --overlay: rgba(15, 23, 42, 0.45);
    --toast-bg: #1c2330;
  }
}

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

/* display-Regeln (z. B. .spinner, .skeleton-list) dürfen [hidden] nicht überstimmen */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 140, 255, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(62, 207, 142, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body,
:root:not([data-theme="dark"]) body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(47, 111, 237, 0.08), transparent 55%),
    var(--bg);
}

h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.5rem 0 0.65rem;
}

p {
  margin: 0 0 1rem;
  color: var(--muted);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
  text-decoration: none;
  outline: none;
  box-shadow: var(--focus);
}

/* ---- Theme toggle ---- */
.theme-toggle {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* In der Hauptansicht in die Topbar-Zeile rutschen, ohne Aktionen zu überdecken */
body.app-main .theme-toggle {
  top: 0.5rem;
  right: 0.55rem;
  width: 40px;
  height: 40px;
  box-shadow: none;
  background: var(--bg-elevated);
}

body.app-main .topbar {
  padding-right: 3.4rem;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--card-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

/* ---- Views ---- */
.view {
  justify-content: center;
  align-items: flex-start;
  padding: 2.5rem 1rem 5rem;
  min-height: 100dvh;
}

.view:not([hidden]) {
  display: flex;
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
  margin: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent-soft), rgba(62, 207, 142, 0.1));
  border: 1px solid var(--border);
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text strong {
  display: block;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.brand-text span {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.4rem 1.35rem;
  width: 100%;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.card.wide {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.card-header h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  padding-right: 0.25rem;
}

.card-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.card-close:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: transparent;
}

.card-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.card-lead {
  margin-bottom: 1.15rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.3rem;
  margin-bottom: 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.auth-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-weight: 600;
  font-size: 0.88rem;
}

.field-hint,
small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  padding-right: 2.75rem;
}

.input-action {
  position: absolute;
  right: 0.35rem;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  min-height: 38px;
}

.input-action:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.input-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

input:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.auth-tab:focus-visible,
.entry-list li:focus-visible,
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
  font-family: var(--mono);
  line-height: 1.55;
}

button {
  font: inherit;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

button:hover:not(:disabled) {
  background: var(--card-hover);
  border-color: var(--border-strong);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: var(--danger-soft);
}

button.danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 18%, transparent);
}

button.ghost {
  background: transparent;
}

button.linklike {
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  min-height: auto;
  padding: 0.25rem 0.1rem;
  font-weight: 500;
}

button.linklike:hover:not(:disabled) {
  background: none;
  color: var(--accent-hover);
}

.button-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.button-row>button.primary {
  flex: 1 1 auto;
}

.alt-link {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}

.notice {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--info-soft);
  color: var(--text);
  margin-bottom: 1rem;
}

.notice[data-kind="ok"] {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--border));
}

.notice[data-kind="warn"] {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 35%, var(--border));
}

.notice[data-kind="error"] {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.seedbox {
  display: block;
  font-family: var(--mono);
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  min-height: 3rem;
  word-spacing: 0.35em;
  user-select: all;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.seed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- Spinner ---- */
.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

button.is-loading .btn-label {
  opacity: 0.85;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  white-space: nowrap;
}

.badge-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 30%, var(--border));
}

.badge-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 30%, var(--border));
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}

.badge-info {
  color: var(--info);
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 30%, var(--border));
}

.badge-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

/* ---- Main shell ---- */
body.app-main {
  overflow: hidden;
  height: 100dvh;
}

#view-main {
  padding: 0;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

#view-main:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* überschreibt .view { align-items: flex-start } */
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.85rem;
  width: 100%;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.topbar .spacer {
  flex: 1;
  min-width: 0.5rem;
}

.storename {
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

#save-state {
  font-size: 0.78rem;
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.topbar-actions button,
.icon-btn {
  min-height: 40px;
  padding: 0.45rem 0.7rem;
}

.icon-btn {
  width: 40px;
  padding: 0;
}

.icon-btn svg,
.topbar-actions button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-text {
  display: inline;
}

.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 70%, transparent);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  gap: 0.45rem;
}

.sidebar-head input[type="search"] {
  flex: 1;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.entry-list li {
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid transparent;
  outline: none;
}

.entry-list li:hover {
  background: var(--card-hover);
}

.entry-list li.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.entry-list .entry-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-list .entry-time {
  font-size: 0.78rem;
  color: var(--muted);
}

.empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem;
}

.skeleton-line {
  height: 2.6rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--skeleton), var(--skeleton-shine), var(--skeleton));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.editor-area {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.editor-area>.title-field,
.editor-area>.meta,
.editor-area>.recipient-banner,
.editor-area>.editor-actions {
  flex-shrink: 0;
}

.recipient-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border));
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.title-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.title-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.title-input {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.title-input::placeholder {
  color: var(--muted);
  font-weight: 500;
  opacity: 0.9;
}

.title-input:hover {
  border-color: var(--border-strong);
}

.title-input:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus);
  background: var(--card);
}

.title-input:read-only {
  opacity: 0.85;
  cursor: default;
}

.meta {
  color: var(--muted);
  font-size: 0.8rem;
  min-height: 1em;
}

.editor-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.editor-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.editor-actions button {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.editor-actions .spacer {
  flex: 1;
}

/* ---- Quill dark/modern ---- */
.ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 80%, var(--card));
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.ql-toolbar.ql-snow .ql-formats {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 2px 8px 2px 0;
  padding-right: 8px;
  position: relative;
}

.ql-toolbar.ql-snow .ql-formats:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.ql-snow.ql-toolbar button {
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text);
}

.ql-snow.ql-toolbar button svg {
  width: 14px;
  height: 14px;
}

.ql-snow.ql-toolbar button:hover {
  background: var(--accent-soft);
}

.ql-snow.ql-toolbar button.ql-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.ql-snow .ql-stroke {
  stroke: var(--quill-stroke) !important;
}

.ql-snow .ql-fill {
  fill: var(--quill-stroke) !important;
}

.ql-snow .ql-picker {
  color: var(--text);
  height: 28px;
}

.ql-snow .ql-picker-label {
  border-radius: 7px;
  border-color: transparent !important;
  padding-left: 8px;
  font-size: 0.85rem;
  color: var(--text);
}

.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker.ql-expanded .ql-picker-label {
  background: var(--accent-soft);
}

.ql-snow .ql-picker.ql-header {
  width: auto;
  min-width: 96px;
}

.ql-snow .ql-picker-options {
  border-radius: var(--radius-sm);
  border-color: var(--border) !important;
  background: var(--card);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.ql-snow .ql-picker-options .ql-picker-item {
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text);
}

.ql-snow .ql-picker-options .ql-picker-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Quill: Toolbar und #editor.ql-container sind Geschwister in .editor-shell */
.editor-shell .ql-container.ql-snow,
#editor.ql-container {
  border: none;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.editor-shell .ql-editor {
  min-height: 100%;
  line-height: 1.65;
  font-family: var(--font);
  color: var(--text);
  font-size: 1rem;
}

/* Quill-Defaults ~halbieren (h1 2em→1em, h2 1.5em→0.95em, h3 1.17em→0.88em),
   mit fester rem-Basis damit sie nicht winziger als Body wirken */
.editor-shell .ql-editor h1 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0.55em 0 0.3em;
}

.editor-shell .ql-editor h2 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0.45em 0 0.2em;
}

.editor-shell .ql-editor h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0.45em 0 0.2em;
}

.editor-shell .ql-editor pre,
.editor-shell .ql-editor code,
.editor-shell .ql-editor .ql-code-block-container {
  font-family: var(--mono);
}

.ql-editor.ql-blank::before {
  color: var(--muted);
  font-style: normal;
}

.ql-snow .ql-tooltip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-sm);
}

.ql-snow .ql-tooltip input[type="text"] {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

/* ---- Shares ---- */
#view-shares {
  padding: 1.5rem 1rem 5rem;
}

#view-shares:not([hidden]) {
  display: block;
}

.share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.share-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  background: var(--bg-elevated);
}

.share-list .share-info {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.share-list .share-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.share-list .share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ---- Toast ---- */
.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 1rem;
  z-index: 80;
  padding-bottom: max(1rem, calc(0.75rem + env(safe-area-inset-bottom)));
}

.toast {
  pointer-events: none;
  background: var(--toast-bg);
  color: #f4f7ff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  max-width: min(92vw, 420px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 550;
  font-size: 0.92rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 0.4rem;
  flex-shrink: 0;
  background: var(--info);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 22%, transparent);
}

.toast-text {
  min-width: 0;
}

.toast[data-kind="error"] {
  background: color-mix(in srgb, #2a1214 70%, var(--toast-bg));
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.toast[data-kind="error"] .toast-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent);
}

.toast[data-kind="ok"] {
  background: color-mix(in srgb, #0f241a 65%, var(--toast-bg));
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
}

.toast[data-kind="ok"] .toast-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent);
}

.toast[data-kind="warn"] {
  background: color-mix(in srgb, #2a220c 65%, var(--toast-bg));
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.toast[data-kind="warn"] .toast-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent);
}

.toast[data-kind="info"] .toast-dot {
  background: var(--info);
}

/* ---- Dialog ---- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.dialog {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.2rem 1.1rem;
}

.dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.dialog p {
  margin: 0 0 1.15rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Mobile drawer ---- */
.sidebar-backdrop {
  display: none;
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: inline-flex !important;
}

@media (max-width: 820px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .desktop-only {
    display: none !important;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 340px);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--card);
    padding-top: max(0.85rem, env(safe-area-inset-top));
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.drawer-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .editor-area {
    padding-bottom: calc(var(--actions-h) + 0.75rem + env(safe-area-inset-bottom));
    height: 100%;
  }

  .editor-shell {
    min-height: 0;
  }

  .editor-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    padding: 0.45rem 0.75rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--card) 94%, transparent);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
  }

  .editor-actions .spacer {
    display: none;
  }

  .editor-actions button {
    min-height: 38px;
  }

  .editor-actions button.primary {
    flex: 1;
  }

  .topbar {
    padding-right: 3.5rem;
  }

  .theme-toggle {
    top: 0.45rem;
    right: 0.45rem;
    width: 40px;
    height: 40px;
  }

  .storename {
    max-width: 28vw;
  }

  .btn-text-hide-sm {
    display: none;
  }

  .ql-snow.ql-toolbar button {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .ql-toolbar.ql-snow {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-wrap {
    max-width: 100%;
  }

  .view {
    padding: 1.25rem 0.85rem 5rem;
  }

  .brand {
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .topbar-actions button.ghost .btn-text {
    display: none;
  }

  h1 {
    font-size: 1.25rem;
  }

  .title-input {
    font-size: 1.05rem;
    padding: 0.65rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Druckvorlage ---- */
#print-sheet {
  display: none;
}

#print-sheet table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

#print-sheet th,
#print-sheet td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 1px solid #999;
}

#print-sheet th {
  width: 40%;
  background: #f0f0f0;
}

.ps-seed-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem 1.5rem;
  padding-left: 0;
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  /* Marker (1., 2., ... 12.) innerhalb der Grid-Zelle rendern statt links
     davor - sonst haengen zweistellige Nummern in den Seitenrand hinein
     und werden von manchen Druckern abgeschnitten. */
  list-style-position: inside;
}

.ps-warning {
  border: 2px solid #000;
  padding: 0.6rem 0.8rem;
  margin-top: 1.5rem;
  font-weight: 600;
}

/* Garantierter Seitenrand unabhaengig von Browser-/Druckertreiber-Defaults
   (manche setzen im Druckdialog sehr knappe oder gar keine Raender). */
@page {
  margin: 20mm 18mm;
}

@media print {
  body>*:not(#print-sheet) {
    display: none !important;
  }

  #print-sheet {
    display: block !important;
    color: #000;
    font-family: Georgia, "Times New Roman", serif;
    /* Zweite Sicherheitsmarge zusaetzlich zu @page - falls ein Drucker
       ueber die CSS-Seitenraender hinaus einen eigenen minimalen
       unbedruckbaren Rand erzwingt (bei vielen Tintenstrahldruckern
       links/rechts ueblich). */
    padding: 0 6mm;
  }
}