*{box-sizing:border-box}:root{color-scheme:dark;--bg:#07111f;--panel:#0e1c2f;--panel2:#13243a;--line:#29415f;--text:#eef6ff;--muted:#9fb3c8;--blue:#35bdf5;--green:#34d399;--amber:#fbbf24;--red:#fb7185}body{margin:0;background:radial-gradient(circle at 85% 0,rgba(53,189,245,.12),transparent 30rem),var(--bg);color:var(--text);font:15px system-ui,Segoe UI,sans-serif}button,input,textarea,select{font:inherit}button{cursor:pointer;border:1px solid var(--line);border-radius:9px;background:#20344d;color:var(--text);padding:9px 12px;font-weight:700}button:hover{filter:brightness(1.12)}button:disabled{opacity:.4}.blue{background:var(--blue);color:#082338}.green{background:#183d39;color:#8af0c8}.amber{background:#42371a;color:#ffda70}.red{background:#482431;color:#ffacb9}header,main{width:calc(100% - 20px);margin:0 10px}header{display:flex;justify-content:space-between;padding:28px 0 18px}small{color:var(--blue);font-weight:800;letter-spacing:.15em}h1{margin:5px 0}#status{border:1px solid var(--line);border-radius:99px;color:var(--muted);padding:8px 12px;height:max-content}.tabbar,.issuebar{display:flex;align-items:flex-end;border:1px solid var(--line);border-bottom:0;background:#081524;padding:6px 8px 0;overflow:hidden}.tabbar{border-radius:14px 14px 0 0}.issuebar{background:#0b192a}#customerTabs,#issueTabs{display:flex;gap:3px;overflow:auto;max-width:calc(100% - 80px)}.tabwrap{position:relative;display:flex;min-width:135px;max-width:220px;background:#102139;border-radius:10px 10px 0 0}.tabwrap.active{background:var(--panel2);border:1px solid var(--line);border-bottom:0}.tab{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;background:transparent;border:0;padding-right:34px}.close-tab{position:absolute;right:4px;top:6px;border:0;background:transparent;padding:3px 7px}.close-tab:disabled{display:none}#addCustomer,#addIssue{border:0;background:transparent;margin-bottom:4px}.toolbar{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:7px;position:sticky;top:4px;z-index:10;background:#07111fe8;border:1px solid var(--line);border-radius:0 0 14px 14px;padding:8px;backdrop-filter:blur(10px)}#recentCount{background:#081524;border-radius:99px;padding:2px 6px}#summary{color:var(--muted)}#workspace{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:10px;align-items:start}#fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.card{border:1px solid var(--line);border-radius:12px;background:var(--panel);overflow:hidden}.card-head{display:flex;justify-content:space-between;align-items:center;gap:6px;background:var(--panel2);padding:6px 8px}.card h2{color:#9adfff;font-size:15px;margin:0}.card-actions{display:flex;gap:4px}.card-actions button{padding:4px 7px;font-size:12px}.note{width:calc(100% - 16px);margin:6px 8px 8px;border:1px solid #324c6a;border-radius:9px;background:#081524;color:var(--text);padding:8px 10px;resize:vertical}.collapsed .note{display:none}.field-size-very-small textarea.note{height:42px;min-height:42px}.field-size-very-small input.note{height:32px}.field-size-small textarea.note{min-height:82px}.field-size-medium textarea.note{min-height:145px}.field-size-large textarea.note{min-height:260px}@media(min-width:751px){.field-size-large{grid-column:1/-1}}#notepad{position:sticky;top:64px;border:1px solid var(--line);border-radius:12px;background:var(--panel);overflow:hidden}.notepad-head{display:flex;justify-content:space-between;align-items:center;background:var(--panel2);padding:8px}.notepad-head h2{font-size:15px;margin:0;color:#9adfff}#freeform{display:block;width:calc(100% - 16px);min-height:520px;margin:8px;border:1px solid #324c6a;border-radius:9px;background:#081524;color:var(--text);padding:10px;resize:vertical}.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:16px}.front{z-index:180}.hidden{display:none!important}.shade{position:absolute;inset:0;background:#000b}.dialog{position:relative;width:min(470px,100%);background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:18px;box-shadow:0 20px 60px #0008}.settings-dialog,.recent-dialog{width:min(900px,100%);max-height:85vh;overflow:auto}.dialog-head,.settings-actions,.form-actions{display:flex;justify-content:space-between;gap:8px}.dialog-head h2{margin:4px 0}.dialog-head>button{border:0;border-radius:50%}.dialog label{display:block;color:var(--muted);font-weight:700}.dialog input[type=text],.dialog input:not([type]){width:100%;margin-top:7px;padding:10px;border:1px solid var(--line);border-radius:8px;background:#081524;color:var(--text)}fieldset{margin:14px 0;border:1px solid var(--line)}.toggle{margin:12px 0;padding:10px;border:1px solid var(--line);border-radius:9px}.settings-actions{margin-top:15px}.settings-actions>div{display:flex;flex-wrap:wrap;gap:7px}.setting-row{display:grid;grid-template-columns:minmax(0,1fr) 120px 175px 105px auto;gap:7px;margin:7px 0;padding:8px;border:1px solid var(--line);border-radius:9px}.setting-row input,.setting-row select{min-width:0;border:1px solid var(--line);border-radius:7px;background:#081524;color:var(--text);padding:8px}.row-actions{display:flex;gap:4px}.recent-item{border:1px solid var(--line);border-radius:11px;padding:11px;margin:8px 0;background:#0a1828}.recent-item h3{margin:0}.recent-meta{color:var(--muted);font-size:12px;margin:4px 0}.recent-preview{white-space:pre-wrap;max-height:100px;overflow:hidden}.recent-actions{display:flex;gap:6px;margin-top:8px}#toast{position:fixed;right:15px;bottom:15px;z-index:250;background:#122840;border:1px solid var(--line);border-radius:9px;padding:10px 13px;opacity:0;transform:translateY(10px);transition:.2s;pointer-events:none}.show{opacity:1!important;transform:none!important}@media(max-width:1050px){#workspace{grid-template-columns:1fr}#notepad{position:static}#freeform{min-height:180px}.setting-row{grid-template-columns:1fr 1fr}.row-actions{grid-column:1/-1}}@media(max-width:750px){#fields{grid-template-columns:1fr}.toolbar button{flex:1}.setting-row{grid-template-columns:1fr}.row-actions{grid-column:auto}.settings-actions{flex-direction:column}}

/* Compact layout update */
header { min-height: 46px; padding: 8px 0; align-items: center; }
header h1 { margin: 0; font-size: 20px; line-height: 1.2; }
#status { padding: 5px 10px; font-size: 12px; }
.toolbar { flex-wrap: nowrap; gap: 4px; padding: 5px 7px; overflow-x: auto; }
.toolbar button { flex: 0 0 auto; padding: 6px 9px; font-size: 13px; white-space: nowrap; }
#workspace { grid-template-columns: minmax(0,1fr) var(--notepad-width,240px); gap: 8px; }
#fields { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.card-head { min-height: 28px; padding: 3px 6px; gap: 4px; }
.card h2 { font-size: 13px; line-height: 1.15; }
.card-actions { gap: 3px; }
.card-actions button { min-width: 24px; min-height: 24px; padding: 2px 5px; font-size: 11px; }
.card-actions .collapse-icon { width: 24px; padding: 0; font-size: 17px; line-height: 1; }
.note { margin: 3px 6px 6px; width: calc(100% - 12px); padding: 6px 8px; }
:root[data-notepad-width="very-narrow"] { --notepad-width: 200px; }
:root[data-notepad-width="narrow"] { --notepad-width: 240px; }
:root[data-notepad-width="standard"] { --notepad-width: 320px; }
:root[data-notepad-width="wide"] { --notepad-width: 420px; }
.notepad-settings { display: grid; grid-template-columns: 1fr 220px; gap: 10px; align-items: end; margin: 12px 0; }
.notepad-settings .toggle { margin: 0; }
.notepad-settings select { width: 100%; margin-top: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #081524; color: var(--text); }
@media (max-width: 1150px) { #fields { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 900px) { #workspace { grid-template-columns: 1fr; } #notepad { position: static; } }
@media (max-width: 650px) { #fields { grid-template-columns: 1fr; } .toolbar { flex-wrap: wrap; } .notepad-settings { grid-template-columns: 1fr; } }

/* Fixed desktop ratio: 60% regular fields, 40% freeform notes. */
#workspace {
  grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr);
}
.notepad-settings {
  grid-template-columns: 1fr;
}
.setting-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 900px) {
  #workspace { grid-template-columns: 1fr; }
}

/* Notepad++ inspired editor theme */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f4f4f4;
  --line: #c9c9c9;
  --text: #111111;
  --muted: #555555;
  --blue: #dfe4ff;
  --green: #edf7ed;
  --amber: #fff7dd;
  --red: #fff0f0;
}
html, body, button, input, textarea, select {
  font-family: Consolas, "Courier New", monospace;
}
body {
  background: #ffffff;
  color: #111111;
  font-size: 15px;
}
header {
  display: none;
}
main {
  width: 100%;
  margin: 0;
  padding: 6px 0 20px;
}
.tabbar, .issuebar {
  min-height: 27px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #d5d5d5;
  background: #ffffff;
  align-items: stretch;
}
.tabbar {
  background: #f3f4ff;
}
#customerTabs, #issueTabs {
  max-width: calc(100% - 60px);
  gap: 0;
}
.tabwrap, .tabwrap.active {
  min-width: 115px;
  max-width: 220px;
  border: 0;
  border-right: 1px solid #d5d5d5;
  border-radius: 0;
  background: transparent;
}
.tabwrap.active {
  background: #dfe3ff;
  box-shadow: inset 0 -2px 0 #8e9cff;
}
.issuewrap.active {
  background: #eeeeee;
  box-shadow: inset 0 -2px 0 #999999;
}
.tab, #addCustomer, #addIssue {
  min-height: 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111111;
  padding: 3px 28px 3px 5px;
  font-weight: 400;
}
#addCustomer, #addIssue {
  padding: 3px 9px;
  margin: 0;
}
.close-tab {
  top: 2px;
  right: 2px;
  padding: 2px 5px;
  border: 0;
  background: transparent;
  color: #666666;
}
.toolbar {
  position: static;
  justify-content: center;
  flex-wrap: nowrap;
  min-height: 32px;
  overflow-x: auto;
  padding: 3px 5px;
  gap: 0;
  border: 0;
  border-bottom: 1px solid #d5d5d5;
  border-radius: 0;
  background: #ffffff;
  backdrop-filter: none;
}
.toolbar button {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #111111 !important;
  padding: 4px 11px;
  font-size: 15px;
  font-weight: 400;
}
.toolbar button:not(:last-child)::after {
  content: "|";
  position: absolute;
  right: -2px;
  color: #777777;
}
.toolbar button:hover, #addCustomer:hover, #addIssue:hover, .tab:hover {
  background: #e8e8e8 !important;
}
#recentCount {
  background: transparent;
  padding: 0;
}
#summary {
  margin: 22px 5px 16px;
  color: #111111;
}
#workspace {
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 0;
}
#fields {
  padding: 0 10px 0 5px;
  gap: 7px 10px;
  border-right: 1px dotted #aaaaaa;
}
.card {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}
.card-head {
  min-height: 22px;
  padding: 0;
  background: #ffffff;
}
.card h2 {
  font-size: 15px;
  line-height: 1.15;
  font-weight: 400;
}
.card-actions {
  gap: 2px;
}
.card-actions button {
  min-width: auto;
  min-height: 20px;
  padding: 1px 5px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #333333 !important;
  font-size: 11px;
  font-weight: 400;
}
.card-actions button:hover {
  background: #e8e8e8 !important;
}
.card-actions .collapse-icon {
  width: 20px;
  font-size: 14px;
}
.note {
  width: 100%;
  margin: 2px 0 0;
  padding: 4px 5px;
  border: 1px solid #d2d2d2;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  outline: none;
}
.note:focus, #freeform:focus {
  border-color: #7a8cff;
  box-shadow: inset 0 0 0 1px #7a8cff;
}
#notepad {
  position: sticky;
  top: 0;
  margin: 0 5px 0 10px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}
