:root {
  --bg-page: #f7f6f2;
  --bg-surface: #ffffff;
  --bg-subtle: #eeecea;
  --bg-hover: #e4e1db;
  --border-weak: rgba(0, 0, 0, 0.1);
  --border-mid: rgba(0, 0, 0, 0.16);
  --border-strong: rgba(0, 0, 0, 0.24);
  --text-primary: #0d0d0d;
  --text-secondary: #3a3a3a;
  --text-tertiary: #767676;
  --brand: #2c5cff;
  --brand-light: #eef1ff;
  --brand-mid: #6e8fff;
  --brand-border: rgba(44, 92, 255, 0.35);
  --brand-text: #1a3dcc;
  --teal: #18a76a;
  --teal-light: #eaf8f1;
  --teal-border: rgba(24, 167, 106, 0.28);
  --teal-text: #108552;
  --purple: #5b6fd6;
  --purple-light: #eef1ff;
  --purple-border: rgba(44, 92, 255, 0.22);
  --purple-text: #1a3dcc;
  --red: #e24b4a;
  --red-light: #fcebeb;
  --red-border: rgba(226, 75, 74, 0.3);
  --red-text: #a32d2d;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 22px;
  --r-pill: 999px;
  --font: -apple-system, "PingFang SC", BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Microsoft YaHei UI", "PingFang SC", monospace;
  --tr: 0.15s ease;
  --shadow-card: 0 16px 38px rgba(27, 35, 56, 0.07);
  --shadow-btn: 0 10px 24px rgba(44, 92, 255, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #111218;
    --bg-surface: #1a1c24;
    --bg-subtle: #22252f;
    --bg-hover: #2a2e3a;
    --border-weak: rgba(255, 255, 255, 0.08);
    --border-mid: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.22);
    --text-primary: #f2f3f7;
    --text-secondary: #b8bcc8;
    --text-tertiary: #7f8596;
    --brand: #5b7fff;
    --brand-light: #1a254d;
    --brand-mid: #8aa4ff;
    --brand-border: rgba(91, 127, 255, 0.35);
    --brand-text: #a8bcff;
    --teal-light: #0d2e22;
    --teal-border: rgba(93, 202, 165, 0.25);
    --teal-text: #5dcaa5;
    --purple-light: #1a254d;
    --purple-border: rgba(91, 127, 255, 0.25);
    --purple-text: #a8bcff;
    --red-light: #501313;
    --red-border: rgba(240, 149, 149, 0.25);
    --red-text: #f09595;
    --shadow-card: 0 16px 38px rgba(0, 0, 0, 0.28);
    --shadow-btn: 0 10px 24px rgba(44, 92, 255, 0.22);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

svg {
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0 20px 64px;
  overflow-x: clip;
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 32px 0 28px;
  border-bottom: 0.5px solid var(--border-weak);
  margin-bottom: 28px;
}

.header-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
}

.header-logo svg {
  width: 22px;
  height: 22px;
  fill: var(--brand);
}

.header-text {
  min-width: 0;
}

.header-text h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
}

.header-text p {
  margin: 1px 0 0;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}

.status-pill {
  margin-left: auto;
  flex-shrink: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  white-space: nowrap;
}

.status-pill.ready {
  border-color: var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.status-pill.bad {
  border-color: var(--red-border);
  background: var(--red-light);
  color: var(--red-text);
}

.auth-user-badge {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-logout {
  appearance: none;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  padding: 3px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  max-width: 100%;
}

.tab-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  transition: all var(--tr);
  white-space: nowrap;
}

.tab-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  border: 0.5px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  width: 100%;
  margin: 0 0 16px;
  padding: 28px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 0.5px solid var(--border-weak);
}

.card-header > :last-child {
  min-width: 0;
}

.card-header-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}

