:root {
  color-scheme: light;
  --bg: #eff2f7;
  --surface: #ffffff;
  --border: #c7cfdb;
  --text: #1f2a3a;
  --muted: #5e6a7f;
  --accent: #0d5ea8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f6f8fb 0%, #e9eef6 100%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
  height: 100vh;
  overflow: hidden;
}

.about-page {
  min-height: 100vh;
  height: auto;
  overflow: auto;
  background:
    radial-gradient(circle at top right, rgba(13, 94, 168, 0.16), transparent 45%),
    linear-gradient(180deg, #f7f9fd 0%, #e7edf7 100%);
}

.about-shell {
  max-width: 860px;
  margin: 2.2rem auto;
  padding: 0 1rem 2rem;
}

.about-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(23, 42, 70, 0.14);
  padding: 1.5rem 1.6rem;
  line-height: 1.6;
}

.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.about-header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.about-signoff {
  margin-top: 1.1rem;
  font-weight: 600;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #dde5f2;
  padding: 0.8rem 1rem;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.1rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.6rem;
}

button {
  border: 1px solid #9aa8bf;
  background: linear-gradient(180deg, #f9fcff 0%, #dce6f4 100%);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

button:not(:disabled):hover {
  border-color: var(--accent);
}

.toolbar-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid #9aa8bf;
  background: linear-gradient(180deg, #f9fcff 0%, #dce6f4 100%);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
}

.toolbar-link:hover {
  border-color: var(--accent);
}

.toolbar-actions .github-button {
  align-self: center;
}

.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.left-panel {
  border-right: 1px solid var(--border);
  background: #eef3fb;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.left-panel-main {
  min-height: 0;
}

.left-panel h2 {
  margin-top: 0;
  font-size: 1rem;
}

.serial-support-warning {
  margin: 0.35rem 0 0.8rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid #d97b2f;
  border-radius: 6px;
  background: #fff4e8;
  color: #61330f;
  font-size: 0.82rem;
  line-height: 1.35;
}

.serial-support-warning a {
  color: #7b3f14;
  font-weight: 600;
}

.serial-support-warning[hidden] {
  display: none;
}

#radio-make,
#radio-model,
#tx-hex,
#rx-bytes,
#rx-timeout {
  width: 100%;
  margin: 0.2rem 0 0.55rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.left-panel button:disabled,
.left-panel input:disabled,
.left-panel select:disabled {
  color: #7d889a;
  border-color: #c4cbd8;
  background: linear-gradient(180deg, #eef2f8 0%, #dee5f0 100%);
  cursor: not-allowed;
}

#tx-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.serial-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.3rem 0 0.6rem;
}

.serial-actions > :only-child {
  grid-column: 1 / -1;
}

.serial-log {
  margin: 0.6rem 0 0;
  min-height: 92px;
  max-height: 180px;
  overflow: auto;
  background: #f8fbff;
  border: 1px solid var(--border);
  padding: 0.45rem;
  font-size: 0.74rem;
  line-height: 1.4;
}

.editor-panel {
  padding: 1rem;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.channel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
  flex: 0 0 auto;
  position: relative;
}

.mem-table-scroll {
  min-height: 0;
  overflow: auto;
  flex: 1 1 auto;
}

#channel-insert,
#channel-remove {
  min-width: 2.1rem;
  padding: 0.3rem 0.45rem;
  font-size: 1rem;
  line-height: 1;
}

.channel-menu {
  position: relative;
}

.channel-menu-popup {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 20;
  min-width: 12rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(21, 37, 63, 0.16);
}

.channel-menu-popup.hidden {
  display: none;
}

.channel-menu-popup button {
  width: 100%;
  text-align: left;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 23, 40, 0.45);
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(18, 35, 60, 0.3);
  padding: 1rem;
}

.modal-card h2 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.45rem 0.7rem;
  align-items: center;
}

.modal-grid input[type="text"],
.modal-grid input[type="number"],
.modal-grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  padding: 0.35rem 0.45rem;
}

.modal-grid input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.modal-geo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: center;
}

.modal-geo-button {
  min-width: 2rem;
  padding: 0.35rem 0.45rem;
  line-height: 1;
}

.modal-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.35rem 0.55rem;
}

.modal-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.modal-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

#przemienniki-country {
  margin-bottom: 2em;
}

#przemienniki-band-list {
  margin-bottom: 2em;
}

#przemienniki-mode-list {
  margin-bottom: 2em;
}

.sidebar-debug-panel {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}

.debug-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
  padding: 0.45rem 0;
}

.debug-body {
  margin-top: 0.3rem;
}

.debug-output-panel {
  border-top: 1px solid var(--border);
  background: #e6edf8;
  padding: 0.7rem 0.9rem 0.9rem;
}

.debug-serial-tools {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.35rem 0.7rem;
  align-items: center;
  max-width: 520px;
  margin-bottom: 0.7rem;
}

.debug-serial-tools button {
  grid-column: 2;
  justify-self: start;
}

.debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.debug-actions {
  display: inline-flex;
  gap: 0.5rem;
}

.debug-header h2 {
  margin: 0;
  font-size: 0.9rem;
}

#report-issue {
  border-color: #965200;
  background: linear-gradient(180deg, #fff4df 0%, #f6d7ab 100%);
}

#report-issue.hidden {
  display: none;
}

#debug-output {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  background: #f9fbff;
  color: var(--text);
  padding: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#mem-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  table-layout: fixed;
}

#mem-table th,
#mem-table td {
  border: 1px solid var(--border);
  padding: 0.35rem;
  font-size: 0.85rem;
}

#mem-table th {
  background: #e3ebf8;
  text-align: left;
}

#mem-table td input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
}

#mem-table td select {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
}

#mem-table .channel-location-button {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

#mem-table .channel-location-button:hover {
  color: #0b4b85;
  text-decoration: underline;
}

#mem-table .channel-location-button:focus-visible {
  outline: 1px solid var(--accent);
  background: #f2f8ff;
}

#mem-table tbody tr.is-selected td {
  background: #dcecff;
}

#mem-table td.is-invalid {
  background: #ffd9d9;
}

#mem-table td input:focus {
  outline: 1px solid var(--accent);
  background: #f2f8ff;
}

#mem-table td select:focus {
  outline: 1px solid var(--accent);
  background: #f2f8ff;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .left-panel {
    display: block;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-debug-panel {
    margin-top: 0.8rem;
  }

  .debug-serial-tools {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .debug-serial-tools button {
    grid-column: 1;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }
}
