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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --accent: #58a6ff;
  --accent2: #3fb950;
  --accent3: #d2a8ff;
  --text: #e6edf3;
  --muted: #8b949e;
  --danger: #f85149;
  --success: #3fb950;
}

/* Midnight Slate — default above */

/* Pure White — clean crisp light */
body.th-white {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface2: #ebebeb;
  --border: #d0d0d0;
  --accent: #2563eb;
  --accent2: #16a34a;
  --accent3: #9333ea;
  --text: #111827;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
}

/* Monokai Pro — warm dark */
body.th-monokai {
  --bg: #2d2a2e;
  --surface: #221f22;
  --surface2: #3a3a3c;
  --border: #484449;
  --accent: #ffd866;
  --accent2: #a9dc76;
  --accent3: #ff6188;
  --text: #fcfcfa;
  --muted: #939293;
  --danger: #ff6188;
  --success: #a9dc76;
}

/* Nord — cool arctic blue */
body.th-nord {
  --bg: #2e3440;
  --surface: #3b4252;
  --surface2: #434c5e;
  --border: #4c566a;
  --accent: #88c0d0;
  --accent2: #a3be8c;
  --accent3: #b48ead;
  --text: #eceff4;
  --muted: #7b88a1;
  --danger: #bf616a;
  --success: #a3be8c;
}

/* Dracula — vibrant purple dark */
body.th-dracula {
  --bg: #282a36;
  --surface: #1e1f29;
  --surface2: #373844;
  --border: #44475a;
  --accent: #bd93f9;
  --accent2: #50fa7b;
  --accent3: #ff79c6;
  --text: #f8f8f2;
  --muted: #8e909e;
  --danger: #ff5555;
  --success: #50fa7b;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .3s, color .3s;
  font-size: 14px;
}

/* ━━ HEADER ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
header {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: .05em;
  flex-shrink: 0;
  user-select: none;
  cursor: default;
}
.logo sup { font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; font-style: normal; }

.tabs-bar {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  height: 100%;
  padding-top: 8px;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px;
  border-radius: 7px 7px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer; font-size: 12px; color: var(--muted);
  white-space: nowrap; transition: all .15s;
  min-width: 80px; max-width: 160px; position: relative; height: 34px;
}
.tab.active { background: var(--bg); border-color: var(--border); color: var(--text); }
.tab:hover:not(.active) { background: rgba(255,255,255,.04); color: var(--text); }
.tab-name { flex: 1; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.tab-close { opacity:0; width:14px; height:14px; display:flex; align-items:center; justify-content:center; border-radius:3px; font-size:10px; flex-shrink:0; transition:opacity .1s; }
.tab:hover .tab-close { opacity:1; }
.tab-close:hover { background:var(--danger); color:#fff; }
.tab-unsaved::before { content:''; position:absolute; top:5px; left:5px; width:5px; height:5px; border-radius:50%; background:var(--accent); }
.btn-new-tab { width:28px; height:28px; border:1px solid var(--border); border-radius:5px; background:transparent; color:var(--muted); font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .15s; flex-shrink:0; }
.btn-new-tab:hover { border-color:var(--accent); color:var(--accent); }

/* ━━ TOOLBAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.toolbar {
  height: 46px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 50;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 6px 0 10px;
  overflow-x: auto;
  overflow-y: visible;
  flex: 1;
  height: 100%;
  scrollbar-width: none;
}
.toolbar-left::-webkit-scrollbar { display: none; }
.tright {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 10px 0 8px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  height: 100%;
  background: var(--surface);
}

/* toolbar button */
.tb {
  width: 32px; height: 32px;
  border: none; background: transparent; color: var(--muted);
  border-radius: 5px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .1s; flex-shrink: 0; position: relative;
}
.tb:hover { background: rgba(255,255,255,.08); color: var(--text); }
.tb.on { background: rgba(212,168,83,.18); color: var(--accent); }

/* toolbar group label */
.tgrp {
  display: flex; align-items: center; gap: 1px; flex-shrink: 0;
  padding: 0 2px;
}

.tsep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.tsel {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 11px; border-radius: 5px;
  padding: 2px 5px; cursor: pointer; height: 28px; flex-shrink: 0;
}
.tsel option { background: var(--surface); color: var(--text); }

/* color picker */
.tcolor {
  width: 32px; height: 32px; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 5px; padding: 0; position: relative;
}
.tcolor:hover { background: rgba(255,255,255,.08); }
.tcolor input[type=color] {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  top: 50%; left: 50%; transform: translate(-50%,-50%); pointer-events: none;
}
.tcolor-icon { font-size: 13px; line-height: 1; pointer-events: none; display: block; }
.tcolor-bar { position: absolute; bottom: 4px; left: 6px; right: 6px; height: 3px; border-radius: 2px; pointer-events: none; }

/* ── Mode pills (Write / Split / Preview) ── */
.mpills {
  display: flex; gap: 2px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px; flex-shrink: 0;
}
.mpill {
  padding: 3px 11px; border-radius: 4px; font-size: 12px;
  cursor: pointer; color: var(--muted); border: none;
  background: transparent; font-family: 'DM Mono', monospace; transition: all .1s;
}
.mpill.on { background: var(--surface2); color: var(--text); }
.mpill:hover:not(.on) { color: var(--text); }

