:root {
  --bg: #f8f6ef;
  --panel: #ffffff;
  --line: #ead9aa;
  --text: #1f1a12;
  --muted: #6c614e;
  --primary: #c99a2e;
  --primary-dark: #a67a1f;
  --soft: #fff7e3;
  --danger: #b42318;
  --success: #0f8a4b;
  --shadow: 0 18px 40px rgba(93, 70, 17, 0.10);
  --radius: 20px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fffdf7 0%, #f7f2e6 100%);
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select {
  transition: background-color .22s ease, border-color .22s ease, color .22s ease, box-shadow .22s ease, transform .16s ease, opacity .22s ease;
}
.hidden { display: none !important; }
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #1f180f;
  color: #f8ecd0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: transform .26s ease, box-shadow .26s ease;
}
.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
}
.brand-box p,
.sidebar-foot p {
  margin: 4px 0 0;
  color: #d9c9a3;
  font-size: 0.92rem;
}
.sidebar-nav {
  display: grid;
  gap: 10px;
}
.sidebar-logout {
  width: 100%;
}
.sidebar-nav button {
  background: rgba(255,255,255,0.06);
  color: #f8ecd0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transform: translateY(0);
}
.sidebar-nav button:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.14);
}
.sidebar-nav button:active {
  transform: translateY(1px) scale(0.995);
}
.sidebar-nav button.active {
  background: linear-gradient(135deg, #c99a2e, #e6bd59);
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(201, 154, 46, 0.24);
}
.sidebar-nav button[data-role="admin"]::after {
  content: "Admin";
  float: right;
  font-size: 0.74rem;
  opacity: 0.8;
}
.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}
.main-content {
  padding: 28px;
}

.sidebar.hidden {
  display: none;
}

.app-shell.login-mode {
  grid-template-columns: 1fr;
}
.login-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.view {
  display: none;
}

.view.active {
  display: block;
}
.login-card {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px;
}
.login-head h1,
.topbar h2,
.panel-head h3 {
  margin: 10px 0 8px;
}
.kicker {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 700;
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-form.one-col,
.grid-form.narrow,
.grid-form.narrow-order-form {
  grid-template-columns: 1fr;
}
label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}
input, textarea, select {
  width: 100%;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: 0 1px 0 rgba(31, 26, 18, 0.02);
}
input[readonly] {
  background: #f8f3e6;
  color: #6c614e;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(201, 154, 46, 0.18);
  border-color: #d7b159;
}
.primary-btn,
.ghost-btn {
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 700;
  min-height: 46px;
  transform: translateY(0);
  will-change: transform;
}
.primary-btn {
  background: linear-gradient(135deg, var(--primary), #e5bc57);
  color: white;
  box-shadow: 0 12px 24px rgba(201, 154, 46, 0.22);
}
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(201, 154, 46, 0.28);
}
.primary-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 8px 18px rgba(201, 154, 46, 0.2);
}
.ghost-btn {
  background: #fffdf8;
  border-color: var(--line);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(31, 26, 18, 0.04);
}
.ghost-btn:hover {
  background: #fff7e6;
  border-color: #dfbe6e;
  transform: translateY(-1px);
}
.ghost-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 4px 12px rgba(31, 26, 18, 0.05);
}
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.sidebar-nav button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(201, 154, 46, 0.18);
}
.hint-box {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.status-text { margin: 0; color: var(--muted); }
.hero-strip {
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid #f0e1b4;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff8e8, #fffdf7);
  box-shadow: 0 12px 30px rgba(93, 70, 17, 0.08);
}
.hero-strip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}
.hero-strip p,
.topbar-subtitle {
  margin: 0;
  color: var(--muted);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.menu-button {
  display: none;
}
.topbar-actions {
  display: flex;
  gap: 12px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(93, 70, 17, 0.13);
}
.stat-card strong {
  display: block;
  font-size: 1.7rem;
  margin: 8px 0 4px;
}
.stat-card span { color: var(--muted); }
.panel-grid {
  display: grid;
  gap: 20px;
}
.panel-grid.two-col {
  grid-template-columns: 1fr 1fr;
}
.panel {
  padding: 22px;
}
.wide-panel {
  width: 100%;
}
.panel-head,
.wrap-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.flow-list {
  display: grid;
  gap: 12px;
  color: var(--muted);
  padding-left: 18px;
}
.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.full-span {
  grid-column: 1 / -1;
}
.orders-mobile-list {
  display: none;
}
.orders-desktop-wrap {
  display: block;
}
.orders-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}
.orders-table th,
.orders-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0e7cd;
  text-align: left;
  vertical-align: top;
}
.orders-table th {
  color: var(--muted);
  font-size: 0.9rem;
}
.badge-status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.status-pending { background: #fff2d4; color: #9b6900; }
.status-processing { background: #dff1ff; color: #005ea6; }
.status-done { background: #dcfce7; color: #166534; }
.status-error { background: #fee2e2; color: #991b1b; }
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.recent-list,
.admin-users-list {
  display: grid;
  gap: 12px;
}
.recent-item,
.user-item {
  padding: 14px;
  border: 1px solid #f0e7cd;
  border-radius: 16px;
  background: #fffdf9;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.recent-item:hover,
.user-item:hover {
  transform: translateY(-1px);
  border-color: #e4c77a;
  box-shadow: 0 12px 22px rgba(93, 70, 17, 0.08);
}
.recent-item small,
.user-item small { color: var(--muted); }
.top-gap { margin-top: 14px; }
.order-delete-btn {
  padding: 8px 12px;
}
.empty-state {
  padding: 28px 20px;
  border: 1px dashed #e2c980;
  border-radius: 18px;
  background: #fffdf8;
  text-align: center;
}
.empty-state strong {
  display: block;
  margin-bottom: 8px;
}
.order-card-mobile {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #efdfb1;
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 12px 24px rgba(93, 70, 17, 0.06);
}
.order-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.order-card-top p {
  margin: 6px 0 0;
  color: var(--muted);
}
.order-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.order-meta-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .82rem;
}
.order-meta-grid strong {
  display: block;
  line-height: 1.4;
}
.order-card-actions {
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .stats-grid,
  .panel-grid.two-col,
  .grid-form {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: calc(100vw - 48px);
    z-index: 30;
    transform: translateX(0);
    transition: transform .24s ease, box-shadow .24s ease;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.22);
  }
  .sidebar.hidden {
    display: flex !important;
    transform: translateX(-100%);
  }
  .main-content {
    padding: 16px;
  }
  .menu-button {
    display: inline-flex;
  }
  .topbar,
  .panel-head,
  .wrap-head,
  .filters,
  .action-row,
  .order-card-top {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-left-group {
    justify-content: space-between;
  }
  .orders-mobile-list {
    display: grid;
    gap: 12px;
  }
  .orders-desktop-wrap {
    display: none;
  }
  .order-meta-grid {
    grid-template-columns: 1fr;
  }
}
