﻿* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; margin: 0; padding: 0; }
body { min-height: 100vh; }


:root {
  --bg-primary: #20242a;
  --bg-secondary: rgb(40, 44, 50);
  --bg-tertiary: rgb(40, 44, 50);
  --bg-hover: #20242a;
  --bg-active: #0073EA;

  --text-primary: rgb(206, 212, 218);
  --text-secondary: rgb(135, 138, 153);
  --text-muted: var(--bg-primary);

  --accent: var(--bg-active);
  --accent-hover: #0063CC;

  --border: var(--bg-primary);
  --border-light: var(--bg-active);
  --input-bg:  var(--bg-tertiary);

  --radius: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.1);

  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-primary: #D9E0E8;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #C0CCD8;
  --bg-hover: var(--bg-primary);
  --bg-active: #0073EA;

  --text-primary: #080A0D;
  --text-secondary: #1F2833;
  --text-muted: var(--bg-primary);

  --accent: var(--bg-active);
  --accent-hover: #0063CC;

  --border: var(--bg-primary);
  --border-light: var(--bg-active);
  --input-bg: var(--bg-tertiary);

  --radius: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.25);

  color-scheme: light;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  margin: 8px 16px;
  border-radius: 8px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* SEARCH */
.search-wrap { position: relative; width: min(520px, 52vw); }
.search-container { position: relative; width: 100%; }

.search-input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); background: var(--bg-tertiary); }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .65;
}
.search-icon img { width: 16px; height: 16px; }

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
}

/* Dropdown muss sichtbar sein */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.search-results:empty { display: none; }
.search-results li {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-primary);
}
.search-results li:hover { background: var(--bg-hover); }

/* BUTTONS */
.toolbar-button,
.icon-button,
.search-clear-btn,
.dash-btn,
.btn-mini,
.dash-picker-item,
.dash-customize-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  font: inherit;
}

.toolbar-button:hover,
.icon-button:hover,
.search-clear-btn:hover,
.dash-btn:hover,
.btn-mini:hover,
.dash-picker-item:hover,
.dash-customize-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.toolbar-button:focus-visible,
.icon-button:focus-visible,
.search-clear-btn:focus-visible,
.dash-btn:focus-visible,
.btn-mini:focus-visible,
.dash-picker-item:focus-visible,
.dash-customize-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--border-light) 55%, transparent);
  outline-offset: 1px;
}

.icon-button {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.icon-button img { width: 18px; height: 18px; opacity: .9; }
.icon-button.primary { color: var(--accent); }
.icon-button.primary:hover {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.35);
  color: var(--accent-hover);
}
.icon-button.danger { border-color: rgba(255,80,80,0.35); }
.icon-button.danger:hover {
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,80,80,0.55);
}

#save-btn { position: relative; }
.save-dot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  opacity: 0;
}
#save-btn[data-state="dirty"] .save-dot { background: #fbbf24; opacity: 1; }
#save-btn[data-state="saving"] .save-dot { background: #60a5fa; opacity: 1; }
#save-btn[data-state="saved"] .save-dot { background: #34d399; opacity: 1; }
#save-btn[data-state="error"] .save-dot { background: #fb7185; opacity: 1; }

/* APP LAYOUT */
.app-container {
  display: flex;
  height: calc(100vh - 72px);
  width: 100%;
}

/* SIDEBAR */
.sidebar {
  flex: 0 0 320px;
  width: 320px;
  max-width: 320px;
  min-width: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  padding: 8px;
  flex-direction: column;
}
.sidebar.collapsed {
  flex: 0 0 0 !important;
  width: 0 !important;
  max-width: 0 !important;
  border-right: none;
  padding: 0;
}

.sidebar-divider{
  flex: 0 0 18px;
  width: 18px;
  margin-left: -9px;
  position: relative;
  z-index: 5;
  cursor: col-resize;
  background: transparent;
  touch-action: none;
}

.sidebar-divider::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 1px;
  background: var(--border);
  opacity: .75;
}

.sidebar-divider:hover::before{
  background: var(--accent);
  opacity: 1;
}

.sidebar.collapsed + .sidebar-divider,
.sidebar-divider.is-hidden{
  display: none !important;
}

#sidebar[style*="display: none"] + #sidebar-resizer{
  display: none !important;
}

.app-container.is-sidebar-resize-hover,
.app-container.is-sidebar-resize-hover *{
  cursor: col-resize !important;
}

/* Tree muss HÃƒÂ¶he haben */
.tree-view {
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 10px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  user-select: none;
  cursor: pointer;
}

#tree-root.tree-root {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 120px;
  padding: 8px;
}

#tree-root.tree-root > * { min-width: max-content; }

#tree-root::-webkit-scrollbar { width: 8px; height: 8px; }
#tree-root::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 999px; }

/* Tree Items */
.tree-item {
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: background .15s ease;
  cursor: pointer;
  min-height: 44px;
  min-width: max-content;
}
.tree-item:hover { background: var(--bg-active); }
.drag-over { outline: 1px dashed var(--accent); }
.dragging { opacity: .5; }

.tree-indent {
  width: 24px;
  height: 44px;
  position: relative;
  flex: 0 0 24px;
}
.tree-indent::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--border);
}
.tree-toggle {
  width: 36px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex: 0 0 36px;
}
.tree-toggle img.tree-toggle-icon{
  width: 12px;
  height: 12px;
  opacity: .85;
  transition: transform .12s ease;
}
.tree-toggle img.tree-toggle-icon.collapsed{
  transform: rotate(-90deg);
}
.tree-toggle img.tree-toggle-icon.expanded{
  transform: rotate(0deg);
}
.tree-root-controls .toolbar-button{
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
}
.tree-root-controls .toolbar-button img{
  width: 16px;
  height: 16px;
}
.tree-label {
  flex: 1;
  min-width: max-content;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}
.tree-text {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  color: var(--text-primary);
  font-size: 16px;
}
.tree-icon img { width: 16px; height: 16px; opacity: .9; }

/* CONTENT */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

#pin-toggle-btn.is-on{
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.title-input {
  width: 100%;
  flex: 1;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
}
.title-input::placeholder { color: var(--text-muted); }
.title-input:focus { border-color: var(--accent); background: var(--bg-tertiary); }

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-group { display: flex; gap: 4px; }