/* preview pane */
.prev {
  flex: 1; padding: 36px 60px; overflow-y: auto; display: none;
  line-height: 1.85; color: var(--text); font-size: 15px;
}
.prev::-webkit-scrollbar { width: 6px; }
.prev::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.prev h1 { font-family: 'Playfair Display', serif; color: var(--accent); margin: .8em 0 .3em; font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: .2em; }
.prev h2 { font-family: 'Playfair Display', serif; color: var(--accent); margin: .7em 0 .25em; font-size: 1.5em; }
.prev h3 { color: var(--accent2); margin: .6em 0 .2em; font-size: 1.2em; }
.prev p { margin-bottom: .6em; }
.prev ul, .prev ol { padding-left: 24px; margin-bottom: .8em; }
.prev li { margin-bottom: .2em; }
.prev blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--muted); margin: .8em 0; font-style: italic; }
.prev pre { background: var(--surface); padding: 14px; border-radius: 7px; margin: .8em 0; border: 1px solid var(--border); font-size: .9em; overflow-x: auto; }
.prev code { background: var(--surface); padding: 2px 5px; border-radius: 4px; font-size: .88em; color: var(--accent2); }
.prev a { color: var(--accent2); }
.prev hr { border: none; border-top: 1px solid var(--border); margin: 1.4em 0; }
.prev table { border-collapse: collapse; margin: .8em 0; width: 100%; }
.prev th { background: var(--surface); padding: 8px 12px; border: 1px solid var(--border); color: var(--accent); font-size: 12px; }
.prev td { padding: 7px 12px; border: 1px solid var(--border); font-size: 13px; }
.prev img { max-width: 100%; border-radius: 6px; }
.more-wrap { position: relative; flex-shrink: 0; }
.more-btn {
  display: flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--muted);
  font-family: 'DM Mono', monospace; font-size: 12px;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.more-btn:hover { border-color: var(--accent); color: var(--accent); }
