:root {
  --bg: #0b0d10;
  --panel: #12161c;
  --panel2: #171c24;
  --line: #2a323d;
  --line2: #202630;
  --text: #eef1f5;
  --muted: #9aa5b3;
  --muted2: #727d8c;
  --accent: #caa45d;
  --danger: #d66a75;
  --ok: #70c28d;
}
* { box-sizing: border-box; }

/* Nomad v0.1.39.77: unified Merchant scrollbar theme. */
html, body, * {
  scrollbar-width: thin;
  scrollbar-color: #566273 #11161d;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #11161d; }
*::-webkit-scrollbar-thumb {
  background: #566273;
  border: 2px solid #11161d;
  border-radius: 999px;
  min-height: 28px;
  min-width: 28px;
}
*::-webkit-scrollbar-thumb:hover { background: #738093; }
*::-webkit-scrollbar-corner { background: #11161d; }
*::-webkit-scrollbar-button { display: none !important; width: 0 !important; height: 0 !important; background: #11161d !important; }
html, body { color-scheme: dark; }
[style*="overflow"], .table-wrap, .preview, .library-list, .data-table-wrap {
  scrollbar-width: thin !important;
  scrollbar-color: #64748b #11161d !important;
  color-scheme: dark !important;
}
[style*="overflow"]::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track, .preview::-webkit-scrollbar-track, .library-list::-webkit-scrollbar-track, .data-table-wrap::-webkit-scrollbar-track {
  background: #11161d !important;
  box-shadow: inset 0 0 0 999px #11161d !important;
}
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button, select, input[type="search"], input[type="url"] {
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #0e1218;
  color: var(--text);
  height: 34px;
}
button {
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
}
button:hover, select:hover, input:focus { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--text); text-decoration: none; }
.app { max-width: 1680px; margin: 0 auto; padding: 14px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
}
h1 { font-size: 18px; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
#rootPath { color: var(--muted); font-size: 12px; margin-top: 3px; }
.status { display: flex; gap: 8px; align-items: center; }
.status span {
  border: 1px solid var(--line);
  background: #0e1218;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
}
.toolbar, .controls, .pathbar, .quick-import {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line2);
  background: var(--panel);
  padding: 10px;
  margin-top: 10px;
}
.toolbar { justify-content: space-between; flex-wrap: wrap; }
.group { display: flex; gap: 6px; flex-wrap: wrap; }
.group.right { margin-left: auto; }
#deleteBtn { color: #ffd6dc; border-color: rgba(214,106,117,.55); }
#importBtn, #quickImportBtn { background: #2a2418; border-color: rgba(202,164,93,.7); color: #f7df9a; }
.pathbar { justify-content: space-between; min-height: 42px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.breadcrumbs button {
  height: 28px;
  padding: 0 8px;
  color: var(--muted);
}
.breadcrumbs button:last-child { color: var(--text); border-color: var(--accent); }
.selection-info { color: var(--muted); font-size: 12px; white-space: nowrap; }
.controls { flex-wrap: wrap; }
.controls input[type="search"] { min-width: 280px; flex: 1; padding: 0 10px; }
.controls select { padding: 0 10px; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; white-space: nowrap; }
.table-shell {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
  min-height: 400px;
}
table { border-collapse: collapse; width: 100%; min-width: 960px; }
th, td {
  border-bottom: 1px solid var(--line2);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #151a22;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--accent); }
tr { cursor: default; }
tbody tr:hover { background: rgba(255,255,255,.035); }
tbody tr.selected { background: rgba(202,164,93,.13); }
.select-col { width: 42px; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 260px; overflow: hidden; }
.icon { flex: 0 0 26px; width: 26px; height: 22px; display: inline-grid; place-items: center; color: var(--accent); font-size: 13px; border: 1px solid rgba(202,164,93,.35); background: rgba(202,164,93,.08); }
.name-cell .file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name { color: var(--text); font-weight: 650; }
.folder-link { cursor: pointer; }
.folder-link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.type-pill {
  display: inline-block;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 6px;
  font-size: 12px;
  min-width: 58px;
  text-align: center;
}
.empty {
  color: var(--muted);
  display: grid;
  place-items: center;
  min-height: 320px;
}
.quick-import { display: grid; grid-template-columns: 150px minmax(220px, 1fr) 120px; }
.quick-title { font-weight: 750; color: var(--muted); }
.quick-import input { padding: 0 10px; width: 100%; }
.dropzone {
  margin-top: 10px;
  border: 1px dashed var(--accent);
  background: rgba(202,164,93,.09);
  color: #f7df9a;
  padding: 18px;
  text-align: center;
  font-weight: 800;
}
.result {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line2);
}
.result h2 { margin: 0; font-size: 16px; }
.result p { color: var(--muted); margin-top: 4px; font-size: 12px; }
.downloads { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.download-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 7px 2px 7px 0; }
.downloads a {
  border: 1px solid var(--line);
  background: #0e1218;
  padding: 7px 10px;
  font-weight: 700;
  font-size: 12px;
}
.warnings {
  color: #ffd1d8;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(214,106,117,.35);
  background: rgba(214,106,117,.08);
}
.batch-stats {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line2);
  flex-wrap: wrap;
}
.batch-stats span { border: 1px solid var(--line); padding: 5px 8px; color: var(--muted); }
.tabs { display: flex; border-bottom: 1px solid var(--line2); padding: 0 12px; gap: 4px; }
.tab { border: 0; border-left: 1px solid var(--line2); border-right: 1px solid var(--line2); border-radius: 0; background: transparent; color: var(--muted); }
.tab.active { color: var(--accent); background: #0e1218; }
.tab-body { display: none; padding: 12px; }
.tab-body.active { display: block; }
.tab-body pre {
  white-space: pre-wrap;
  margin: 0;
  background: #090c11;
  border: 1px solid var(--line2);
  padding: 12px;
  max-height: 520px;
  overflow: auto;
}
.preview-frame, .preview-image, .preview-html {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line2);
  background: #090c11;
}
.preview-image { object-fit: contain; max-height: 620px; }
.preview-html { color: var(--text); padding: 12px; overflow: auto; }
.sheet-block { margin-bottom: 14px; border: 1px solid var(--line2); }
.sheet-block h3 { margin: 0; padding: 8px 10px; font-size: 13px; background: #151a22; }
.sheet-block .table-shell { margin: 0; border: 0; min-height: 0; max-height: 360px; }
.inner { margin: 0; min-height: 0; }
.busy {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  display: grid; place-items: center;
  z-index: 99;
}
.busy[hidden], .toast[hidden], [hidden] { display: none !important; }
.busy > div {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
.busy p { margin-top: 52px; position: absolute; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: #111722;
  border: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--text);
  z-index: 120;
}
@media (max-width: 900px) {
  .app { padding: 8px; }
  .topbar, .toolbar, .controls, .pathbar, .result-head { align-items: stretch; flex-direction: column; }
  .quick-import { grid-template-columns: 1fr; }
  .selection-info { white-space: normal; }
}

/* v3.2 editable canonical schedule grid */
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line2);
  background: #0e1218;
  padding: 10px;
  margin-bottom: 8px;
}
.schedule-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.schedule-actions button { height: 30px; padding: 0 9px; font-size: 12px; }
#scheduleSave { background: #2a2418; border-color: rgba(202,164,93,.7); color: #f7df9a; }
.grid-note { color: var(--muted); font-size: 12px; margin: 8px 0; }
.schedule-grid-wrap {
  border: 1px solid var(--line);
  background: #080b10;
  overflow: auto;
  max-height: 620px;
}
.schedule-grid {
  min-width: 1200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}
.schedule-grid th,
.schedule-grid td {
  padding: 6px 8px;
  border-right: 1px solid var(--line2);
  min-width: 120px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-grid th {
  background: #151a22;
  top: 0;
  z-index: 3;
}
.schedule-grid .row-head {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 58px;
  width: 58px;
  background: #10151d;
  color: var(--muted);
  text-align: right;
}
.schedule-grid tbody .row-head { z-index: 2; }
.schedule-grid td[contenteditable="true"] {
  background: #0b0f15;
  color: var(--text);
  outline: none;
}
.schedule-grid td[contenteditable="true"]:focus {
  background: #131a24;
  box-shadow: inset 0 0 0 1px var(--accent);
  color: #fff;
}
.schedule-grid tr:nth-child(even) td[contenteditable="true"] { background: #0d1219; }
.schedule-grid label { display: inline-flex; align-items: center; gap: 5px; }

/* v3.3 cleaner schedule model workspace */
.schedule-header-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #151a22 0%, #10151c 100%);
  padding: 14px;
  margin-bottom: 10px;
}
.schedule-title-block .eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 4px;
}
.schedule-title-block h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: .01em;
}
.schedule-title-block p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}
.schedule-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 8px;
  min-width: 420px;
}
.schedule-metrics div {
  border: 1px solid var(--line2);
  background: #0b0f15;
  padding: 10px;
}
.schedule-metrics strong {
  display: block;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
}
.schedule-metrics span {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.schedule-toolbar.redesigned {
  margin-bottom: 8px;
  padding: 8px;
  background: #0c1118;
  border-color: var(--line);
}
.schedule-left-actions,
.schedule-right-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.schedule-toolbar.redesigned button {
  height: 31px;
  border-radius: 2px;
  background: #111720;
}
.schedule-toolbar.redesigned #scheduleSave {
  background: #2a2418;
  border-color: rgba(202,164,93,.7);
  color: #f7df9a;
}
.schedule-toolbar.redesigned #scheduleDeleteRows,
.schedule-toolbar.redesigned #scheduleDeleteCols {
  color: #ffd6dc;
  border-color: rgba(214,106,117,.55);
}
.schedule-empty {
  border: 1px solid var(--line2);
  background: #0c1118;
  padding: 18px;
}
.schedule-empty strong { display: block; margin-bottom: 5px; }
.schedule-grid-wrap {
  border: 1px solid var(--line);
  background: #090d12;
  max-height: 640px;
  overflow: auto;
}
.schedule-grid.redesigned-grid {
  min-width: 1100px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}
