@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500&family=Sora:wght@600;700&display=swap');

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

/* ══ DARK THEME ══ */
:root {
  --bg:         #0d1117;
  --surface:    #161b27;
  --surface2:   #1e2537;
  --surface3:   #252d42;
  --border:     #2a324e;
  --border2:    #3a4560;
  --accent:     #1565C0;
  --accent-hl:  #1976D2;
  --accent-dim: rgba(21,101,192,0.15);
  --accent2:    #FFC107;
  --text:       #dde2f0;
  --text-dim:   #8892b0;
  --text-muted: #4a5470;
  --danger:     #e53935;
  --success:    #43A047;
  --editor-bg:  #ffffff;
  --editor-text:#1a1c2e;
  --editor-shad:0 2px 20px rgba(0,0,0,0.35),0 0 0 1px rgba(0,0,0,0.1);
  --font-ui:    'DM Sans', sans-serif;
  --font-code:  'JetBrains Mono', monospace;
  --font-disp:  'Sora', sans-serif;
  --r:          6px;
  --rlg:        12px;
  --shadow:     0 8px 32px rgba(0,0,0,0.55);
  --t:          0.17s ease;
}

/* ══ LIGHT THEME ══ */
[data-theme="light"] {
  --bg:         #eef1f8;
  --surface:    #ffffff;
  --surface2:   #f4f6fc;
  --surface3:   #eaecf6;
  --border:     #d0d6ea;
  --border2:    #b8c1d8;
  --accent:     #1565C0;
  --accent-hl:  #1976D2;
  --accent-dim: rgba(21,101,192,0.08);
  --accent2:    #F57F17;
  --text:       #1a2040;
  --text-dim:   #475270;
  --text-muted: #8c95b5;
  --danger:     #c62828;
  --success:    #2E7D32;
  --editor-shad:0 2px 16px rgba(0,0,0,0.1),0 0 0 1px rgba(0,0,0,0.06);
  --shadow:     0 8px 32px rgba(0,0,0,0.14);
}

html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--text); display: flex; flex-direction: column; }

/* ══ HEADER ══ */
#header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 50px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.logo-icon {
  width: 30px; height: 30px; background: #1565C0; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-icon svg { width: 16px; height: 16px; }
.logo-text { font-family: var(--font-disp); font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; white-space: nowrap; }
.logo-text span { color: #1976D2; }

#doc-title-input {
  flex: 1; max-width: 280px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--font-ui); font-size: 13px;
  padding: 6px 10px; outline: none; transition: border-color var(--t);
}
#doc-title-input:focus { border-color: var(--accent); }
#doc-title-input::placeholder { color: var(--text-muted); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid transparent;
  border-radius: var(--r); font-family: var(--font-ui);
  font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: all var(--t); white-space: nowrap; line-height: 1;
}
.btn svg { width: 12px; height: 12px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hl); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }

#theme-toggle {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; font-size: 15px; transition: all var(--t); flex-shrink: 0;
}
#theme-toggle:hover { background: var(--surface3); }

#tour-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text-dim);
  transition: all var(--t); flex-shrink: 0;
}
#tour-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ══ TOOLBAR ══ */
#toolbar { background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }

.toolbar-menus {
  display: flex; align-items: center; gap: 1px;
  padding: 3px 10px 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.menu-item { position: relative; }
.menu-btn {
  background: none; border: none; color: var(--text-dim);
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  padding: 4px 8px; border-radius: 5px; cursor: pointer; transition: all var(--t);
}
.menu-btn:hover, .menu-btn.active { background: var(--surface2); color: var(--text); }

.dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 210px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); z-index: 999; display: none; overflow: hidden;
}
.dropdown.show { display: block; animation: dropIn 0.12s ease; }
@keyframes dropIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; } }

