/* ---------- Windows XP Notepad ---------- */
.np-window .window-content.np-root {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0 3px;
  width: auto;
  overflow: hidden;
  background: #ece9d8;
  font: 11px Tahoma, "Segoe UI", sans-serif;
  position: relative;
}

/* Menu bar */
.np-menubar {
  display: flex;
  height: 19px;
  align-items: stretch;
  background: #ece9d8;
  border-bottom: 1px solid #fff;
  box-shadow: 0 1px 0 #aca899 inset;
  user-select: none;
  flex-shrink: 0;
  box-shadow: none;
}
.np-menu-title {
  padding: 0 6px;
  line-height: 19px;
  cursor: default;
  color: #000;
}
.np-menu-title:hover { background: #316ac5; color: #fff; }
.np-menu-title.open { background: #316ac5; color: #fff; }
.np-menubar u, .np-dropdown u, .np-dialog u { text-decoration: underline; }

/* Drop-down menus */
.np-dropdown {
  position: absolute;
  z-index: 10;
  min-width: 150px;
  background: #fff;
  border: 1px solid #aca899;
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.35);
  padding: 2px;
  font: 11px Tahoma, "Segoe UI", sans-serif;
  user-select: none;
}
.np-item {
  display: flex;
  align-items: center;
  height: 17px;
  padding-right: 14px;
  white-space: nowrap;
  cursor: default;
  color: #000;
}
.np-item.hover { background: #316ac5; color: #fff; }
.np-item.disabled { color: #aca899; }
.np-item.disabled.hover { background: #316ac5; color: #aca899; }
.np-check { width: 20px; text-align: center; flex-shrink: 0; }
.np-item.checked .np-check::before { content: "✓"; font-weight: bold; }
.np-label { flex: 1; padding-right: 24px; }
.np-sc { text-align: left; min-width: 40px; }
.np-sep { height: 1px; background: #aca899; margin: 3px 1px; }

/* Editing area */
.np-edit-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  border: 1px solid #7f9db9;
  background: #fff;
}
.np-text {
  flex: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 1px 2px;
  border: none !important;
  outline: none;
  resize: none;
  box-shadow: none !important;
  background: #fff;
  color: #000;
  font-family: "Lucida Console", monospace;
  font-size: 10pt;
  line-height: 1.2;
  white-space: pre;
  overflow: scroll;
  tab-size: 8;
  box-sizing: border-box;
  border-radius: 0;
}
.np-text.np-wrap {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: hidden;
  overflow-y: scroll;
}
.np-text::selection { background: #316ac5; color: #fff; }

/* Status bar */
.np-statusbar {
  display: flex;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  align-items: stretch;
  background: #ece9d8;
  font: 11px Tahoma, sans-serif;
  user-select: none;
  cursor: default;
  border-top: 1px solid #fff;
}
.np-status-main { flex: 1; }
.np-status-pos {
  width: 30%;
  max-width: 180px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  border-left: 1px solid #aca899;
  box-shadow: -1px 0 0 #fff inset;
  padding-left: 2px;
}
.np-grip {
  width: 14px;
  background:
    linear-gradient(135deg, transparent 0 55%, #fff 55% 60%, #aca899 60% 66%, transparent 66% 70%, #fff 70% 75%, #aca899 75% 81%, transparent 81% 85%, #fff 85% 90%, #aca899 90% 96%, transparent 96%);
}

.np-modal-block {
  position: absolute;
  inset: 0;
  z-index: 50;
  cursor: default;
}

/* ---------- Dialogs ---------- */
.np-dialog {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: #ece9d8;
  font: 11px Tahoma, "Segoe UI", sans-serif;
  color: #000;
  padding: 0 0 3px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  box-shadow: inset -1px -1px #00138c, inset 1px 1px #0831d9, inset -2px -2px #001ea0, inset 2px 2px #166aee,
    inset -3px -3px #003bda, inset 3px 3px #0855dd, 2px 3px 8px rgba(0, 0, 0, 0.35);
  user-select: none;
}
.np-dialog .title-bar { cursor: default; }
.np-dialog .title-bar-text { font-weight: bold; }
.np-dialog.np-inactive .title-bar { background: linear-gradient(180deg, #7a96df, #7a96df 8%, #7a96df 40%, #9db9eb 88%, #9db9eb 93%, #8aa4e3); }
.np-dialog-body { padding: 10px 11px 8px; }
.np-dialog-body button { min-width: 75px; min-height: 23px; font: 11px Tahoma, sans-serif; }
.np-dialog input[type="text"], .np-dialog select { font: 11px Tahoma, sans-serif; }
.np-dlg-buttons { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }

/* Message box */
.np-msgbox { min-width: 240px; max-width: 460px; }
.np-msg-row { display: flex; gap: 14px; align-items: flex-start; padding: 4px 6px 10px 2px; }
.np-msg-row img { width: 32px; height: 32px; flex-shrink: 0; }
.np-msg-text { white-space: pre-wrap; padding-top: 2px; line-height: 1.35; min-height: 32px; display: flex; align-items: center; }
.xp-perm { width: 340px; }
.xp-perm .np-msg-text { display: block; white-space: normal; }
.xp-perm ul { margin: 6px 0 8px; padding-left: 18px; }
.xp-perm .xp-perm-app { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.xp-perm .xp-perm-app img { width: 16px; height: 16px; }
.np-msg-buttons { display: flex; justify-content: center; gap: 6px; }

/* Find / Replace */
.np-find-grid { display: flex; gap: 10px; }
.np-find-fields { display: flex; flex-direction: column; gap: 6px; }
.np-row { display: flex; align-items: center; gap: 6px; }
.np-lbl { width: 68px; flex-shrink: 0; }
.np-find .np-what { width: 190px; }
.np-replace .np-what, .np-replace .np-with { width: 160px; }
.np-find-opts { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 6px; }
.np-mc { display: flex; align-items: center; padding-bottom: 4px; }
.np-dir { padding: 4px 8px 6px; margin: 0; display: flex; gap: 10px; align-items: center; }
.np-replace .np-find-opts { margin-top: 18px; }
.np-find-buttons { display: flex; flex-direction: column; gap: 5px; }

/* Go To */
.np-goto .np-dialog-body { width: 220px; }
.np-goto-lbl { display: block; margin-bottom: 4px; }
.np-goto input { width: 100%; box-sizing: border-box; }

/* Font */
.np-font-top { display: flex; gap: 10px; }
.np-font-col { display: flex; flex-direction: column; gap: 2px; }
.np-font-col input { width: 100%; box-sizing: border-box; }
.np-listbox {
  height: 100px;
  overflow-y: scroll;
  background: #fff;
  border: 1px solid #7f9db9;
  outline: none;
}
.np-opt { padding: 0 3px; line-height: 15px; white-space: nowrap; cursor: default; }
.np-opt.sel { background: #316ac5; color: #fff; }
.np-font-btns { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; }
.np-font-bottom { display: flex; gap: 10px; margin-top: 10px; margin-left: 165px; }
.np-sample { margin: 0; padding: 4px 8px 8px; width: 180px; box-sizing: border-box; }
.np-sample-box {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  background: #ece9d8;
}
.np-script { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.np-script select { width: 130px; }
.np-font .np-font-bottom { margin-left: 165px; }

/* Page Setup */
.np-ps { display: flex; gap: 12px; }
.np-ps fieldset { margin: 0 0 8px; padding: 6px 8px 8px; }
.np-ps-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.np-ps-row label { width: 44px; flex-shrink: 0; }
.np-ps-row select { flex: 1; min-width: 180px; }
.np-ps-row.wide input { flex: 1; }
.np-ps-pair { display: flex; gap: 8px; }
.np-ps-orient div { margin: 5px 0; }
.np-ps-mgrid { display: grid; grid-template-columns: auto 40px auto 40px; gap: 5px 6px; align-items: center; }
.np-ps-mgrid input { width: 40px; box-sizing: border-box; }
.np-ps-right { display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.np-ps-preview { width: 130px; height: 130px; display: flex; align-items: center; justify-content: center; }
.np-ps-page { position: relative; background: #fff; border: 1px solid #000; box-shadow: 3px 3px 0 #808080; }
.np-ps-lines {
  position: absolute;
  background: repeating-linear-gradient(#fff 0 2px, #bbb 2px 3px);
}
.np-ps-btns { display: flex; flex-direction: column; gap: 6px; }

/* About */
.np-about .np-dialog-body { padding: 0 0 10px; width: 410px; }
.np-about-banner {
  position: relative;
  height: 72px;
  background: linear-gradient(90deg, #5a7edc, #9db8ee 60%, #d6e1f7);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 10px;
  color: #fff;
  border-bottom: 3px solid #f0a232;
}
.np-about-flag { width: 44px; height: auto; filter: drop-shadow(1px 1px 1px rgba(0,0,0,.35)); }
.np-about-brand { display: flex; flex-direction: column; line-height: 1; font-family: "Franklin Gothic Medium", Arial, sans-serif; }
.np-about-brand small { font-size: 11px; }
.np-about-brand b { font-size: 30px; font-weight: normal; letter-spacing: -0.5px; }
.np-about-brand b span { font-size: 18px; color: #ff8c1a; font-style: italic; vertical-align: super; margin-left: 2px; }
.np-about-copy { position: absolute; right: 12px; bottom: 8px; font-size: 9px; text-align: right; color: #1b3a8a; }
.np-about-main { display: flex; gap: 14px; padding: 16px 18px 0; }
.np-about-main img { width: 32px; height: 32px; }
.np-about-text p { margin: 0 0 10px; line-height: 1.4; user-select: text; }
.np-about-text a { color: #00c; }
.np-about-text hr { border: none; border-top: 1px solid #aca899; border-bottom: 1px solid #fff; margin: 4px 0 10px; }
.np-dlg-buttons.right { padding: 0 14px; }

/* Help */
.np-help .np-dialog-body { padding: 4px; }
.np-help-wrap { display: flex; width: 460px; height: 260px; gap: 4px; }
.np-help-tree { width: 170px; background: #fff; border: 1px solid #7f9db9; padding: 4px; overflow: auto; }
.np-help-book { font-weight: bold; padding: 2px 0 4px; }
.np-help-book::before { content: "📖 "; }
.np-help-topic { padding: 2px 4px 2px 14px; cursor: pointer; color: #000; }
.np-help-topic::before { content: "? "; color: #316ac5; font-weight: bold; }
.np-help-topic:hover { text-decoration: underline; color: #00c; }
.np-help-topic.sel { background: #316ac5; color: #fff; }
.np-help-page { flex: 1; background: #fff; border: 1px solid #7f9db9; padding: 8px 12px; overflow: auto; user-select: text; line-height: 1.45; }
.np-help-page h3 { margin: 0 0 8px; font: bold 13px Verdana, sans-serif; color: #003399; }
.np-help-page p { margin: 0; font: 11px Verdana, Tahoma, sans-serif; }

/* Open */
.np-open .np-dialog-body { width: 470px; }
.np-open-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.np-open-path {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  background: #fff;
  border: 1px solid #7f9db9;
  padding: 0 4px;
}
.np-open-path img { width: 16px; height: 16px; }
.np-open-top .np-up { min-width: 26px; width: 26px; padding: 0; }
.np-open-list {
  height: 190px;
  background: #fff;
  border: 1px solid #7f9db9;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  overflow-x: auto;
  padding: 3px;
  outline: none;
}
.np-open-item { display: flex; align-items: center; gap: 4px; height: 18px; padding: 0 3px; width: 150px; cursor: default; }
.np-open-item img { width: 16px; height: 16px; }
.np-open-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-open-item.sel span { background: #316ac5; color: #fff; }
.np-open-form { display: grid; grid-template-columns: 80px 1fr auto; gap: 6px 8px; align-items: center; margin-top: 10px; }

/* ---------- Save As common dialog ---------- */
.sa-dialog .np-dialog-body { width: 540px; padding: 8px 8px 8px; }
.sa-top { display: flex; align-items: center; gap: 6px; margin: 0 0 6px 92px; }
.sa-top > label { white-space: nowrap; }
.sa-combo {
  position: relative;
  flex: 1;
  height: 21px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px 0 3px;
  background: #fff;
  border: 1px solid #7f9db9;
  cursor: default;
  outline: none;
}
.sa-combo:focus > span { background: #316ac5; color: #fff; padding: 0 2px; }
.sa-combo > img { width: 16px; height: 16px; }
.sa-arrow {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 17px;
  border-radius: 2px;
  background: linear-gradient(#c6d3f7, #b1c6f5 50%, #98b3f1);
  border: 1px solid #b9cbf3;
}
.sa-arrow::after {
  content: ""; position: absolute; left: 4px; top: 6px;
  border: 4px solid transparent; border-top: 5px solid #4d6185; border-bottom: 0;
}
.sa-popup {
  position: absolute;
  left: -1px; right: -1px; top: 100%;
  z-index: 20;
  background: #fff;
  border: 1px solid #000;
  padding: 1px 0;
  max-height: 260px;
  overflow: auto;
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3);
}
.sa-pop-item { display: flex; align-items: center; gap: 4px; height: 18px; white-space: nowrap; cursor: default; }
.sa-pop-item img, .sa-pop-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sa-pop-item:hover, .sa-pop-item.sel:not(:hover) { background: #316ac5; color: #fff; }
.sa-popup:hover .sa-pop-item.sel:not(:hover) { background: none; color: #000; }
.sa-tools { display: flex; gap: 1px; }
.np-dialog-body .sa-tool {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  box-shadow: none;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.np-dialog-body .sa-tool svg { width: 16px; height: 16px; }
.np-dialog-body .sa-back, .np-dialog-body .sa-views { width: 32px; gap: 2px; }
.np-dialog-body .sa-tool:not(:disabled):hover { border-color: #aca899; background: #fff; }
.np-dialog-body .sa-tool:not(:disabled):active { background: #e3e2da; }
.np-dialog-body .sa-tool:disabled svg { filter: grayscale(1); opacity: 0.45; }
.sa-caret { border: 3px solid transparent; border-top: 3px solid #000; border-bottom: 0; }
.sa-tool:disabled .sa-caret { border-top-color: #aca899; }
.sa-views-pop { left: 0; right: auto; width: 110px; border-color: #aca899; text-align: left; }
.sa-views-pop .sa-pop-item { padding: 0 8px 0 4px; }
.sa-dot { width: 14px; display: inline-flex; justify-content: center; }
.sa-pop-item.checked .sa-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.sa-main { display: flex; gap: 6px; }
.sa-places {
  width: 86px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
  background: #7e8dc9;
  background: linear-gradient(90deg, #6f84c8, #8aa0dd);
  border: 1px solid #5a6ea8;
  box-shadow: inset 1px 1px 0 #4d5f99;
}
.sa-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 2px 4px;
  margin: 0 2px;
  color: #fff;
  text-align: center;
  line-height: 1.15;
  border: 1px solid transparent;
  cursor: default;
}
.sa-place img, .sa-place svg { width: 32px; height: 32px; }
.sa-place:hover { border-color: #b8c6f0; background: rgba(255, 255, 255, 0.15); }
.sa-place.sel { border-color: #fff; background: rgba(255, 255, 255, 0.3); }

.sa-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sa-list {
  height: 218px;
  background: #fff;
  border: 1px solid #7f9db9;
  outline: none;
  overflow: auto;
  user-select: none;
}
.sa-list.sa-list {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 2px;
  overflow-x: auto;
  overflow-y: hidden;
}
.sa-list.sa-details { display: block; padding: 0; overflow: auto; }
.sa-item { display: flex; align-items: center; height: 18px; cursor: default; }
.sa-list .sa-item { width: 160px; padding: 0 2px; }
.sa-n { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sa-n img { width: 16px; height: 16px; flex-shrink: 0; }
.sa-n b { font-weight: normal; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-item.sel b { background: #316ac5; color: #fff; }
.sa-list:not(:focus-within) .sa-item.sel b { background: #ece9d8; color: #000; }
.sa-rename { height: 16px; padding: 0 2px; width: 120px; border: 1px solid #000 !important; font: 11px Tahoma, sans-serif; }

.sa-head, .sa-details .sa-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px 100px 110px;
}
.sa-details .sa-item { padding: 0 4px; width: auto; }
.sa-details .sa-item > span:not(.sa-n) { color: #000; padding-left: 6px; white-space: nowrap; overflow: hidden; }
.sa-details .sa-item > span:nth-child(2) { text-align: right; padding-right: 6px; }
.sa-head {
  position: sticky;
  top: 0;
  height: 19px;
  background: linear-gradient(#fff, #ebeadb 90%, #d6d3c2);
  border-bottom: 2px solid #d6d3c2;
  z-index: 1;
}
.sa-head span { padding: 3px 6px; border-right: 1px solid #c7c5b2; white-space: nowrap; }
.sa-head span:nth-child(2) { text-align: right; }

.sa-form {
  display: grid;
  grid-template-columns: 82px 1fr 75px;
  gap: 6px 8px;
  align-items: center;
  margin-top: 8px;
}
.sa-form input, .sa-form select { width: 100%; box-sizing: border-box; }