.notepad-head {
  min-height: 22px;
  padding: 0;
  background: #ffffff;
}
.notepad-head h2 {
  color: #0000ff;
  font-size: 15px;
  font-weight: 400;
}
.notepad-head button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111111;
  padding: 2px 5px;
  font-weight: 400;
}
#freeform {
  width: 100%;
  min-height: 570px;
  margin: 2px 0 0;
  padding: 5px;
  border: 1px solid #d2d2d2;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  outline: none;
}
.modal .dialog {
  background: #ffffff;
  color: #111111;
  border-color: #aaaaaa;
  border-radius: 2px;
}
.setting-row input, .setting-row select, .dialog input[type=text], .dialog input:not([type]), .notepad-settings select {
  background: #ffffff;
  color: #111111;
}
.setting-row {
  grid-template-columns: minmax(0,1fr) 120px 120px 105px 48px auto;
}
.setting-row input[type="color"] {
  width: 42px;
  min-height: 36px;
  padding: 2px;
}
@media (max-width: 1050px) {
  .setting-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  #workspace { grid-template-columns: 1fr; }
  #fields { border-right: 0; }
  #notepad { position: static; margin-top: 16px; }
}

/* Complete Notepad++ styling for Recent Notes, Settings, and Add Field dialogs */
.modal .shade {
  background: rgba(0, 0, 0, .28);
}
.modal .dialog,
.settings-dialog,
.recent-dialog {
  width: min(940px, calc(100vw - 28px));
  max-height: 88vh;
  padding: 10px;
  border: 1px solid #8e8e8e;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .12);
  font-family: Consolas, "Courier New", monospace;
}
#fieldModal .dialog {
  width: min(480px, calc(100vw - 28px));
}
.dialog-head {
  align-items: center;
  margin: -10px -10px 10px;
  padding: 5px 7px;
  border-bottom: 1px solid #bcbcbc;
  background: #f0f0f0;
}
.dialog-head small {
  color: #555555;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
}
.dialog-head h2 {
  margin: 0;
  color: #111111;
  font-size: 15px;
  font-weight: 400;
}
.dialog-head > button {
  width: 25px;
  height: 23px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #222222;
  font-size: 18px;
  font-weight: 400;
}
.dialog-head > button:hover {
  border-color: #b7b7b7;
  background: #e2e2e2;
}
.dialog p {
  color: #444444;
}
.dialog label,
.dialog legend {
  color: #111111;
  font-weight: 400;
}
.dialog fieldset {
  border: 1px dotted #999999;
  border-radius: 0;
}
.dialog input[type="text"],
.dialog input:not([type]),
.dialog select {
  border: 1px solid #bcbcbc;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  outline: none;
}
.dialog input:focus,
.dialog select:focus {
  border-color: #7a8cff;
  box-shadow: inset 0 0 0 1px #7a8cff;
}
.notepad-settings,
.toggle {
  margin: 6px 0 10px;
  padding: 5px 0 9px;
  border: 0;
  border-bottom: 1px dotted #999999;
  border-radius: 0;
}
#settingsList {
  border-top: 1px dotted #aaaaaa;
}
.setting-row {
  margin: 0;
  padding: 5px 2px;
  border: 0;
  border-bottom: 1px dotted #c7c7c7;
  border-radius: 0;
  background: #ffffff;
}
.setting-row:hover,
.setting-row:focus-within {
  background: #f1f2ff;
}
.setting-row input,
.setting-row select {
  min-height: 29px;
  padding: 4px 5px;
  border: 1px solid #bcbcbc;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
}
.setting-row input[type="color"] {
  width: 42px;
  min-height: 29px;
  padding: 1px;
}
.row-actions,
.recent-actions,
.settings-actions,
.form-actions {
  gap: 0;
}
.row-actions button,
.recent-actions button,
.settings-actions button,
.form-actions button,
#clearRecent {
  position: relative;
  min-height: 27px;
  padding: 3px 8px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #111111 !important;
  font-weight: 400;
}
.row-actions button:hover,
.recent-actions button:hover,
.settings-actions button:hover,
.form-actions button:hover,
#clearRecent:hover {
  background: #e8e8e8 !important;
}
.row-actions button:not(:last-child)::after,
.recent-actions button:not(:last-child)::after,
.settings-actions > div button:not(:last-of-type)::after,
.form-actions button:not(:last-child)::after {
  content: "|";
  position: absolute;
  right: -2px;
  color: #888888;
}
.row-actions .red,
.recent-actions .red,
.settings-actions .red,
.form-actions .red,
#clearRecent {
  color: #8b0000 !important;
}
.settings-actions {
  align-items: center;
  margin: 10px -2px -2px;
  padding-top: 7px;
  border-top: 1px dotted #999999;
}
.settings-actions > div {
  gap: 0;
}
.settings-save-group {
  gap: 0;
}
.recent-dialog > p {
  margin: 3px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #999999;
}
#recentList {
  border-top: 1px solid #c8c8c8;
}
.recent-item {
  margin: 0;
  padding: 7px 5px;
  border: 0;
  border-bottom: 1px dotted #bdbdbd;
  border-radius: 0;
  background: #ffffff;
}
.recent-item:hover,
.recent-item:focus-within {
  background: #f1f2ff;
}
.recent-item h3 {
  color: #000080;
  font-size: 15px;
  font-weight: 400;
}
.recent-meta {
  margin: 2px 0 5px;
  color: #666666;
  font-size: 11px;
}
.recent-preview {
  max-height: 64px;
  overflow: hidden;
  padding: 3px 5px;
  border-left: 2px solid #d5d5d5;
  background: #fafafa;
  color: #222222;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}
.recent-actions {
  margin-top: 3px;
}
.recent-dialog > .form-actions {
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px dotted #999999;
}
#toast {
  border: 1px solid #888888;
  border-radius: 0;
  background: #ffffe1;
  color: #111111;
  box-shadow: 2px 2px 0 rgba(0,0,0,.12);
  font-family: Consolas, "Courier New", monospace;
}
@media (max-width: 700px) {
  .modal .dialog { padding: 8px; }
  .dialog-head { margin: -8px -8px 8px; }
  .settings-actions { flex-direction: column; align-items: stretch; }
}


