:root {
  --bg: #f5f5f5;
  --bg-panel: #efefef;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --border: #dddddd;
  --text: #171717;
  --muted: #666666;
  --accent: #f7b500;
  --accent-soft: #fff1bf;
  --danger: #c53030;
  --success: #1f7a4d;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.auth-body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #fbfbfb 0%, #eeeeee 100%);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand img {
  width: 120px;
  height: auto;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span,
.sidebar-foot,
.page-head p,
.muted,
.field-help,
.table-empty {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: #222;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.sidebar-foot {
  margin-top: auto;
  font-size: 0.9rem;
}

.main {
  padding: 32px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.auth-brand img {
  width: 120px;
  height: auto;
}

.auth-brand strong {
  display: block;
  font-size: 1.1rem;
}

.auth-brand p {
  margin: 6px 0 0;
  color: var(--muted);
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 2rem;
}

.page-head p {
  margin: 8px 0 0;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two-cols {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

.card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}

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

.card-header h2,
.card-header h3 {
  margin: 0;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.status-ready {
  color: var(--success);
}

.status-error,
.text-danger {
  color: var(--danger);
}

.status-queued,
.status-running,
.status-qr {
  color: #8a6200;
}

.status-read {
  color: var(--success);
}

.status-paused,
.status-cancelled,
.status-failed {
  color: var(--danger);
}

.status-draft {
  color: var(--muted);
}

.qr-frame {
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  place-items: center;
  min-height: 240px;
}

.qr-frame img {
  width: min(100%, 240px);
  height: auto;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #efefef;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

.button,
button.button {
  border: 0;
  border-radius: 14px;
  background: #1c1c1c;
  color: #fff;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.button:hover,
button.button:hover {
  transform: translateY(-1px);
}

.button-secondary {
  background: #e9e9e9;
  color: #202020;
}

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

.button-danger {
  background: #1f1f1f;
  color: #fff;
}

.flash {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.flash-warning {
  background: linear-gradient(135deg, #fff4bf 0%, #ffe082 100%);
  color: #3f2d00;
  border: 1px solid #f0c94a;
  box-shadow: 0 18px 32px rgba(247, 181, 0, 0.18);
  font-weight: 700;
}

.flash-critical {
  background: linear-gradient(135deg, #fff1f1 0%, #ffd9d9 100%);
  color: #6e1212;
  border: 1px solid #efb0b0;
  box-shadow: 0 18px 32px rgba(197, 48, 48, 0.16);
  font-weight: 700;
}

.flash-title {
  display: block;
  margin-bottom: 4px;
}

.flash-detail {
  display: block;
  margin-top: 6px;
  font-weight: 500;
  opacity: 0.9;
}

.flash-success {
  background: #eff9f2;
  color: var(--success);
}

.flash-error {
  background: #fff1f1;
  color: var(--danger);
}

.auth-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

input[type="text"],
input[type="datetime-local"],
input[type="file"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: #fcfcfc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

.checkbox-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  background: #fcfcfc;
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid #ededed;
}

.checkbox-row:last-child {
  border-bottom: 0;
}

.preview-box,
.log-list {
  background: var(--surface-muted);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid #efefef;
}

.log-item {
  padding: 12px 0;
  border-bottom: 1px solid #ebebeb;
}

.log-item:last-child {
  border-bottom: 0;
}

.log-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .main {
    padding: 22px;
  }

  .grid.two-cols {
    grid-template-columns: 1fr;
  }
}