.toolbar-button {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* EDITOR */
.editor-area {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 16px;
  gap: 0;
  min-width: 0;
  min-height: 0;
}

.editor-panel,
.preview-panel {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  overflow: auto;
  padding: 16px;
  min-width: 0;
  min-height: 0;
}

.editor-textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
}
.editor-textarea::placeholder { color: var(--text-muted); }

.divider {
  width: 1px;
  background: var(--border);
  margin: 0 12px;
  position: relative;
}
.divider::before {
  content: "";
  position: absolute;
  top: -16px;
  bottom: -16px;
  left: -10px;
  right: -10px;
  cursor: col-resize;
}
.divider:hover {
  background: var(--accent);
  opacity: 1;
}

.pin-header,
.pin-panel,
.pin-divider{
  display: none;
}

#main.content.has-pin-panel{
  --pin-panel-width: 340px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px var(--pin-panel-width);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  overflow: hidden;
}

#main.content.has-pin-panel > #app-header{
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

#main.content.has-pin-panel > #editor-container{
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

#main.content.has-pin-panel > #pin-header{
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  padding: 16px 16px 12px 12px;
  min-width: 0;
}

#main.content.has-pin-panel > #pin-resizer{
  grid-column: 2;
  grid-row: 2;
  display: block;
}

#main.content.has-pin-panel > #pin-panel{
  grid-column: 3;
  grid-row: 2;
  display: block;
  padding: 16px 16px 16px 12px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.pin-divider{
  width: 18px;
  margin: 0;
  background: transparent;
}

.pin-divider::before{
  left: 9px;
  right: auto;
  top: 0;
  bottom: 0;
  width: 1px;
  cursor: col-resize;
  background: var(--border);
}

.pin-divider:hover{
  background: transparent;
}

.pin-divider:hover::before{
  background: var(--accent);
}

.pin-head-main{
  min-width: 0;
  flex: 1;
}

.pin-head-title{
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-head-path{
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-head-actions{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pin-head-actions .icon-button.is-on{
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.pin-panel-content{
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 0;
  overflow: auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.pin-view{
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(140px, 1fr) 1px minmax(140px, 1fr);
  min-height: 0;
}

.pin-view.mode-edit{
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.pin-view.mode-preview{
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.pin-view.mode-edit .pin-view-divider,
.pin-view.mode-edit .pin-pane-preview{
  display: none;
}

.pin-view.mode-preview .pin-view-divider,
.pin-view.mode-preview .pin-pane-editor{
  display: none;
}

.pin-pane{
  min-width: 0;
  min-height: 0;
}

.pin-pane-editor{
  padding: 16px;
}

.pin-pane-preview{
  padding: 16px;
}

.pin-editor-text{
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
}

.pin-view-divider{
  width: 100%;
  height: 1px;
  margin: 0;
  background: var(--border);
}

.pin-empty{
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px;
}

.pin-panel-content input.task-list-item-checkbox{
  pointer-events: none;
}

/* Preview basics */
/* --- Markdown basics: make emphasis visible again (preview only) --- */
.preview-panel strong,
.preview-panel b {
  font-weight: 700 !important;
}

.preview-panel em,
.preview-panel i {
  font-style: italic !important;
}

.preview-panel s,
.preview-panel del,
.preview-panel strike {
  text-decoration: line-through !important;
}

.preview-panel mark {
  background: rgba(255, 230, 0, 0.35) !important;
  padding: 0 .15em;
  border-radius: 0.2em;
}

.preview-panel h1,
.preview-panel h2,
.preview-panel h3 {
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.preview-panel p { margin: 8px 0; }
.preview-panel ul, .preview-panel ol { margin: 8px 0 8px 22px; }
.preview-panel li { margin: 4px 0; }
.preview-panel table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.preview-panel th, .preview-panel td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

@media (max-width: 760px) {
  .editor-area { flex-direction: column; }
  .divider { width: 100%; height: 1px; margin: 12px 0; }
  .divider::before { left: 0; right: 0; top: -10px; bottom: -10px; cursor: row-resize; }
  .search-wrap { width: 100%; }
}

@media (max-width: 980px){
  #pin-toggle-btn{ display: none !important; }
  #main.content.has-pin-panel{
    display: flex;
    flex-direction: column;
  }
  #pin-header,
  #pin-resizer,
  #pin-panel{
    display: none !important;
  }
}


/* share-view class not used anymore; keep empty to avoid accidental hide */
body.share-note,
body.share-folder {
  overflow-y: auto !important;
}

body.share-note .app-shell,
body.share-folder .app-shell,
body.share-note .app-frame,
body.share-folder .app-frame {
  min-height: 100vh !important;
  height: auto !important;
}

body.share-note #app.app-container,
body.share-folder #app.app-container {
  min-height: 100vh !important;
  height: auto !important;
  overflow: visible !important;
}

/* Share Note: wirklich nur Preview sichtbar */
body.share-note #sidebar { display:none !important; }
body.share-note #sidebar-resizer { display:none !important; }
body.share-note #main { width:100% !important; }
body.share-note #main > * { display:none !important; }
body.share-note #editor-container {
  display:flex !important;
  overflow: visible !important;
  padding: 0 !important;
}
body.share-note #preview {
  display:block !important;
  overflow: auto !important;
  max-height: none !important;
}

/* Share Folder: nur Sidebar + Preview */
body.share-folder #main > * { display:none !important; }
body.share-folder #editor-container {
  display:flex !important;
  overflow: visible !important;
  padding: 0 !important;
}
body.share-folder #preview {
  display:block !important;
  overflow: auto !important;
  max-height: none !important;
}
body.share-folder #preview { border:none !important; }

/* Share: ensure list bullets are visible */
body.share-note #preview ul,
body.share-note #preview ol,
body.share-folder #preview ul,
body.share-folder #preview ol {
  margin: 8px 0 8px 22px;
  padding-left: 18px;
  list-style-position: outside;
}

/* Share TOC: use same icon sizing as tree */
body.share-folder #preview img[src*="/assets/icons/"]{
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  margin-right: 4px;
}

/* sicherheitshalber: alles Drag&Drop visuell neutral */
body.share-folder .drag-over,
body.share-folder .dragging { outline:none !important; }
/* Share: Note Ã¢â‚¬â€œ nur Preview, ohne AbstÃƒÂ¤nde */
body.share-note-view,
body.share-note-view #main {
  margin: 0 !important;
  padding: 0 !important;
}