/* Configurable field widths in the three-column editor grid. */
.card.field-width-one { grid-column: span 1; }
.card.field-width-two { grid-column: span 2; }
.card.field-width-full { grid-column: 1 / -1; }

/* Width is independent from height. Large height no longer forces full width. */
@media (min-width: 751px) {
  .card.field-size-large { grid-column: auto; }
  .card.field-size-large.field-width-one { grid-column: span 1; }
  .card.field-size-large.field-width-two { grid-column: span 2; }
  .card.field-size-large.field-width-full { grid-column: 1 / -1; }
}

/* Settings row now contains both Height and Width controls. */
.setting-row {
  grid-template-columns: minmax(0,1fr) 112px 112px 130px 108px 48px auto;
}
@media (max-width: 1200px) {
  .setting-row { grid-template-columns: 1fr 1fr 1fr; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 700px) {
  .setting-row { grid-template-columns: 1fr; }
  .row-actions { grid-column: auto; }
}

/* Prevent two-column width from overflowing when the field grid has two columns. */
@media (max-width: 1150px) and (min-width: 651px) {
  .card.field-width-two,
  .card.field-width-full { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .card.field-width-one,
  .card.field-width-two,
  .card.field-width-full { grid-column: 1 / -1; }
}


/* Equal workspace split and stronger active tab indicators. */
#workspace {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Customer tabs: lavender family. */
.tabbar {
  background: #f2f1ff;
}
#customerTabs .tabwrap {
  background: #ebeaff;
  color: #24205f;
}
#customerTabs .tabwrap:hover {
  background: #dfddff;
}
#customerTabs .tabwrap.active {
  position: relative;
  background: #c9c7ff;
  color: #17134f;
  box-shadow: inset 0 -3px 0 #4d46d8;
}
#customerTabs .tabwrap.active .tab {
  color: #17134f;
  font-weight: 700;
}
#customerTabs .tabwrap.active::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #4d46d8;
}
#customerTabs .tabwrap.active .tab {
  padding-left: 16px;
}