.card-header-icon svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.card-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.card-subtitle {
  margin: 1px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.drop-zone {
  position: relative;
  margin-bottom: 20px;
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  cursor: pointer;
  padding: 32px 20px;
  text-align: center;
  transition: all var(--tr);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.drop-icon,
.drop-icon svg {
  width: 36px;
  height: 36px;
}

.drop-icon {
  margin: 0 auto 10px;
  color: var(--text-tertiary);
}

.drop-main {
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.drop-sub {
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-bar {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  border: 0.5px solid var(--teal-border);
  border-radius: var(--r-md);
  background: var(--teal-light);
  padding: 10px 14px;
}

.file-bar.show {
  display: flex;
}

.file-bar-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--teal-text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
}

.file-bar-meta {
  min-width: 0;
  flex: 1;
}

.file-bar-name {
  overflow: hidden;
  color: var(--teal-text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-bar-size {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 11px;
}

.file-bar-clear {
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  padding: 4px 7px;
  transition: all var(--tr);
}

.file-bar-clear:hover {
  background: var(--red-light);
  color: var(--red);
}

.flash-parts-panel {
  display: grid;
  gap: 10px;
  margin: -8px 0 20px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: 12px;
}

.flash-parts-panel[hidden] {
  display: none;
}

.flash-parts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.flash-parts-head small {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 400;
}

.flash-parts-list {
  display: grid;
  gap: 8px;
}

.flash-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 150px) auto;
  align-items: center;
  gap: 10px;
}

.flash-part-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flash-part-offset {
  width: 100%;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
}

.flash-part-row small {
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}

.chip-params-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-bottom: 18px;
}

.chip-params-panel .field-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.45;
}

.expert-params {
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
}

.expert-params > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  list-style: none;
}

.expert-params > summary::-webkit-details-marker {
  display: none;
}

.expert-params[open] > summary {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.expert-params .field {
  margin: 14px;
}

.fw-tag--clock {
  background: rgba(24, 167, 106, 0.12);
  color: #12875a;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field,
.form-section {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span,
.form-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  outline: none;
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 10px 12px;
  transition: all var(--tr);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-border);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.exp-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exp-btn {
  min-width: 64px;
  flex: 1;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  text-align: center;
  transition: all var(--tr);
}

.exp-btn:hover {
  border-color: var(--border-mid);
  color: var(--text-primary);
}

.exp-btn.selected {
  border-color: var(--brand-border);
  background: var(--brand-light);
  color: var(--brand-text);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
  transition: background var(--tr);
}

.toggle-row:hover {
  background: var(--bg-hover);
}

.toggle-copy {
  flex: 1;
}

.toggle-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.toggle-desc {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 11px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--border-mid);
  cursor: pointer;
  transition: background var(--tr);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left var(--tr);
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  left: 23px;
}

.switch input:disabled + .switch-track {
  background: var(--border-weak);
  cursor: not-allowed;
  opacity: 0.65;
}

.progress-wrap {
  display: none;
  margin-bottom: 18px;
}

.progress-wrap.show {
  display: block;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: width 0.1s linear;
}

.upload-btn,
.modal-start-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 16px;
  transition: all var(--tr);
}

.upload-btn:hover:not(:disabled),
.modal-start-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.upload-btn:active:not(:disabled),
.modal-start-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.upload-btn svg,
.modal-start-btn svg {
  width: 16px;
  height: 16px;
}