body.share-note-view #preview {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

/* --------------------------------------------------------------------------
   Preview: tables + embeds
---------------------------------------------------------------------------*/
#preview table,
.pin-pane-preview table{ border-collapse:collapse; width:100%; }
#preview th, #preview td,
.pin-pane-preview th, .pin-pane-preview td{ border:1px solid rgba(127,127,127,.35); padding:6px 8px; vertical-align:top; }
#preview thead th,
.pin-pane-preview thead th{ background: rgba(127,127,127,.12); }
#preview .embed-ref,
.pin-pane-preview .embed-ref{ cursor: help; border-bottom: 1px dotted rgba(127,127,127,.6); }
#preview li.task-list-item,
.pin-pane-preview li.task-list-item{
  list-style: none;
}
#preview li.task-list-item > label,
#preview .md-table-task,
.pin-pane-preview li.task-list-item > label,
.pin-pane-preview .md-table-task{
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
#preview input.task-list-item-checkbox,
.pin-pane-preview input.task-list-item-checkbox{
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 20px;
  border-radius: 7px;
  border: 1.5px solid color-mix(in srgb, var(--border-light) 65%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-secondary) 90%, white 10%), var(--bg-secondary));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    0 1px 2px rgba(0,0,0,0.22);
  position: relative;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease, transform .08s ease;
}
#preview input.task-list-item-checkbox::after,
.pin-pane-preview input.task-list-item-checkbox::after{
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  opacity: 0;
  transition: transform .14s ease, opacity .14s ease;
}
#preview input.task-list-item-checkbox:hover,
.pin-pane-preview input.task-list-item-checkbox:hover{
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-light));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 2px 6px rgba(0,0,0,0.25);
}
#preview input.task-list-item-checkbox:active,
.pin-pane-preview input.task-list-item-checkbox:active{
  transform: translateY(1px);
}
#preview input.task-list-item-checkbox:checked,
.pin-pane-preview input.task-list-item-checkbox:checked{
  border-color: color-mix(in srgb, var(--accent) 78%, #1d4ed8);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white 18%), color-mix(in srgb, var(--accent) 70%, #1d4ed8));
}
#preview input.task-list-item-checkbox:checked::after,
.pin-pane-preview input.task-list-item-checkbox:checked::after{
  transform: rotate(45deg) scale(1);
  opacity: 1;
}
#preview input.task-list-item-checkbox:focus-visible,
.pin-pane-preview input.task-list-item-checkbox:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

#preview input.task-list-item-checkbox:disabled,
.pin-pane-preview input.task-list-item-checkbox:disabled,
.pin-panel-content input.task-list-item-checkbox{
  cursor: not-allowed;
  border-color: var(--border-light);
  background: var(--bg-tertiary);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 0 1px color-mix(in srgb, var(--border) 35%, transparent);
  opacity: .62;
  transform: none;
}

#preview input.task-list-item-checkbox:disabled:hover,
#preview input.task-list-item-checkbox:disabled:active,
.pin-pane-preview input.task-list-item-checkbox:disabled:hover,
.pin-pane-preview input.task-list-item-checkbox:disabled:active,
.pin-panel-content input.task-list-item-checkbox:hover,
.pin-panel-content input.task-list-item-checkbox:active{
  border-color: color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 0 0 1px color-mix(in srgb, var(--border) 35%, transparent);
  transform: none;
}

#preview input.task-list-item-checkbox:disabled::after,
.pin-pane-preview input.task-list-item-checkbox:disabled::after,
.pin-panel-content input.task-list-item-checkbox::after{
  border-color: color-mix(in srgb, var(--text-secondary) 85%, #cbd5e1);
}

#preview input.task-list-item-checkbox:disabled:checked,
.pin-pane-preview input.task-list-item-checkbox:disabled:checked,
.pin-panel-content input.task-list-item-checkbox:checked{
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 36%, white 64%), color-mix(in srgb, var(--accent) 30%, var(--bg-tertiary) 70%));
}

/* --------------------------------------------------------------------------
   Embed autosuggest
---------------------------------------------------------------------------*/
#embed-suggest .item{
  display:flex; gap:8px; align-items:center;
  padding:8px 10px; border-radius:8px;
  cursor:pointer; user-select:none;
  color: var(--text-primary, #e5e7eb);
  font-size: 14px;
}
#embed-suggest .item .meta{
  opacity:.7; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#embed-suggest .item.active{
  background: rgba(99,102,241,.18);
  outline: 1px solid rgba(99,102,241,.45);
}

/* --------------------------------------------------------------------------
   Tree: special rows
---------------------------------------------------------------------------*/
.tree-item.tree-special .tree-label{ opacity: .95; }
.tree-item.tree-special.active{ background: rgba(99,102,241,.14); }
.tree-divider{ height:10px; }

/* --------------------------------------------------------------------------
   Dashboard
---------------------------------------------------------------------------*/
.dash{
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}
.dash-header{
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px; margin-bottom: 14px;
}
.dash-title{ font-size: 22px; font-weight: 700; }
.dash-sub{ opacity:.7; font-size: 14px; }
.dash-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
}
.dash-card{
  grid-column: span 3;
  background: rgba(127,127,127,.08);
  border: 1px solid rgba(127,127,127,.18);
  border-radius: 14px;
  padding: 14px;
}
.dash-card.big{ grid-column: span 6; }
.dash-kpi-label{ font-size: 12px; opacity:.75; margin-bottom: 4px; }
.dash-kpi-value{ font-size: 24px; font-weight: 700; letter-spacing: .2px; }
.dash-kpi-sub{ margin-top: 8px; font-size: 12px; opacity:.75; }
.dash-list{ margin:0; padding-left: 16px; }
.dash-list li{ margin: 8px 0; }
.mini-bar{
  display:flex; gap:6px; align-items:flex-end;
  height: 90px;
  padding: 8px 2px 2px 2px;
}
.mini-bar .b{
  flex:1 1 0;
  background: rgba(99,102,241,.35);
  border: 1px solid rgba(99,102,241,.55);
  border-radius: 8px;
}
.mini-bar .b:hover{ background: rgba(99,102,241,.45); }

