* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f3f5f9;
  color: #1f2937;
}

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

.auth-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
}

h1 { margin: 0 0 6px; font-size: 30px; }
h2 { margin: 14px 0 10px; font-size: 20px; }
.muted { margin: 0 0 14px; color: #64748b; }
.hidden { display: none; }

label {
  display: block;
  font-size: 14px;
  margin: 10px 0 6px;
}

input, button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cfd6e4;
  font-size: 15px;
}
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cfd6e4;
  font-size: 15px;
  background: #fff;
}

button {
  margin-top: 12px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn {
  width: auto;
  padding: 8px 12px;
  border-radius: 10px;
  border: 0;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn.ghost {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-xs {
  padding: 5px 9px;
  font-size: 12px;
}

.msg { margin-top: 10px; min-height: 20px; font-size: 14px; }
.msg.bad { color: #b91c1c; }
.msg.ok { color: #0f766e; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.top h1 { font-size: 26px; margin: 0; }
.top button { width: auto; padding: 8px 12px; margin: 0; background: #ef4444; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.dash { padding: 16px; }
.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
}
.toolbar label { margin: 0; }
.toolbar select {
  min-width: 220px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #cfd6e4;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 5px 8px;
}

.card h3 { margin: 0 0 2px; font-size: 11px; color: #475569; }
.card p { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.2; }
.card.bad p { font-size: 11px; color: #b91c1c; }

.table-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

th, td {
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  padding: 8px 6px;
  font-size: 14px;
}

th {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.trend-chart {
  width: 100%;
  background: linear-gradient(#fbfcff, #f7f9fc);
  border: 1px solid #eef1f5;
  border-radius: 8px;
  padding: 4px 4px 0;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  color: #334155;
  margin: 8px 0 6px 58px;
}
.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 99px;
  margin-right: 5px;
  vertical-align: middle;
}
.dot.users     { background: #2563eb; }
.dot.trainings { background: #16a34a; }
.dot.matches   { background: #f59e0b; }
.dot.regs      { background: #8b5cf6; }
.dot.orders    { background: #ef4444; }

.tenant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.row-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}
.tenant-modules {
  grid-column: 1 / -1;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 14px;
  margin-top: 6px;
}
.checks label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.checks input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #fff;
  border: 1px solid #d7dde8;
  border-radius: 12px;
  padding: 12px;
}
.modal-wide {
  width: min(1100px, calc(100% - 24px));
}

.hint {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 8px;
}

.storage-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}
.storage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.storage-table th, .storage-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef1f5;
  text-align: right;
  white-space: nowrap;
}
.storage-table th:first-child, .storage-table td:first-child {
  text-align: left;
  font-family: monospace;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Wizard ===== */
.wizard-steps {
  display: flex;
  align-items: center;
  margin: 14px 0 22px;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.ws {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.ws-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  transition: background .2s, color .2s;
}
.ws-lbl {
  font-size: 13px;
  color: #94a3b8;
  transition: color .2s;
  white-space: nowrap;
}
.ws.active .ws-num { background: #2563eb; color: #fff; }
.ws.active .ws-lbl { color: #1e293b; font-weight: 600; }
.ws.done .ws-num   { background: #16a34a; color: #fff; }
.ws.done .ws-lbl   { color: #16a34a; }
.ws-sep {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  min-width: 12px;
  max-width: 36px;
}
.ws-title {
  margin: 0 0 14px;
  font-size: 16px;
  color: #1e293b;
}
.ws-panel {
  min-height: 160px;
}
.wizard-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.w-summary {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
}
.ws-checklist {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px 12px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.7;
}
.ws-checklist-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #92400e;
}
.ws-checklist ol {
  margin: 0;
  padding-left: 20px;
}
.ws-checklist li {
  margin-bottom: 4px;
  color: #44403c;
}
.ws-checklist code {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: monospace;
  color: #92400e;
}