.schedule-grid.redesigned-grid th,
.schedule-grid.redesigned-grid td {
  padding: 8px 10px;
  border-right: 1px solid #1d2530;
  min-width: 130px;
  max-width: 260px;
  height: 36px;
  vertical-align: middle;
}
.schedule-grid.redesigned-grid th {
  background: #18202a;
  color: #aeb8c6;
  font-size: 11px;
  letter-spacing: .05em;
}
.schedule-grid.redesigned-grid th label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.schedule-grid.redesigned-grid .row-head {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 62px;
  width: 62px;
  background: #121821;
  color: var(--muted);
  text-align: right;
  box-shadow: 1px 0 0 var(--line2);
}
.schedule-grid.redesigned-grid tbody .row-head { z-index: 3; }
.schedule-grid.redesigned-grid tbody tr:nth-child(even) td { background: #0e141c; }
.schedule-grid.redesigned-grid tbody tr:nth-child(odd) td { background: #0b1017; }
.schedule-grid.redesigned-grid tbody tr:hover td,
.schedule-grid.redesigned-grid tbody tr:hover .row-head { background: #151d28; }
.schedule-grid.redesigned-grid td[contenteditable="true"] {
  color: #edf2f7;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-grid.redesigned-grid td[contenteditable="true"]:focus {
  background: #1d2836 !important;
  box-shadow: inset 0 0 0 1px var(--accent);
  white-space: normal;
  min-width: 240px;
  position: relative;
  z-index: 6;
}
.schedule-grid.redesigned-grid td.edited {
  box-shadow: inset 3px 0 0 var(--accent);
}
.schedule-grid.redesigned-grid td[data-col="person_name"],
.schedule-grid.redesigned-grid td[data-col="teacher_name"],
.schedule-grid.redesigned-grid td[data-col="student_name"] {
  font-weight: 750;
  color: #fff;
}
.schedule-grid.redesigned-grid td[data-col="block"],
.schedule-grid.redesigned-grid td[data-col="period_number"],
.schedule-grid.redesigned-grid td[data-col="period_label"] {
  color: #f4d989;
}
.schedule-grid.redesigned-grid td[data-col="assignment"],
.schedule-grid.redesigned-grid td[data-col="subject"],
.schedule-grid.redesigned-grid td[data-col="course_name"] {
  color: #dfe8f5;
}
.schedule-grid.redesigned-grid td[data-col$="json"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #9aa5b3;
  font-size: 11px;
}
@media (max-width: 1100px) {
  .schedule-header-card { grid-template-columns: 1fr; }
  .schedule-metrics { min-width: 0; grid-template-columns: repeat(2, 1fr); }
}

/* v3.4 result workspace + schedule editing refinements */
.secondary-btn {
  border: 1px solid var(--line);
  background: #0e1218;
  color: var(--muted);
  height: 32px;
  padding: 0 10px;
}
.secondary-btn:hover { color: var(--text); border-color: var(--accent); }
.result {
  min-height: 70vh;
}
.result-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel);
}
.schedule-grid.redesigned-grid {
  border-collapse: separate;
  border-spacing: 0;
}
.schedule-grid.redesigned-grid th,
.schedule-grid.redesigned-grid td {
  border-right: 1px solid #334052;
  border-left: 1px solid rgba(255,255,255,.025);
  border-bottom: 1px solid #202936;
}
.schedule-grid.redesigned-grid th:first-child,
.schedule-grid.redesigned-grid td:first-child { border-left: 0; }
.schedule-grid.redesigned-grid td.cell-selected {
  background: #243247 !important;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 9999px rgba(202,164,93,.03) !important;
  color: #fff;
}
.schedule-grid.redesigned-grid tr.row-selected .row-head,
.schedule-grid.redesigned-grid tr.row-selected td {
  background-color: rgba(202,164,93,.11) !important;
}
.schedule-grid.redesigned-grid th.col-selected {
  background: #263142 !important;
  color: #f7df9a;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.schedule-toolbar.redesigned #scheduleUndo,
.schedule-toolbar.redesigned #scheduleRedo {
  border-color: #465466;
  color: #d4dbe6;
}
.schedule-log {
  border: 1px solid var(--line2);
  background: #0b1017;
  margin: 8px 0 10px;
}
.schedule-log summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 750;
  list-style-position: inside;
}
.schedule-log summary span {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent);
}
.schedule-log ul {
  margin: 0;
  padding: 0 10px 8px 28px;
  max-height: 140px;
  overflow: auto;
}
.schedule-log li {
  padding: 3px 0;
  color: #d9e1ec;
}
.schedule-log li span {
  display: inline-block;
  min-width: 68px;
  color: var(--muted2);
  font-size: 12px;
}
.schedule-log p {
  border-top: 1px solid var(--line2);
  padding: 7px 10px;
  color: var(--muted2);
  font-size: 11px;
}

