/* PortTester Modern Modbus & Serial Communication Studio Stylesheet */
:root {
  --pt-bg-dark: #070b14;
  --pt-bg-card: #0d1527;
  --pt-bg-card-alt: #111a30;
  --pt-bg-input: #080d19;
  --pt-border: #1e293b;
  --pt-border-glow: #0284c7;
  --pt-text-main: #f8fafc;
  --pt-text-sub: #94a3b8;
  --pt-text-muted: #64748b;
  --pt-blue: #0ea5e9;
  --pt-blue-light: #38bdf8;
  --pt-green: #10b981;
  --pt-yellow: #f59e0b;
  --pt-red: #ef4444;
  --pt-purple: #8b5cf6;
}

.pt-container {
  max-width: 1260px;
  width: min(100% - 32px, 1260px);
  margin: 0 auto;
  padding: 0 0 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--pt-text-main);
  overscroll-behavior-y: auto;
}

/* Sleek Modern Dark Scrollbars for PortTester UI */
.pt-container ::-webkit-scrollbar,
.pt-table-wrap::-webkit-scrollbar,
.pt-log-terminal::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
.pt-container ::-webkit-scrollbar-track,
.pt-table-wrap::-webkit-scrollbar-track,
.pt-log-terminal::-webkit-scrollbar-track {
  background: #090e1c;
}
.pt-container ::-webkit-scrollbar-thumb,
.pt-table-wrap::-webkit-scrollbar-thumb,
.pt-log-terminal::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
.pt-container ::-webkit-scrollbar-thumb:hover,
.pt-table-wrap::-webkit-scrollbar-thumb:hover,
.pt-log-terminal::-webkit-scrollbar-thumb:hover {
  background: #0284c7;
}
.pt-container ::-webkit-scrollbar-button,
.pt-table-wrap::-webkit-scrollbar-button,
.pt-log-terminal::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Header & Status Bar */
.pt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--pt-bg-card);
  border: 1px solid var(--pt-border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.pt-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pt-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0284c7, #0f766e);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
}

.pt-title-box h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pt-title-box h1 span.tag-ver {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.2);
  color: var(--pt-blue-light);
  border: 1px solid rgba(14, 165, 233, 0.4);
}

.pt-title-box p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--pt-text-sub);
}

.pt-header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pt-stat-pill {
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Language Switcher Dropdown (Matching Melsec Monitor) */
.lang-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 3px 8px;
}

.lang-switcher-wrap select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 4px center;
  color: var(--pt-text-main);
  border: none;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding: 2px 20px 2px 4px;
}

.lang-switcher-wrap select option {
  background: var(--pt-bg-card);
  color: var(--pt-text-main);
}

/* Badges */
.pt-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.pt-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pt-badge-offline {
  background: rgba(100, 116, 139, 0.15);
  color: var(--pt-text-sub);
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.pt-badge-offline .pt-badge-dot { background: var(--pt-text-muted); }

.pt-badge-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}
.pt-badge-online .pt-badge-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Connection Toolbar Card */
.pt-conn-card {
  background: var(--pt-bg-card);
  border: 1px solid var(--pt-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.pt-mode-switch {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--pt-border);
  padding-bottom: 12px;
}

.pt-radio-opt, .pt-check-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--pt-text-sub);
}
.pt-radio-opt input[type="radio"]:checked + span,
.pt-check-opt input[type="checkbox"]:checked + span {
  color: var(--pt-blue-light);
}

.pt-conn-subpanel {
  background: #111a30;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 12px 16px;
}

.pt-conn-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pt-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}
.pt-dot.red {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}
.pt-dot.green {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* Tab Navigation */
.pt-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--pt-border);
  margin-bottom: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}

.pt-tab-btn {
  background: transparent;
  border: none;
  color: var(--pt-text-sub);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.pt-tab-btn:hover {
  color: var(--pt-text-main);
  background: rgba(255, 255, 255, 0.04);
}

.pt-tab-btn.active {
  color: var(--pt-blue-light);
  background: var(--pt-bg-card);
  border: 1px solid var(--pt-border);
  border-bottom: 2px solid var(--pt-blue);
  margin-bottom: -2px;
}

.pt-tab-pane {
  display: none;
}
.pt-tab-pane.active {
  display: block;
}

/* Card & Forms */
.pt-card {
  background: var(--pt-bg-card);
  border: 1px solid var(--pt-border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  margin-bottom: 18px;
}

.pt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--pt-border);
  padding-bottom: 10px;
}

.pt-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--pt-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pt-toggle-group {
  display: inline-flex;
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  border-radius: 6px;
  padding: 2px;
}

.pt-radio-mini, .pt-check-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--pt-text-sub);
  padding: 2px 6px;
  cursor: pointer;
}
.pt-radio-mini input:checked + span {
  color: var(--pt-blue-light);
  font-weight: 600;
}

