* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: #e9edf3;
  color: #13294b;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: #e9edf3;
}

/* SIDEBAR */
.sidebar-dark {
  width: 250px;
  background: linear-gradient(180deg, #041126 0%, #06142f 100%);
  color: #fff;
  padding: 22px 18px;
  flex-shrink: 0;
}

.sidebar-brand-wrap {
  margin-bottom: 32px;
}

.sidebar-brand {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.sidebar-role-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #9ab0d3;
}

.modern-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modern-sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 0 16px;
  border-radius: 14px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
}

.modern-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.modern-sidebar-nav a.active {
  background: #3167e3;
  color: #ffffff;
  font-weight: 700;
}

/* MAIN */
.main-layout {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.top-header-bar {
  height: 92px;
  background: #ffffff;
  border-bottom: 1px solid #d9e0ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.top-header-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.top-panel-title {
  font-size: 22px;
  font-weight: 700;
  color: #13294b;
  line-height: 1.1;
}

.top-panel-subtitle {
  font-size: 15px;
  color: #5d718c;
  line-height: 1.2;
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user-block {
  text-align: right;
  line-height: 1.1;
}

.header-user-name {
  font-size: 17px;
  font-weight: 700;
  color: #13294b;
}

.header-user-role {
  font-size: 13px;
  color: #5d718c;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 22px;
  border: 1px solid #c6cfdb;
  border-radius: 15px;
  background: #f8f8f8;
  color: #13294b;
  font-size: 15px;
  font-weight: 500;
}

/* CONTENT AREA */
.content-area {
  padding: 24px 26px;
}

.page-section-header {
  margin-bottom: 20px;
}

.page-section-header h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  color: #13294b;
}

.page-section-header p {
  margin: 0;
  font-size: 15px;
  color: #5d718c;
}

/* DASHBOARD */
.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.dashboard-stat-card {
  min-height: 144px;
  background: #ffffff;
  border: 1px solid #d6dde8;
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-stat-card-small {
  max-width: 280px;
}

.dashboard-stat-label {
  font-size: 14px;
  color: #687c95;
  margin-bottom: 12px;
}

.dashboard-stat-value {
  font-size: 34px;
  font-weight: 700;
  color: #13294b;
}

.content-panel,
.products-table-panel {
  background: #ffffff;
  border: 1px solid #d6dde8;
  border-radius: 20px;
  padding: 22px;
}

.content-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.content-panel-header h2 {
  margin: 0;
  font-size: 18px;
  color: #13294b;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  height: 42px;
  border-radius: 14px;
  background: #f3f5f8;
  color: #a0aabd;
  font-size: 15px;
}

/* PRODUCTS TOOLBAR */
.products-toolbar-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.products-search-form {
  flex: 1;
  max-width: 565px;
}

.products-search-input {
  width: 100%;
  height: 58px;
  border: 1px solid #ccd5e2;
  border-radius: 16px;
  padding: 0 20px;
  background: #ffffff;
  font-size: 16px;
  color: #223a59;
}

.products-search-input::placeholder {
  color: #6c7f98;
}

.filter-button {
  min-width: 90px;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: #f2f2f2;
  color: #13294b;
  font-size: 16px;
  cursor: pointer;
}

.products-results-line {
  margin-bottom: 16px;
  font-size: 15px;
  color: #314966;
}

/* FILTER PANEL */
.filter-panel-modern {
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid #d6dde8;
  border-radius: 18px;
  padding: 18px;
}

.filter-panel-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: #223a59;
}

.filter-group select {
  height: 42px;
  border: 1px solid #ccd5e2;
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* TABLE PANEL */
.products-table-panel {
  padding: 22px 24px;
}

.table-wrap {
  overflow-x: auto;
}

.dashboard-table,
.products-table-clean {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-table thead th,
.products-table-clean thead th {
  background: #f8fafc;
  border-bottom: 1px solid #d9e0ea;
  color: #13294b;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 18px 16px;
  white-space: nowrap;
}

.dashboard-table tbody td,
.products-table-clean tbody td {
  border-bottom: 1px solid #dfe5ee;
  padding: 18px 16px;
  font-size: 15px;
  color: #223a59;
  vertical-align: middle;
  line-height: 1.25;
}

.dashboard-table tbody tr:last-child td,
.products-table-clean tbody tr:last-child td {
  border-bottom: none;
}

.checkbox-col {
  width: 42px;
}

.product-col-wide {
  min-width: 540px;
}

/* STOCK */
.stock-badge {
  min-width: 40px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.stock-badge-high {
  background: #d8f2df;
  color: #16803e;
}

.stock-badge-low {
  background: #fde2e2;
  color: #b42318;
}

.stock-inline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-control-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #bdc7d6;
  border-radius: 11px;
  background: #ffffff;
  color: #13294b;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
}

/* PAGINATION */
.pagination-modern {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.page-info-modern {
  font-size: 14px;
  color: #4c627f;
}

/* COMMON */
.empty-state {
  text-align: center;
  padding: 28px 0;
  color: #6d7f98;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: #3167e3;
  color: #fff;
}

.btn-secondary {
  background: #475569;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-light {
  background: #eef1f5;
  color: #13294b;
  border: 1px solid #d3dbe6;
}

.btn-success {
  background: #16a34a;
  color: #fff;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.action-message {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.action-message.info {
  background: #dbeafe;
  color: #1d4ed8;
}

.action-message.success {
  background: #dcfce7;
  color: #166534;
}

.action-message.error {
  background: #fee2e2;
  color: #991b1b;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9edf3;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  padding: 32px;
  border-radius: 18px;
  border: 1px solid #d7dde8;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.login-card h1 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #13294b;
}

.login-subtext {
  color: #6b7280;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group input,
.form-group select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.user-form .form-group {
  margin-bottom: 16px;
}

.user-form input,
.user-form select {
  width: 100%;
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 12px;
}

.json-preview {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: Consolas, monospace;
  font-size: 12px;
  max-width: 320px;
}

@media (max-width: 1280px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-col-wide {
    min-width: 360px;
  }
}

@media (max-width: 900px) {
  .sidebar-dark {
    width: 220px;
  }

  .top-header-bar {
    height: auto;
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .top-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-stat-grid {
    grid-template-columns: 1fr;
  }

  .products-toolbar-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .products-search-form {
    max-width: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar-dark {
    width: 100%;
  }

  .content-area {
    padding: 18px;
  }

  .page-section-header h1 {
    font-size: 30px;
  }
}