/* v3.5 schedule/data usability refinements */
.sheet-block .table-shell {
  max-height: 58vh;
  overflow: auto;
}
.sheet-block .table-shell table th {
  position: sticky;
  top: 0;
  z-index: 6;
}
.data-view-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-top: 1px solid var(--line2);
  border-bottom: 1px solid var(--line2);
  background: #0b1017;
}
.data-view-bar label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.data-view-bar select {
  height: 30px;
  min-width: 140px;
  border-radius: 2px;
}
.data-view-bar button {
  height: 30px;
  padding: 0 9px;
}
.data-group-summary {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #0d131b;
  border-bottom: 1px solid var(--line2);
}
.data-group-summary strong {
  color: var(--accent);
  margin-right: 4px;
}
.data-group-summary span {
  border: 1px solid var(--line2);
  background: #111820;
  padding: 4px 7px;
  color: var(--muted);
}
.data-group-summary b { color: var(--text); }
.schedule-grid.redesigned-grid th {
  position: sticky;
  top: 0;
  z-index: 8;
}
.schedule-grid.redesigned-grid .row-head {
  min-width: 72px;
  width: 72px;
}
.row-head-inner,
.col-head-inner {
  display: flex;
  align-items: center;
  gap: 6px;
}
.row-head-inner { justify-content: flex-end; }
.col-head-inner { justify-content: space-between; }
.col-head-inner label { min-width: 0; }
.col-head-inner span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-menu,
.col-menu {
  height: 22px;
  min-width: 22px;
  padding: 0 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted2);
  line-height: 1;
}
.row-menu:hover,
.col-menu:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #151a22;
}
.schedule-grid.redesigned-grid tbody tr.row-selected td,
.schedule-grid.redesigned-grid tbody tr.row-selected .row-head {
  background: rgba(202,164,93,.18) !important;
}
.schedule-grid.redesigned-grid tbody tr.row-selected td.cell-selected {
  background: #293952 !important;
}
.schedule-grid.redesigned-grid td.cell-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.schedule-action-menu {
  position: fixed;
  z-index: 10000;
  width: 220px;
  border: 1px solid var(--line);
  background: #0d1219;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding: 4px;
}
.schedule-action-menu button {
  display: block;
  width: 100%;
  height: 32px;
  text-align: left;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}
