* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 300px;
  background: #111827;
  color: white;
  padding: 26px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.brand-logo-container {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo {
  width: 95%;
  height: 95%;
  object-fit: contain;
}

.brand h1 {
  font-size: 18px;
  margin: 0;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: #9ca3af;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav-link {
  color: #d1d5db;
  text-decoration: none;
  padding: 13px 16px;
  border-radius: 12px;
  font-weight: 500;
}

.nav-link.active,
.nav-link:hover {
  background: #1f2937;
  color: white;
}

.sidebar-footer {
  margin-top: 28px;
  padding-top: 22px;
}

.sidebar-footer-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 16px;
}

.sidebar-footer-title {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 5px;
}

.sidebar-footer-team {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
}

.sidebar-footer-version {
  font-size: 12px;
  color: #6b7280;
}

.main-content {
  flex: 1;
  padding: 24px 28px;
  overflow-x: hidden;
}

.topbar {
  background: linear-gradient(
    135deg,
    #111827 0%,
    #1e3a8a 100%
  );
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 0 0 7px;
  font-size: 25px;
  color: white;
}

.topbar p {
  margin: 0;
  color: rgba(255,255,255,0.85);
}

.user-pill {
  white-space: nowrap;
  background: #eef2ff;
  color: #3730a3;
  padding: 9px 13px;
  border-radius: 999px;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card,
.panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.card {
  padding: 18px 20px;
  min-height: 102px;
  border-left: 6px solid #2563eb;
}

.card.success {
  border-left-color: #16a34a;
}

.card.warning {
  border-left-color: #f59e0b;
}

.card.danger {
  border-left-color: #dc2626;
}

.card-label {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.card h3 {
  margin: 9px 0 0;
  font-size: 32px;
  line-height: 1.1;
}

.panel {
  padding: 22px 24px;
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0 0 6px;
}

.panel-header p {
  margin: 0;
  color: #6b7280;
}

.booking-form {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #dbeafe;
  border-color: #2563eb;
}

textarea {
  resize: vertical;
}

.action-row {
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

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

.btn.primary {
  background: #2563eb;
  color: white;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn.secondary:hover {
  background: #d1d5db;
}

.btn.success-action {
  background: #16a34a;
  color: white;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.22);
}

.btn.success-action:hover {
  background: #15803d;
}

.btn.override-action {
  background: #7c3aed;
  color: white;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.22);
}

.btn.override-action:hover {
  background: #6d28d9;
}

.btn.danger-action {
  background: #dc2626;
  color: white;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

.btn.danger-action:hover {
  background: #b91c1c;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

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

th {
  text-align: left;
  background: #f9fafb;
  color: #374151;
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.badge.available {
  background: #dcfce7;
  color: #166534;
}

.badge.conflict {
  background: #fef3c7;
  color: #92400e;
}

.badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.badge.override {
  background: #f3e8ff;
  color: #6b21a8;
}

.empty-state {
  text-align: center;
  color: #6b7280;
  padding: 24px;
}

.status-console {
  background: #0f172a;
  color: white;
  border-radius: 14px;
  padding: 16px 18px;
  min-height: 138px;
  max-height: 240px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.log {
  margin-bottom: 7px;
}

.log.info {
  color: #93c5fd;
}

.log.success {
  color: #86efac;
}

.log.warning {
  color: #fcd34d;
}

.log.error {
  color: #fca5a5;
}

.log.override {
  color: #d8b4fe;
}

.filter-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.table-summary {
  color: #4b5563;
  font-weight: 600;
  margin-bottom: 10px;
}

.inventory-header {
  align-items: center;
}

.table-container {
  max-height: 600px;
  overflow: auto;
  border-radius: 12px;
}

.table-container thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  width: 360px;
  background: white;
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.loading-card h3 {
  margin: 0 0 10px;
}

.loading-card p {
  margin: 0;
  color: #6b7280;
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border: 5px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 430px;
  max-width: calc(100vw - 32px);
  background: white;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
}

.modal-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.modal-card p {
  margin: 0;
  color: #4b5563;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-warning {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px;
  margin: 14px 0;
  font-weight: 600;
}

.app-page.hidden {
  display: none;
}

.report-placeholder {
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
  }

  .sidebar-footer {
    margin-top: 28px;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}