.dd-item {
  display: flex; align-items: center;
  padding: 8px 12px; font-size: 12.5px; color: var(--text-dim);
  cursor: pointer; transition: background 0.1s; gap: 9px;
}
.dd-item:hover { background: var(--surface3); color: var(--text); }
.dd-icon { width: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.dd-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dd-label { flex: 1; }
.dd-shortcut { font-size: 11px; color: var(--text-muted); font-family: var(--font-code); margin-left: auto; }
.dd-separator { height: 1px; background: var(--border); margin: 3px 0; }

.toolbar-buttons {
  display: flex; align-items: center; padding: 3px 8px; flex-wrap: wrap; min-height: 36px; gap: 1px;
}
.tb-group {
  display: flex; align-items: center; gap: 1px;
  padding: 0 5px; border-right: 1px solid var(--border);
}
.tb-group:last-child { border-right: none; }
.tb-group:first-child { padding-left: 0; }

.tb-btn {
  min-width: 28px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 4px;
  color: var(--text-dim); cursor: pointer; transition: all 0.1s;
  position: relative; flex-shrink: 0; padding: 0 4px;
}
.tb-btn:hover { background: var(--surface2); color: var(--text); }
.tb-btn.active { background: var(--accent-dim); color: var(--accent); }

.tb-icon-svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.tb-bold   { font-family: Georgia, serif; font-size: 14px; font-weight: 900; font-style: normal; line-height: 1; }
.tb-italic { font-family: Georgia, serif; font-size: 14px; font-style: italic; font-weight: 700; line-height: 1; }
.tb-uline  { font-family: var(--font-ui); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; line-height: 1; }
.tb-strike { font-family: var(--font-ui); font-size: 13px; font-weight: 600; text-decoration: line-through; line-height: 1; }
.tb-sup    { font-family: var(--font-ui); font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.tb-sub    { font-family: var(--font-ui); font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }

.tb-color-a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-family: Georgia, serif; font-size: 13px; font-weight: 700; line-height: 1; }
.color-bar { width: 16px; height: 3px; border-radius: 1.5px; }

.tb-btn::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  background: var(--surface3); color: var(--text);
  font-size: 11px; white-space: nowrap; padding: 3px 7px; border-radius: 4px;
  border: 1px solid var(--border); pointer-events: none; opacity: 0;
  transition: opacity 0.15s; z-index: 99;
}
.tb-btn:hover::after { opacity: 1; }

.tb-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--font-ui); font-size: 11.5px; padding: 3px 6px;
  border-radius: 5px; cursor: pointer; outline: none; height: 26px;
  transition: border-color var(--t);
}
.tb-select:focus { border-color: var(--accent); color: var(--text); }

/* ══ LAYOUT ══ */
#app { display: flex; flex: 1; overflow: hidden; }

/* ══ SIDEBAR ══ */
#sidebar {
  width: 262px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
  transition: width 0.25s ease;
}
#sidebar.collapsed { width: 0; }

.sidebar-header {
  padding: 11px 13px 9px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-title { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-tab {
  flex: 1; padding: 8px 6px; font-size: 12px; font-weight: 500;
  text-align: center; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all var(--t);
}
.sidebar-tab:hover { color: var(--text-dim); }
.sidebar-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sidebar-content { flex: 1; overflow-y: auto; padding: 6px; }
.sidebar-new-btn { padding: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }

.doc-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer; transition: background 0.1s;
}
.doc-item:hover { background: var(--surface2); }
.doc-item.active { background: var(--surface3); }
.doc-item-icon { font-size: 12px; flex-shrink: 0; color: var(--text-muted); }
.doc-item-info { flex: 1; min-width: 0; }
.doc-item-title { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item-date { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.doc-item-del { display: none; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 3px; }
.doc-item:hover .doc-item-del { display: block; }

.template-item { padding: 8px 9px; border-radius: 6px; cursor: pointer; transition: background 0.1s; border: 1px solid transparent; }
.template-item:hover { background: var(--surface2); border-color: var(--border); }
.template-name { font-size: 12.5px; color: var(--text); }
.template-cat { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ══ EDITOR AREA ══ */
#editor-area { flex: 1; display: flex; overflow: hidden; }
.editor-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 8px;
}
.pane-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-muted); flex-shrink: 0; }
.pane-actions { display: flex; gap: 5px; align-items: center; margin-left: auto; }

.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 5px; color: var(--text-dim); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--t);
}
.copy-btn svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-btn.copied { background: var(--success); border-color: var(--success); color: #fff; }

.divider {
  width: 5px; background: var(--bg);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  cursor: col-resize; flex-shrink: 0; transition: background var(--t);
}
.divider:hover { background: var(--accent); opacity: 0.7; }

#source-editor {
  flex: 1; width: 100%; padding: 13px 15px;
  background: #090e1a; color: #c0ccf0;
  font-family: var(--font-code); font-size: 12px; line-height: 1.8;
  border: none; outline: none; resize: none; overflow-y: auto; tab-size: 2;
}
[data-theme="light"] #source-editor { background: #f2f4fc; color: #253060; }
#source-editor::selection { background: rgba(21,101,192,0.3); }

#wysiwyg-wrapper {
  flex: 1; background: #e4e8f2; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px;
}
[data-theme="light"] #wysiwyg-wrapper { background: #d8dcea; }