.schedule-action-menu button:hover {
  background: #1a2330;
  color: var(--accent);
}
.schedule-toolbar.redesigned #scheduleMoveDataset {
  border-color: rgba(202,164,93,.55);
  color: #f7df9a;
}

/* v3.6 cleaner conditional actions and data controls */
.data-view-bar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(170px, .8fr) minmax(170px, .8fr) auto auto;
  gap: 8px;
  align-items: end;
  background: #0c1118;
}
.data-control-group {
  display: grid;
  gap: 4px;
}
.data-control-group span {
  color: var(--muted2);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
}
.data-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  padding-bottom: 8px;
}
.data-group-summary {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: start;
  gap: 10px;
}
.data-group-summary strong { display: block; color: var(--accent); }
.data-group-summary small { display: block; color: var(--muted2); margin-top: 2px; }
.data-summary-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.data-summary-chips span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  max-width: 260px;
}
.data-summary-chips em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-menu,
.col-menu,
.schedule-action-menu { display: none !important; }
.schedule-actions button[disabled] {
  opacity: .42;
  cursor: not-allowed;
  border-color: var(--line2);
  color: var(--muted2);
  background: #0b0f15;
}
.schedule-actions .context-action.action-ready {
  display: inline-flex;
  align-items: center;
  border-color: rgba(202,164,93,.85);
  color: #ffe5a3;
  background: rgba(202,164,93,.12);
  box-shadow: 0 0 0 1px rgba(202,164,93,.2), 0 0 18px rgba(202,164,93,.16);
}
.schedule-actions .danger-action.action-ready {
  border-color: rgba(214,106,117,.85);
  color: #ffd6dc;
  background: rgba(214,106,117,.12);
  box-shadow: 0 0 0 1px rgba(214,106,117,.18), 0 0 18px rgba(214,106,117,.13);
}
.schedule-grid.redesigned-grid tbody tr.row-selected td,
.schedule-grid.redesigned-grid tbody tr.row-selected .row-head {
  background: rgba(202,164,93,.2) !important;
}
.schedule-grid.redesigned-grid tbody tr.row-selected td.cell-selected {
  background: #2e3d55 !important;
}
.schedule-grid.redesigned-grid th.col-selected {
  background: rgba(202,164,93,.18) !important;
  color: #ffe5a3;
}
@media (max-width: 1000px) {
  .data-view-bar { grid-template-columns: 1fr; align-items: stretch; }
  .data-count { padding-bottom: 0; }
  .data-group-summary { grid-template-columns: 1fr; }
}

.crumb-current { border: 1px solid var(--accent); color: var(--text); background: rgba(211,169,83,.12); padding: 7px 10px; font-weight: 800; }