.state {
  margin-top: 14px;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

.state.muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.state.good {
  border: 0.5px solid var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.state.bad {
  border: 0.5px solid var(--red-border);
  background: var(--red-light);
  color: var(--red-text);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--teal-border);
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--success {
  border-color: rgba(20, 160, 111, 0.22);
}

.toast-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--teal-light);
  color: var(--teal-text);
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-body {
  min-width: 0;
  padding-top: 2px;
}

.toast-title {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.toast-message {
  display: block;
  color: var(--brand);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.toast-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.result-wrap {
  display: none;
  text-align: center;
  padding: 18px 0 4px;
}

.result-wrap.show {
  display: block;
}

.result-eyebrow {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.code-block {
  position: relative;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 22px 16px;
}

.code-value {
  color: var(--brand);
  font-family: var(--mono);
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 10px;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  transition: all var(--tr);
}

.code-copy-btn:hover,
.code-copy-btn.copied {
  border-color: var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.code-copy-btn svg {
  width: 13px;
  height: 13px;
}

.result-notice {
  margin-bottom: 14px;
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 14px;
  text-align: left;
}

.result-notice strong {
  color: var(--brand-text);
}

.upload-again-btn {
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 7px 16px;
  transition: all var(--tr);
}

.upload-again-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.locker-wrap {
  position: relative;
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 0 4px;
  text-align: center;
  cursor: text;
}

.locker-wrap:focus-within .locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(44, 92, 255, 0.2);
}

.code-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  opacity: 0;
  padding: 0;
  cursor: text;
  background: transparent;
}

.locker-label {
  margin-bottom: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.locker-cells {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.locker-cell {
  width: 40px;
  height: 50px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}

.locker-cell.filled {
  border-color: rgba(0, 0, 0, 0.12);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(44, 92, 255, 0.2);
}

.locker-cell.empty-dot {
  color: rgba(0, 0, 0, 0.18);
  font-size: 18px;
  line-height: 1;
}

.extract-card {
  padding: 24px 22px 22px;
}

.extract-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.extract-header-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.extract-header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--text-primary);
}

.extract-header-text {
  min-width: 0;
}

.extract-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.extract-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.extract-entry {
  display: grid;
  gap: 18px;
}

@media (prefers-color-scheme: dark) {
  .locker-cell {
    border-color: var(--border-mid);
  }

  .locker-cell.filled {
    border-color: var(--border-strong);
  }

  .locker-cell.empty-dot {
    color: var(--border-strong);
  }

  .kb-key {
    border-color: var(--border-mid);
  }
}

.locker-wrap.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kb-grid-hex {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kb-grid-alnum {
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.kb-grid-alnum .kb-key {
  min-height: 42px;
  font-size: 14px;
}

.kb-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kb-action {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--tr), color var(--tr);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kb-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.kb-action:active {
  transform: scale(0.98);
}

.kb-action.key-del:hover {
  background: var(--red-light);
  color: var(--red-text);
}

.kb-key {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  padding: 14px 8px;
  transition: border-color var(--tr), background var(--tr), transform 0.1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.kb-key:hover {
  border-color: rgba(0, 0, 0, 0.14);
  background: var(--bg-hover);
}

.kb-key:active {
  border-color: rgba(0, 0, 0, 0.12);
  background: var(--bg-subtle);
  transform: scale(0.97);
}

.kb-key.key-del,
.kb-key.key-clr {
  display: none;
}

.captcha-box {
  width: min(420px, 100%);
}

.captcha-hint {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.turnstile-wrap {
  display: grid;
  min-height: 74px;
  place-items: center;
  margin: 6px 0 12px;
  padding: 10px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
}

.slider-captcha {
  display: grid;
  gap: 12px;
}

.slider-track {
  position: relative;
  height: 112px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.08)),
    var(--bg-subtle);
  overflow: hidden;
}

.slider-slot,
.slider-piece {
  position: absolute;
  top: 34px;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  transition: left 0.08s ease;
}

.slider-slot {
  border: 1.5px dashed rgba(15, 23, 42, 0.28);
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.slider-piece {
  border: 1px solid var(--brand-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(219, 234, 254, 0.95));
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  cursor: grab;
  touch-action: none;
}

.slider-piece.dragging {
  cursor: grabbing;
}

.slider-rail {
  position: relative;
  height: 44px;
  border: 0.5px solid var(--border-mid);
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
}

.slider-handle {
  position: absolute;
  top: 3px;
  left: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  cursor: grab;
  touch-action: none;
}

.slider-handle.dragging,
.slider-handle:active {
  cursor: grabbing;
}

.captcha-refresh-btn {
  margin-top: 12px;
}

.captcha-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.captcha-actions .upload-btn {
  margin-top: 0;
}

.captcha-retry-btn[hidden] {
  display: none;
}

.profile-card {
  padding: 24px 22px 22px;
}

.profile-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-user-line {
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-user-line strong {
  color: var(--text-primary);
  font-weight: 600;
}

.profile-refresh-btn {
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.profile-refresh-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.profile-empty {
  margin-top: 12px;
  border: 0.5px dashed var(--border-mid);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  padding: 18px 16px;
  text-align: center;
}

.profile-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.profile-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  padding: 16px;
}

.profile-item-main {
  min-width: 0;
  flex: 1;
}

.profile-item-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.profile-item-code {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-item-code code {
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

.profile-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.profile-item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.profile-copy-btn,
.profile-delete-btn {
  min-width: 84px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: all var(--tr);
}

.profile-copy-btn:hover {
  border-color: var(--brand-border);
  color: var(--brand-text);
  background: var(--brand-light);
}

.profile-delete-btn {
  border-color: var(--red-border);
  color: var(--red-text);
  background: var(--red-light);
}

.profile-delete-btn:hover {
  filter: brightness(0.98);
}

.delete-box {
  width: min(460px, 100%);
}

.delete-confirm-text {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.delete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.delete-cancel-btn,
.delete-confirm-btn {
  min-height: 44px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--tr);
}

.delete-cancel-btn {
  border: 0.5px solid var(--border-mid);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.delete-cancel-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.delete-confirm-btn {
  border: 0.5px solid var(--red-border);
  background: var(--red);
  color: #fff;
}

.delete-confirm-btn:hover:not(:disabled) {
  filter: brightness(1.03);
}

.delete-confirm-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.extract-error {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  border: 0.5px solid var(--red-border);
  border-radius: var(--r-md);
  background: var(--red-light);
  color: var(--red-text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
}

.extract-error.show {
  display: flex;
}

.extract-error.loading {
  border-color: var(--border-weak);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.extract-error svg {
  width: 15px;
  height: 15px;
}

.fw-card {
  display: none;
  margin-top: 16px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  padding: 20px;
}

.fw-card.show {
  display: block;
}

.fw-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border-weak);
}

.fw-file-badge {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.5px solid var(--purple-border);
  border-radius: var(--r-md);
  background: var(--purple-light);
}

.fw-file-badge svg {
  width: 20px;
  height: 20px;
  color: var(--purple-text);
}

.fw-filename {
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.fw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.profile-item-tags {
  margin-top: 8px;
}

.fw-tag {
  display: inline-block;
  border-radius: 3px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: none;
}

.fw-tag--format {
  border: 0.5px solid var(--purple-border);
  background: var(--purple-light);
  color: var(--purple-text);
}

.fw-tag--chip {
  border: 0.5px solid rgba(14, 116, 144, 0.24);
  background: rgba(14, 116, 144, 0.08);
  color: #0e7490;
}

.fw-tag--expiry.fw-tag--permanent {
  border: 0.5px solid rgba(22, 101, 52, 0.24);
  background: rgba(22, 101, 52, 0.08);
  color: #166534;
}

.fw-tag--expiry.fw-tag--active {
  border: 0.5px solid rgba(180, 83, 9, 0.24);
  background: rgba(180, 83, 9, 0.08);
  color: #b45309;
  text-transform: none;
}

.fw-tag--expiry.fw-tag--expired {
  border: 0.5px solid rgba(185, 28, 28, 0.24);
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
}

.fw-ext-tag {
  display: inline-block;
  margin-top: 3px;
  border: 0.5px solid var(--purple-border);
  border-radius: 3px;
  background: var(--purple-light);
  color: var(--purple-text);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  text-transform: uppercase;
}

.fw-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.fw-meta-item {
  min-width: 0;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 10px 12px;
}

.fw-meta-key {
  margin-bottom: 4px;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.fw-meta-val {
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fw-desc {
  display: none;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 10px 12px;
}

.fw-desc.show {
  display: block;
}

.flash-yes {
  color: var(--teal-text);
}

.flash-no {
  color: var(--text-tertiary);
}

.fw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fw-btn {
  font-family: var(--font);
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  transition: all var(--tr);
}

.fw-btn svg {
  width: 15px;
  height: 15px;
}

.fw-btn-dl {
  border: 0.5px solid var(--border-mid);
  background: transparent;
  color: var(--text-primary);
}

.fw-btn-dl:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.fw-btn-flash {
  border: 0.5px solid var(--teal-border);
  background: var(--teal-light);
  color: var(--teal-text);
}

.fw-btn-flash:hover:not(:disabled) {
  filter: brightness(0.96);
}

.fw-btn-flash:disabled {
  border-color: var(--border-mid);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.72;
}

.browser-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
}

.browser-note svg {
  width: 12px;
  height: 12px;
}

.modal-faux {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
}

.modal-faux.show {
  display: flex;
}

.modal-box {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  padding: 24px;
  animation: modalPop 0.18s ease;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border-weak);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
}

.modal-title svg {
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.auth-box {
  width: min(420px, 100%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 4px;
}

.auth-tab {
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
}

.auth-tab.active {
  border: 0.5px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.auth-form[hidden] {
  display: none;
}

.modal-close {
  display: flex;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  padding: 4px;
  transition: all var(--tr);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-desc {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.modal-steps {
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
}

.modal-steps + .notice {
  margin-bottom: 14px;
}

.flash-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.7fr);
  gap: 10px;
  margin-bottom: 14px;
}

.flash-select-field,
.flash-check {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 10px 12px;
}

.flash-select-field span,
.flash-check span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.flash-select-field select {
  height: 39px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
}

.flash-check {
  align-content: center;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  cursor: pointer;
}

.flash-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.flash-progress-panel {
  margin-bottom: 14px;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  padding: 12px 14px;
}

.flash-progress-head,
.flash-meter-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
}

.flash-progress-head {
  color: var(--text-primary);
  font-weight: 500;
}

.flash-progress-track,
.flash-meter-track {
  height: 5px;
  overflow: hidden;
  border: 0.5px solid var(--border-weak);
  border-radius: var(--r-pill);
  background: var(--bg-surface);
}

.flash-progress-fill,
.flash-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: width 0.12s linear;
}

.flash-meter {
  margin-top: 11px;
}

.flash-meter-fill {
  background: var(--teal);
}

.modal-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 0;
}

.step-num {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  border: 0.5px solid var(--border-weak);
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
}

.terminal {
  height: 130px;
  overflow-y: auto;
  margin-bottom: 14px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--r-md);
  background: #1a1916;
  color: #9b9a96;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  padding: 12px 14px;
}

.t-line {
  display: block;
}

.t-ok {
  color: #5dcaa5;
}

.t-dim {
  color: #77736a;
}

.t-bad {
  color: #f09595;
}

.t-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: #9b9a96;
  vertical-align: middle;
  animation: cur 1s step-end infinite;
}

@keyframes cur {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.installer-mount {
  display: grid;
  gap: 10px;
}

.installer-mount esp-web-install-button {
  --esp-tools-button-color: var(--teal);
  --esp-tools-button-text-color: #fff;
  --esp-tools-button-border-radius: 10px;
}

.notice {
  border: 0.5px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-light);
  color: var(--brand-text);
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 12px;
}

.footer {
  margin-top: 32px;
  border-top: 0.5px solid var(--border-weak);
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  padding: 20px 0;
  text-align: center;
}

.key-page {
  width: min(560px, 100%);
}

.key-home-link {
  text-decoration: none;
}

.key-card {
  margin-top: 20px;
}

.key-result {
  padding-top: 22px;
  text-align: left;
}

.key-output {
  min-height: 96px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
  word-break: break-all;
}

.key-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.key-countdown {
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 560px) {
  .page {
    width: 100%;
    padding-inline: 14px;
  }

  .header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 8px;
    padding-top: 22px;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .header-logo {
    width: 36px;
    height: 36px;
  }

  .header-text h1 {
    font-size: 17px;
  }

  .header-text {
    flex: 1 1 calc(100% - 48px);
  }

  .header-text p {
    font-size: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-pill {
    margin-left: 0;
    max-width: calc(50% - 4px);
    overflow: hidden;
    padding: 3px 8px;
    text-overflow: ellipsis;
  }

  .tabs {
    display: flex;
    gap: 2px;
    overflow: visible;
  }

  .tab-btn {
    flex: 1 1 0;
    line-height: 1.2;
    min-width: 0;
    gap: 4px;
    font-size: 12px;
    overflow: hidden;
    padding: 8px 4px;
    text-align: center;
    white-space: normal;
  }

  .tab-btn svg {
    width: 13px;
    height: 13px;
  }

  .card {
    padding: 18px 14px;
  }

  .card-header {
    align-items: flex-start;
  }

  .card-subtitle {
    overflow-wrap: anywhere;
  }

  .drop-zone {
    padding: 28px 12px;
  }

  .drop-main,
  .drop-sub {
    overflow-wrap: anywhere;
  }

  .field-grid,
  .chip-params-panel,
  .fw-meta,
  .flash-config {
    grid-template-columns: 1fr;
  }

  .flash-parts-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .flash-part-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .fw-card {
    padding: 16px 14px;
  }

  .fw-header {
    align-items: flex-start;
  }

  .fw-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .fw-btn {
    min-width: 0;
    width: 100%;
  }

  .modal-faux {
    align-items: stretch;
    padding: 12px;
  }

  .modal-box {
    max-height: calc(100dvh - 24px);
    padding: 18px 14px;
  }

  .modal-top,
  .flash-progress-head,
  .flash-meter-info {
    flex-wrap: wrap;
  }

  .profile-toolbar,
  .key-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-refresh-btn {
    width: 100%;
  }

  .locker-cell {
    width: 36px;
    height: 44px;
    font-size: 18px;
  }

  .extract-title {
    font-size: 17px;
  }

  .extract-subtitle {
    font-size: 12px;
  }

  .profile-item {
    flex-direction: column;
  }

  .profile-item-actions {
    flex-direction: row;
    width: 100%;
  }

  .profile-copy-btn,
  .profile-delete-btn {
    flex: 1;
  }

  .code-value {
    letter-spacing: 6px;
  }
}

@media (max-width: 360px) {
  .page {
    padding-inline: 12px;
  }

  .header {
    gap: 8px;
  }

  .header-logo {
    width: 34px;
    height: 34px;
  }

  .header-text {
    flex-basis: calc(100% - 42px);
  }

  .header-text h1 {
    font-size: 16px;
  }

  .status-pill {
    font-size: 10px;
    padding: 2px 7px;
  }

  .tab-btn {
    gap: 3px;
    padding-inline: 3px;
  }

  .tab-btn svg {
    width: 12px;
    height: 12px;
  }

  .card {
    padding: 16px 12px;
  }

  .drop-main {
    font-size: 13px;
  }

  .drop-sub,
  .terminal {
    font-size: 11px;
  }

  .modal-faux {
    padding: 10px;
  }

  .modal-box {
    max-height: calc(100dvh - 20px);
    padding: 16px 12px;
  }
}

/* ─── New style (blue SaaS theme) ─── */

.page {
  width: min(760px, 100%);
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 -20px 28px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-weak);
  background: rgba(247, 246, 242, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-home-link {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: all var(--tr);
}

.header-home-link:hover {
  color: var(--brand);
  border-color: var(--brand-border);
  background: var(--brand-light);
}

@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(17, 18, 24, 0.9);
  }
}

.header-logo {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(44, 92, 255, 0.25);
}

.header-logo svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.header-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-text p {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill {
  font-size: 12px;
  font-weight: 650;
  padding: 5px 12px;
}

.tabs {
  gap: 6px;
  padding: 5px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  .tabs {
    background: rgba(26, 28, 36, 0.85);
  }
}

.tab-btn {
  font-weight: 650;
  border-radius: var(--r-md);
}

.tab-btn.active {
  border: 0;
  background: var(--text-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.tab-btn.active svg {
  opacity: 1;
}

.panel.active {
  animation: panelIn 0.25s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  border: 1px solid var(--border-weak);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

.card-header {
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--brand-light);
}

.card-header-icon svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.card-kicker {
  margin-bottom: 3px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.card-subtitle {
  margin-top: 4px;
  font-size: 13px;
}

.drop-zone {
  border: 2px dashed rgba(44, 92, 255, 0.22);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fafbff, var(--brand-light));
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f5f7ff, var(--brand-light));
}

.drop-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(44, 92, 255, 0.12);
}

.drop-main {
  font-size: 15px;
  font-weight: 700;
}

.file-bar {
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-weak);
}

.file-bar-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 850;
}

.file-bar-name {
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 700;
}

.field span,
.form-label {
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 92, 255, 0.12);
}

.exp-btn {
  border-radius: var(--r-pill);
}

.exp-btn.selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(44, 92, 255, 0.25);
}

.upload-btn,
.modal-start-btn {
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 800;
  padding: 13px 16px;
  box-shadow: var(--shadow-btn);
}

.upload-btn:hover:not(:disabled),
.modal-start-btn:hover:not(:disabled) {
  filter: none;
  background: var(--brand-text);
  transform: translateY(-1px);
}

.result-wrap {
  margin-top: 24px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(145deg, var(--brand-light), var(--bg-surface));
  border: 1px solid rgba(44, 92, 255, 0.15);
  text-align: left;
}

.result-eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.code-block {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.code-value {
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 850;
  letter-spacing: 8px;
  color: var(--brand);
}

.code-copy-btn {
  position: static;
  margin-top: 12px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  border: 0;
  font-weight: 800;
  padding: 8px 14px;
}

.code-copy-btn:hover,
.code-copy-btn.copied {
  background: var(--brand-text);
  color: #fff;
  border: 0;
}

.extract-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-light);
}

.extract-header-icon svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.extract-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.locker-label {
  font-weight: 700;
  color: var(--text-secondary);
}

.locker-cell {
  width: 42px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  text-align: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  background: var(--bg-subtle);
}

.locker-cell.filled {
  border-color: transparent;
  background: linear-gradient(180deg, #3967ff, #2147d8);
  color: #fff;
  box-shadow: 0 8px 16px rgba(44, 92, 255, 0.2);
}

.locker-cell.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 92, 255, 0.15);
}

.kb-key {
  font-weight: 800;
  font-family: var(--mono);
}

.kb-key:hover {
  border-color: rgba(44, 92, 255, 0.25);
  background: var(--brand-light);
  color: var(--brand);
}

.fw-card {
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

.fw-file-badge {
  border: 0;
  border-radius: 12px;
  background: var(--brand-light);
}

.fw-file-badge svg {
  color: var(--brand);
}

.fw-filename {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fw-meta-item {
  border-radius: 14px;
}

.fw-btn-flash {
  box-shadow: 0 8px 20px rgba(44, 92, 255, 0.25);
}

.footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-weak);
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
}

.modal-box {
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

.auth-tab.active {
  background: var(--text-primary);
  color: #fff;
}

/* Keep app modals visually aligned with the light app shell, even on dark OS themes. */
.modal-faux {
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e8eef7;
  --border-weak: rgba(15, 23, 42, 0.1);
  --border-mid: rgba(15, 23, 42, 0.18);
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #7b8798;
  --brand: #2f63f6;
  --brand-light: #eaf0ff;
  --brand-border: rgba(47, 99, 246, 0.34);
  --brand-text: #244fc8;
  --teal: #14a06f;
  --teal-light: #e8f7f1;
  --teal-border: rgba(20, 160, 111, 0.24);
  --teal-text: #0f7c56;
  --red-light: #fff0f0;
  --red-border: rgba(218, 62, 62, 0.24);
  --red-text: #b42323;
  background: rgba(15, 23, 42, 0.34);
  color: var(--text-primary);
}

.modal-faux .modal-box {
  border: 1px solid var(--border-weak);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-faux .modal-top {
  border-bottom-color: var(--border-weak);
}

.modal-faux .modal-title {
  color: var(--text-primary);
}

.modal-faux .modal-close {
  color: var(--text-tertiary);
}

.modal-faux .modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-faux .auth-tabs {
  border-color: var(--border-weak);
  background: var(--bg-subtle);
}

.modal-faux .auth-tab {
  color: var(--text-secondary);
}

.modal-faux .auth-tab.active {
  border-color: var(--brand-border);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 99, 246, 0.18);
}

.modal-faux .field span,
.modal-faux .form-label {
  color: #5b6678;
  font-weight: 750;
}

.modal-faux input,
.modal-faux select,
.modal-faux textarea {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.modal-faux input:focus,
.modal-faux select:focus,
.modal-faux textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 99, 246, 0.14);
}

.modal-faux .state.muted {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* ─── App shell layout (sidebar + main) ─── */
.app-shell {
  --bg-page: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e8eef7;
  --border-weak: rgba(15, 23, 42, 0.1);
  --border-mid: rgba(15, 23, 42, 0.18);
  --border-strong: rgba(15, 23, 42, 0.28);
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #7b8798;
  --brand: #2f63f6;
  --brand-light: #eaf0ff;
  --brand-mid: #6b8eff;
  --brand-border: rgba(47, 99, 246, 0.34);
  --brand-text: #244fc8;
  --teal: #14a06f;
  --teal-light: #e8f7f1;
  --teal-border: rgba(20, 160, 111, 0.24);
  --teal-text: #0f7c56;
  --red-light: #fff0f0;
  --red-border: rgba(218, 62, 62, 0.24);
  --red-text: #b42323;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 82% 6%, rgba(47, 99, 246, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg-page) 100%);
}

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100vh;
  max-height: 100vh;
  padding: 22px 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(248, 250, 252, 0.96);
  border-right: 1px solid var(--border-weak);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.72) inset;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(44, 92, 255, 0.25);
}

.sidebar-brand .brand-mark svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 22px;
}

.app-sidebar .tab-btn.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.app-sidebar .tab-btn.sidebar-item svg {
  width: 16px;
  height: 16px;
}

.app-sidebar .tab-btn.sidebar-item:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.app-sidebar .tab-btn.sidebar-item.active {
  background: var(--text-primary);
  color: #fff;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
}

.app-shell .app-sidebar #tab-extract.active,
.app-shell .app-sidebar #tab-upload.active,
.app-shell .app-sidebar #tab-profile.active {
  background: var(--text-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14) !important;
}

.app-shell .app-sidebar #tab-extract:not(.active),
.app-shell .app-sidebar #tab-upload:not(.active),
.app-shell .app-sidebar #tab-profile:not(.active) {
  background: transparent !important;
  color: var(--text-secondary) !important;
  box-shadow: none !important;
}