.pt-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--pt-text-sub);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.pt-input, .pt-select, .pt-textarea {
  width: 100%;
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--pt-text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
}

.pt-input:focus, .pt-select:focus, .pt-textarea:focus {
  border-color: var(--pt-blue);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.pt-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Buttons */
.pt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.pt-btn-primary {
  background: #0284c7;
  color: #ffffff;
}
.pt-btn-primary:hover {
  background: #0369a1;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.pt-btn-danger {
  background: #dc2626;
  color: #ffffff;
}
.pt-btn-danger:hover {
  background: #b91c1c;
}

.pt-btn-secondary {
  background: #1e293b;
  color: var(--pt-text-main);
  border-color: #334155;
}
.pt-btn-secondary:hover {
  background: #334155;
}

.pt-btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* Terminal Console */
.pt-terminal-box {
  background: #070c18;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: 'Cascadia Code', Consolas, 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  height: 250px;
  overflow-y: auto;
  line-height: 1.65;
  letter-spacing: 0.2px;
}

.log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: pre-wrap;
  word-break: break-all;
}

.log-entry .time {
  color: #64748b;
  margin-right: 6px;
  font-weight: 500;
}

.log-entry .tag-sys {
  color: #eab308;
  font-weight: 700;
  margin-right: 6px;
}

.log-entry .tag-rx {
  color: #22c55e;
  font-weight: 700;
  margin-right: 6px;
}

.log-entry .tag-tx {
  color: #00d2ff;
  font-weight: 700;
  margin-right: 6px;
}

.log-entry.rx .payload {
  color: #4ade80;
}

.log-entry.tx .payload {
  color: #38bdf8;
}

.log-entry .packet-note {
  color: #fb923c;
  font-weight: 600;
  margin-left: 8px;
}

.log-entry.sys .sys-bracket {
  color: #fde047;
  font-weight: 700;
}

.log-entry.sys .sys-body {
  color: #fef08a;
}

/* Subbox & 2-Col Layout */
.pt-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .pt-two-col {
    grid-template-columns: 1fr;
  }
}

.pt-subbox {
  background: #111a30;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 14px;
}

.pt-subbox-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--pt-text-main);
  margin-top: 0;
  margin-bottom: 12px;
}