.control-check { display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.control-check span, .row-head-inner span, .col-head-inner span { pointer-events: none; }
.row-head-inner, .col-head-inner { display: inline-flex; align-items: center; gap: 6px; }
.row-head-inner input, .col-head-inner input, .control-check input { cursor: pointer; }

/* v3.9 custom in-app dialog system. No browser-native prompt/confirm UI. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}
.modal-card {
  width: min(440px, calc(100vw - 32px));
  background: #111820;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  padding: 18px;
}
.modal-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: .02em;
}
.modal-card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.4;
}
.modal-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 10px 12px;
  color: var(--text);
  background: #0b1118;
  border: 1px solid var(--border);
  outline: none;
}
.modal-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(214,177,88,.35);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-actions button.primary {
  border-color: var(--gold);
  color: #111;
  background: var(--gold);
}
.modal-actions button.danger {
  border-color: #70343d;
  color: #ffd1d6;
  background: #221016;
}
.modal-actions button.secondary {
  color: var(--muted);
}

/* v3.9 data-sheet workspace and anchored confirmation popovers */
.modal-overlay {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: none;
  align-items: flex-start;
  justify-content: flex-start;
}
.modal-card {
  position: fixed;
  width: min(420px, calc(100vw - 24px));
  transform-origin: top left;
}
.modal-card::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: #111820;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.datasheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  background: #0b1118;
  padding: 10px;
  margin-bottom: 10px;
}
.datasheet-toolbar .left-actions,
.datasheet-toolbar .right-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.datasheet-grid-wrap {
  border: 1px solid var(--border);
  max-height: 56vh;
  overflow: auto;
  background: #0b1017;
}
.datasheet-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.datasheet-grid th,
.datasheet-grid td {
  border-right: 1px solid #253142;
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  min-width: 130px;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.datasheet-grid th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #131a23;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}
.datasheet-grid .row-head {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 58px;
  max-width: 58px;
  background: #111820;
}
.datasheet-grid thead .row-head { z-index: 5; }
.datasheet-grid td[contenteditable="true"] { outline: none; }
.datasheet-grid td[contenteditable="true"]:focus,
.datasheet-grid td.cell-selected {
  background: rgba(214,177,88,.16) !important;
  box-shadow: inset 0 0 0 1px var(--gold);
}
.datasheet-grid tr.row-selected td,
.datasheet-grid tr.row-selected .row-head { background: rgba(214,177,88,.08); }
.datasheet-grid th.col-selected { background: rgba(214,177,88,.18); color: var(--text); }
.datasheet-note { color: var(--muted); font-size: 12px; margin: 8px 0; }
.downloads .ds-download { border-color: rgba(214,177,88,.35); }

/* v4.0 modal placement refinements */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: block;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  position: fixed;
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  left: 50%;
  top: 50%;
  background: #111820;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  padding: 18px;
}
.modal-card.centered::before { display: none; }
.modal-card.anchored::before {
  display: block;
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: #111820;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.modal-extra-fields { display: grid; gap: 10px; margin: 2px 0 14px; }
.modal-extra-fields label { display: grid; gap: 6px; color: var(--text); font-weight: 800; font-size: 12px; }
.modal-extra-fields small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.ds-col-name { cursor: text; }
.ds-col-name:hover { color: var(--gold); }

/* v4.1 single modal engine: fixed overlay/card, no document-flow popups */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 5000 !important;
  display: block !important;
  background: rgba(0,0,0,.48) !important;
  backdrop-filter: blur(3px) !important;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  position: fixed !important;
  width: min(460px, calc(100vw - 28px)) !important;
  max-height: calc(100vh - 28px) !important;
  overflow: auto !important;
  background: #111820 !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.62) !important;
  padding: 18px !important;
  margin: 0 !important;
}
.modal-card.modal-card-centered::before { display: none !important; }
.modal-card.modal-card-anchored::before {
  content: "" !important;
  position: absolute !important;
  top: -7px !important;
  left: 22px !important;
  width: 12px !important;
  height: 12px !important;
  transform: rotate(45deg) !important;
  background: #111820 !important;
  border-left: 1px solid var(--border) !important;
  border-top: 1px solid var(--border) !important;
  display: block !important;
}
.modal-card h3 { margin: 0 0 8px !important; font-size: 15px !important; letter-spacing: .02em !important; }
.modal-card p { margin: 0 0 14px !important; color: var(--muted) !important; line-height: 1.4 !important; }
.modal-extra-fields { display: grid !important; gap: 10px !important; margin: 2px 0 14px !important; }
.modal-extra-fields label { display: grid !important; gap: 6px !important; color: var(--text) !important; font-weight: 800 !important; font-size: 12px !important; }
.modal-extra-fields label span { pointer-events: none; }
.modal-extra-fields small { color: var(--muted) !important; font-weight: 700 !important; margin-left: 0 !important; }
.modal-input { width: 100% !important; box-sizing: border-box !important; margin: 0 0 14px !important; padding: 10px 12px !important; color: var(--text) !important; background: #0b1118 !important; border: 1px solid var(--border) !important; outline: none !important; }
.modal-input:focus { border-color: var(--gold) !important; box-shadow: 0 0 0 1px rgba(214,177,88,.35) !important; }
.modal-actions { display: flex !important; justify-content: flex-end !important; gap: 8px !important; }
.modal-actions button.primary { border-color: var(--gold) !important; color: #111 !important; background: var(--gold) !important; }
.modal-actions button.danger { border-color: #70343d !important; color: #ffd1d6 !important; background: #221016 !important; }
.modal-actions button.secondary { color: var(--muted) !important; }


/* v4.2 authoritative modal system. This intentionally overrides older modal rules. */
#modalOverlay.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9000 !important;
  background: rgba(0,0,0,.52) !important;
  backdrop-filter: blur(3px) !important;
  display: block !important;
}
#modalOverlay.modal-overlay[hidden] { display: none !important; }
#modalOverlay .modal-card {
  position: fixed !important;
  width: min(460px, calc(100vw - 28px)) !important;
  max-height: calc(100vh - 28px) !important;
  overflow: auto !important;
  margin: 0 !important;
  padding: 18px !important;
  background: #111820 !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.62) !important;
}
#modalOverlay .modal-card.modal-card-centered::before { display: none !important; }
#modalOverlay .modal-card.modal-card-anchored::before {
  content: "" !important;
  position: absolute !important;
  top: -7px !important;
  left: 22px !important;
  width: 12px !important;
  height: 12px !important;
  transform: rotate(45deg) !important;
  background: #111820 !important;
  border-left: 1px solid var(--line) !important;
  border-top: 1px solid var(--line) !important;
}
#modalOverlay .modal-card h3 { margin: 0 0 8px !important; font-size: 15px !important; }
#modalOverlay .modal-card p { margin: 0 0 14px !important; color: var(--muted) !important; line-height: 1.4 !important; }
#modalOverlay .modal-input {
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 0 14px !important;
  padding: 10px 12px !important;
  color: var(--text) !important;
  background: #0b1118 !important;
  border: 1px solid var(--line) !important;
  outline: none !important;
}
#modalOverlay .modal-input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 1px rgba(202,164,93,.35) !important; }
#modalOverlay .modal-extra-fields { display: grid !important; gap: 10px !important; margin: 2px 0 14px !important; }
#modalOverlay .modal-extra-fields label { display: grid !important; gap: 6px !important; color: var(--text) !important; font-weight: 800 !important; font-size: 12px !important; }
#modalOverlay .modal-extra-fields small { color: var(--muted) !important; font-weight: 700 !important; }
#modalOverlay .modal-actions { display: flex !important; justify-content: flex-end !important; gap: 8px !important; }
#modalOverlay .modal-actions button.primary { border-color: var(--accent) !important; color: #111 !important; background: var(--accent) !important; }
#modalOverlay .modal-actions button.danger { border-color: #70343d !important; color: #ffd1d6 !important; background: #221016 !important; }
#modalOverlay .modal-actions button.secondary { color: var(--muted) !important; }