/* Issue tabs: cyan/green family, visually separate from customers. */
.issuebar {
  background: #f2fbf9;
}
#issueTabs .tabwrap {
  background: #e5f5f2;
  color: #164b45;
}
#issueTabs .tabwrap:hover {
  background: #d3eee9;
}
#issueTabs .tabwrap.active {
  position: relative;
  background: #bde8df;
  color: #0c403a;
  box-shadow: inset 0 -3px 0 #15947f;
}
#issueTabs .tabwrap.active .tab {
  color: #0c403a;
  font-weight: 700;
}
#issueTabs .tabwrap.active::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #15947f;
}
#issueTabs .tabwrap.active .tab {
  padding-left: 16px;
}

@media (max-width: 900px) {
  #workspace { grid-template-columns: 1fr; }
}


/* Theme selector */
.notepad-settings { grid-template-columns: 1fr 180px; }
.theme-setting select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 6px;
  border: 1px solid #bcbcbc;
  border-radius: 0;
  background: #fff;
  color: #111;
}
.setting-note { grid-column: 1 / -1; }

/* Dark Notepad++ palette */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e1e1e;
  --panel: #202020;
  --panel2: #252526;
  --line: #454545;
  --text: #d4d4d4;
  --muted: #969696;
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] main,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .card-head,
:root[data-theme="dark"] #notepad,
:root[data-theme="dark"] .notepad-head {
  background: #1e1e1e;
  color: #d4d4d4;
}
:root[data-theme="dark"] .tabbar { background: #181818; }
:root[data-theme="dark"] .issuebar { background: #1b1b1b; }
:root[data-theme="dark"] #customerTabs .tabwrap { background: #29263d; color: #d8d2ff; }
:root[data-theme="dark"] #customerTabs .tabwrap:hover { background: #332f4e; }
:root[data-theme="dark"] #customerTabs .tabwrap.active { background: #39345f; box-shadow: inset 0 -3px 0 #9b8cff; }
:root[data-theme="dark"] #customerTabs .tabwrap.active .tab { color: #f0edff; }
:root[data-theme="dark"] #customerTabs .tabwrap.active::before { background: #9b8cff; }
:root[data-theme="dark"] #issueTabs .tabwrap { background: #1d3430; color: #b7ddd5; }
:root[data-theme="dark"] #issueTabs .tabwrap:hover { background: #24413b; }
:root[data-theme="dark"] #issueTabs .tabwrap.active { background: #21443f; box-shadow: inset 0 -3px 0 #4ec9b0; }
:root[data-theme="dark"] #issueTabs .tabwrap.active .tab { color: #d8fff7; }
:root[data-theme="dark"] #issueTabs .tabwrap.active::before { background: #4ec9b0; }
:root[data-theme="dark"] .tab,
:root[data-theme="dark"] #addCustomer,
:root[data-theme="dark"] #addIssue,
:root[data-theme="dark"] .close-tab,
:root[data-theme="dark"] .toolbar button,
:root[data-theme="dark"] .notepad-head button {
  color: #d4d4d4 !important;
}
:root[data-theme="dark"] .toolbar { background: #1e1e1e; border-color: #454545; }
:root[data-theme="dark"] .toolbar button:hover,
:root[data-theme="dark"] #addCustomer:hover,
:root[data-theme="dark"] #addIssue:hover,
:root[data-theme="dark"] .tab:hover,
:root[data-theme="dark"] .card-actions button:hover,
:root[data-theme="dark"] .row-actions button:hover,
:root[data-theme="dark"] .recent-actions button:hover,
:root[data-theme="dark"] .settings-actions button:hover,
:root[data-theme="dark"] .form-actions button:hover {
  background: #333333 !important;
}
:root[data-theme="dark"] #summary,
:root[data-theme="dark"] .setting-note,
:root[data-theme="dark"] .recent-meta,
:root[data-theme="dark"] .dialog p { color: #969696; }
:root[data-theme="dark"] .note,
:root[data-theme="dark"] #freeform {
  border-color: #454545;
  background: #202020;
  color: #d4d4d4;
  caret-color: #ffffff;
}
:root[data-theme="dark"] .note:focus,
:root[data-theme="dark"] #freeform:focus {
  border-color: #569cd6;
  box-shadow: inset 0 0 0 1px #569cd6;
}
:root[data-theme="dark"] #fields { border-right-color: #555555; }
:root[data-theme="dark"] .modal .shade { background: rgba(0,0,0,.62); }
:root[data-theme="dark"] .modal .dialog,
:root[data-theme="dark"] .settings-dialog,
:root[data-theme="dark"] .recent-dialog,
:root[data-theme="dark"] .dialog-head,
:root[data-theme="dark"] .setting-row,
:root[data-theme="dark"] .recent-item {
  border-color: #454545;
  background: #252526;
  color: #d4d4d4;
}
:root[data-theme="dark"] .dialog-head h2,
:root[data-theme="dark"] .dialog label,
:root[data-theme="dark"] .dialog legend,
:root[data-theme="dark"] .dialog-head > button,
:root[data-theme="dark"] .row-actions button,
:root[data-theme="dark"] .recent-actions button,
:root[data-theme="dark"] .settings-actions button,
:root[data-theme="dark"] .form-actions button {
  color: #d4d4d4 !important;
}
:root[data-theme="dark"] .setting-row:hover,
:root[data-theme="dark"] .setting-row:focus-within,
:root[data-theme="dark"] .recent-item:hover,
:root[data-theme="dark"] .recent-item:focus-within { background: #2d2d3d; }
:root[data-theme="dark"] .setting-row input,
:root[data-theme="dark"] .setting-row select,
:root[data-theme="dark"] .dialog input[type="text"],
:root[data-theme="dark"] .dialog input:not([type]),
:root[data-theme="dark"] .dialog select,
:root[data-theme="dark"] .theme-setting select {
  border-color: #454545;
  background: #202020;
  color: #d4d4d4;
}
:root[data-theme="dark"] .recent-preview {
  border-left-color: #555555;
  background: #202020;
  color: #d4d4d4;
}
:root[data-theme="dark"] .recent-item h3 { color: #b4a7ff; }
:root[data-theme="dark"] #toast {
  border-color: #606060;
  background: #2d2d30;
  color: #d4d4d4;
}
:root[data-theme="dark"] .row-actions .red,
:root[data-theme="dark"] .recent-actions .red,
:root[data-theme="dark"] .settings-actions .red,
:root[data-theme="dark"] #clearRecent { color: #f48771 !important; }
@media (max-width: 700px) { .notepad-settings { grid-template-columns: 1fr; } .setting-note { grid-column: auto; } }


/* Per-issue image paste area beneath regular fields */
#regularWorkspace { min-width: 0; }
#imagePasteArea {
  margin: 12px 10px 0 5px;
  padding-top: 6px;
  border-top: 1px dotted #999;
}
.image-area-head { display:flex; align-items:center; justify-content:space-between; min-height:24px; }
.image-area-head h2 { margin:0; color:#800080; font-size:15px; font-weight:400; }
#imageCount { color:#666; font-size:11px; }
#imageEmpty { margin:7px 0; padding:16px 8px; border:1px dashed #bbb; color:#666; text-align:center; }
#imageGrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:7px; }
.image-thumb { min-width:0; border:1px solid #c8c8c8; background:#fff; }
.image-thumb>img { display:block; width:100%; height:100px; object-fit:contain; background:#f6f6f6; cursor:zoom-in; }
.image-thumb>div { display:flex; border-top:1px dotted #bbb; }
.image-thumb button { flex:1; padding:3px 4px; border:0; border-radius:0; background:transparent; color:#111; font:11px Consolas,"Courier New",monospace; }
.image-thumb button:hover { background:#e8e8e8; }
.image-thumb button.red { color:#8b0000; }
.image-preview-dialog { width:min(1000px,calc(100vw - 28px))!important; }
#imagePreview { display:block; max-width:100%; max-height:72vh; margin:auto; object-fit:contain; background:#ddd; }
.notepad-settings { grid-template-columns:1fr 1fr 180px; }
:root[data-theme="dark"] #imagePasteArea { border-top-color:#555; }
:root[data-theme="dark"] .image-area-head h2 { color:#c586c0; }
:root[data-theme="dark"] #imageCount,:root[data-theme="dark"] #imageEmpty { color:#969696; }
:root[data-theme="dark"] #imageEmpty { border-color:#555; }
:root[data-theme="dark"] .image-thumb { border-color:#454545; background:#202020; }
:root[data-theme="dark"] .image-thumb>img { background:#181818; }
:root[data-theme="dark"] .image-thumb>div { border-top-color:#555; }
:root[data-theme="dark"] .image-thumb button { color:#d4d4d4; }
:root[data-theme="dark"] .image-thumb button:hover { background:#333; }
:root[data-theme="dark"] .image-thumb button.red { color:#f48771; }
:root[data-theme="dark"] #imagePreview { background:#181818; }
@media(max-width:700px){.notepad-settings{grid-template-columns:1fr}}

.image-area-actions { display:flex; align-items:center; gap:0; }
.image-area-actions button {
  position:relative;
  padding:2px 7px;
  border:0;
  border-radius:0;
  background:transparent;
  color:#111;
  font:11px Consolas,"Courier New",monospace;
}
.image-area-actions button:not(:last-child)::after {
  content:"|";
  position:absolute;
  right:-2px;
  color:#888;
}
.image-area-actions button:hover { background:#e8e8e8; }
.image-area-actions button.red { color:#8b0000; }
#imageCount { margin-right:5px; }
:root[data-theme="dark"] .image-area-actions button { color:#d4d4d4; }
:root[data-theme="dark"] .image-area-actions button:hover { background:#333; }
:root[data-theme="dark"] .image-area-actions button.red { color:#f48771; }

/* Reusable escalation template builder */
.template-settings { margin-top:14px; padding-top:8px; border-top:1px dotted #999; }
.section-title,.template-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:0; }
.section-title { justify-content:space-between; }
.section-title h3 { margin:0; color:#000080; font-size:15px; font-weight:400; }
.template-toolbar { margin:7px 0; border-bottom:1px dotted #aaa; padding-bottom:7px; }
.template-toolbar label { display:flex; align-items:center; gap:5px; }
.template-toolbar select { min-width:190px; }
.template-toolbar button,.section-title button { border:0;border-radius:0;background:transparent;color:#111;padding:4px 8px;font-weight:400; }
.template-toolbar button:hover,.section-title button:hover { background:#e8e8e8; }
.template-field-row { display:grid; grid-template-columns:minmax(140px,1fr) 120px 90px minmax(150px,1fr) minmax(140px,1fr) auto; gap:6px; padding:5px 2px; border-bottom:1px dotted #c7c7c7; }
.template-field-row:hover,.template-field-row:focus-within { background:#f1f2ff; }
.template-field-row input,.template-field-row select { min-width:0; padding:5px; border:1px solid #bcbcbc; border-radius:0; background:#fff; color:#111; }
.required-check { display:flex!important; align-items:center; gap:4px; white-space:nowrap; }
.escalation-dialog { width:min(760px,calc(100vw - 28px))!important; }
.escalation-dialog>label { display:flex; align-items:center; gap:8px; padding-bottom:8px; border-bottom:1px dotted #999; }
.escalation-dialog select { min-width:240px; }
#escalationForm { display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; margin-top:8px; }
.escalation-row { display:flex!important; flex-direction:column; gap:3px; }
.escalation-row textarea { min-height:80px; resize:vertical; }
.escalation-row input,.escalation-row textarea { width:100%; padding:6px; border:1px solid #bcbcbc; border-radius:0; background:#fff; color:#111; font:14px Consolas,"Courier New",monospace; }
.escalation-missing { margin:8px 0; padding:6px; border:1px solid #c08080; color:#8b0000; background:#fff4f4; }
:root[data-theme="dark"] .section-title h3 { color:#b4a7ff; }
:root[data-theme="dark"] .template-toolbar button,:root[data-theme="dark"] .section-title button { color:#d4d4d4; }
:root[data-theme="dark"] .template-toolbar button:hover,:root[data-theme="dark"] .section-title button:hover { background:#333; }
:root[data-theme="dark"] .template-field-row:hover,:root[data-theme="dark"] .template-field-row:focus-within { background:#2d2d3d; }
:root[data-theme="dark"] .template-field-row input,:root[data-theme="dark"] .template-field-row select,:root[data-theme="dark"] .escalation-row input,:root[data-theme="dark"] .escalation-row textarea { border-color:#454545;background:#202020;color:#d4d4d4; }
:root[data-theme="dark"] .escalation-missing { border-color:#a06060;color:#f48771;background:#322020; }
@media(max-width:1000px){.template-field-row{grid-template-columns:1fr 1fr}.template-field-row .row-actions{grid-column:1/-1}}
@media(max-width:650px){#escalationForm,.template-field-row{grid-template-columns:1fr}.template-field-row .row-actions{grid-column:auto}}

/* Compact escalation list, popup editor, and dropdown option editor */
#templateCompactList { border-top:1px dotted #aaa; }
.template-compact-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:5px 2px; border-bottom:1px dotted #c7c7c7; }
.template-compact-row:hover { background:#f1f2ff; }
.template-compact-info { display:flex; align-items:center; justify-content:space-between; flex:1; min-width:0; border:0; border-radius:0; background:transparent; color:#111; padding:4px 6px; text-align:left; font-weight:400; }
.template-compact-info strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:400; color:#000080; }
.template-compact-info span { flex:0 0 auto; color:#666; font-size:11px; margin-left:12px; }
.template-compact-actions { display:flex; gap:0; }
.template-compact-actions button,.template-editor-toolbar button { border:0; border-radius:0; background:transparent; color:#111; padding:4px 8px; font-weight:400; }
.template-compact-actions button:hover,.template-editor-toolbar button:hover { background:#e8e8e8; }
.template-compact-actions .red { color:#8b0000; }
.template-editor-dialog { width:min(1120px,calc(100vw - 28px))!important; max-height:90vh!important; overflow:auto; }
.template-editor-dialog>label { display:block; margin-bottom:8px; }
.template-editor-dialog>label input { width:100%; }
.template-editor-toolbar { padding:5px 0; border-top:1px dotted #aaa; border-bottom:1px dotted #aaa; }
.dropdown-options-dialog { width:min(560px,calc(100vw - 28px))!important; }
.dropdown-options-dialog textarea { width:100%; min-height:180px; padding:6px; border:1px solid #bbb; border-radius:0; background:#fff; color:#111; font:14px Consolas,"Courier New",monospace; resize:vertical; }
.dropdown-options-dialog select { width:100%; margin-top:5px; }
.setting-row { grid-template-columns:minmax(0,1fr) 108px 68px 105px 125px 105px 48px auto; }
.template-field-row { grid-template-columns:minmax(130px,1fr) 110px 68px 90px minmax(145px,1fr) minmax(130px,1fr) auto; }
.setting-row>button:disabled,.template-field-row>button:disabled { opacity:.35; }
.escalation-row select { width:100%; padding:6px; border:1px solid #bcbcbc; border-radius:0; background:#fff; color:#111; font:14px Consolas,"Courier New",monospace; }
.escalation-dialog .form-actions { flex-wrap:wrap; }
:root[data-theme="dark"] .template-compact-row:hover { background:#2d2d3d; }
:root[data-theme="dark"] .template-compact-info,:root[data-theme="dark"] .template-compact-actions button,:root[data-theme="dark"] .template-editor-toolbar button { color:#d4d4d4; }
:root[data-theme="dark"] .template-compact-info strong { color:#b4a7ff; }
:root[data-theme="dark"] .template-compact-info span { color:#969696; }
:root[data-theme="dark"] .template-compact-actions button:hover,:root[data-theme="dark"] .template-editor-toolbar button:hover { background:#333; }
:root[data-theme="dark"] .template-compact-actions .red { color:#f48771; }
:root[data-theme="dark"] .dropdown-options-dialog textarea,:root[data-theme="dark"] .escalation-row select { background:#202020; color:#d4d4d4; border-color:#454545; }
@media(max-width:1200px){.setting-row,.template-field-row{grid-template-columns:1fr 1fr}.setting-row .row-actions,.template-field-row .row-actions{grid-column:1/-1}}
@media(max-width:650px){.setting-row,.template-field-row{grid-template-columns:1fr}.setting-row .row-actions,.template-field-row .row-actions{grid-column:auto}.template-compact-row{align-items:flex-start}.template-compact-actions{flex-wrap:wrap}}

/* Advanced configuration UI */
.option-set-settings { margin-top:14px; padding-top:8px; border-top:1px dotted #999; }
.option-set-row { display:flex; justify-content:space-between; align-items:center; padding:5px 2px; border-bottom:1px dotted #c7c7c7; }
.option-set-row>div { display:flex; gap:0; }
.option-set-row button { border:0; border-radius:0; background:transparent; color:#111; padding:4px 8px; font-weight:400; }
.option-set-row button:hover { background:#e8e8e8; }
.option-set-row .red { color:#8b0000; }
.template-preview { margin-top:10px; padding-top:7px; border-top:1px dotted #999; }
.template-preview h3 { margin:0 0 5px; font-size:14px; font-weight:400; color:#000080; }
.template-preview pre { max-height:180px; overflow:auto; margin:0; padding:7px; border:1px solid #ccc; background:#fafafa; color:#222; white-space:pre-wrap; font:12px Consolas,"Courier New",monospace; }
.broken-mapping { border-color:#c17d00!important; color:#9a6300!important; }
.undo-bar { position:fixed; left:12px; bottom:12px; z-index:260; display:flex; align-items:center; gap:10px; padding:7px 9px; border:1px solid #888; background:#ffffe1; color:#111; font:13px Consolas,"Courier New",monospace; }
.undo-bar button { border:0; background:transparent; color:#000080; text-decoration:underline; padding:2px 4px; }
:root[data-theme="dark"] .option-set-row button { color:#d4d4d4; }
:root[data-theme="dark"] .option-set-row button:hover { background:#333; }
:root[data-theme="dark"] .option-set-row .red { color:#f48771; }
:root[data-theme="dark"] .template-preview h3 { color:#b4a7ff; }
:root[data-theme="dark"] .template-preview pre { border-color:#454545; background:#202020; color:#d4d4d4; }
:root[data-theme="dark"] .broken-mapping { border-color:#d7ba7d!important; color:#d7ba7d!important; }
:root[data-theme="dark"] .undo-bar { border-color:#666; background:#2d2d30; color:#d4d4d4; }
:root[data-theme="dark"] .undo-bar button { color:#9b8cff; }

/* Compact gear control for dropdown configuration */
.dropdown-gear {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #333 !important;
  font: 16px/1 Consolas, "Courier New", monospace;
}
.dropdown-gear:hover,
.dropdown-gear:focus-visible {
  background: #e8e8e8 !important;
  outline: 1px solid #999;
  outline-offset: -1px;
}
.dropdown-gear::after {
  content: attr(data-option-count);
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 13px;
  height: 13px;
  padding: 0 2px;
  border: 1px solid #aaa;
  background: #fff;
  color: #444;
  font: 9px/11px Consolas, "Courier New", monospace;
  text-align: center;
}
.dropdown-gear.empty-options {
  color: #b06b00 !important;
}
.dropdown-gear.empty-options::after {
  border-color: #c17d00;
  color: #9a6300;
  background: #fff5dc;
}
.dropdown-gear[hidden] { display: none !important; }
:root[data-theme="dark"] .dropdown-gear { color: #d4d4d4 !important; }
:root[data-theme="dark"] .dropdown-gear:hover,
:root[data-theme="dark"] .dropdown-gear:focus-visible { background: #333 !important; outline-color: #777; }
:root[data-theme="dark"] .dropdown-gear::after { border-color: #666; background: #252526; color: #d4d4d4; }
:root[data-theme="dark"] .dropdown-gear.empty-options { color: #d7ba7d !important; }
:root[data-theme="dark"] .dropdown-gear.empty-options::after { border-color: #d7ba7d; background: #332b1c; color: #d7ba7d; }


/* Actions inside the dropdown option-set popup */
.option-set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 5px 0 9px;
  padding-bottom: 7px;
  border-bottom: 1px dotted #aaa;
}
.option-set-actions button {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  padding: 4px 8px;
  font-weight: 400;
}
.option-set-actions button:not(:last-child)::after {
  content: "|";
  position: absolute;
  right: -2px;
  color: #888;
}
.option-set-actions button:hover { background: #e8e8e8; }
:root[data-theme="dark"] .option-set-actions button { color: #d4d4d4; }
:root[data-theme="dark"] .option-set-actions button:hover { background: #333; }


/* Multiline reusable option-set editor */
.option-set-editor-dialog { width:min(620px,calc(100vw - 28px))!important; }
.option-set-editor-dialog>label { display:block; margin:8px 0; }
#optionSetEditorOptions { width:100%; min-height:220px; padding:7px; border:1px solid #bbb; border-radius:0; background:#fff; color:#111; font:14px/1.45 Consolas,"Courier New",monospace; resize:vertical; white-space:pre-wrap; }
#optionSetEditorDefault { width:100%; margin-top:5px; }
.option-set-error { margin:8px 0; padding:6px; border:1px solid #c08080; background:#fff4f4; color:#8b0000; }
:root[data-theme="dark"] #optionSetEditorOptions { border-color:#454545; background:#202020; color:#d4d4d4; }
:root[data-theme="dark"] .option-set-error { border-color:#a06060; background:#322020; color:#f48771; }