#wysiwyg {
  width: 100%; max-width: 750px; min-height: 440px;
  background: #ffffff; color: #1a1c2e;
  font-family: Georgia, 'Times New Roman', serif; font-size: 15px; line-height: 1.8;
  padding: 42px 50px; border-radius: 3px; box-shadow: var(--editor-shad);
  outline: none; word-wrap: break-word;
}
#wysiwyg:focus { box-shadow: var(--editor-shad), 0 0 0 2px rgba(21,101,192,0.2); }
#wysiwyg h1 { font-size: 2em; margin: 0.4em 0 0.3em; }
#wysiwyg h2 { font-size: 1.5em; margin: 1em 0 0.3em; }
#wysiwyg h3 { font-size: 1.2em; margin: 0.8em 0 0.3em; }
#wysiwyg p  { margin: 0 0 0.9em; }
#wysiwyg ul, #wysiwyg ol { padding-left: 1.5em; margin: 0 0 0.9em; }
#wysiwyg li { margin-bottom: 0.25em; }
#wysiwyg a  { color: #1565C0; }
#wysiwyg table { border-collapse: collapse; width: 100%; margin: 1em 0; }
#wysiwyg td, #wysiwyg th { border: 1px solid #d4d8e8; padding: 7px 11px; text-align: left; }
#wysiwyg th { background: #f5f7ff; font-weight: 600; }
#wysiwyg blockquote { border-left: 3px solid #1565C0; margin: 1em 0; padding: 0.5em 1em; color: #555; font-style: italic; background: #f0f4ff; border-radius: 0 4px 4px 0; }
#wysiwyg code { background: #f0f2fa; padding: 2px 5px; border-radius: 3px; font-family: var(--font-code); font-size: 0.86em; color: #c62828; }
#wysiwyg pre { background: #1e2537; color: #c9d1f0; padding: 14px 16px; border-radius: 6px; overflow-x: auto; font-family: var(--font-code); font-size: 12.5px; margin: 1em 0; }
#wysiwyg hr { border: none; border-top: 2px solid #e0e4f0; margin: 1.8em 0; }

/* ══ WORD LIMIT BAR ══ */
#word-limit-bar {
  padding: 4px 12px; font-size: 11.5px; font-weight: 600;
  text-align: center; flex-shrink: 0; display: none;
  border-top: 1px solid;
}
#word-limit-bar.warn  { display: block; background: #78350f; color: #fcd34d; border-color: #92400e; }
#word-limit-bar.limit { display: block; background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }

/* ══ STATUS BAR ══ */
#statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 14px; background: var(--surface); border-top: 1px solid var(--border);
  flex-shrink: 0; font-size: 11px; color: var(--text-muted); font-family: var(--font-code);
}
.status-left, .status-right { display: flex; align-items: center; gap: 14px; }
.status-pill { display: flex; align-items: center; gap: 5px; padding: 2px 8px; background: var(--surface2); border-radius: 10px; font-size: 10.5px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.status-dot.saving { background: var(--accent2); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.status-link { color: var(--text-muted); text-decoration: none; cursor: pointer; transition: color var(--t); }
.status-link:hover { color: var(--accent); }

/* ══ MODAL (shared) ══ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rlg); box-shadow: var(--shadow);
  width: 520px; max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column;
  transform: scale(0.96) translateY(8px); transition: transform 0.2s; overflow: hidden;
}
.modal-overlay.show .modal { transform: none; }
.modal-wide { width: 720px; max-width: 96vw; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 3px; border-radius: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; letter-spacing: 0.4px; text-transform: uppercase; }
.form-input, .form-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--font-ui);
  font-size: 13px; padding: 8px 11px; outline: none; transition: border-color var(--t);
}
.form-input:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 100px; font-family: var(--font-code); font-size: 12px; }

/* ══ CONFIRM MODAL ══ */
#confirm-modal .modal { width: 420px; }
#confirm-message { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* ══ LINK MODAL ══ */
.link-preview { font-size: 11px; color: var(--accent); font-family: var(--font-code); word-break: break-all; min-height: 16px; margin-top: 4px; padding: 3px 6px; background: var(--surface3); border-radius: 4px; }

/* ══ LEGAL BODY (Terms/Privacy in modal) ══ */
.legal-body { padding: 4px 0; font-family: var(--font-ui); color: var(--text); line-height: 1.8; }
.legal-body h2 { font-size: 1em; font-weight: 700; margin: 1.6em 0 0.4em; color: var(--text); padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.legal-body p, .legal-body li { font-size: 13.5px; color: var(--text-dim); margin-bottom: 0.7em; }
.legal-body ul { padding-left: 1.3em; }
.legal-body li { margin-bottom: 0.3em; }
.legal-body .last-updated { font-size: 11.5px; color: var(--text-muted); margin-bottom: 1em; }
.legal-body a { color: var(--accent); text-decoration: underline; }
.legal-body strong { color: var(--text); }
.legal-body code { background: var(--surface3); padding: 1px 5px; border-radius: 3px; font-family: var(--font-code); font-size: 0.88em; }

/* ══ REPORT MODAL ══ */
.report-word-counter { font-size: 11px; color: var(--text-muted); font-family: var(--font-code); margin-top: 4px; text-align: right; display: block; }
.report-word-counter.warn  { color: var(--accent2); }
.report-word-counter.limit { color: var(--danger); font-weight: 600; }
.report-contact-note { margin-top: 14px; padding: 10px 14px; background: var(--surface2); border-radius: var(--r); border: 1px solid var(--border); font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.report-contact-note a { color: var(--accent); text-decoration: underline; }

/* ══ HELP DOCK ══ */
#help-dock {
  position: fixed; bottom: 0; right: 24px; width: 390px; max-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-bottom: none; border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 30px rgba(0,0,0,0.3);
  z-index: 800; overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
#help-dock.open { max-height: 490px; }

.help-dock-tab {
  position: fixed; bottom: 32px; right: 20px;
  display: flex; align-items: center; gap: 5px;
  background: var(--accent); color: #fff;
  padding: 6px 13px; border-radius: 20px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; box-shadow: 0 4px 14px rgba(21,101,192,0.45);
  z-index: 801; transition: all var(--t);
}
.help-dock-tab:hover { background: var(--accent-hl); transform: translateY(-1px); }

.help-header { padding: 13px 17px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.help-title { font-size: 14px; font-weight: 600; color: var(--text); }
.help-close { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 2px; }
.help-close:hover { color: var(--text); }

.help-body { padding: 12px 16px; overflow-y: auto; max-height: 400px; }
.help-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.help-tab { padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; cursor: pointer; background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); transition: all var(--t); }
.help-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.help-panel { display: none; animation: fadeIn 0.15s ease; }
.help-panel.active { display: block; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.help-feature { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.help-feature:last-child { border-bottom: none; }
.help-feature-icon { font-size: 15px; flex-shrink: 0; width: 22px; text-align: center; margin-top: 1px; }
.help-feature-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.help-feature-desc { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }

.faq-item { padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.faq-q::after { content: '▾'; color: var(--text-muted); flex-shrink: 0; font-size: 11px; }
.faq-item.open .faq-q::after { content: '▴'; }
.faq-a { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-top: 6px; display: none; }
.faq-item.open .faq-a { display: block; }

.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-action { color: var(--text-dim); }
.shortcut-key { background: var(--surface3); color: var(--text); padding: 2px 7px; border-radius: 4px; font-family: var(--font-code); font-size: 11px; border: 1px solid var(--border2); }

/* ══ COOKIE BANNER ══ */
#cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #1e2537; border-top: 2px solid var(--accent);
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; z-index: 2000; box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  flex-wrap: wrap; animation: slideUp 0.35s ease;
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:none} }
@keyframes slideDown { from{transform:translateY(0)} to{transform:translateY(110%)} }
[data-theme="light"] #cookie-banner { background: #f0f4ff; border-top-color: var(--accent); }
#cookie-banner.hidden { display: none; }
.cookie-text { font-size: 13px; color: var(--text-dim); flex: 1; min-width: 200px; }
.cookie-text a { color: var(--accent); text-decoration: underline; cursor: pointer; }
.cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-accept { padding: 7px 18px; background: var(--accent); color: #fff; border: none; border-radius: var(--r); font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--t); }
.cookie-accept:hover { background: var(--accent-hl); }
.cookie-decline { padding: 7px 14px; background: transparent; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--r); font-family: var(--font-ui); font-size: 13px; cursor: pointer; transition: all var(--t); }
.cookie-decline:hover { color: var(--text); border-color: var(--border2); }

/* ══ GUIDED TOUR ══ */
#tour-overlay { position: fixed; inset: 0; z-index: 5000; pointer-events: none; display: none; }
#tour-overlay.active { display: block; }
#tour-veil { position: absolute; inset: 0; background: rgba(0,0,0,0.72); pointer-events: all; }
#tour-spotlight { position: absolute; border: 3px solid #1976D2; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.72); pointer-events: none; transition: all 0.35s cubic-bezier(0.4,0,0.2,1); z-index: 5001; }
#tour-card { position: absolute; width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); box-shadow: 0 12px 40px rgba(0,0,0,0.6); padding: 20px; pointer-events: all; z-index: 5002; transition: all 0.3s ease; }

.tour-step-badge { display: inline-flex; align-items: center; background: var(--accent-dim); color: var(--accent); font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-bottom: 10px; letter-spacing: 0.4px; text-transform: uppercase; }
.tour-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; font-family: var(--font-disp); }
.tour-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }
.tour-nav { display: flex; align-items: center; gap: 8px; }
.tour-dots { display: flex; gap: 5px; align-items: center; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border2); cursor: pointer; transition: all var(--t); }
.tour-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }
.tour-skip { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 2px 0; text-decoration: underline; font-family: var(--font-ui); }
.tour-skip:hover { color: var(--text-dim); }
.tour-prev, .tour-next, .tour-finish { padding: 7px 14px; border-radius: var(--r); font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--t); }
.tour-prev { background: var(--surface3); color: var(--text-dim); border-color: var(--border); }
.tour-prev:hover { color: var(--text); }
.tour-next, .tour-finish { background: var(--accent); color: #fff; }
.tour-next:hover, .tour-finish:hover { background: var(--accent-hl); }

#tour-welcome { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: all; }
.tour-welcome-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); box-shadow: 0 16px 60px rgba(0,0,0,0.7); padding: 36px 40px; text-align: center; max-width: 440px; width: 90%; }
.tour-welcome-icon { width: 60px; height: 60px; background: #1565C0; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 28px; }
.tour-welcome-icon svg { width: 30px; height: 30px; }
.tour-welcome-title { font-family: var(--font-disp); font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.tour-welcome-desc { font-size: 14px; color: var(--text-dim); line-height: 1.65; margin-bottom: 24px; }
.tour-welcome-btns { display: flex; gap: 10px; justify-content: center; }
.tour-start { background: var(--accent); color: #fff; border: none; padding: 10px 24px; border-radius: var(--r); font-family: var(--font-ui); font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--t); }
.tour-start:hover { background: var(--accent-hl); }
.tour-skip-all { background: none; border: 1px solid var(--border); color: var(--text-muted); padding: 10px 18px; border-radius: var(--r); font-family: var(--font-ui); font-size: 14px; cursor: pointer; transition: all var(--t); }
.tour-skip-all:hover { color: var(--text); border-color: var(--border2); }

/* ══ COLOR PICKER ══ */
.color-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 8px; }
.color-swatch { width: 28px; height: 28px; border-radius: 5px; cursor: pointer; border: 2px solid transparent; transition: transform 0.1s, border-color 0.1s; }
.color-swatch:hover { border-color: var(--text); transform: scale(1.12); }

/* ══ TABLE PICKER ══ */
.table-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 3px; }
.table-cell { width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 2px; cursor: pointer; transition: background 0.1s; }
.table-cell.hover { background: var(--accent); border-color: var(--accent); }

/* ══ TOAST ══ */
#toast-container { position: fixed; bottom: 62px; right: 22px; z-index: 9999; display: flex; flex-direction: column-reverse; gap: 6px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 13px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); font-size: 12.5px; color: var(--text); min-width: 200px; animation: toastIn 0.2s ease; pointer-events: all; border-left: 3px solid var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info  { border-left-color: var(--accent); }
.toast.warn  { border-left-color: var(--accent2); }
@keyframes toastIn { from{opacity:0;transform:translateX(14px)} to{opacity:1;transform:none} }

/* ══ MISC ══ */
.empty-state { text-align: center; padding: 28px 14px; color: var(--text-muted); }
.empty-state-icon { font-size: 26px; margin-bottom: 10px; }
.empty-state-text { font-size: 12px; line-height: 1.5; }
.tag { display: inline-block; padding: 2px 6px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.tag-blue  { background: rgba(21,101,192,0.12); color: #1976D2; }
.tag-green { background: rgba(67,160,71,0.12); color: #388E3C; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

@media (max-width: 800px) {
  #sidebar { display: none; }
  #wysiwyg { padding: 22px 18px; }
  .logo-text { display: none; }
  #help-dock { width: calc(100% - 12px); right: 6px; }
}
@media print {
  #header, #toolbar, #statusbar, #sidebar, .pane-header,
  #help-dock, .help-dock-tab, #toast-container,
  #cookie-banner, #tour-overlay { display: none !important; }
  #wysiwyg-wrapper { padding: 0; background: none; }
  #wysiwyg { box-shadow: none; max-width: 100%; padding: 0; }
  #left-pane, .divider { display: none !important; }
  body, html { height: auto; overflow: auto; }
}