.pt-analysis-box {
  background: var(--pt-bg-input);
  border: 1px solid var(--pt-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'Cascadia Code', Consolas, 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  height: 190px;
  overflow-y: auto;
  color: #e2e8f0;
}

.dec-label {
  color: #38bdf8;
  font-weight: 700;
}
.dec-val {
  color: #f8fafc;
}
.dec-ok {
  color: #4ade80;
  font-weight: 700;
}
.dec-err {
  color: #f87171;
  font-weight: 700;
}

/* Presets Grid */
.pt-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.pt-preset-card {
  background: #111a30;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.pt-preset-card:hover {
  background: #18243e;
  border-color: var(--pt-blue);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.pt-preset-badge {
  background: #0284c7;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

/* Footer Bar */
.pt-footer-bar {
  background: #0a0e1a;
  border-top: 1px solid var(--pt-border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 12px;
}

/* Tables */
.pt-table-wrap {
  overflow-x: auto;
}

.pt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.pt-table th {
  background: #090e1c;
  color: var(--pt-text-sub);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--pt-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.pt-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.pt-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Guide Section */
.pt-guide-section {
  background: var(--pt-bg-card);
  border: 1px solid var(--pt-border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 30px;
  line-height: 1.7;
}

.pt-guide-section h2 {
  font-size: 20px;
  color: var(--pt-blue-light);
  margin-top: 0;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pt-guide-section h3 {
  font-size: 16px;
  color: var(--pt-text-main);
  margin-top: 20px;
  margin-bottom: 8px;
}

.pt-guide-section p, .pt-guide-section li {
  font-size: 14px;
  color: var(--pt-text-sub);
}

.pt-guide-section code {
  background: #090e1c;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.pt-guide-section pre {
  background: #050811;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #e2e8f0;
}

/* =========================================================================
   Live Multi-Format Register Poller & Address Scanner Styles
   ========================================================================= */
.pt-poller-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: #111a30;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.pt-poller-field {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.pt-poller-field .pt-input,
.pt-poller-field .pt-select {
  height: 34px;
  padding: 4px 8px;
  font-size: 12px;
}

.pt-poller-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.pt-poller-actions .pt-btn {
  height: 34px;
}

.pt-poller-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 12px;
}

.pt-poller-status {
  font-size: 11.5px;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pt-scanner-panel {
  background: #0c1426;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.pt-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pt-border);
}

.pt-reg-grid-wrap {
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  background: #070c18;
}

.pt-reg-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cascadia Code', Consolas, 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
}

.pt-reg-table th {
  background: #0b1324;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 9px 10px;
  border-bottom: 1px solid #1e293b;
  box-shadow: 0 1px 0 #1e293b;
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
}

.pt-reg-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  white-space: nowrap;
  transition: background-color 0.25s ease;
}

/* Change Detection Heat Highlighting */
.pt-reg-table tr.reg-row-hot td {
  background-color: rgba(245, 158, 11, 0.32) !important;
}

.pt-reg-table tr.reg-row-warm td {
  background-color: rgba(16, 185, 129, 0.18) !important;
}

.pt-reg-table tr.reg-row-changed td:first-child {
  border-left: 3px solid #38bdf8;
}

.reg-cell-edit {
  cursor: pointer;
  border-radius: 4px;
}

.reg-cell-edit:hover {
  background-color: rgba(56, 189, 248, 0.14) !important;
  outline: 1px dashed rgba(56, 189, 248, 0.5);
}

.reg-alias-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 11.5px;
  padding: 2px 5px;
  outline: none;
}

.reg-alias-input:hover,
.reg-alias-input:focus {
  background: #0f172a;
  border-color: #38bdf8;
  color: #ffffff;
}

.reg-inline-editor {
  width: 100%;
  min-width: 64px;
  background: #0f172a;
  border: 1px solid #38bdf8;
  border-radius: 4px;
  color: #38bdf8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 5px;
  outline: none;
  box-sizing: border-box;
}

.reg-bit-group {
  display: inline-flex;
  gap: 1px;
  margin-right: 5px;
}

.reg-bit {
  display: inline-block;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
}

.reg-bit.bit-1 {
  color: #4ade80;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.14);
}

.reg-bit.bit-0 {
  color: #64748b;
}

.reg-bit:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #ffffff;
}

.reg-chg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.reg-chg-badge:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

/* =========================================================================
   Mobile & Smartphone Responsive Overrides (Zero Panel Overflow)
   ========================================================================= */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .pt-container {
    width: calc(100% - 16px) !important;
    padding: 8px 0 36px !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .pt-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
    gap: 10px;
    overflow: hidden;
  }

  .pt-branding {
    width: 100%;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
  }

  .pt-logo-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .pt-title-box {
    min-width: 0;
    flex: 1;
  }

  .pt-title-box h1 {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    font-size: 1.15rem;
    width: 100%;
    min-width: 0;
  }

  .pt-title-box h1 span.tag-ver {
    white-space: normal;
    line-height: 1.35;
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 6px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .pt-header-stats {
    width: 100%;
    gap: 6px;
    justify-content: flex-start;
  }

  .pt-conn-card,
  .pt-card {
    padding: 12px 14px;
    margin-bottom: 14px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  #btn-download-pc-bridge-pt {
    width: 100% !important;
    justify-content: center !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  .pt-nav-sep {
    display: none !important;
  }

  .pt-mode-switch {
    width: 100% !important;
    flex: 1 1 100% !important;
  }

  #cb-comm-protocol,
  #cb-tcp-role,
  #cb-serial-role,
  #cb-serial-terminator {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .pt-conn-subpanel {
    padding: 10px 12px;
  }

  .pt-conn-subpanel .pt-check-opt {
    margin-left: 0 !important;
    width: 100%;
  }

  .pt-conn-fields {
    gap: 8px;
  }

  .pt-conn-fields > div {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 120px !important;
  }

  .pt-conn-fields > div:first-child,
  .pt-conn-fields > div:last-child {
    flex: 1 1 100% !important;
  }

  .pt-conn-fields > div:last-child > label {
    display: none;
  }

  #btn-connect-tcp,
  #btn-connect-serial,
  #btn-ping-plc {
    width: 100% !important;
  }

  .pt-poller-toolbar {
    padding: 10px;
    gap: 8px;
  }

  .pt-poller-field {
    flex: 1 1 calc(50% - 8px) !important;
    width: auto !important;
    min-width: 120px !important;
  }

  .pt-poller-actions {
    width: 100%;
    margin-left: 0;
    gap: 6px;
  }

  .pt-poller-actions .pt-btn {
    flex: 1 1 auto;
  }

  .pt-scanner-header > div:last-child {
    flex-wrap: wrap;
    width: 100%;
  }

  #tab-master .pt-subbox > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #tab-master #txt-manual-decode-input {
    min-width: 0;
  }

  #tab-quick > div > div:first-child {
    flex-wrap: wrap;
  }

  #tab-quick #cb-send-input {
    flex: 1 1 180px;
    min-width: 0;
  }

  #tab-quick #btn-send {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 90px;
  }

  #tab-ascii > div:first-child {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  #tab-ascii > div:first-child > div:nth-child(2) {
    margin-top: 0 !important;
    transform: rotate(90deg);
  }

  .pt-footer-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }

  .pt-guide-section {
    padding: 18px 14px;
  }
}

