/* Online notepad */
[hidden] { display: none !important; } /* the hidden attribute wins over display rules below */
.np-app { --ed-bg: #0b0b0f; --ed-text: #e9e9ef; --ed-muted: #8b90a0; --ed-line: #262833; --ed-panel: #121319; --hl: rgba(149, 214, 0, .28); --hl-cur: rgba(255, 180, 84, .75);
  --ed-font: ui-monospace, "SF Mono", Menlo, Consolas, "Cascadia Mono", monospace; --ed-size: 15px;
  position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr); color-scheme: dark; border: 1px solid var(--ed-line); border-radius: 14px; background: var(--ed-panel); color: var(--ed-text); }
.np-app.light { color-scheme: light; --ed-bg: #ffffff; --ed-text: #16171c; --ed-muted: #5f6475; --ed-line: #d9dbe3; --ed-panel: #f3f4f7; --hl: rgba(110, 160, 0, .25); --hl-cur: rgba(255, 160, 40, .6); }
.np-app.sans { --ed-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.np-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--ed-line); }
.np-b, .np-menu > summary { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--ed-text); font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; list-style: none; }
.np-menu > summary::-webkit-details-marker { display: none; }
.np-menu > summary::after { content: "▾"; margin-left: 6px; color: var(--ed-muted); font-size: 11px; }
.np-b:hover, .np-menu > summary:hover, .np-menu[open] > summary { background: var(--ed-bg); border-color: var(--ed-line); }
.np-b[aria-expanded="true"] { color: #95d600; }
.np-app.light .np-b[aria-expanded="true"] { color: #4f7a00; }
.np-menu { position: relative; }
.np-pop { position: absolute; z-index: 20; top: 40px; left: 0; min-width: 230px; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--ed-line); border-radius: 10px;
  background: var(--ed-panel); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.np-pop > button { text-align: left; background: transparent; border: 0; color: var(--ed-text); padding: 9px 10px; border-radius: 6px; font: 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; min-height: 36px; }
.np-pop > button:hover, .np-pop > button:focus-visible { background: var(--ed-bg); color: #95d600; outline: none; }
.np-view { gap: 8px; padding: 10px; }
.np-vrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.np-view .seg button { color: var(--ed-muted); }
.np-view .check { color: var(--ed-text); }

.np-tabrow { display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px 0; border-bottom: 1px solid var(--ed-line); min-width: 0; }
.np-tabs { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.np-tab { display: inline-flex; align-items: center; gap: 2px; max-width: 220px; height: 36px; padding: 0 4px 0 12px; border: 1px solid var(--ed-line); border-bottom: 0;
  border-radius: 8px 8px 0 0; background: transparent; color: var(--ed-muted); font: 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; flex: 0 0 auto; }
.np-tab[aria-selected="true"] { background: var(--ed-bg); color: var(--ed-text); font-weight: 600; }
.np-tab .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-tab .c { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--ed-muted); font-size: 16px; cursor: pointer; line-height: 1; }
.np-tab .c:hover { color: #ff6b6b; background: var(--ed-panel); }
.np-tab input { width: 140px; font: inherit; background: var(--ed-panel); color: var(--ed-text); border: 1px solid #95d600; border-radius: 4px; padding: 2px 4px; }
.np-tabnew { flex: 0 0 auto; width: 36px; height: 34px; margin-bottom: 1px; border: 0; border-radius: 8px; background: transparent; color: var(--ed-muted); font-size: 20px; cursor: pointer; }
.np-tabnew:hover { color: #95d600; background: var(--ed-bg); }

.np-main { position: relative; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.np-app.noside .np-main { grid-template-columns: minmax(0, 1fr); }
.np-app.noside .np-side { display: none; }
.np-side { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 8px; padding: 10px; border-right: 1px solid var(--ed-line); min-height: 0; max-height: min(78vh, 900px); }
.np-side .in { background: var(--ed-bg); color: var(--ed-text); border-color: var(--ed-line); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.np-list { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; display: grid; align-content: start; gap: 2px; }
.np-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 8px; }
.np-item.on { background: var(--ed-bg); }
.np-item > .open { text-align: left; background: transparent; border: 0; color: var(--ed-text); padding: 7px 8px; cursor: pointer; min-width: 0; font: 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; border-radius: 8px; }
.np-item .ti { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-item .sn { display: block; color: var(--ed-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-item .sn mark { background: var(--hl); color: inherit; border-radius: 2px; }
.np-item .acts { display: flex; gap: 2px; padding-right: 4px; }
.np-item .acts button { display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--ed-muted); font-size: 12px; padding: 6px; border-radius: 6px; cursor: pointer; min-height: 30px; }
.np-item .acts button:hover { color: var(--ed-text); background: var(--ed-panel); }
.np-item .acts button.del:hover { color: #ff6b6b; }
.np-empty { color: var(--ed-muted); font-size: 12px; padding: 6px 8px; }
.np-trashbtn { justify-self: start; background: transparent; border: 0; color: var(--ed-muted); font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; padding: 6px 4px; }
.np-trashbtn:hover { color: var(--ed-text); }
#trashBox { display: grid; gap: 6px; max-height: 240px; overflow: auto; }

.np-edit { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.np-find { display: grid; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--ed-line); background: var(--ed-panel); }
.np-frow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.np-frow .in { flex: 1 1 180px; width: auto; background: var(--ed-bg); color: var(--ed-text); border-color: var(--ed-line); }
.np-frow .in.bad { border-color: #ff6b6b; }
.np-fcount { font-size: 12px; color: var(--ed-muted); min-width: 64px; text-align: right; }
.np-fopts .check { font-size: 12px; color: var(--ed-text); }
.np-find .btn.ghost { color: var(--ed-text); border-color: var(--ed-line); }

.np-field { position: relative; min-height: 0; height: min(70vh, 820px); background: var(--ed-bg); }
.np-ed, .np-back { position: absolute; inset: 0; margin: 0; padding: 14px 16px; border: 0; font-family: var(--ed-font); font-size: var(--ed-size); line-height: 1.55; letter-spacing: normal;
  tab-size: 4; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; overflow-y: scroll; overflow-x: hidden; }
.np-app.nowrap .np-ed, .np-app.nowrap .np-back { white-space: pre; overflow-wrap: normal; overflow-x: scroll; }
.np-ed { width: 100%; height: 100%; resize: none; background: transparent; color: var(--ed-text); caret-color: #95d600; outline: none; }
.np-app.light .np-ed { caret-color: #4f7a00; }
.np-ed::placeholder { color: var(--ed-muted); }
.np-ed::selection { background: rgba(145, 71, 255, .45); }
.np-back { color: transparent; pointer-events: none; }
.np-back mark { color: transparent; background: var(--hl); border-radius: 2px; }
.np-back mark.cur { background: var(--hl-cur); }
.np-status { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--ed-line); font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ed-muted); min-height: 32px; }
.np-status .warn { color: #ffb454; }
.np-sbtn { margin-left: auto; background: transparent; border: 0; color: var(--ed-muted); font: inherit; cursor: pointer; padding: 4px 0; text-decoration: underline dotted; }
.np-sbtn.warn { color: #ffb454; }

.np-tip { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #4a3b1f; border-radius: 10px; font-size: 13px; color: var(--text); }
.np-tip span { flex: 1 1 240px; }

.np-dlg { width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); padding: 16px 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.np-dlg::backdrop { background: rgba(0, 0, 0, .6); }
.np-dlg.np-small { width: min(380px, calc(100vw - 24px)); }
.np-dlg h2 { margin: 0; font-size: 16px; }
.np-dhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.np-dlg .btn { font-family: inherit; }
.np-hist { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; min-height: 340px; }
.np-hist .np-list { max-height: 60vh; }
.np-hist .np-item > .open { color: var(--text); }
.np-hist .np-item .sn { color: var(--muted); }
.np-hist .np-item.on { background: var(--panel-2); outline: 1px solid var(--accent-dim); }
.np-vprev { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; min-width: 0; }
.np-vtext { min-height: 260px; height: 100%; resize: vertical; font-size: 13px; white-space: pre-wrap; }
.np-brow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.np-keys { border-collapse: collapse; font-size: 13px; width: 100%; }
.np-keys td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.np-keys td:first-child { white-space: nowrap; color: var(--accent); font-family: ui-monospace, Consolas, monospace; }

.np-print { display: none; }
.np-unfocus { position: absolute; top: 8px; right: 8px; z-index: 30; }

/* Focus mode: only the text */
body.np-focusing { overflow: hidden; }
body.np-focusing .np-app { position: fixed; inset: 0; z-index: 40; border-radius: 0; border: 0; grid-template-rows: minmax(0, 1fr); }
body.np-focusing .np-bar, body.np-focusing .np-tabrow, body.np-focusing .np-side, body.np-focusing .np-status { display: none; }
body.np-focusing .np-main { grid-template-columns: minmax(0, 1fr); }
body.np-focusing .np-field { height: 100vh; }
body.np-focusing .np-ed, body.np-focusing .np-back { padding: 6vh max(16px, calc((100vw - 760px) / 2)); }

@media (max-width: 760px) {
  .np-bar { gap: 2px; padding: 6px; }
  .np-b, .np-menu > summary { padding: 0 8px; }
  .np-menu > summary::after { margin-left: 3px; }
  .np-main { grid-template-columns: minmax(0, 1fr); }
  .np-side { position: absolute; z-index: 25; inset: 0; background: var(--ed-panel); border-right: 0; max-height: none; }
  .np-app:not(.sideopen) .np-side { display: none; }
  .np-field { height: 62vh; }
  .np-hist { grid-template-columns: minmax(0, 1fr); }
  .np-hist .np-list { max-height: 30vh; }
  .np-pop { position: fixed; left: 12px; right: 12px; top: auto; }
}

@media print {
  body { background: #fff !important; }
  body > *:not(.np-print) { display: none !important; }
  .np-print { display: block; white-space: pre-wrap; overflow-wrap: break-word; color: #000; font: 11pt/1.45 ui-monospace, Consolas, "Courier New", monospace; }
  .np-print.sans { font-family: system-ui, Arial, sans-serif; }
}