.more-btn.open { border-color: var(--accent); color: var(--accent); background: rgba(212,168,83,.07); }
.more-menu {
  display: none; position: fixed; top: 46px; left: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; z-index: 9999; min-width: 280px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.more-menu.open { display: block; }
.more-section { margin-bottom: 10px; }
.more-section:last-child { margin-bottom: 0; }
.more-section-lbl {
  font-size: 9px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .1em; margin-bottom: 5px; padding: 0 2px;
}
.more-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.more-sel {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 11px; border-radius: 5px;
  padding: 4px 6px; cursor: pointer; flex: 1; height: 28px; min-width: 80px;
}
.more-sel option { background: var(--surface); color: var(--text); }
.more-sep { height: 1px; background: var(--border); margin: 8px 0; }

/* pill buttons */
.pill {
  display: flex; align-items: center; gap: 3px;
  padding: 5px 12px; border-radius: 5px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  font-family: 'DM Mono', monospace; font-size: 12px;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.pri { background: var(--accent); border-color: var(--accent); color: #0f0e0c; font-weight: 500; }
.pill.pri:hover { opacity: .88; }

/* ━━ MAIN LAYOUT ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.main { display: flex; flex: 1; overflow: hidden; }

/* ━━ SIDEBAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.sidebar {
  width: 230px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: width .22s cubic-bezier(.4,0,.2,1); overflow: hidden;
}
.sidebar.col { width: 0; }
.sb-hd { padding: 12px 12px 7px; display: flex; align-items: center; justify-content: space-between; }
.sb-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 500; }
.sb-new { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.sb-new:hover { color: var(--accent); }
.sb-srch { margin: 0 10px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-family: 'DM Mono', monospace; font-size: 12px; padding: 6px 9px; outline: none; width: calc(100% - 20px); }
.sb-srch:focus { border-color: var(--accent); }
.sb-srch::placeholder { color: var(--muted); }
.sb-list { flex: 1; overflow-y: auto; }
.sb-list::-webkit-scrollbar { width: 4px; }
.sb-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.srch-scope-btn {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; font-family: 'DM Mono', monospace;
  transition: all .1s;
}
.srch-scope-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(88,166,255,.08); }
.srch-scope-btn:hover:not(.on) { border-color: var(--muted); color: var(--text); }
.ni-match { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.ni-match mark { background: rgba(255,210,80,.28); color: var(--text); border-radius: 2px; padding: 0 1px; font-style: normal; }
.ni-name mark { background: rgba(255,210,80,.28); color: var(--text); border-radius: 2px; padding: 0 1px; }
.srch-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.srch-empty svg { opacity: .4; margin-bottom: 8px; }

.ni { padding: 9px 10px 9px 12px; cursor: pointer; color: var(--muted); border-left: 3px solid transparent; transition: all .1s; display: flex; align-items: center; gap: 9px; overflow: hidden; }
.ni:hover { color: var(--text); background: rgba(255,255,255,.04); }
.ni.act { color: var(--accent); border-left-color: var(--accent); background: rgba(212,168,83,.07); }
.ni-icon { font-size: 15px; flex-shrink: 0; }
.ni-inner { flex: 1; overflow: hidden; }
.ni-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ni-name-input {
  font-size: 12px; font-weight: 500; font-family: 'DM Mono', monospace;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 1px 5px; outline: none; width: 100%;
  box-shadow: 0 0 0 2px rgba(88,166,255,.15);
}
.ni-prev { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }

/* ━━ EDITOR AREA ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.edwrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

#editor {
  flex: 1;
  background: var(--bg); color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  line-height: 1.85;
  padding: 36px 60px;
  border: none; outline: none;
  overflow-y: auto;
  caret-color: var(--accent);
  transition: padding .3s, font-size .2s, background .3s, color .3s;
  word-wrap: break-word;
  min-height: 100%;
}
#editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
  pointer-events: none;
}
#editor::-webkit-scrollbar { width: 6px; }
#editor::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Rich text styling inside editor */
#editor h1 { font-family: 'Playfair Display', serif; font-size: 2em; color: var(--accent); margin: .8em 0 .3em; border-bottom: 1px solid var(--border); padding-bottom: .2em; }
#editor h2 { font-family: 'Playfair Display', serif; font-size: 1.5em; color: var(--accent); margin: .7em 0 .25em; }
#editor h3 { font-size: 1.2em; color: var(--accent2); margin: .6em 0 .2em; }
#editor h4 { font-size: 1.05em; color: var(--accent2); margin: .5em 0 .2em; }
#editor p { margin-bottom: .6em; }
#editor ul, #editor ol { padding-left: 24px; margin-bottom: .8em; }
#editor li { margin-bottom: .2em; }
#editor blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--muted); margin: .8em 0; font-style: italic; }
#editor pre { background: var(--surface); padding: 14px; border-radius: 7px; margin: .8em 0; overflow-x: auto; border: 1px solid var(--border); font-size: .9em; }
#editor code { background: var(--surface); padding: 2px 5px; border-radius: 4px; font-size: .88em; color: var(--accent2); }
#editor pre code { background: none; padding: 0; color: var(--text); }
#editor a { color: var(--accent2); text-decoration: underline; }
#editor hr { border: none; border-top: 1px solid var(--border); margin: 1.4em 0; }
#editor table { border-collapse: collapse; margin: .8em 0; width: 100%; }
#editor th { background: var(--surface); padding: 8px 12px; text-align: left; border: 1px solid var(--border); color: var(--accent); font-size: 12px; }
#editor td { padding: 7px 12px; border: 1px solid var(--border); font-size: 13px; }
#editor tr:nth-child(even) td { background: var(--surface); }
#editor img { max-width: 100%; border-radius: 6px; margin: .4em 0; display: block; }
#editor mark { background: rgba(212,168,83,.3); padding: 0 2px; border-radius: 2px; }

/* Focus mode */
body.focus-mode header,
body.focus-mode .toolbar,
body.focus-mode .sidebar,
body.focus-mode .rpanel,
body.focus-mode .sbar { opacity: 0; pointer-events: none; transition: opacity .3s; }
body.focus-mode #editor { padding: 60px 120px; }
body.focus-mode .focbar { display: block; }

/* Typewriter */
body.typer #editor { padding-top: 40vh; padding-bottom: 60vh; }

/* ━━ RIGHT PANEL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.rpanel { width:0; background:var(--surface); border-left:1px solid var(--border); overflow:hidden; transition:width .22s cubic-bezier(.4,0,.2,1); flex-shrink:0; display:flex; flex-direction:column; }
.rpanel.open { width: 280px; }
.rptabs { display:flex; border-bottom:1px solid var(--border); flex-shrink:0; }
.rptab { flex:1; padding:11px 0; font-size:11px; cursor:pointer; color:var(--muted); text-align:center; border-bottom:2px solid transparent; transition:all .12s; background:transparent; border-top:none; border-left:none; border-right:none; font-family:'DM Mono',monospace; }
.rptab.on { color:var(--accent); border-bottom-color:var(--accent); }
.rpbody { padding:14px; flex:1; overflow-y:auto; }
.rpbody::-webkit-scrollbar { width:4px; }
.rpbody::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
.sgrid { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-bottom:16px; }
.sc { background:var(--bg); border:1px solid var(--border); border-radius:7px; padding:10px 8px; text-align:center; }
.sv { font-size:20px; color:var(--accent); font-weight:300; }
.slb { font-size:10px; color:var(--muted); margin-top:3px; text-transform:uppercase; letter-spacing:.04em; }
.sec-lbl { font-size:10px; color:var(--muted); margin:0 0 7px; text-transform:uppercase; letter-spacing:.1em; font-weight:500; }
.rbar { height:4px; background:var(--border); border-radius:2px; margin-bottom:16px; overflow:hidden; }
.rfill { height:100%; background:linear-gradient(90deg,var(--accent2),var(--accent)); border-radius:2px; transition:width .4s; }
.gring { display:flex; flex-direction:column; align-items:center; margin-bottom:12px; }
.ring-svg { margin-bottom:8px; }
.rbg { fill:none; stroke:var(--border); stroke-width:6; }
.rprog { fill:none; stroke:var(--accent); stroke-width:6; stroke-linecap:round; transform:rotate(-90deg); transform-origin:50% 50%; transition:stroke-dashoffset .4s; }
.gnum { font-size:16px; color:var(--text); }
.glbl { font-size:11px; color:var(--muted); margin-top:3px; }
.g-row { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.ginp { background:var(--bg); border:1px solid var(--border); color:var(--text); font-family:'DM Mono',monospace; font-size:13px; padding:5px 8px; border-radius:5px; width:80px; outline:none; }
.ginp:focus { border-color:var(--accent); }
.ginp-lbl { font-size:11px; color:var(--muted); }
.twrap { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.tag { padding:4px 10px; border:1px solid var(--border); border-radius:20px; font-size:11px; color:var(--muted); cursor:pointer; transition:all .1s; }
.tag.on { border-color:var(--accent); color:var(--accent); background:rgba(212,168,83,.07); }
.twds { font-size:12px; }
.twr { display:flex; align-items:center; gap:8px; padding:4px 0; }
.twb { height:3px; background:var(--accent); border-radius:2px; }
.tgrid { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-bottom:16px; }
.tc { display:flex; align-items:center; gap:7px; padding:9px 11px; border:1px solid var(--border); border-radius:7px; cursor:pointer; font-size:12px; color:var(--muted); transition:all .12s; }
.tc.on { border-color:var(--accent); color:var(--accent); }
.tc:hover { border-color:var(--accent); }
.tdot { width:16px; height:16px; border-radius:50%; flex-shrink:0; }
.font-item { padding:8px 10px; border:1px solid var(--border); border-radius:5px; cursor:pointer; font-size:13px; color:var(--muted); margin-bottom:5px; transition:all .12s; }
.font-item:hover,.font-item.sel { border-color:var(--accent); color:var(--text); }
.range-row { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.range-row input[type=range] { flex:1; accent-color:var(--accent); }
.range-val { font-size:11px; color:var(--muted); width:40px; text-align:right; }
.pomowrap { text-align:center; padding:16px 0; }
.ptimer { font-size:42px; color:var(--text); font-weight:300; letter-spacing:.05em; margin-bottom:6px; }
.plbl { font-size:12px; color:var(--muted); margin-bottom:16px; }
.pbtns { display:flex; gap:6px; justify-content:center; margin-bottom:14px; }
.pbtn { padding:7px 14px; border:1px solid var(--border); border-radius:5px; background:transparent; color:var(--muted); font-family:'DM Mono',monospace; font-size:12px; cursor:pointer; transition:all .12s; }
.pbtn:hover { border-color:var(--accent); color:var(--accent); }
.pbtn.pri { background:var(--accent); border-color:var(--accent); color:#0f0e0c; }
.psess { display:flex; gap:5px; justify-content:center; flex-wrap:wrap; }
.pdot { width:10px; height:10px; border-radius:50%; border:1px solid var(--border); }
.pdot.done { background:var(--accent); border-color:var(--accent); }
.pomo-set { padding-top:14px; border-top:1px solid var(--border); }
.pomo-field { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.hi { padding:9px 0; border-bottom:1px solid var(--border); cursor:pointer; transition:background .1s; }
.hi:hover { background:rgba(255,255,255,.03); }
.htm { font-size:11px; color:var(--accent); }
.hres { font-size:10px; color:var(--muted); float:right; margin-top:2px; }
.hprev { font-size:11px; color:var(--muted); margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ━━ FLOATING ACTION BUTTONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.fab-group {
  position: fixed;
  bottom: 48px; /* above status bar */
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
}
.fab {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  transition: all .18s cubic-bezier(.4,0,.2,1);
  position: relative;
  flex-shrink: 0;
}
.fab:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
}
.fab-label {
  position: absolute;
  right: 54px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.fab:hover .fab-label { opacity: 1; }
body.focus-mode .fab-group { opacity: 0; pointer-events: none; transition: opacity .3s; }

/* ━━ STATUS BAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.sbar { height:28px; background:var(--surface); border-top:1px solid var(--border); display:flex; align-items:center; padding:0 14px; gap:14px; font-size:11px; color:var(--muted); flex-shrink:0; z-index:10; }
.si { display:flex; align-items:center; gap:5px; }
.sdot { width:6px; height:6px; border-radius:50%; background:var(--success); }
.sv2 .sdot { background:var(--accent); }
.sr { margin-left:auto; display:flex; gap:12px; align-items:center; }

/* ━━ MODALS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.mov { position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:100; display:none; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
.mov.open { display:flex; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:28px; max-width:460px; width:90%; position:relative; max-height:85vh; overflow-y:auto; }
.mclose { position:absolute; top:14px; right:14px; background:none; border:none; color:var(--muted); cursor:pointer; font-size:16px; border-radius:4px; padding:2px 6px; }
.mclose:hover { color:var(--text); background:var(--surface2); }
.modal h3 { font-size:16px; color:var(--text); margin-bottom:18px; font-family:'Playfair Display',serif; }
.mrow { margin-bottom:14px; }
.mlbl { font-size:11px; color:var(--muted); margin-bottom:5px; text-transform:uppercase; letter-spacing:.08em; }
.minput { width:100%; background:var(--bg); border:1px solid var(--border); color:var(--text); font-family:'DM Mono',monospace; font-size:13px; padding:8px 10px; border-radius:6px; outline:none; resize:vertical; }
.minput:focus { border-color:var(--accent); }
.macts { display:flex; gap:8px; margin-top:18px; }
.egrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ec { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:16px 12px; cursor:pointer; text-align:center; transition:all .15s; }
.ec:hover { border-color:var(--accent); background:rgba(212,168,83,.04); }
.ei { font-size:26px; margin-bottom:7px; }
.en { font-size:13px; color:var(--text); font-weight:500; }
.ed { font-size:11px; color:var(--muted); margin-top:3px; }
.snpi { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.snn { font-size:13px; flex:1; color:var(--text); }
.snt { font-size:11px; color:var(--accent2); margin-top:2px; }
.snins { font-size:11px; color:var(--accent2); padding:4px 10px; border:1px solid var(--accent2); border-radius:4px; cursor:pointer; background:none; font-family:'DM Mono',monospace; }
.snins:hover { background:rgba(126,184,164,.1); }
.sndel { background:none; border:none; color:var(--muted); cursor:pointer; font-size:14px; padding:2px 6px; border-radius:4px; }
.sndel:hover { color:var(--danger); }
.tpl { padding:10px 12px; border-radius:7px; cursor:pointer; margin-bottom:5px; border:1px solid transparent; transition:all .12s; }
.tpl:hover { border-color:var(--border); background:var(--surface2); }
.tpl.sel { border-color:var(--accent); }
.tpln { font-size:13px; color:var(--text); font-weight:500; }
.tpld { font-size:11px; color:var(--muted); margin-top:2px; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* ━━ LOCK SCREEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.lock-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.lock-screen.visible { display: flex; }
.lock-icon { font-size: 48px; margin-bottom: 8px; opacity: .7; }
.lock-title { font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 26px; color: var(--accent); }
.lock-sub { font-size: 12px; color: var(--muted); margin-top: -10px; }
.lock-input-wrap { display: flex; gap: 8px; margin-top: 8px; }
.lock-input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-family: 'DM Mono', monospace; font-size: 14px;
  padding: 10px 14px; border-radius: 7px; outline: none; width: 240px;
  transition: border-color .15s;
}
.lock-input:focus { border-color: var(--accent); }
.lock-input.err { border-color: var(--danger); animation: shake .3s; }
.lock-hint { font-size: 11px; color: var(--muted); }
@keyframes shake {
  0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)}
}
/* lock icon in sidebar */
.ni-lock { font-size: 11px; color: var(--muted); margin-left: auto; flex-shrink: 0; }
.ni.locked .ni-name::after { content: ' 🔒'; font-size: 10px; }
.ni.private-hidden { display: none !important; }

/* ━━ ENCRYPT MODAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.enc-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px; font-size: 10px;
  background: rgba(248,81,73,.15); color: var(--danger);
  border: 1px solid rgba(248,81,73,.3); margin-left: 6px;
}
.enc-badge.ok { background: rgba(63,185,80,.15); color: var(--success); border-color: rgba(63,185,80,.3); }
.pw-strength { height: 3px; border-radius: 2px; margin-top: 5px; transition: all .2s; }

/* ━━ AUTOCOMPLETE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ac-popup {
  position: fixed; z-index: 500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  overflow: hidden; min-width: 160px; max-width: 280px;
  display: none;
}
.ac-popup.open { display: block; }
.ac-item {
  padding: 7px 12px; font-size: 13px; color: var(--muted);
  cursor: pointer; transition: background .08s;
  display: flex; align-items: center; gap: 8px;
}
.ac-item:hover, .ac-item.sel { background: var(--surface2); color: var(--text); }
.ac-item .ac-word { flex: 1; }
.ac-item .ac-tab { font-size: 9px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 4px; white-space: nowrap; }
.ac-item.sel .ac-tab { border-color: var(--accent); color: var(--accent); }

/* sidebar section: show private toggle */
.sb-hd-row { display: flex; align-items: center; gap: 6px; padding: 8px 12px 4px; }
.sb-prv-btn {
  font-size: 10px; color: var(--muted); background: none; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px; cursor: pointer; font-family: 'DM Mono', monospace;
  transition: all .12s; white-space: nowrap;
}
.sb-prv-btn:hover { border-color: var(--accent); color: var(--accent); }
.sb-prv-btn.on { background: rgba(212,168,83,.12); border-color: var(--accent); color: var(--accent); }

/* ━━ UPLOAD MODAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.upload-drop {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: var(--bg);
}
.upload-drop:hover, .upload-drop.drag-over {
  border-color: var(--accent); background: rgba(88,166,255,.05);
}
.upload-drop.drag-over { transform: scale(1.01); }
.upload-drop-icon { color: var(--muted); margin-bottom: 10px; display: flex; justify-content: center; }
.upload-drop.drag-over .upload-drop-icon { color: var(--accent); }
.upload-drop-title { font-size: 14px; color: var(--text); margin-bottom: 5px; }
.upload-drop-sub { font-size: 11px; color: var(--muted); }
.upload-file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; margin-bottom: 6px; background: var(--bg);
}
.upload-file-icon { font-size: 18px; flex-shrink: 0; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.upload-file-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.upload-file-remove:hover { color: var(--danger); background: rgba(248,81,73,.1); }

/* ━━ AUTH ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.auth-btns { display:flex; gap:6px; align-items:center; flex-shrink:0; }
.btn-login {
  height:30px; padding:0 14px;
  border:1px solid var(--border); border-radius:6px;
  background:transparent; color:var(--muted);
  font-family:'DM Mono',monospace; font-size:12px;
  cursor:pointer; flex-shrink:0;
  transition:all .15s;
}
.btn-login:hover { border-color:var(--accent); color:var(--accent); }
.btn-register {
  height:30px; padding:0 14px;
  border:1px solid var(--accent); border-radius:6px;
  background:var(--accent); color:#0d1117;
  font-family:'DM Mono',monospace; font-size:12px; font-weight:500;
  cursor:pointer; flex-shrink:0;
  transition:all .15s;
}
.btn-register:hover { opacity:.85; }

/* user avatar + dropdown */
.user-area { position:relative; flex-shrink:0; z-index:10000; }
.user-avatar {
  width:32px; height:32px; border-radius:50%;
  background:var(--accent); color:#0d1117;
  font-family:'DM Mono',monospace; font-size:13px; font-weight:600;
  border:none; cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition:opacity .15s; flex-shrink:0; position:relative; z-index:10001;
}
.user-avatar:hover { opacity:.85; }
.user-dropdown {
  position:fixed; top:52px; right:12px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:10px; box-shadow:0 12px 40px rgba(0,0,0,.5);
  min-width:220px; z-index:10000; overflow:hidden;
  display:none;
}
.user-dropdown.open { display:block; }
.ud-header { padding:14px 16px 10px; border-bottom:1px solid var(--border); }
.ud-name { font-size:14px; color:var(--text); font-weight:500; margin-bottom:2px; }
.ud-email { font-size:11px; color:var(--muted); }
.ud-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 16px; font-size:12px; color:var(--muted);
  cursor:pointer; transition:background .1s;
  background:none; border:none; width:100%;
  font-family:'DM Mono',monospace; text-align:left;
}
.ud-item:hover { background:var(--surface2); color:var(--text); }
.ud-item.danger:hover { color:var(--danger); }
.ud-sep { height:1px; background:var(--border); margin:4px 0; }

/* auth modal fields */
.auth-modal { max-width:400px; }
.auth-or { display:flex; align-items:center; gap:10px; margin:14px 0; color:var(--muted); font-size:11px; }
.auth-or::before,.auth-or::after { content:''; flex:1; height:1px; background:var(--border); }
.auth-switch { font-size:12px; color:var(--muted); text-align:center; margin-top:14px; }
.auth-switch span { color:var(--accent); cursor:pointer; text-decoration:underline; }
.auth-switch span:hover { opacity:.8; }
.auth-err { font-size:11px; color:var(--danger); margin-top:8px; display:none; text-align:center; }

/* ━━ COMMENTS / ANNOTATIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.comment-highlight { background: rgba(255,210,80,.28); border-bottom: 2px solid #ffd250; cursor: pointer; border-radius: 2px; position: relative; }
.comment-highlight:hover { background: rgba(255,210,80,.45); }
.comments-panel { position: absolute; right: -300px; top: 0; width: 280px; pointer-events: none; }
.comment-bubble {
  position: absolute; right: 0; width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); pointer-events: all;
  transition: box-shadow .15s;
}
.comment-bubble:hover { box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.comment-bubble-author { font-size: 10px; color: var(--accent); font-weight: 500; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.comment-bubble-text { color: var(--text); line-height: 1.5; }
.comment-bubble-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; border-radius: 3px; }
.comment-bubble-del:hover { color: var(--danger); }
.comment-input-bar {
  position: absolute; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; z-index: 200;
  box-shadow: 0 8px 28px rgba(0,0,0,.5); min-width: 260px; display: none;
}
.comment-input-bar.open { display: block; }
.comment-input-bar textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-family: 'DM Mono', monospace; font-size: 12px; padding: 7px 9px; border-radius: 5px; outline: none; resize: none; }
.comment-input-bar textarea:focus { border-color: var(--accent); }
.comment-input-bar .cbbtns { display: flex; gap: 6px; margin-top: 7px; justify-content: flex-end; }

/* ━━ SHARE MODAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.share-link-box { display: flex; gap: 6px; margin: 10px 0; }
.share-link-inp { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-family: 'DM Mono', monospace; font-size: 11px; padding: 7px 9px; border-radius: 5px; outline: none; }
.share-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 12px; font-size: 10px; border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: all .12s; }
.share-badge.on { border-color: var(--accent); color: var(--accent); background: rgba(88,166,255,.1); }
.share-collab-list { max-height: 140px; overflow-y: auto; margin-top: 8px; }
.share-collab-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.share-collab-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #0d1117; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ━━ REMINDER MODAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.reminder-list { margin-top: 10px; }
.reminder-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.reminder-time { flex: 1; color: var(--text); }
.reminder-note { font-size: 10px; color: var(--muted); }
.reminder-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.reminder-del:hover { color: var(--danger); }

/* ━━ EMOJI PICKER ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.emoji-picker {
  position: fixed; z-index: 999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  display: none; width: 260px;
}
.emoji-picker.open { display: block; }
.emoji-search { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-family: 'DM Mono', monospace; font-size: 12px; padding: 6px 9px; border-radius: 5px; outline: none; margin-bottom: 8px; }
.emoji-search:focus { border-color: var(--accent); }
.emoji-category { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 6px 0 3px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 2px; max-height: 180px; overflow-y: auto; }
.emoji-btn { width: 30px; height: 30px; border: none; background: transparent; font-size: 18px; cursor: pointer; border-radius: 5px; display: flex; align-items: center; justify-content: center; transition: background .08s; }
.emoji-btn:hover { background: var(--surface2); }

/* ━━ COLLAB CURSORS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.collab-cursor {
  display: inline-block; width: 2px; height: 1.2em;
  margin: 0 1px; vertical-align: text-bottom;
  animation: cursorBlink .9s steps(1) infinite;
  position: relative;
}
.collab-cursor-label {
  position: absolute; top: -22px; left: 0; white-space: nowrap;
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  font-family: 'DM Mono', monospace; pointer-events: none;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

/* ━━ MOBILE TOOLBAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.mob-toolbar {
  display: none; position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 40px; padding: 6px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  gap: 4px; align-items: center; z-index: 100;
}
.mob-toolbar .tb { width: 36px; height: 36px; font-size: 16px; border-radius: 50%; }

/* dark/light auto badge */
.auto-theme-badge { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: 4px; }

/* collab presence strip */
.presence-strip { display: flex; align-items: center; gap: -6px; flex-shrink: 0; }
.presence-avatar { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--bg); font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; margin-left: -6px; color: #0d1117; flex-shrink: 0; }
.presence-avatar:first-child { margin-left: 0; }

/* status bar word-selection count */
#stsel { color: var(--accent2); font-size: 11px; display: none; }

@media (max-width: 768px) {
  .toolbar-left { gap: 0; padding: 0 4px; }
  .tgrp { display: none; }
  .tgrp.mob-show { display: flex; }
  .tsep { display: none; }
  .mob-toolbar { display: flex; }
  .tright .pill { padding: 4px 8px; font-size: 11px; }
  header { padding: 0 8px; gap: 6px; }
  .logo { font-size: 17px; }
  #editor { padding: 20px 16px; }
  .sidebar { width: 0; }
  .auth-btns .btn-login { display: none; }
}

/* ━━ FIND BAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.fbar { position:absolute; bottom:12px; right:16px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:10px 12px; z-index:50; display:none; flex-direction:column; gap:7px; min-width:280px; box-shadow:0 4px 20px rgba(0,0,0,.4); }
.fbar.open { display:flex; }
.frow { display:flex; align-items:center; gap:6px; }
.fin { flex:1; background:var(--bg); border:1px solid var(--border); color:var(--text); font-family:'DM Mono',monospace; font-size:12px; padding:5px 8px; border-radius:5px; outline:none; }
.fin:focus { border-color:var(--accent); }
.fmc { font-size:11px; color:var(--muted); white-space:nowrap; min-width:60px; }
.fbtn { background:var(--surface2); border:1px solid var(--border); color:var(--text); font-family:'DM Mono',monospace; font-size:11px; padding:4px 8px; border-radius:4px; cursor:pointer; transition:all .1s; }
.fbtn:hover { border-color:var(--accent); color:var(--accent); }
.fopts { display:flex; gap:6px; }
.fopt { font-size:11px; color:var(--muted); padding:3px 7px; border:1px solid var(--border); border-radius:4px; cursor:pointer; transition:all .1s; }
.fopt.on { border-color:var(--accent); color:var(--accent); }

/* ━━ TOAST / MISC ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.toast { position:fixed; bottom:36px; left:50%; transform:translateX(-50%) translateY(10px); background:var(--surface2); border:1px solid var(--border); color:var(--text); padding:8px 18px; border-radius:30px; font-size:12px; opacity:0; transition:all .22s; pointer-events:none; z-index:200; white-space:nowrap; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.toast.ok { border-color:var(--success); color:var(--success); }
.toast.warn { border-color:var(--accent); color:var(--accent); }
.charlmt { position:absolute; bottom:10px; right:20px; font-size:11px; color:var(--muted); pointer-events:none; }
.charlmt.near { color:var(--accent); }
.charlmt.over { color:var(--danger); }
.welcome { position:absolute; top:50%; left:50%; transform:translate(-50%,-60%); text-align:center; pointer-events:none; transition:opacity .3s; }
.welcome.gone { opacity:0; }
.wt { font-family:'Playfair Display',serif; font-style:italic; font-size:28px; color:var(--accent); opacity:.4; margin-bottom:6px; }
.ws { font-size:13px; color:var(--muted); opacity:.5; margin-bottom:20px; }
.wh { font-size:11px; color:var(--muted); opacity:.4; display:flex; flex-direction:column; gap:5px; }
kbd { background:var(--surface); border:1px solid var(--border); border-radius:3px; padding:1px 5px; font-family:'DM Mono',monospace; font-size:10px; }
.focbar { position:fixed; bottom:0; left:0; right:0; height:3px; background:linear-gradient(90deg,var(--accent2),var(--accent),var(--accent3)); display:none; z-index:500; }

/* ━━ INSERT IMAGE MODAL ━━ */
.img-tabs { display:flex; gap:0; margin-bottom:14px; border:1px solid var(--border); border-radius:6px; overflow:hidden; }
.img-tab { flex:1; padding:7px; text-align:center; font-size:12px; color:var(--muted); cursor:pointer; background:transparent; border:none; font-family:'DM Mono',monospace; }
.img-tab.on { background:var(--accent); color:#0f0e0c; }

/* ━━ RESPONSIVE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 900px) {
  .pill { padding: 4px 8px; font-size: 11px; }
  .tsel { max-width: 80px; font-size: 10px; }
}
@media (max-width: 650px) {
  .sidebar { width: 0; }
  .logo { font-size: 17px; }
  #editor { padding: 24px 20px; }
  .tb { width: 28px; height: 28px; font-size: 12px; }
}

/* ━━ ADMIN DASHBOARD ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.admin-stat-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; text-align: center;
  transition: all .15s;
}
.admin-stat-card:hover {
  border-color: var(--accent); background: rgba(88,166,255,.05);
}
.admin-stat-value {
  font-size: 32px; font-weight: 600; color: var(--accent);
  margin-bottom: 4px; font-family: 'DM Mono', monospace;
}
.admin-stat-label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}

.admin-toolbar {
  display: flex; gap: 10px; margin-bottom: 16px;
  align-items: center; flex-wrap: wrap;
}
.admin-search {
  flex: 1; min-width: 200px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 12px; padding: 8px 12px; border-radius: 6px;
  outline: none;
}
.admin-search:focus { border-color: var(--accent); }
.admin-filter {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 12px; padding: 8px 12px; border-radius: 6px;
  outline: none; cursor: pointer;
}
.admin-filter:focus { border-color: var(--accent); }

.admin-table-wrap {
  max-height: 500px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg);
}
.admin-table-wrap::-webkit-scrollbar { width: 6px; }
.admin-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.admin-table thead {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 2px solid var(--border);
}
.admin-table th {
  padding: 12px 14px; text-align: left;
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
  font-weight: 600;
}
.admin-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.admin-table tbody tr {
  transition: background .1s;
}
.admin-table tbody tr:hover {
  background: rgba(255,255,255,.03);
}
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-user-name {
  font-weight: 500; color: var(--text); margin-bottom: 2px;
}
.admin-user-email {
  font-size: 11px; color: var(--muted);
}
.admin-role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px; font-size: 10px;
  font-weight: 500;
}
.admin-role-badge.admin {
  background: rgba(88,166,255,.15); color: var(--accent);
  border: 1px solid rgba(88,166,255,.3);
}
.admin-role-badge.user {
  background: rgba(139,148,158,.15); color: var(--muted);
  border: 1px solid rgba(139,148,158,.3);
}
.admin-actions {
  display: flex; gap: 6px; align-items: center;
}
.admin-action-btn {
  padding: 4px 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  border-radius: 4px; cursor: pointer;
  font-size: 11px; font-family: 'DM Mono', monospace;
  transition: all .1s;
}
.admin-action-btn:hover {
  border-color: var(--accent); color: var(--accent);
}
.admin-action-btn.danger:hover {
  border-color: var(--danger); color: var(--danger);
}

@media (max-width: 768px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-table-wrap { overflow-x: auto; }
  .admin-table { min-width: 600px; }
}

/* Admin Tabs */
.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
  overflow-x: auto; flex-wrap: wrap;
}
.admin-tab {
  padding: 8px 16px; border: none; background: transparent;
  color: var(--muted); font-size: 12px; font-family: 'DM Mono', monospace;
  cursor: pointer; border-radius: 6px; transition: all .12s;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.admin-tab.on {
  background: var(--surface2); color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.admin-tab-content { animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Admin Quick Actions */
.admin-quick-actions {
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Bulk Actions */
.admin-bulk-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}

/* Admin Charts */
.admin-charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px; margin-top: 16px;
}
.admin-chart-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px;
}
.admin-chart-card canvas {
  max-width: 100%; height: auto;
}

/* User Status Badges */
.admin-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px; font-size: 10px;
  font-weight: 500;
}
.admin-status-badge.active {
  background: rgba(63,185,80,.15); color: var(--success);
  border: 1px solid rgba(63,185,80,.3);
}
.admin-status-badge.suspended {
  background: rgba(248,81,73,.15); color: var(--danger);
  border: 1px solid rgba(248,81,73,.3);
}
.admin-status-badge.banned {
  background: rgba(139,148,158,.15); color: var(--muted);
  border: 1px solid rgba(139,148,158,.3);
}
.admin-status-badge.inactive {
  background: rgba(139,148,158,.1); color: var(--muted);
  border: 1px solid rgba(139,148,158,.2);
}

/* Last Active */
.admin-last-active {
  font-size: 11px; color: var(--muted);
}
.admin-last-active.recent { color: var(--success); }
.admin-last-active.old { color: var(--danger); }

/* Communication */
.admin-communication {
  max-width: 600px;
}
.announcement-item {
  padding: 12px; border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 8px;
  background: var(--bg);
}
.announcement-item-header {
  display: flex; justify-content: space-between;
  margin-bottom: 6px; font-size: 12px;
}
.announcement-item-subject {
  font-weight: 500; color: var(--text);
}
.announcement-item-date {
  color: var(--muted); font-size: 11px;
}
.announcement-item-message {
  color: var(--muted); font-size: 12px;
  margin-top: 4px;
}

/* ━━ ADMIN DASHBOARD FULL SCREEN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.admin-dashboard-fullscreen {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg); display: flex; flex-direction: column;
  overflow: hidden;
}
.admin-dashboard-container {
  display: flex; flex-direction: column; height: 100vh;
  overflow: hidden;
}
.admin-dashboard-header {
  height: 60px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.admin-back-btn {
  width: 36px; height: 36px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.admin-back-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(88,166,255,.1);
}
.admin-dashboard-body {
  flex: 1; overflow-y: auto; padding: 20px;
  background: var(--bg);
}
.admin-dashboard-body::-webkit-scrollbar { width: 8px; }
.admin-dashboard-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Hide main app when dashboard is shown */
body.admin-dashboard-active header,
body.admin-dashboard-active .toolbar,
body.admin-dashboard-active .main,
body.admin-dashboard-active .sbar {
  display: none !important;
}
body.admin-dashboard-active {
  overflow: hidden;
}