/* --------------------------------------------------------------------------
   Trash
---------------------------------------------------------------------------*/
.trash{
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}
.trash-header{ display:flex; justify-content:space-between; align-items:end; gap:12px; margin-bottom: 10px; }
.trash-title{ font-size: 20px; font-weight: 700; }
.trash-sub{ opacity:.7; font-size: 14px; }
.trash-table{ width:100%; border-collapse: collapse; overflow:hidden; border-radius: 12px; }
.trash-table th, .trash-table td{ border:1px solid rgba(127,127,127,.22); padding: 10px; vertical-align: top; }
.trash-table th{ background: rgba(127,127,127,.10); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; opacity:.85; }
.trash-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.btn-mini{
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-mini.primary{ border-color: rgba(99,102,241,.55); background: rgba(99,102,241,.18); }
.btn-mini.danger{ border-color: rgba(239,68,68,.55); background: rgba(239,68,68,.14); }
.btn-mini.danger:hover{
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,80,80,0.55);
}


.tree-item.drag-over{
  outline: 2px dashed rgba(99,102,241,.6);
  background: rgba(99,102,241,.10);
}


/* -----------------------------
   Mobile sticky header + layout
----------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* iOS Safari: stabilere Viewport-HÃƒÂ¶he */
html, body {
  height: 100%;
}

.app-container {
  min-height: calc(100dvh - 72px);
}
/* preview hidden must win everywhere (desktop + mobile) */
body.preview-hidden #preview {
  display: none !important;
}
body.preview-hidden #editor-resizer {
  display: none !important;
}

@media (max-width: 720px) {
  .sidebar-divider { display: none !important; }

  #app-header .toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
  }

  #editor-toolbar.toolbar-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  #editor-toolbar .toolbar-group {
    display: inline-flex;
    gap: 8px;
    margin-right: 8px;
  }

  .toolbar-button,
  .icon-button,
  .dash-btn.dash-btn-icon {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
  }

  .toolbar-button img,
  .icon-button img,
  .dash-btn img {
    width: 18px;
    height: 18px;
  }

  .toolbar-toggles {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
  }

}
/* Prevent iOS auto-zoom on focus */
input, textarea, select {
  font-size: 16px !important;
}


/* ============================
   App Shell (Left Tabs + App)
============================ */
.app-shell{
  display: flex;
  min-height: 100dvh;
  background: var(--bg-primary);
}

.app-frame{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================
   Left Vertical Tabs (like Nexlink)
============================ */
.app-navbar-tabs{
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  gap: 16px;
  padding-right: 0;
}

.tabs-logo{
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.tabs-logo img {
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 25%;
}

.tabs-spacer{
  flex: 1 1 auto;
}

.app-navbar-tabs .navtab{
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.app-navbar-tabs .navtab:hover{
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.app-navbar-tabs .navtab:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--border-light) 55%, transparent);
  outline-offset: 1px;
}

.app-navbar-tabs .navtab.active{
  background: var(--bg-active);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.app-navbar-tabs .navtab img{
  width: 20px;
  height: 20px;
  display: block;
}

/* eingeklappt: nur etwas schmaler, Icons bleiben */
.app-navbar-tabs.collapsed{
  width: 44px;
  flex-basis: 44px;
  padding: 10px 4px;
}

.app-navbar-tabs.collapsed .navtab{
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

/* Wenn Sidebar toggled -> Tabs komplett ausblenden */
.app-navbar-tabs.is-hidden{
  display: none !important;
}

/* ============================
   Dashboard tab hides sidebar/tree
============================ */
body.section-dashboard #sidebar,
body.section-dashboard .sidebar,
body.section-dashboard #sidebar-resizer,
body.section-dashboard #tree-root{
  display: none !important;
}

body.section-media #sidebar,
body.section-media .sidebar,
body.section-media #sidebar-resizer,
body.section-media #tree-root{
  display: none !important;
}

/* Optional: content area full width in dashboard */
body.section-dashboard #app.app-container{
  grid-template-columns: 1fr !important; /* falls du CSS Grid benutzt */
}

/* Ensure topbar sticky still works inside frame */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Mobile */
@media (max-width: 900px){
  .app-navbar-tabs{
    width: 52px;
    flex-basis: 52px;
  }
}