.sidebar-card {
  padding: 14px;
  border: 1px solid var(--border-weak);
  border-radius: 16px;
  background: var(--bg-surface);
  margin-top: auto;
  color: var(--text-primary);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.sidebar-card span {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.app-main-wrap {
  min-width: 0;
}

.app-main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px 28px 40px;
}

.app-panel {
  width: 100%;
}

.app-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.app-kicker {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  line-height: 1.18;
  color: var(--text-primary);
  letter-spacing: 0;
}

.app-subtitle {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.verify-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eaf8f1;
  color: #108552;
  font-size: 12px;
  font-weight: 750;
}

.verify-badge i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #18a76a;
  box-shadow: 0 0 0 4px rgba(24, 167, 106, 0.14);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.firmware-panel {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.code-header > span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.copy-chip {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  transition: background 0.15s;
}

.copy-chip:hover {
  background: rgba(44, 92, 255, 0.16);
}

.extract-entry .locker-label {
  display: none;
}

.locker-cells {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.code-gap {
  width: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 18px;
  font-weight: 800;
  user-select: none;
}

.locker-cell.filled.accent {
  border-color: transparent;
  background: linear-gradient(180deg, #3967ff, #2147d8);
  color: #fff;
  box-shadow: 0 10px 18px rgba(44, 92, 255, 0.22);
}

.locker-cell.filled.secondary {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, #f9faff, #eef1f6);
  color: var(--text-primary);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.locker-cell.empty-dot.accent {
  background: rgba(44, 92, 255, 0.06);
  border: 1px dashed rgba(44, 92, 255, 0.18);
  color: rgba(44, 92, 255, 0.35);
}

.locker-cell.empty-dot.secondary {
  background: #f3f4f7;
  border: 1px dashed rgba(0, 0, 0, 0.1);
  color: var(--text-tertiary);
}

.firmware-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.meta-card {
  padding: 12px;
  border: 1px solid var(--border-weak);
  border-radius: 16px;
  background: var(--bg-subtle);
}

.meta-card small {
  display: block;
  margin-bottom: 2px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.meta-card strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-card-extra {
  display: none;
}

.fw-card {
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.fw-card:not(.show) {
  display: none;
}

.transfer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(13, 13, 13, 0.94);
  color: #fff;
}

.transfer-row .progress-copy {
  min-width: 0;
}

.transfer-row .progress-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.transfer-row .progress-copy span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.transfer-row .progress-track {
  height: 8px;
  margin-top: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill-transfer {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #4ade80);
  transition: width 0.35s ease;
}

.transfer-row.ready .progress-fill-transfer {
  width: 74%;
}

.transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.flash-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.flash-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.flash-button-primary {
  background: #fff;
  color: var(--text-primary);
  font-weight: 850;
}

.flash-button-primary:hover:not(:disabled) {
  background: #f3f4f6;
}

.flash-button svg {
  width: 15px;
  height: 15px;
}

.upload-panel {
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.profile-panel {
  padding: 20px;
  border: 1px solid var(--border-weak);
  border-radius: 22px;
  background: var(--bg-surface);
  box-shadow: 0 16px 38px rgba(27, 35, 56, 0.07);
}

.app-shell .app-kicker {
  color: var(--brand);
}

.app-shell .app-title {
  color: #0f172a;
}

.app-shell .app-subtitle {
  color: #526070;
}

.app-shell .upload-panel,
.app-shell .firmware-panel,
.app-shell .profile-panel {
  box-shadow: 0 18px 42px rgba(30, 41, 59, 0.08);
}

.app-shell .drop-zone {
  border-color: #c8d7ff;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5ff 100%);
}

.app-shell .drop-zone:hover,
.app-shell .drop-zone.drag-over {
  border-color: var(--brand);
  background: linear-gradient(180deg, #ffffff 0%, #e8efff 100%);
}

.app-shell .drop-icon {
  background: #ffffff;
  color: var(--brand);
}

.app-shell .drop-main {
  color: #0f172a;
}

.app-shell .drop-sub {
  color: #687587;
}

.app-shell .field span,
.app-shell .form-label {
  color: #5b6678;
  font-weight: 750;
}

.app-shell input,
.app-shell select,
.app-shell textarea {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-shell input::placeholder,
.app-shell textarea::placeholder {
  color: #8995a7;
  opacity: 1;
}

.app-shell input:focus,
.app-shell select:focus,
.app-shell textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 99, 246, 0.14);
}

.app-shell .exp-btn {
  border-color: #d8e1ee;
  background: #f8fafc;
  color: #48576a;
}

.app-shell .exp-btn.selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 99, 246, 0.22);
}

.app-shell .toggle-row {
  border-color: #d8e1ee;
  background: #f8fafc;
}

.app-shell .toggle-desc {
  color: #687587;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }

  .sidebar-brand {
    margin-bottom: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    justify-content: flex-end;
    margin-bottom: 0;
  }

  .sidebar-card,
  .sidebar-status {
    display: none;
  }

  .app-main {
    padding: 20px 16px 32px;
  }

  .firmware-meta {
    grid-template-columns: 1fr;
  }

  .transfer-row {
    grid-template-columns: 1fr;
  }

  .transfer-actions {
    justify-content: stretch;
  }

  .transfer-actions .flash-button {
    flex: 1;
    justify-content: center;
  }
}
