:root {
  --nav-bg: #1e2a3a;
  --nav-bg-hover: #263545;
  --nav-active: #3d5a80;
  --content-bg: #eef1f5;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* —— Admin shell —— */
.admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--content-bg);
}

.admin-sidebar {
  width: 240px;
  background: var(--nav-bg);
  color: #b8c5d6;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.admin-brand {
  margin: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: 4px;
  text-align: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #1e2a3a;
  letter-spacing: 0.02em;
}

.admin-brand small {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 0.15rem;
}

.admin-nav {
  flex: 1;
  padding: 0 0.5rem;
  overflow-y: auto;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: none;
  background: none;
  color: #b8c5d6;
  font-size: 0.875rem;
  text-align: left;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
  text-decoration: none;
}

.admin-nav-link:hover {
  background: var(--nav-bg-hover);
  color: #fff;
  text-decoration: none;
}

.admin-nav-link.active {
  background: var(--nav-active);
  color: #fff;
}

.admin-nav-link .oi {
  width: 1.1rem;
  opacity: 0.9;
}

.admin-sidebar-footer {
  padding: 0.75rem 1rem 1rem;
  font-size: 0.7rem;
  color: #6b7c93;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.admin-topbar {
  background: var(--nav-bg);
  color: #fff;
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.admin-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.admin-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.35rem 0 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.admin-lang-globe {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.15rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1;
}

.admin-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.3rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  color: inherit;
}

.admin-lang-btn:hover,
.admin-lang-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  outline: none;
}

.admin-lang-btn.is-active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
}

.admin-lang .store-header-lang-flag {
  width: 1.35rem;
  height: 0.95rem;
}