@media (max-width: 720px){
  .app-navbar-tabs{
    width: 48px;
    flex-basis: 48px;
  }
  .tabs-logo{
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .app-navbar-tabs .navtab{
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
}

/* ============================
   Dashboard tweaks (2026-02)
============================ */
.dash-tile[data-type="customize"]{
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.dash-tile[data-type="customize"] .dash-tile-body{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.dash-customize-wrap{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
}
.dash-btn.dash-btn-full{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  z-index: 1;
}
.dash-btn.dash-btn-full img{
  width: 16px;
  height: 16px;
  opacity: .9;
}
.dash-btn.dash-btn-full.is-on{
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.55);
}

.dash-drag-grip{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  opacity: 0.35;
  cursor: grab;
  z-index: 2;
  background:
    radial-gradient(currentColor 1px, transparent 1px) 0 0/8px 8px,
    radial-gradient(currentColor 1px, transparent 1px) 4px 4px/8px 8px;
}
.dash-drag-grip:active{ cursor: grabbing; }
.dash-tile[data-type="customize"]:hover .dash-drag-grip{ opacity: 0.6; }

.dash-save-indicator{
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
  z-index: 2;
}
.dash-save-indicator[data-state="saved"]{ background: #34d399; }
.dash-save-indicator[data-state="saving"]{ background: #60a5fa; animation: dashSavePulse 1s ease-in-out infinite; }
.dash-save-indicator[data-state="dirty"]{ background: #fbbf24; }
.dash-save-indicator[data-state="error"]{ background: #fb7185; }

/* Only show drag + save indicator in customize mode */
.dash-tile[data-type="customize"] .dash-drag-grip,
.dash-tile[data-type="customize"] .dash-save-indicator{
  display: none;
}
.customize-mode .dash-tile[data-type="customize"] .dash-drag-grip,
.customize-mode .dash-tile[data-type="customize"] .dash-save-indicator{
  display: block;
}

@keyframes dashSavePulse{
  0%{ transform: scale(1); opacity: .7; }
  50%{ transform: scale(1.25); opacity: 1; }
  100%{ transform: scale(1); opacity: .7; }
}


/* Add-tile only visible in customize mode (JS also enforces) */
.dash-tile-add{
  min-height: 80px;
}

/* Inline catalog (no modal in customize mode) */
.dash-catalog-inline{
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
  display: none;
}
.dash-catalog-inline[data-open="1"]{
  display: block;
}
.dash-catalog-inline-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dash-catalog-inline-body{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Dashboard (latest merged)
---------------------------------------------------------------------------*/
:root{
  --dash-gap: 8px;
  --dash-row: 80px;
  --dash-cell: 80px;
  --dash-tile-bg: var(--bg-secondary);
  --dash-tile-text: var(--text-primary);
  --dash-border-soft: rgba(255,255,255,0.12);
  --dash-border-soft-2: rgba(255,255,255,0.08);
  --dash-surface: rgba(255,255,255,0.05);
  --dash-surface-2: rgba(255,255,255,0.03);
  --dash-muted: rgba(255,255,255,0.7);
  --dash-backdrop: rgba(0,0,0,0.6);
  --dash-modal-bg: var(--bg-secondary);
  --dash-suggest-bg: var(--bg-secondary);
  --dash-shadow: 0 6px 20px rgba(0,0,0,0.25);
  --dash-overlay: rgba(0,0,0,0.25);
}

html[data-theme="light"]{
  --dash-border-soft: rgba(0,0,0,0.12);
  --dash-border-soft-2: rgba(0,0,0,0.08);
  --dash-surface: rgba(0,0,0,0.04);
  --dash-surface-2: rgba(0,0,0,0.03);
  --dash-muted: rgba(0,0,0,0.6);
  --dash-backdrop: rgba(0,0,0,0.35);
  --dash-shadow: 0 6px 20px rgba(0,0,0,0.12);
  --dash-overlay: rgba(0,0,0,0.12);
}

.dash-root{
  padding: 0px;
}

.dash-grid{
  display: grid;
  grid-template-columns: repeat(var(--dash-cols, 4), var(--dash-cell, 80px));
  grid-auto-rows: var(--dash-cell, 80px);
  gap: var(--dash-gap, 8px);
  position: relative;
  justify-content: start;
  align-content: start;
}

.dash-grid--customize{
  background-image: none;
  border-radius: 12px;
}

.dash-tile{
  background: var(--dash-tile-bg);
  color: var(--dash-tile-text);
  border: 1px solid var(--dash-border-soft-2);
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}



.dash-tile[data-no-chrome="1"]{
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0;
}

.dash-tile-body{
  position: relative;
  z-index: 0;
}

.dash-tile-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 0;
  cursor: default;
  position: relative;
  z-index: 2;
}
.dash-tile-title{ display: none; }
.dash-tile-actions{ margin-left: auto; }

.dash-tile-actions{
  display: flex;
  gap: 8px;
}

/* Customize: actions float over content (no layout shift) */

.customize-mode .dash-tile{
  box-shadow: var(--dash-shadow);
}
.customize-mode .dash-tile-head{
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  margin: 0;
}
.customize-mode .dash-tile-actions{
  display: grid;
  grid-template-columns: repeat(2, 32px);
  grid-auto-rows: 32px;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
  background: var(--dash-surface);
  border: 1px solid var(--dash-border-soft);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.dash-grid:not(.dash-grid--customize) .dash-tile-actions{
  display: none;
}

.dash-grid:not(.dash-grid--customize) .dash-tile-head{
  cursor: default;
}

.dash-btn{
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dash-btn.dash-btn-icon{
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
}

.dash-btn.dash-btn-icon img{
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.dash-btn.danger{
  border-color: rgba(255,80,80,0.35);
  color: var(--text-secondary);
}

.dash-btn.danger:hover{
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,80,80,0.55);
  color: var(--text-primary);
}

.dash-tile-body{
  flex: 1;
  min-height: 0;
}

.dash-tile-resize{
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 16px;
  height: 16px;
  border-right: 2px solid var(--dash-border-soft);
  border-bottom: 2px solid var(--dash-border-soft);
  cursor: se-resize;
  opacity: 0.6;
  display: none;
  z-index: 2;
}

.dash-grid--customize .dash-tile-resize{
  display: block;
}

.dash-grid--customize .dash-tile-actions{
  opacity: 1;
}

.dash-kpi-label{
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.dash-kpi-value{
  font-size: 32px;
  font-weight: 600;
  margin-top: -4px;
}

.dash-last-title{
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-last-title .dash-link{
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-last-meta{
  font-size: 12px;
  opacity: 0.7;
}

.dash-chart{
  margin-top: 8px;
}

.dash-tile[data-type="notesCreated"] .dash-tile-body{
  display: flex;
  flex-direction: column;
}

.dash-tile[data-type="notesCreated"] .dash-chart{
  margin-top: auto;
  padding-top: 8px;
  flex: 1;
  min-height: 0;
  display: flex;
}

.dash-tile[data-type="notesCreated"] .dash-chart .spark{
  width: 100%;
  height: 100%;
}

.spark{
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
}

.spark-bar{
  flex: 1;
  background: rgba(59,130,246,0.8);
  border-radius: 4px 4px 0 0;
}

.dash-table-wrap{
  max-height: 100%;
  overflow: auto;
}

.dash-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dash-table th,
.dash-table td{
  padding: 8px 8px;
  border-bottom: 1px solid var(--dash-border-soft-2);
}

.dash-table .num{
  text-align: right;
}

.dash-table .muted{
  opacity: 0.6;
  text-align: center;
}

.dash-tile-settings{
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--dash-border-soft);
  display: none;
  z-index: 2;
}

.dash-tile-settings[data-open="1"]{
  display: block;
}

.dash-settings-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 6px;
}

.dash-settings-sub{
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.7;
}

.dash-settings-grid{
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
}

.dash-picker{
  margin-top: 8px;
}

.dash-picker-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.dash-picker-item{
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--text-secondary);
}

.dash-picker-item img{
  width: 16px;
  height: 16px;
  opacity: .9;
  flex: 0 0 16px;
}

.dash-picker-text{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-picker-label{
  font-size: 12px;
  color: var(--text-primary);
}

.dash-picker-meta{
  font-size: 12px;
  opacity: .7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-picker-empty{
  padding: 8px 10px;
  font-size: 12px;
  opacity: .7;
}

@media (max-width: 720px){
  .dash-settings-grid{
    grid-template-columns: 1fr;
  }
}

.dash-settings-grid input:not([type="checkbox"]),
.dash-settings-grid select{
  background: var(--dash-surface);
  border: 1px solid var(--dash-border-soft);
  border-radius: 6px;
  padding: 4px 8px;
  color: inherit;
}

.dash-settings-grid input[type="checkbox"],
.dash-sort-check input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  margin: 0;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--dash-border-soft) 78%, var(--border-light));
  border-radius: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--dash-surface) 90%, white 10%), var(--dash-surface));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    0 1px 2px rgba(0,0,0,0.2);
  position: relative;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease, transform .08s ease;
}

.dash-settings-grid input[type="checkbox"]::after,
.dash-sort-check input[type="checkbox"]::after{
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  opacity: 0;
  transition: transform .12s ease, opacity .12s ease;
}

.dash-settings-grid input[type="checkbox"]:hover,
.dash-sort-check input[type="checkbox"]:hover{
  border-color: color-mix(in srgb, var(--accent) 58%, var(--dash-border-soft));
}

.dash-settings-grid input[type="checkbox"]:active,
.dash-sort-check input[type="checkbox"]:active{
  transform: translateY(1px);
}

.dash-settings-grid input[type="checkbox"]:checked,
.dash-sort-check input[type="checkbox"]:checked{
  border-color: var(--border);
  background: var(--bg-active);
}

.dash-settings-grid input[type="checkbox"]:checked::after,
.dash-sort-check input[type="checkbox"]:checked::after{
  transform: rotate(45deg) scale(1);
  opacity: 1;
}

.dash-settings-grid input[type="checkbox"]:focus-visible,
.dash-sort-check input[type="checkbox"]:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--accent) 44%, transparent);
  outline-offset: 2px;
}

.dash-settings-grid input[type="checkbox"]:disabled,
.dash-sort-check input[type="checkbox"]:disabled{
  cursor: not-allowed;
  border-color: color-mix(in srgb, var(--dash-border-soft) 88%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--dash-surface-2) 94%, white 6%), color-mix(in srgb, var(--dash-surface-2) 98%, black 2%));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px color-mix(in srgb, var(--dash-border-soft) 35%, transparent);
  opacity: .58;
  transform: none;
}

