:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b1f24;
  --muted: #68707d;
  --line: #dfe3ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --soft: #ecfdf5;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 44px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.login-box h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

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

.topbar p,
.login-box p,
.status-head p {
  margin: 7px 0 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 44px) 40px;
}

.panel,
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.input-panel,
.status-panel {
  align-self: start;
}

.table-panel,
.missing-panel,
.errors-panel {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

label {
  font-weight: 700;
}

textarea,
input[type="file"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

textarea,
input[type="password"] {
  padding: 12px;
}

textarea {
  resize: vertical;
  min-height: 220px;
  direction: ltr;
  text-align: left;
}

.missing-barcodes {
  min-height: 150px;
  margin: 14px 0;
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

input[type="file"] {
  padding: 10px;
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.link-button:hover {
  background: var(--accent-dark);
}

button:disabled,
.disabled {
  opacity: 0.48;
  pointer-events: none;
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: #f1f5f9;
}

.status-head,
.section-title,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-head strong {
  direction: ltr;
  white-space: nowrap;
}

.progress-track {
  height: 12px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 14px;
}

td a {
  color: var(--accent-dark);
}

.empty {
  color: var(--muted);
}

.errors-list {
  display: grid;
  gap: 10px;
}

.error-item {
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--danger);
}

.error-item strong {
  color: #7f1d1d;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fee2e2;
  color: var(--danger);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .status-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}