.btn-logout {
  background: #dc3545;
  border: none;
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-logout:hover {
  background: #bb2d3b;
  color: #fff;
}

.btn-open-webshop {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-open-webshop:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: #fff;
}

.admin-content {
  padding: 1.25rem 1.5rem 2rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.admin-content:has(.dash-page) {
  padding: 0.5rem 1rem 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* —— Dashboard —— */
.dash-page {
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: auto;
  align-content: start;
  gap: 0.5rem;
}

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

  .dash-page {
    max-height: none;
    overflow: visible;
  }
}

.portfolio-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  min-height: 220px;
}

.portfolio-card--compact {
  padding: 0.6rem 0.75rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portfolio-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.portfolio-card--compact h3 {
  font-size: 0.88rem;
  margin-bottom: 0.55rem;
}

.dash-metric {
  margin-bottom: 0.08rem;
}

.dash-metric:last-child {
  margin-bottom: 0;
}

.icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.portfolio-card--compact .icon-circle {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.icon-circle.purple { background: #7c6cf0; }
.icon-circle.red { background: #e85d5d; }
.icon-circle.blue { background: #5b8def; }
.icon-circle.green { background: #3cb371; }

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.85rem;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  background: #f4f6f8;
  border-radius: 6px;
  font-size: 0.85rem;
}

.portfolio-card--compact .stat-band {
  padding: 0.32rem 0.5rem;
  margin-bottom: 0;
  gap: 0.45rem;
}

.stat-band-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.1rem;
}

.portfolio-card--compact .stat-band-label {
  font-size: 0.68rem;
  margin-bottom: 0;
  line-height: 1.2;
}

.stat-band-value {
  font-weight: 600;
  color: #1e2a3a;
  font-size: 0.85rem;
}

.portfolio-card--compact .stat-band-value {
  font-size: 0.74rem;
  line-height: 1.25;
}

.portfolio-card--compact .pill {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
}

.low-stock-dashboard-card .card-header {
  padding: 0.5rem 0.75rem;
}

.low-stock-dashboard-card .card-header h2 {
  font-size: 0.88rem;
  font-weight: 700;
}

.low-stock-dashboard-card .table {
  font-size: 0.8125rem;
}

.low-stock-dashboard-card .table th {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
}

.low-stock-dashboard-card .table td {
  padding: 0.35rem 0.65rem;
  vertical-align: middle;
}

.low-stock-dashboard-card .table td strong {
  font-weight: 600;
  font-size: 0.8125rem;
}

.low-stock-dashboard-card .table td .text-muted {
  font-size: 0.75rem;
}

.low-stock-dashboard-card .badge {
  font-size: 0.65rem;
  font-weight: 600;
}

.low-stock-dashboard-card .btn-sm {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}

.low-stock-dashboard-card .table-responsive {
  max-height: 220px;
  overflow-y: auto;
}

.dash-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0;
}

/* Back navigation — same visual weight as Cancel (btn-secondary) */
.btn-back,
a.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
  text-decoration: none;
}

.pill-blue { color: #0d6efd; border-color: #0d6efd; background: #eff6ff; }
.pill-green { color: #198754; border-color: #198754; background: #ecfdf5; }
.pill-red { color: #dc3545; border-color: #dc3545; background: #fef2f2; }
.pill-purple { color: #6f42c1; border-color: #6f42c1; background: #f3e8ff; }

.progress-thin {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  margin: 0.35rem 0;
  overflow: hidden;
}

.dash-metric .progress-thin {
  height: 4px;
  margin: 0.2rem 0 0;
  border-radius: 2px;
}

.progress-thin > span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: #198754;
  border-radius: 3px;
}

.progress-thin--danger > span {
  background: #dc3545;
}

.progress-thin--info > span {
  background: #0d6efd;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.mini-metric {
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.65rem;
  color: #64748b;
}

.mini-metric strong {
  display: block;
  font-size: 0.8rem;
  color: #1e2a3a;
  margin-top: 0.15rem;
}

/* —— Hub —— */
.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-header p {
  color: #64748b;
  font-size: 0.9rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.hub-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.hub-card .hub-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.hub-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.hub-card p {
  font-size: 0.85rem;
  color: #64748b;
  flex: 1;
  margin-bottom: 1rem;
}

.hub-card .entity-tag {
  font-size: 0.65rem;
  color: #0d6efd;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.hub-card .btn-form {
  width: 100%;
  border: 1px solid #0d6efd;
  color: #0d6efd;
  background: #fff;
  padding: 0.45rem;
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: center;
  text-decoration: none;
  display: block;
}

.hub-card .btn-form:hover {
  background: #eff6ff;
  color: #0d6efd;
}

a.hub-card.hub-card-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
}

a.hub-card.hub-card-link:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  color: inherit;
}

a.hub-card.hub-card-link:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* —— List / filters —— */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.list-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-panel {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.table-wrap {
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.admin-form-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.admin-form-card .card-header {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 1.25rem;
}

.admin-form-card .card-body {
  padding: 1.25rem;
}

/* —— Entity list + form (single page, AB-MATIC pattern) —— */
.entity-page {
  max-width: 100%;
}

.entity-back-link {
  font-size: 0.85rem;
  color: #6c757d;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.entity-back-link:hover {
  color: #495057;
  text-decoration: underline;
}

.entity-page-header {
  margin-bottom: 1.75rem;
}

.entity-page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #1e2a3a;
}

.entity-page-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.entity-form-panel {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 2.5rem;
  box-shadow: var(--card-shadow);
}

.entity-form-panel-title {
  font-size: 1rem;
  font-weight: 700;
  padding: 1rem 1.5rem;
  margin: 0;
  border-bottom: 1px solid #e9ecef;
  color: #1e2a3a;
}

.entity-form-panel-body {
  padding: 1.5rem;
}

.entity-grid-panel {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.entity-grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.entity-grid-toolbar h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #1e2a3a;
  flex: 0 0 auto;
}

.entity-grid-search {
  flex: 1 1 320px;
  min-width: 240px;
  max-width: none;
}

.entity-grid-search .input-group {
  width: 100%;
}

.entity-grid-search-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #495057;
  background: #f8f9fa;
  border-right: none;
  white-space: nowrap;
}

.entity-grid-search .form-control {
  border-left: none;
  border-right: none;
}

.entity-grid-search-icon {
  background: #fff;
  color: #64748b;
  border-left: none;
  cursor: pointer;
}

button.entity-grid-search-icon {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  line-height: 1;
}

button.entity-grid-search-icon:hover {
  color: #0d6efd;
  background: #f8f9fa;
}

button.entity-grid-search-icon:focus {
  outline: none;
  box-shadow: none;
  border-color: #86b7fe;
  color: #0d6efd;
}

.entity-grid-search .form-control:focus {
  box-shadow: none;
  border-color: #ced4da;
}

.entity-grid-search .form-control:focus + .entity-grid-search-icon {
  border-color: #86b7fe;
}

.entity-empty-row td {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 1.5rem !important;
}

.entity-form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.entity-form-card-header h2 {
  margin: 0;
  flex: 1 1 auto;
}

.admin-export-dropdown {
  position: relative;
  flex-shrink: 0;
}

.admin-export-btn {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 7.5rem;
}

.admin-export-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 1050;
  min-width: 10rem;
  padding: 0.35rem 0;
  margin: 0;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.admin-export-menu .dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.45rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  text-align: left;
  color: #212529;
}

.admin-export-menu .dropdown-item:hover {
  background: #f8f9fa;
}

/* —— AB-MATIC form density (css_abmatic + mock-admin) —— */
.admin-content .entity-form-card .card-header {
  padding: 0.75rem 1.25rem;
}

.admin-content .entity-form-card .card-body {
  padding: 1rem 1.25rem;
}

.admin-content .entity-form-fields {
  width: 100%;
  max-width: none;
}

/* Alias kept for pages that still opt in (e.g. ProductList). */
.admin-content .entity-form-fields.entity-form-fields-wide {
  max-width: none;
  width: 100%;
}

.admin-content .entity-form-fields .form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  color: #495057;
}

.admin-content .entity-form-fields .form-control,
.admin-content .entity-form-fields .form-select,
.admin-content .entity-form-fields textarea.form-control {
  font-size: 0.875rem;
  padding: 0.375rem 0.625rem;
}

.admin-content .entity-form-fields .form-control-sm,
.admin-content .entity-form-fields .form-select-sm {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
}

.admin-content .entity-form-fields .form-check-label {
  font-size: 0.875rem;
}

.admin-content .entity-form-fields .form-text,
.admin-content .entity-form-fields small.text-muted {
  font-size: 0.75rem;
}

.admin-content .entity-grid-card {
  margin-bottom: 1.25rem;
  background: #fff;
}

.admin-content .entity-grid-card .card-header {
  padding: 0.75rem 1.25rem;
}

.admin-content .entity-grid-card .table-responsive {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  border-top: 1px solid #e9ecef;
  border-bottom: 1px solid #e9ecef;
}

.admin-content .entity-grid-card .table-responsive thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-content .entity-grid-card .admin-grid-pagination {
  border-top: 1px solid #dee2e6;
  background: #f8f9fa !important;
}

.admin-content .entity-grid-card .form-control {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
}

/* AB-MATIC validation (from css_abmatic/validation.css) */
.admin-content .form-control.is-invalid,
.admin-content .form-select.is-invalid {
  border-color: #dc3545;
}

.admin-content .validation-error-highlight {
  border-color: #dc3545 !important;
  background-color: #fff5f5 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* AB-MATIC entity card headers (from css_abmatic/site.css) */
.card-header-catalog {
  background-color: #e3f2fd !important;
  color: #0d47a1 !important;
  border-bottom: 1px solid #bbdefb !important;
}

/* —— Login (AB-MATIC-branded) —— */
.admin-login-page {
  min-height: 100vh;
  background: var(--content-bg);
  font-family: "Segoe UI", system-ui, sans-serif;
}

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

.admin-login-aside {
  width: 320px;
  flex-shrink: 0;
  background: var(--nav-bg);
  color: #b8c5d6;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.admin-brand--login {
  margin: 0 0 1.5rem;
}

.admin-login-tagline {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  color: #94a3b8;
}

.admin-login-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-login-features li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0;
  font-size: 0.875rem;
}

.admin-login-features .oi {
  opacity: 0.85;
}

.admin-login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.admin-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 2rem;
}

.admin-login-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #1e2a3a;
}

.admin-login-card .login-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .admin-login-shell {
    flex-direction: column;
  }

  .admin-login-aside {
    width: 100%;
    padding: 1.25rem;
  }

  .admin-login-main {
    padding: 1.25rem;
  }
}

/* —— Audit log —— */
.audit-filter-card .card-body {
  padding: 1rem 1.25rem;
}

.audit-action-badge {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

.audit-badge-create { background: #198754; }
.audit-badge-update { background: #0d6efd; }
.audit-badge-delete { background: #dc3545; }
.audit-badge-login { background: #0d6efd; }
.audit-badge-login-failed { background: #dc3545; }
.audit-badge-logout { background: #6c757d; }
.audit-badge-report { background: #6f42c1; }
.audit-badge-checkout { background: #20c997; }
.audit-badge-payment { background: #fd7e14; }
.audit-badge-payment-expired { background: #dc3545; }
.audit-badge-order-cancelled { background: #dc3545; }
.audit-badge-password { background: #6610f2; }
.audit-badge-stock { background: #e67e22; }
.audit-badge-default { background: #495057; }

.audit-detail-json {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.75rem;
  font-size: 0.8125rem;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0;
}

.audit-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
