* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

body.is-booting .container {
  visibility: hidden;
}

.boot-loader {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(2px);
  z-index: 9999;
}

body.is-booting .boot-loader {
  display: flex;
}

.boot-watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(148, 163, 184, 0.12);
  text-align: center;
  line-height: 1.08;
  pointer-events: none;
  user-select: none;
}

.boot-watermark-main,
.boot-watermark-sub,
.boot-watermark-by {
  display: block;
  white-space: nowrap;
}

.boot-watermark-main {
  font-size: clamp(1.65rem, 3.9vw, 3.1rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: none;
}

.boot-watermark-sub {
  margin-top: 4px;
  font-size: clamp(0.95rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.boot-watermark-by {
  margin-top: 5px;
  font-size: clamp(0.68rem, 1.2vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
}

.boot-loader-card {
  width: min(420px, calc(100% - 32px));
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 22px 18px;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.5);
  display: flex;
  align-items: center;
  gap: 16px;
}

.boot-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #334155;
  border-top-color: #60a5fa;
  flex: 0 0 auto;
  animation: boot-spin 0.8s linear infinite;
}

.boot-skeleton {
  flex: 1;
  display: grid;
  gap: 8px;
}

.boot-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 220% 100%;
  animation: boot-shimmer 1.2s linear infinite;
}

.boot-line-lg {
  width: 88%;
}

.boot-line-md {
  width: 68%;
}

.boot-line-sm {
  width: 42%;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes boot-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.container {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.hero-right {
  display: flex;
  align-items: center;
}

.tenant-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-user-row {
  justify-content: flex-start;
}

.operations-toolbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.operations-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-link-btn {
  background: transparent;
  color: #93c5fd;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: 0.95rem;
  text-decoration: underline;
}

.subtitle {
  margin: 0 0 24px;
  color: #94a3b8;
}

.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.form .checkbox-label {
  display: flex;
  align-items: center;
}

.form input {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button.danger {
  background: #dc2626;
}

.status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.status-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b1220;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 12px;
}

.ok {
  color: #22c55e;
}

.error {
  color: #ef4444;
}

.muted {
  color: #94a3b8;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.hero-right .tabs {
  margin: 0;
  justify-content: flex-start;
}

#tenant-active-event-banner {
  margin: 0 0 20px;
  padding: 8px 10px;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #0b1220;
}

#tenant-active-event-banner h3 {
  margin: 0;
  font-size: 1.2rem;
}

.tenant-event-context-menu {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tab {
  background: #1e293b;
  color: #cbd5e1;
}

.tab.active {
  background: #2563eb;
  color: #fff;
}

.tenant-tab {
  background: #1e293b;
  color: #cbd5e1;
}

.tenant-tab.active {
  background: #2563eb;
  color: #fff;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.tenant-panel {
  display: none;
}

.tenant-panel.active {
  display: block;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tenant-create-box {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0a1020;
}

.tenant-actions-top {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 12px;
}

.tenant-create-box #tenant-form {
  margin-top: 10px;
}

.inline-form .modules-picker {
  grid-column: 1 / -1;
}

#tenant-event-form > .inline-form,
#tenant-event-form > button {
  grid-column: 1 / -1;
}

.inline-form input,
.inline-form select {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px;
}

.list {
  display: grid;
  gap: 8px;
}

.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: #0b1220;
}

.row-item.pending-row {
  border-color: #f59e0b;
  background: #1f1a0b;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #1e293b;
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #1e293b;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  background: #0b1220;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111827;
}

.sort-btn {
  background: transparent;
  color: #cbd5e1;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.82rem;
}

.table-actions {
  white-space: nowrap;
}

.inline-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-checkbox-row .checkbox-label {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 4px 10px;
}

.classification-sequence-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.classification-sequence-form textarea {
  flex: 1 1 auto;
  min-width: 75%;
}

.classification-sequence-form button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.table-actions-cell {
  text-align: right !important;
}

.table-actions button {
  margin-right: 4px;
  padding: 4px 6px;
  font-size: 0.72rem;
  line-height: 1.05;
  border-radius: 5px;
}

.table-actions button.is-disabled,
.table-actions button:disabled {
  background: #475569;
  color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.9;
}

.table-actions button.is-partenti-ready {
  background: #16a34a;
  color: #ffffff;
}

.classification-btn {
  border: 1px solid transparent;
  color: #ffffff;
  transition: filter 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}

.classification-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.classification-btn:active {
  transform: translateY(1px);
}

.classification-btn-insert {
  background: #16a34a;
}

.classification-btn-dns {
  background: #f59e0b;
}

.classification-btn-dnf {
  background: #ea580c;
}

.classification-btn-dsq {
  background: #dc2626;
}

.classification-btn-otl {
  background: #7c3aed;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.status-pill.warning {
  background: #92400e;
  color: #fef3c7;
}

.status-pill.ok-pill {
  background: #14532d;
  color: #dcfce7;
}

.warning-text {
  color: #fbbf24;
  font-size: 0.78rem;
}

.success-message {
  margin: 8px 0 12px;
  border: 1px solid #14532d;
  background: #0b2a1b;
  color: #bbf7d0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.table-pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-pagination select {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.75rem;
}

.table-pagination button {
  padding: 4px 6px;
  font-size: 0.72rem;
}

.row-item div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.row-item button {
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.78rem;
  line-height: 1.1;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.kpi-card {
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #0b1220;
  padding: 12px;
}

.modules-dropdown {
  grid-column: 1 / -1;
  position: relative;
}

.modules-dropdown summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0b1220;
  color: #e2e8f0;
  padding: 10px;
}

.modules-dropdown summary::-webkit-details-marker {
  display: none;
}

.modules-picker {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0b1220;
  padding: 8px;
}

.module-choice {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #111827;
  padding: 6px 10px;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgb(2 6 23 / 72%);
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 14px;
  background: #111827;
  padding: 18px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 40%);
}

.modal-card h3 {
  margin: 0 0 14px;
}

.modal-fields {
  display: grid;
  gap: 10px;
}

.modal-fields label {
  display: grid;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.modal-fields input,
.modal-fields select {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0b1220;
  color: #e2e8f0;
  padding: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.live-links-row a {
  display: inline-flex;
  align-items: center;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 10px;
  color: #cbd5e1;
  text-decoration: none;
  background: #111827;
}

.live-links-row a.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}
