:root { color-scheme: light; }
html, body { height: 100%; }
body {
  font-family: system-ui, Segoe UI, Arial;
  margin: 0;
  padding: 16px;
  background:#fafafa;
  color:#111;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.topPanel {
  position: relative;
  z-index: 30;
  background: #fafafa;
  padding-top: 2px;
  flex: 0 0 auto;
}

.pageHeader { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:10px; }
.pageHeader h1 { margin:0; font-size:20px; line-height:1.2; }
.pageHeader .sub { font-size:12px; opacity:.75; margin-top:2px; }
.pageHeaderRight { display:flex; align-items:center; justify-content:flex-end; gap:10px; }
.topHelpBtn {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.topHelpBtn:hover { background: #f8f8f8; }
.loadedFile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size:12px;
  margin-top:6px;
  padding: 4px 8px;
  border: 1px solid #b9c8de;
  border-radius: 8px;
  background: #e4e4e4;
  color: #1f3b63;
}
.loadedFile strong { font-size: 12.5px; color: #142847; }

.toolbar {
  display:flex; gap:8px; align-items:stretch; flex-wrap:wrap; margin-bottom:10px;
  padding:10px; border:1px solid #ddd; border-radius:12px; background:#fff;
}
.toolbarGroup {
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  padding:6px;
  border:1px solid #b6b6b6;
  border-radius:10px;
  background:#ececec;
}
.toolbarGroup.right { margin-left:auto; }
button, label.btn {
  padding:8px 12px; cursor:pointer; border:1px solid #ccc; border-radius:10px;
  background:#fff; font-size:13px;
}
.toolbar button, .toolbar label.btn, .toolbar .opt {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.toolbar label.btn { display:inline-flex; }
button:hover, label.btn:hover { background:#f8f8f8; }
label.btn input { display:none; }
.status { font-size:13px; opacity:.95; white-space:nowrap; }
.hidden { display: none !important; }

.deleteTools {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f8f8f8;
}
.toolbar button.warn { border-color: #e0b877; background: #fff8eb; }
.toolbar button.danger { border-color: #d89d9d; background: #fff2f2; }

.progressWrap {
  display:none; align-items:center; gap:10px;
  margin:0 0 10px; padding:8px 10px; border:1px solid #ddd; border-radius:10px; background:#fff;
}
progress { width:min(360px, 75vw); height:12px; }
#progressText { font-size:12px; opacity:.85; }

.hint { font-size: 12px; opacity: .75; margin: 8px 0 12px; }

.pageWindowBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #d8dde5;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}
.pageWindowSummary {
  font-size: 13px;
  color: #223650;
  font-weight: 600;
}
.pageWindowControls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pageSizeLabel {
  font-size: 12px;
  color: #4f5e73;
}
.pageWindowControls select {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #c6cfdb;
  border-radius: 10px;
  background: #fff;
}
.pageWindowPage {
  min-width: 88px;
  text-align: center;
  font-size: 12px;
  color: #45556d;
}

.opt {
  display:flex; gap:8px; align-items:center; padding:6px 10px;
  border:1px solid #ccc; border-radius:10px; background:#fff;
}
.opt input { transform: scale(1.05); margin:0; }
.opt label { font-size:13px; cursor:pointer; }

.gridWrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
}

table { border-collapse: collapse; width: max-content; min-width: 100%; }
th, td { border: 1px solid #ddd; padding: 4px; vertical-align: top; min-width: 77px; }
th { position: sticky; top: 0; background: #f3f3f3; z-index: 5; text-align:left; }
th.rowSelectCol, td.rowSelectCol { min-width: 36px; width: 36px; text-align: center; padding: 4px 2px; }
.rowSelectChk { width: 16px; height: 16px; cursor: pointer; }
th .h { display:flex; align-items:center; justify-content:space-between; gap:8px; }
th .label { font-weight:600; }
th .h-actions { display:flex; gap:4px; align-items:center; }
th .i {
  font-size: 16px;
  line-height: 1;
  opacity: .6;
  cursor: pointer;
}
th .fill-btn {
  margin:0; padding:2px 6px; border:1px solid #ccc; border-radius:8px;
  background:#fff; cursor:pointer; font-size:12px; line-height:1;
}
th .fill-btn:hover { background:#f8f8f8; }

td input,
td select {
  width: 100%; box-sizing: border-box; padding: 5px;
  border: 1px solid #ccc; border-radius: 8px;
  transition: background-color .12s ease;
  text-align: left;
  background: #fff;
}
td input.ta-right,
td select.ta-right { text-align: right; font-variant-numeric: tabular-nums; }
td input.ta-center,
td select.ta-center { text-align: center; font-variant-numeric: tabular-nums; }
td input.invalid,
td select.invalid { border-color: #c00; outline: 2px solid rgba(204,0,0,.15); }
td input.warn,
td select.warn {
  border-color: #d3a315;
  outline: 2px solid rgba(211,163,21,.18);
  background: #fff8dc;
}

td input.dup {
  border-color: rgba(0,0,0,.25);
  outline: 2px solid rgba(0,0,0,.06);
}

/* kis “vágás történt” jelzés */
td input.trimmed {
  box-shadow: inset 0 -2px 0 rgba(255,165,0,.8);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 16px;
  box-sizing: border-box;
}
.modal.hidden { display: none; }
.modalCard {
  width: min(560px, 96vw);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 14px;
  box-sizing: border-box;
}
.modalTitle { margin: 0 0 8px; font-size: 18px; }
.modalText { margin: 0 0 10px; font-size: 13px; opacity: .9; }
.modalList { margin: 0 0 10px 18px; padding: 0; font-size: 13px; }
.modalActions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; }
.modalActions .grow { margin-right: auto; }
.radioList { display: grid; gap: 8px; margin-top: 6px; }
.radioList label { display:flex; gap:8px; align-items:flex-start; font-size:13px; cursor:pointer; }
.modalKeys {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
  font-size: 12px;
  opacity: .85;
}
.wizardBox {
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  background: #fafafa;
  padding: 10px;
  margin-top: 6px;
}
.wizardStepTitle { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.wizardStepBody { margin: 0; font-size: 13px; line-height: 1.45; }
.wizardCounter { font-size: 12px; opacity: .85; align-self: center; }
.errorPreviewSummary { margin: 0 0 8px; font-size: 13px; opacity: .95; }
.errorPreview {
  margin: 0;
  padding: 10px;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(40vh, 360px);
  overflow: auto;
}

@media (max-width: 900px) {
  .pageWindowBar {
    align-items: stretch;
  }

  .pageWindowControls {
    width: 100%;
  }

  .pageWindowControls button,
  .pageWindowControls select {
    flex: 1 1 auto;
  }

  .pageWindowPage {
    min-width: 0;
    flex: 1 0 100%;
    order: 10;
  }
}