.dash-settings-grid input[type="checkbox"]:disabled:hover,
.dash-settings-grid input[type="checkbox"]:disabled:active,
.dash-sort-check input[type="checkbox"]:disabled:hover,
.dash-sort-check input[type="checkbox"]:disabled:active{
  border-color: color-mix(in srgb, var(--dash-border-soft) 88%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px color-mix(in srgb, var(--dash-border-soft) 35%, transparent);
  transform: none;
}

.dash-settings-grid input[type="checkbox"]:disabled::after,
.dash-sort-check input[type="checkbox"]:disabled::after{
  border-color: color-mix(in srgb, var(--text-secondary) 82%, #cbd5e1);
}

.dash-settings-grid input[type="checkbox"]:disabled:checked,
.dash-sort-check input[type="checkbox"]:disabled:checked{
  border-color: color-mix(in srgb, var(--accent) 35%, var(--dash-border-soft));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 34%, white 66%), color-mix(in srgb, var(--accent) 28%, var(--dash-surface-2) 72%));
}

.dash-setting-range{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
}

.dash-setting-range input[type="range"]{
  width: 100%;
  padding: 0;
}

.dash-setting-range input[type="number"]{
  width: 100%;
}

.dash-sortable{
  display: block;
}

.dash-sort-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-sort-item{
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--dash-border-soft);
  border-radius: 8px;
  background: var(--dash-surface-2);
}

.dash-sort-item.is-dragging{
  opacity: 0.45;
}

