:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #126c80;
  --accent-dark: #0b5262;
  --good: #1f7a4d;
  --warn: #a15c00;
  --bad: #bd3124;
  --soft: #eef4f6;
}

/* LuBass website visual system */
:root {
  --bg: #f6f2ef;
  --panel: #ffffff;
  --ink: #171313;
  --muted: #716763;
  --line: #d9cfca;
  --accent: #e31b23;
  --accent-dark: #b71118;
  --soft: #f4ece8;
}

.utility-bar { color: #d8cbc6; background: #171313; font: 700 10px/1.2 Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.utility-inner, .header-inner { width: min(1240px, calc(100% - 48px)); margin: auto; display: flex; align-items: center; justify-content: space-between; }
.utility-inner { min-height: 32px; }
.utility-inner a { color: #fff; text-decoration: none; }
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.header-inner { min-height: 84px; }
.brand img { display: block; width: 155px; height: 48px; object-fit: contain; object-position: left center; }
.tool-nav { display: flex; align-items: center; gap: 30px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.tool-nav a { color: var(--ink); text-decoration: none; }
.tool-nav a:hover { color: var(--accent); }
.tool-nav span { padding: 12px 16px; color: #fff; background: var(--accent); }
.language-switch { display: inline-flex; border: 1px solid var(--line); }
.language-switch button { min-width: 38px; min-height: 34px; padding: 0 8px; border: 0; color: var(--muted); background: transparent; font-size: 10px; }
.language-switch button.active { color: #fff; background: var(--accent); }

body { background: var(--bg); }
.shell { width: min(1240px, calc(100% - 48px)); padding: 0 0 72px; }
.tool-intro { display: grid; grid-template-columns: 1.25fr .75fr; gap: 70px; align-items: end; padding: 78px 0 70px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-number { margin: 0 0 18px !important; color: var(--accent) !important; font: 800 10px/1.2 Consolas, monospace !important; letter-spacing: .17em; text-transform: uppercase; }
.tool-intro h1 { margin: 0; color: var(--ink); font-size: clamp(48px, 6.2vw, 82px); line-height: .94; letter-spacing: -.06em; }
.tool-intro h1 em { color: var(--accent); font-style: normal; }
.tool-intro > p { max-width: 470px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.topbar { align-items: end; margin: 0; padding: 44px 0 24px; }
.topbar h2 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.045em; }
.topbar p { margin-top: 10px; }
.header-action { display: inline-flex; min-height: 40px; align-items: center; padding: 0 16px; border: 1px solid var(--ink); color: var(--ink); font-size: 12px; font-weight: 800; text-decoration: none; text-transform: uppercase; letter-spacing: .06em; }
.header-action:hover { color: #fff; background: var(--ink); }
.user-chip { border-color: #bfddd0; border-radius: 0; color: #176e49; background: #edf8f2; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

button { border-radius: 0; font-weight: 800; }
button.secondary { color: var(--ink); border-color: var(--ink); }
.metric, .panel, .log-panel { border-radius: 0; box-shadow: none; }
.status-grid { gap: 1px; padding: 1px; background: var(--line); }
.metric { border: 0; min-height: 88px; padding: 17px 20px; }
.metric span { font: 800 10px/1.2 Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.metric strong { margin-top: 12px; font-size: 15px; }
.workspace { gap: 18px; margin-top: 22px; }
.panel, .log-panel { border-color: var(--line); padding: 24px; }
.panel-header { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-header h2 { font-size: 22px; letter-spacing: -.025em; }
.field span, .details dt { color: var(--muted); font: 800 10px/1.2 Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }
input, select, textarea { border-radius: 0 !important; border-color: var(--line) !important; }
.progress-bar { border-radius: 0; background: #eadfda; }
#progressFill { background: var(--accent); }
.log-panel { margin-top: 18px; color: #fff; border-color: #332a27; background: #211c1a; }
.log-panel .panel-header { border-color: #433835; }
.log { color: #d8cbc6; background: #171313; }

@media (max-width: 760px) {
  .utility-inner, .header-inner, .shell { width: calc(100% - 28px); }
  .utility-inner span, .tool-nav a { display: none; }
  .header-inner { min-height: 68px; }
  .brand img { width: 125px; }
  .tool-nav { gap: 8px; }.tool-nav span { display: none; }.language-switch button { min-width: 36px; }
  .tool-intro { grid-template-columns: 1fr; gap: 24px; padding: 50px 0 44px; }
  .tool-intro h1 { font-size: 46px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .status-grid, .workspace { grid-template-columns: 1fr; }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  border-color: #c6ccd3;
  background: #cfd5dc;
  color: #737b84;
  cursor: not-allowed;
}

button.secondary {
  background: #ffffff;
  color: var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: var(--soft);
}

button.danger {
  border-color: var(--bad);
  background: #ffffff;
  color: var(--bad);
}

button.danger:hover:not(:disabled) {
  background: #fde9e7;
}

button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

button.full {
  width: 100%;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: start;
  min-height: calc(100vh - 80px);
  padding-top: 10vh;
}

.login-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.login-panel p {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

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

.role-button {
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
}

.admin-login {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.login-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--bad);
  font-size: 13px;
  line-height: 1.4;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric,
.panel,
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  min-height: 72px;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.metric strong {
  display: block;
  margin-top: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.panel,
.log-panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font-family: "Cascadia Mono", "Consolas", monospace;
  text-transform: uppercase;
}

.field select {
  font-family: inherit;
  text-transform: none;
}

.field input:focus,
.field select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(18, 108, 128, 0.14);
}

.details {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.details div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 32px;
  padding: 8px 0;
  border-bottom: 1px solid #edf0f3;
}

.details div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
}

.hash {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.badge[data-tone="good"] {
  background: #e7f5ee;
  color: var(--good);
}

.badge[data-tone="warn"] {
  background: #fff3dc;
  color: var(--warn);
}

.badge[data-tone="bad"] {
  background: #fde9e7;
  color: var(--bad);
}

.badge[data-tone="muted"] {
  background: #edf0f3;
  color: #4d5966;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
}

.progress-bar {
  flex: 1;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e0e5eb;
}

.progress-bar div {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

#progressText {
  width: 44px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-panel {
  margin-top: 12px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary div {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.admin-device-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-device-form .panel-header,
.admin-device-form .field:first-of-type {
  grid-column: 1 / -1;
}

.admin-device-form .field {
  margin-bottom: 0;
}

.file-import-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.file-import-row span {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-import-form textarea {
  width: 100%;
  min-height: 236px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #edf0f3;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td {
  overflow-wrap: anywhere;
}

.actions-cell {
  width: 1%;
  white-space: nowrap;
}

.log {
  min-height: 176px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #edf0f3;
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.log-line {
  overflow-wrap: anywhere;
}

.log-error {
  color: var(--bad);
}

.log-success {
  color: var(--good);
}

@media (max-width: 900px) {
  .status-grid,
  .workspace,
  .summary,
  .admin-tools {
    grid-template-columns: 1fr 1fr;
  }

  .login-panel {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .status-grid,
  .workspace,
  .summary,
  .admin-tools,
  .admin-device-form {
    grid-template-columns: 1fr;
  }

  .button-row,
  .button-row button {
    width: 100%;
  }

  .details div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
