html {
  font-size: 15px;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: #14213d;
  background:
    radial-gradient(circle at top left, rgba(248, 196, 113, 0.35), transparent 30%),
    linear-gradient(135deg, #f7f1e3 0%, #eaf1ef 45%, #dfe7f1 100%);
}

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

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

.sidebar {
  padding: 28px 22px;
  background: rgba(13, 27, 42, 0.95);
  color: #f6f1e9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  color: #fff7e6;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #d97d54, #f1c27d);
  color: #0d1b2a;
}

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

.nav-stack a {
  color: #dbe7f0;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  transition: 0.2s ease;
}

.nav-stack a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.main-shell {
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}

.topbar-sub,
.muted,
.table-sub {
  color: #5f6b7a;
  font-size: 0.92rem;
}

.content {
  padding: 0 28px 32px;
}

.hero,
.form-card,
.table-card,
.detail-card,
.auth-card {
  background: rgba(255, 252, 247, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(20, 33, 61, 0.08);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(20, 33, 61, 0.08);
}

.hero {
  padding: 28px;
  margin-bottom: 22px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b55d3d;
}

.hero h1,
.page-header h1,
.auth-card h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
  line-height: 1.1;
}

.stats-grid,
.quick-links,
.details-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 22px;
}

.stat-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(20, 33, 61, 0.07);
  color: inherit;
  text-decoration: none;
}

a.stat-card:hover {
  border-color: rgba(31, 78, 95, 0.35);
}

.nav-section {
  margin: 14px 14px 2px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fa3b5;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin-top: 12px;
}

.stat-label {
  color: #5f6b7a;
}

.warning {
  background: linear-gradient(135deg, rgba(255, 232, 195, 0.95), rgba(255, 245, 228, 0.95));
}

.quick-links {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-link {
  padding: 18px 20px;
  border-radius: 18px;
  background: #1f4e5f;
  color: #f6f8fb;
  text-decoration: none;
  font-weight: 600;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.table-card,
.form-card,
.detail-card {
  padding: 20px;
}

.table-card table {
  margin-bottom: 0;
}

.table-link {
  color: #1f4e5f;
  font-weight: 600;
  text-decoration: none;
}

.badge-soft {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f2ef;
  color: #1f4e5f;
  font-size: 0.85rem;
}

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

.span-2 {
  grid-column: span 2;
}

.form-actions,
.user-panel,
.checkbox-wrap {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-actions {
  margin-top: 20px;
  justify-content: flex-end;
}

.space-between {
  justify-content: space-between;
}

.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* A table cell must stay a table cell: as a flex box it falls out of the row (own border, wrong height). */
td.actions-cell {
  display: table-cell;
  white-space: nowrap;
  text-align: right;
}

td.actions-cell > * + * {
  margin-left: 6px;
}

.toolbar .form-select {
  max-width: 340px;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.relocation-table .rack-row td {
  background: #eef3f1;
}

.cases-table td {
  vertical-align: top;
}

.inline-form {
  display: inline;
}

.pagination-panel,
.pagination-nav,
.page-size-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pagination-panel {
  justify-content: space-between;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination-summary,
.pagination-page {
  white-space: nowrap;
}

.page-size-form {
  margin-left: auto;
}

.page-size-form select {
  width: auto;
  min-width: 88px;
}

.details-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 18px;
  margin: 0;
}

.detail-list dt {
  color: #5f6b7a;
}

.detail-list dd {
  margin: 0;
}

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

.auth-card {
  width: min(100%, 460px);
  padding: 32px;
}

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

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

  .sidebar {
    padding-bottom: 16px;
  }

  .stats-grid,
  .quick-links,
  .details-grid,
  .form-grid,
  .storage-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .toolbar,
  .page-header,
  .topbar,
  .user-panel,
  .pagination-panel,
  .pagination-nav,
  .page-size-form {
    flex-direction: column;
    align-items: stretch;
  }

  .page-size-form {
    margin-left: 0;
  }
}