.dash-sort-handle{
  opacity: 0.7;
  user-select: none;
  cursor: grab;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dash-sort-check{
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dash-tile-add{
  border: 2px dashed var(--dash-border-soft);
  background: var(--dash-surface-2);
  color: var(--dash-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dash-add-inner{
  text-align: center;
}

.dash-add-plus{
  font-size: 32px;
  line-height: 1;
}

.dash-add-text{
  font-size: 12px;
  margin-top: 8px;
}

.dash-customize-card{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-customize-btn{
  min-height: 40px;
  padding: 0 12px;
  color: var(--text-secondary);
}

.dash-customize-hint{
  font-size: 12px;
  opacity: 0.7;
}

.dash-shortcut-link,
.dash-shortcut{
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.dash-shortcut-link{
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background .15s ease;
}

.dash-shortcut-link:hover{
  background: var(--bg-hover);
}

.dash-shortcut-link:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--border-light) 55%, transparent);
  outline-offset: 1px;
}

.dash-shortcut.empty{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.dash-shortcut.empty:hover{
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.dash-shortcut-icon img{
  width: 32px;
  height: 32px;
}

.dash-shortcut-label{
  font-size: 12px;
  text-align: center;
  word-break: break-word;
}

.dash-shortcut-link[data-disabled="1"]{
  pointer-events: none;
  opacity: 0.6;
}

.dash-clock-wrap{
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  background: var(--dash-surface);
}

.dash-clock-wrap.no-bg{
  background: transparent;
}

.dash-clock-time{
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dash-clock-date{
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.82;
}

.dash-clock-weekday{
  font-weight: 700;
}

.dash-clock-empty{
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
}

.dash-note-source{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.dash-note-empty,
.dash-error,
.dash-empty{
  font-size: 12px;
  opacity: 0.7;
}

.dash-tile[data-missing-def="1"]{
  border-style: dashed;
}

.dash-missing-tile{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 64px;
}

.dash-missing-tile code{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.dash-modal-wrap{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dash-modal-wrap.open{
  display: flex;
}

.dash-modal-backdrop{
  position: absolute;
  inset: 0;
  background: var(--dash-backdrop);
}

.dash-modal{
  position: relative;
  background: var(--dash-modal-bg);
  border: 1px solid var(--dash-border-soft);
  border-radius: 16px;
  width: min(896px, 90vw);
  max-height: 80vh;
  overflow: hidden;
  z-index: 1;
  color: var(--dash-tile-text);
}

.dash-modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--dash-border-soft-2);
}

.dash-modal-body{
  padding: 16px;
  overflow: auto;
  max-height: calc(80vh - 64px);
}

.dash-modal-body--catalog{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.dash-modal-body--settings{
  display: block;
}

.dash-catalog-card{
  background: var(--dash-surface-2);
  border: 1px solid var(--dash-border-soft-2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-catalog-preview{
  background: var(--dash-surface);
  border-radius: 8px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.dash-preview-kpi,
.dash-preview-block,
.dash-preview-table,
.dash-preview-shortcut{
  font-size: 12px;
  opacity: 0.7;
}

.dash-preview-clock{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  opacity: 0.75;
}

.dash-catalog-title{
  font-weight: 600;
}

.dash-catalog-desc{
  font-size: 12px;
  opacity: 0.7;
}

.dash-embed-suggest{
  position: fixed;
  min-width: 240px;
  max-width: 320px;
  background: var(--dash-suggest-bg);
  border: 1px solid var(--dash-border-soft);
  border-radius: 8px;
  box-shadow: var(--dash-shadow);
  padding: 8px;
  z-index: 10000;
}

.dash-link{
  color: inherit;
  text-decoration: none;
}
.dash-link:hover{
  text-decoration: underline;
  color: var(--text-primary);
}

.dash-note-head{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.dash-note-body{
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.dash-note-label{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.dash-note-meta{
  font-size: 12px;
  opacity: 0.6;
}

.dash-source-link{
  font-size: 14px;
  font-weight: 600;
}

.dash-note-editor{
  width: 100%;
  height: 100%;
  min-height: 120px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: 0;
  padding: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
}

.customize-mode .dash-tile:not([data-type="customize"]):not(.dash-tile-add)::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--dash-overlay);
  pointer-events: none;
  z-index: 1;
}

.customize-mode .dash-tile[data-locked="1"] .dash-tile-body{
  pointer-events: none;
}

.customize-mode .dash-tile[data-locked="1"] textarea,
.customize-mode .dash-tile[data-locked="1"] input,
.customize-mode .dash-tile[data-locked="1"] select{
  pointer-events: none;
  user-select: none;
}

.dash-suggest-item{
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.dash-suggest-item.active,
.dash-suggest-item:hover{
  background: rgba(59,130,246,0.2);
}

.dash-suggest-label{
  font-size: 12px;
}

.dash-suggest-meta{
  font-size: 12px;
  opacity: 0.6;
}

.customize-mode #sidebar,
.customize-mode #sidebar-resizer,
.customize-mode #editor-container,
.customize-mode .topbar{
  pointer-events: none;
  opacity: 1;
}

.customize-mode .app-navbar-tabs{
  pointer-events: auto;
  opacity: 1;
}

.customize-mode #sidebar-toggle,
.customize-mode #theme-toggle,
.customize-mode .dash-root,
.customize-mode .dash-root *{
  pointer-events: auto;
  opacity: 1;
}
/* ---------------------------
   Markdown Timers
--------------------------- */
.md-timer{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 6px;
  border-radius:6px;
  background:rgba(0,0,0,0.06);
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .md-timer{
  background:rgba(255,255,255,0.08);
}
.md-timer-value{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:0.95em;
}
.md-timer-controls{
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.md-timer-control{
  min-width:34px;
  width:34px;
  height:34px;
  padding:0;
}
.md-timer-control img{
  width:16px;
  height:16px;
  opacity:0.9;
  pointer-events:none;
}
.md-timer-control:disabled{
  opacity:0.5;
  cursor:not-allowed;
}

/* ---------------------------
   Media Images
--------------------------- */
.editor-panel {
  position: relative;
}

.editor-textarea {
  position: relative;
  z-index: 1;
}

.media-preview-image {
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.editor-media-drop-hint {
  position: absolute;
  inset: 8px;
  border: 2px dashed color-mix(in srgb, var(--accent) 65%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
  z-index: 8;
  display: grid;
  place-items: center;
}

.editor-media-drop-hint.is-visible {
  opacity: 1;
}

.editor-media-drop-hint-inner {
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 8px 14px;
}

.media-preview-frame {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
}

.media-preview-frame[data-align="left"] {
  margin-left: 0;
  margin-right: auto;
}

.media-preview-frame[data-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.media-preview-frame[data-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

.media-preview-frame .media-preview-image {
  width: 100%;
  height: auto;
  display: block;
}

.media-preview-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  border: 0;
  border-top-left-radius: 8px;
  background: color-mix(in srgb, var(--accent) 55%, var(--bg-primary));
  cursor: nwse-resize;
  display: none;
}

.media-preview-frame.is-editable .media-preview-resize {
  display: block;
}

.media-preview-resize::before {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 255, 255, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 0.8);
}

.media-upload-toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.media-upload-toast {
  background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.media-upload-toast.is-success {
  border-color: rgba(22, 163, 74, 0.5);
}

.media-upload-toast.is-error {
  border-color: rgba(220, 38, 38, 0.55);
}

.media-upload-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-upload-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.media-upload-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-primary) 78%, transparent);
  overflow: hidden;
}

.media-upload-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.media-upload-retry {
  justify-self: end;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
}

.media-library-modal[hidden] {
  display: none !important;
}

.media-library-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
}

.media-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
}

.media-library-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 24px));
  max-height: min(86vh, 900px);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.media-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.media-library-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  font-size: 20px;
  line-height: 1;
}

.media-library-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.media-library-search {
  flex: 1 1 auto;
  min-width: 180px;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 8px 10px;
}

.media-library-status {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.media-manager-tab {
  display: grid;
  gap: 8px;
  min-height: 100%;
}

.media-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  padding: 8px 8px;
}

.media-manager-title-wrap {
  display: grid;
  gap: 2px;
  min-width: 120px;
}

.media-manager-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.media-manager-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.media-manager-controls .media-library-search {
  min-height: 32px;
  height: 32px;
  min-width: 200px;
  padding: 6px 9px;
  border-radius: 7px;
}

.media-manager-controls .toolbar-button {
  min-width: 84px;
  height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.media-library-list {
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.media-library-list--cards {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.media-library-list--compact {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.media-library-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  padding: 10px;
}

.media-library-card-thumb-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

.media-library-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.media-library-card-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.media-library-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-library-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.media-library-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.media-library-card-actions .toolbar-button {
  min-width: 92px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.media-library-card.is-compact .media-library-card-actions .toolbar-button {
  flex: 1 1 auto;
}

.media-library-usage {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
  display: grid;
  gap: 6px;
}

.media-usage-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: center;
}

.media-usage-row code {
  grid-column: 2 / 3;
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-twitch-root{
  display:flex;
  flex-direction:column;
  gap:8px;
  height:100%;
}

.dash-twitch-state{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:100%;
}

.dash-twitch-disconnected-media{
  width:100%;
  height:100%;
  min-height:220px;
  border-radius:10px;
  overflow:hidden;
}

.dash-twitch-disconnected-image{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}

.dash-twitch-loading{
  justify-content:center;
}

.dash-twitch-skel{
  height:34px;
  border-radius:8px;
  background: linear-gradient(90deg, rgba(127,127,127,0.14), rgba(127,127,127,0.24), rgba(127,127,127,0.14));
  background-size: 220% 100%;
  animation: dashTwitchSkel 1.2s ease-in-out infinite;
}

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

.dash-twitch-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.dash-twitch-head-right{
  display:flex;
  align-items:center;
  gap:8px;
}

.dash-twitch-live-count{
  font-size:12px;
  opacity:.75;
  white-space:nowrap;
}

.dash-twitch-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
}

.dash-twitch-item{
  display:grid;
  grid-template-columns: 8px 32px minmax(0,1fr);
  gap:8px;
  align-items:start;
  border:1px solid var(--dash-border-soft);
  border-radius:8px;
  padding:8px;
  background: var(--dash-surface-2);
}

.dash-twitch-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  margin-top:6px;
  background: rgba(127,127,127,.6);
}

.dash-twitch-item.is-live .dash-twitch-dot{
  background:#ef4444;
  box-shadow:0 0 0 4px rgba(239,68,68,.16);
}

.dash-twitch-avatar{
  width:32px;
  height:32px;
  border-radius:8px;
  object-fit:cover;
  background: rgba(127,127,127,.2);
}

.dash-twitch-avatar-fallback{
  display:grid;
  place-items:center;
  font-size:12px;
  font-weight:700;
  color:var(--text-primary);
}

.dash-twitch-meta{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}

.dash-twitch-name{
  font-size:14px;
  font-weight:600;
}

.dash-twitch-sub{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  font-size:12px;
  opacity:.78;
}

.dash-twitch-title{
  font-size:12px;
  opacity:.9;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.dash-twitch-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.dash-twitch-live-grid{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  align-content:start;
  overflow:auto;
  padding: 14px;
}

.dash-twitch-live-card{
  display:block;
  width:48px;
  height:48px;
  text-decoration:none;
  flex:0 0 auto;
}

.dash-twitch-live-avatar-wrap{
  position:relative;
  display:block;
  width:48px;
  height:48px;
  border-radius:50%;
  border:1px solid rgba(145,70,255,.9);
  overflow:hidden;
  background: rgba(145,70,255,.18);
  transition: box-shadow .12s ease;
}

.dash-twitch-live-card:hover .dash-twitch-live-avatar-wrap{
  box-shadow: 0 4px 8px rgba(145,70,255,.28);
}

.dash-twitch-live-avatar{
  width:48px;
  height:48px;
  border-radius:50%;
  object-fit:cover;
  display:block;
  background: rgba(127,127,127,.2);
}

.integration-modal-wrap{
  position:fixed;
  inset:0;
  z-index:13000;
  display:none;
}

.integration-modal-wrap.open{
  display:block;
}

.integration-modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.5);
}

.integration-modal{
  position:relative;
  width:min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow:auto;
  margin:12px auto;
  border-radius:12px;
  border:1px solid var(--dash-border-soft);
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 14px 40px rgba(0,0,0,.32);
}

.integration-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-bottom:1px solid var(--dash-border-soft);
}

.integration-modal-title{
  font-size:16px;
  font-weight:700;
}

.integration-modal-body{
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.integration-group{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:8px;
  border-bottom:1px solid var(--dash-border-soft);
  padding-bottom:8px;
}

.integration-group-head{
  display:flex;
  align-items:center;
  gap:8px;
}

.integration-group-title{
  font-size:14px;
  font-weight:700;
}

.integration-group-sub{
  font-size:12px;
  opacity:.75;
}

.integration-badge{
  display:inline-flex;
  align-items:center;
  height:24px;
  padding:0 8px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--dash-border-soft);
}

.integration-badge.is-on{
  border-color: rgba(34,197,94,.45);
  color: #22c55e;
}

.integration-badge.is-off{
  border-color: rgba(244,63,94,.45);
  color: #f43f5e;
}

.integration-grid{
  display:grid;
  grid-template-columns: 190px 1fr;
  gap:10px;
  align-items:center;
}

.integration-grid label{
  font-size:12px;
  opacity:.8;
}

.integration-grid select{
  min-height:34px;
  border:1px solid var(--border);
  border-radius:8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding:6px 10px;
}

.integration-grid input[type="text"],
.integration-grid input[type="password"]{
  width:100%;
  min-height:34px;
  border:1px solid var(--border);
  border-radius:8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding:6px 10px;
}

.integration-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.integration-note{
  font-size:12px;
  opacity:.82;
  border:1px solid var(--dash-border-soft);
  border-radius:8px;
  padding:8px;
}

.integration-note.is-warn{
  border-color: rgba(245,158,11,.45);
}

.integration-loading{
  font-size:14px;
  opacity:.85;
}

@media (max-width: 860px){
  .integration-grid{
    grid-template-columns: 1fr;
  }
}

.media-usage-empty {
  font-size: 12px;
  color: var(--text-secondary);
}

@media (max-width: 760px) {
  .media-library-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .media-manager-header {
    flex-direction: column;
    align-items: stretch;
  }

  .media-manager-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .media-manager-controls .media-library-search {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .media-manager-controls .toolbar-button {
    width: 100%;
  }

  .media-library-toolbar {
    flex-wrap: wrap;
  }

  .media-library-list--cards,
  .media-library-list--compact {
    grid-template-columns: 1fr;
  }
}
