:root {
  --bg: #f4efe7;
  --panel: #fffaf3;
  --panel-strong: #f2e2c7;
  --text: #2f2418;
  --muted: #77624c;
  --accent: #b4572f;
  --accent-dark: #8d3f1d;
  --border: #dcc5aa;
  --error-bg: #ffe6df;
  --error-text: #8d2c13;
  --shadow: 0 20px 45px rgba(93, 62, 26, 0.12);
  --radius: 20px;
  --font-main: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(180, 87, 47, 0.18), transparent 30%),
    linear-gradient(180deg, #fbf7f1 0%, var(--bg) 100%);
}

.modal-open {
  overflow: hidden;
}

.sidebar-open {
  overflow: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(251, 247, 241, 0.9);
  border-bottom: 1px solid rgba(220, 197, 170, 0.8);
}

.app-header__inner {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header__menu-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 14px;
  background: #3d3126;
}

.app-header__menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  border-radius: 999px;
  background: #fff;
}

.app-header__title {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-header__userbox {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-header__userinfo {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.app-header__userinfo span {
  color: var(--muted);
  font-size: 0.92rem;
}

.app-header__role {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--accent-dark) !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 24px));
  height: 100vh;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.sidebar-open .app-sidebar {
  transform: translateX(0);
}

.app-sidebar__inner {
  height: 100%;
  padding: 24px 20px;
  background: linear-gradient(180deg, #2c2218 0%, #1d1711 100%);
  color: #f6ead6;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.app-sidebar__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.app-sidebar__copy {
  margin: 0;
  color: rgba(246, 234, 214, 0.78);
  line-height: 1.6;
}

.app-sidebar__close {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.app-sidebar__close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.app-sidebar__nav {
  display: grid;
  gap: 8px;
}

.app-sidebar__link {
  display: block;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #f6ead6;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.app-sidebar__link:hover,
.app-sidebar__link.is-active {
  background: rgba(180, 87, 47, 0.2);
  border-color: rgba(180, 87, 47, 0.6);
  transform: translateX(2px);
}

.app-sidebar__overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(20, 14, 10, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-open .app-sidebar__overlay {
  opacity: 1;
  pointer-events: auto;
}

h1,
h2,
p {
  margin-top: 0;
}

.dashboard-layout {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.brand-kicker {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.brand-kicker--header {
  margin-bottom: 8px;
}

.brand-kicker--sidebar {
  margin-bottom: 10px;
  background: rgba(242, 226, 199, 0.12);
  color: #f2d6b6;
}

.dashboard-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

button {
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: #3d3126;
}

.secondary-button:hover {
  background: #241b14;
}

.alert {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.alert-success {
  background: #e5f7ea;
  color: #1f6b36;
}

.dashboard-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.table-card,
.form-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-card__header {
  padding: 20px 24px 0;
}

.filters-bar {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.filters-bar__search {
  min-width: 0;
}

.filters-bar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-scroll {
  overflow-x: auto;
  padding: 20px 24px 24px;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(220, 197, 170, 0.75);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-muted {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill--ok {
  background: #e5f7ea;
  color: #1f6b36;
}

.status-pill--off {
  background: #fbe6e1;
  color: #8d2c13;
}

.status-pill--wait {
  background: #fff1d9;
  color: #8a5a0a;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.form-card {
  padding: 28px;
}

.product-form {
  display: grid;
  gap: 24px;
}

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

.form-field {
  display: grid;
  gap: 8px;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-actions--compact {
  justify-content: flex-start;
}

.ghost-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 820px) {
  .app-header__inner,
  .app-header__userbox {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-header__userinfo {
    justify-items: start;
    text-align: left;
  }

  .app-header__left {
    width: 100%;
  }

  .dashboard-topbar {
    flex-direction: column;
  }

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

  .filters-bar {
    grid-template-columns: 1fr;
  }

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