/* v4.3 New Data Sheet modal list controls */
#modalOverlay .modal-card { width: min(560px, calc(100vw - 28px)) !important; }
#modalOverlay .modal-field-title {
  color: var(--text) !important;
  font-weight: 900 !important;
  font-size: 12px !important;
  letter-spacing: .03em !important;
}
#modalOverlay .modal-list {
  display: grid !important;
  gap: 7px !important;
  padding: 0 !important;
}
#modalOverlay .modal-list small {
  display: block !important;
  color: var(--muted) !important;
  font-weight: 700 !important;
  margin-top: -2px !important;
}
#modalOverlay .modal-list-items {
  display: grid !important;
  gap: 6px !important;
}
#modalOverlay .modal-list-item,
#modalOverlay .modal-list-add-row {
  display: grid !important;
  grid-template-columns: 1fr 40px !important;
  gap: 6px !important;
  align-items: center !important;
}
#modalOverlay .modal-list-item .modal-input,
#modalOverlay .modal-list-add-row .modal-input {
  margin: 0 !important;
}
#modalOverlay .modal-list-add,
#modalOverlay .modal-list-remove {
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  font-size: 16px !important;
  font-weight: 900 !important;
}
#modalOverlay .modal-list-add {
  border-color: var(--accent) !important;
  color: #111 !important;
  background: var(--accent) !important;
}
#modalOverlay .modal-list-remove {
  border-color: #3b4654 !important;
  color: var(--muted) !important;
  background: transparent !important;
}

/* v4.5 linked data sheet controls */
.link-badge {
  margin-left: 7px;
  padding: 2px 6px;
  border: 1px solid rgba(209, 169, 92, .55);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(209, 169, 92, .08);
}
.row-link { margin-left: 6px; }
.modal-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  margin: 10px 0;
}
.modal-check small { grid-column: 2; color: var(--muted); }
.modal-extra-fields select.modal-input { height: 38px; }
.datasheet-toolbar .check.compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
#dsAddRowFromSource, #dsAddColFromSource {
  border-color: rgba(209,169,92,.38);
}

/* v4.9 searchable source picker */
.source-picker {
  display: grid;
  gap: 12px;
  min-width: min(720px, calc(100vw - 80px));
}
.source-picker-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px;
  gap: 10px;
  align-items: end;
}
.source-search-wrap,
.source-kind-wrap {
  display: grid;
  gap: 6px;
}
.source-search-wrap span,
.source-kind-wrap span {
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.source-picker-local-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  padding: 10px 12px;
}
.source-picker-local-row strong {
  display: block;
  font-size: 13px;
}
.source-picker-local-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}
.source-upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(209,169,92,.72);
  background: rgba(209,169,92,.12);
  color: var(--gold);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.source-upload-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.source-picker-count {
  color: var(--muted);
  font-size: 12px;
}
.source-picker-list {
  display: grid;
  gap: 4px;
  max-height: min(46vh, 500px);
  overflow: auto;
  border: 1px solid var(--line);
  background: #0d1218;
  padding: 6px;
}
.source-picker-item {
  width: 100%;
  border: 1px solid transparent;
  border-bottom-color: #202a36;
  background: #101720;
  color: var(--text);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
  border-radius: 2px;
}
.source-picker-item:hover,
.source-picker-item.active {
  border-color: var(--gold);
  background: rgba(215,176,92,.08);
}
.source-icon {
  display: inline-flex;
  height: 22px;
  min-width: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #344053;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
}
.source-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.source-main strong,
.source-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-main small {
  color: var(--muted);
  font-size: 12px;
}
.source-tags {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.source-tags em {
  font-style: normal;
  border: 1px solid #344053;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.source-picker-empty {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}
@media (max-width: 720px) {
  .source-picker { min-width: 0; }
  .source-picker-tools,
  .source-picker-local-row { grid-template-columns: 1fr; }
  .source-picker-item { grid-template-columns: 34px minmax(0, 1fr); }
  .source-tags { grid-column: 2; justify-content: flex-start; }
}

/* v4.8 data sheet builder polish */
.datasheet-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  padding: 14px;
  margin-bottom: 10px;
}
.datasheet-title-row h3 { margin: 2px 0 4px; font-size: 18px; }
.datasheet-title-row p { margin: 0; color: var(--muted); }
.datasheet-viewbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: #0f151c;
  padding: 8px 10px;
  margin: 8px 0;
}
.datasheet-viewbar span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.datasheet-viewbar select { min-width: 150px; height: 32px; }
.datasheet-grid-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line); }
.datasheet-grid thead th { position: sticky; top: 0; z-index: 5; background: #141b24; }
.datasheet-grid td, .datasheet-grid th { border-right: 1px solid rgba(255,255,255,.065); }
.datasheet-grid tr.row-selected td { background: rgba(71,132,205,.12); }
.datasheet-grid td.cell-selected { outline: 2px solid #5aa1ff; outline-offset: -2px; background: rgba(90,161,255,.13); }
.datasheet-grid td[contenteditable="true"]:focus { outline: 2px solid #d1a95c; outline-offset: -2px; }
.link-badge { display:inline-flex; margin-left:6px; padding:1px 5px; border:1px solid rgba(75,174,125,.5); color:#7ee0a5; font-size:10px; text-transform:uppercase; letter-spacing:.05em; }

/* v5.0 modular lego-piece additions */
.validation-panel{border:1px solid var(--line);background:#0d1218;margin:10px 0 12px;padding:10px 12px}
.validation-summary{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.validation-summary span{border:1px solid #2a3440;background:#121a23;padding:5px 8px;font-weight:700;font-size:12px}
.validation-list{max-height:180px;overflow:auto;border-top:1px solid var(--line);padding-top:6px}
.validation-item{display:grid;grid-template-columns:70px 70px 1fr;gap:8px;padding:5px 0;border-bottom:1px solid rgba(255,255,255,.05);font-size:12px}
.link-status-chip{display:inline-flex;align-items:center;gap:4px;border:1px solid #384858;background:#101923;padding:2px 6px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#b9c4d1;margin-left:6px}
.link-status-chip.broken{border-color:#7a3942;color:#ffc0c8}.link-status-chip.manual{border-color:#605437;color:#f2d687}.link-status-chip.linked{border-color:#446548;color:#b8e3bf}
.change-demo-overlay{position:fixed;inset:0;background:rgba(0,0,0,.58);backdrop-filter:blur(4px);z-index:9500;display:flex;align-items:center;justify-content:center;padding:22px}
.change-demo-card{width:min(980px,calc(100vw - 44px));max-height:min(720px,calc(100vh - 44px));overflow:hidden;background:#111820;border:1px solid #2c3744;box-shadow:0 30px 90px rgba(0,0,0,.66);border-radius:4px}
.change-demo-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line);background:#151d27}.change-demo-head h3{margin:0;font-size:15px}.change-demo-head span{color:var(--muted);font-size:12px}
.change-demo-body{padding:14px 16px;overflow:auto;max-height:560px}.change-demo-step{display:none}.change-demo-step.active{display:block}.change-preview-table{width:100%;border-collapse:collapse;font-size:12px}.change-preview-table th,.change-preview-table td{border:1px solid #2a333e;padding:7px 8px;background:#0f151d}.change-preview-table th{position:sticky;top:0;background:#18212c;text-align:left;color:#b8c2ce;text-transform:uppercase;font-size:10px;letter-spacing:.06em}.change-target{outline:2px solid #d1a95c!important;box-shadow:0 0 0 4px rgba(209,169,92,.22);animation:usiPulse 1s ease-in-out 2}.change-demo-actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid var(--line)}
@keyframes usiPulse{0%{background:#0f151d}50%{background:#322914}100%{background:#0f151d}}
.sped-contract-box{border:1px solid #384858;background:#0d141c;padding:10px 12px;margin:10px 0}.sped-contract-box h4{margin:0 0 6px}.sped-contract-box code{font-size:11px;color:#e4d29f}.hidden-control{display:none!important}.disabled-soft{opacity:.42;pointer-events:none}

/* v5.1 SPED connection manager */
.sped-connections-panel {display:flex; flex-direction:column; gap:12px; min-width:min(880px, 86vw);}
.sped-conn-intro {display:flex; align-items:center; justify-content:space-between; gap:16px; padding:10px 12px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.035);}
.sped-conn-intro strong {font-size:14px; letter-spacing:.02em;}
.sped-conn-intro span {font-size:12px; color:var(--muted);}
.conn-list {display:flex; flex-direction:column; gap:8px; max-height:54vh; overflow:auto; padding-right:2px;}
.conn-row {display:grid; grid-template-columns:1fr auto auto; gap:12px; align-items:center; padding:10px; border:1px solid rgba(255,255,255,.12); background:rgba(8,11,16,.72);}
.conn-main {min-width:0;}
.conn-main strong {font-size:13px;}
.conn-main em {font-style:normal; margin-left:6px; font-size:10px; text-transform:uppercase; color:var(--muted); border:1px solid rgba(255,255,255,.14); padding:2px 5px;}
.conn-main small {display:block; margin-top:4px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:440px;}
.conn-warning {color:#e0b86c !important;}
.conn-meta {display:flex; flex-direction:column; gap:5px; align-items:flex-end; font-size:11px; color:var(--muted); min-width:100px;}
.conn-status {display:inline-flex; align-items:center; justify-content:center; min-width:92px; padding:4px 8px; border:1px solid rgba(255,255,255,.14); font-size:11px; text-transform:uppercase; letter-spacing:.05em;}
.conn-status.connected {border-color:rgba(68,200,130,.45); color:#7ee2aa; background:rgba(68,200,130,.08);}
.conn-status.needs_review {border-color:rgba(224,184,108,.55); color:#e0b86c; background:rgba(224,184,108,.08);}
.conn-status.disconnected {border-color:rgba(255,255,255,.12); color:#9aa1ad; background:rgba(255,255,255,.025);}
.conn-actions {display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:flex-end;}
.conn-actions button {padding:6px 8px; font-size:11px;}
.conn-downloads {display:flex; gap:8px; flex-wrap:wrap; padding-top:2px;}
.conn-downloads a {border:1px solid rgba(255,255,255,.14); padding:6px 9px; text-decoration:none; color:var(--text); background:rgba(255,255,255,.035); font-size:12px;}
.sync-summary {display:grid; gap:8px; font-size:13px;}
.sync-summary code {font-size:11px; color:var(--muted); word-break:break-all;}
@media (max-width: 760px) {.conn-row {grid-template-columns:1fr;} .conn-meta {align-items:flex-start;} .conn-actions {justify-content:flex-start;} .sped-conn-intro {align-items:flex-start; flex-direction:column;}}

/* Nomad/Merchant v0.1.7 iframe polish: make SPED Connections modal easier to read inside Nomad Settings. */
#modalOverlay .modal-card:has(.sped-connections-panel){
  width:min(760px, calc(100vw - 36px)) !important;
  max-height:calc(100vh - 36px) !important;
  padding:0 !important;
  overflow:hidden !important;
  border-radius:10px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) h3{
  padding:16px 18px 4px !important;
  margin:0 !important;
  font-size:18px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) > p{
  padding:0 18px 12px !important;
  margin:0 !important;
  font-size:13px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) #modalExtraFields{
  max-height:calc(100vh - 190px) !important;
  overflow:auto !important;
  padding:0 18px 12px !important;
  margin:0 !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .modal-actions{
  padding:12px 18px !important;
  border-top:1px solid var(--line) !important;
  background:#121923 !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .sped-connections-panel{
  min-width:0 !important;
  gap:10px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .sped-conn-intro{
  border-radius:8px !important;
  align-items:flex-start !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-list{
  max-height:420px !important;
  gap:7px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-row{
  grid-template-columns:minmax(0,1fr) auto !important;
  gap:8px 12px !important;
  border-radius:8px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-main small{
  max-width:100% !important;
  white-space:normal !important;
  line-height:1.3 !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-actions{
  grid-column:1 / -1 !important;
  justify-content:flex-start !important;
  padding-top:4px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-actions button{
  min-height:34px !important;
  border-radius:7px !important;
}
#modalOverlay .modal-card:has(.sped-connections-panel) .conn-status{
  border-radius:999px !important;
  min-width:96px !important;
}
@media(max-width:720px){
  #modalOverlay .modal-card:has(.sped-connections-panel) .conn-row{grid-template-columns:1fr !important;}
  #modalOverlay .modal-card:has(.sped-connections-panel) .conn-meta{align-items:flex-start !important;}
}

/* Nomad theme synchronization v0.1.35.10.1 */
body.nomad-light{
  --bg:#f4f7fb;--panel:#ffffff;--panel2:#f7f9fc;--text:#111827;--muted:#5b6678;--line:#cbd5e1;
  background:#f4f7fb!important;color:#111827!important
}
body.nomad-light .app,body.nomad-light .topbar,body.nomad-light .toolbar,body.nomad-light .pathbar,
body.nomad-light .controls,body.nomad-light .table-wrap,body.nomad-light .quick-import{
  background:#fff!important;color:#111827!important;border-color:#cbd5e1!important
}
body.nomad-light button,body.nomad-light input,body.nomad-light select{
  background:#f8fafc!important;color:#111827!important;border-color:#cbd5e1!important
}
body.nomad-light table,body.nomad-light th,body.nomad-light td{color:#111827!important;border-color:#d7dee8!important}
body.nomad-light th{background:#eef2f7!important}
body.nomad-dark{background:#0b0f14!important}


/* Nomad v0.1.39.77: embedded Connections mode shows only Merchant dialogs. */
body.merchant-connections-only { background: transparent !important; overflow: hidden !important; }
body.merchant-connections-only > header,
body.merchant-connections-only > main,
body.merchant-connections-only > #fileInput,
body.merchant-connections-only > #folderInput { display: none !important; }
body.merchant-connections-only #modalOverlay { position: fixed !important; inset: 0 !important; z-index: 50000 !important; }
body.merchant-connections-only #modalOverlay[hidden] { display: none !important; }


/* Nomad/Merchant v0.1.39.77: forced dark native scrollbars. */
:root{--nomad-scroll-track:#0a101c;--nomad-scroll-thumb:#315f95;--nomad-scroll-hover:#4f8fd8}
html,body{color-scheme:only dark!important;scrollbar-width:thin!important;scrollbar-color:var(--nomad-scroll-thumb) var(--nomad-scroll-track)!important}
html::-webkit-scrollbar,body::-webkit-scrollbar,*::-webkit-scrollbar{width:8px!important;height:8px!important;background:var(--nomad-scroll-track)!important;-webkit-appearance:none!important}
html::-webkit-scrollbar-track,body::-webkit-scrollbar-track,*::-webkit-scrollbar-track,html::-webkit-scrollbar-track-piece,body::-webkit-scrollbar-track-piece,*::-webkit-scrollbar-track-piece{background:var(--nomad-scroll-track)!important;border:0!important;box-shadow:none!important}
html::-webkit-scrollbar-thumb,body::-webkit-scrollbar-thumb,*::-webkit-scrollbar-thumb{background:var(--nomad-scroll-thumb)!important;border:1px solid var(--nomad-scroll-track)!important;background-clip:padding-box!important;border-radius:999px!important;min-width:24px!important;min-height:24px!important}
html::-webkit-scrollbar-thumb:hover,body::-webkit-scrollbar-thumb:hover,*::-webkit-scrollbar-thumb:hover{background:var(--nomad-scroll-hover)!important}
html::-webkit-scrollbar-corner,body::-webkit-scrollbar-corner,*::-webkit-scrollbar-corner{background:var(--nomad-scroll-track)!important}
html::-webkit-scrollbar-button,body::-webkit-scrollbar-button,*::-webkit-scrollbar-button{display:none!important;width:0!important;height:0!important}
