:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f8fafc;
  --green: #2fa451;
  --green-dark: #238a42;
  --danger: #b91c1c;
  --brand: #592d3d;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.header {
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(14px, 3vw, 28px);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-logo {
  display: block;
  width: 205px;
  height: auto;
  flex: 0 1 205px;
}
.header-title {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.header-actions { flex: 0 0 auto; display:flex; align-items:center; gap:10px; }
.logout-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #374151;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
}
.logout-btn:hover { background: var(--soft); }

.container { width: min(1200px, calc(100% - 32px)); margin: 30px auto; }
.mobile-container { width: min(720px, calc(100% - 28px)); margin: 24px auto 140px; }
.login-wrap { width: min(560px, calc(100% - 32px)); margin: 56px auto; }
.login-logo { display:block; width:min(255px, 78vw); height:auto; margin:0 auto 36px; }

h2 { font-size: 34px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.field { margin: 28px 0; }
.field label { display:block; margin-bottom: 10px; font-size: 18px; color: #374151; }
.input {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd6df;
  border-radius: 12px;
  padding: 17px 18px;
  font-size: 21px;
  outline: none;
  background:#fff;
}
.input:focus { border-color: #9ca3af; box-shadow: 0 0 0 3px rgba(47,164,81,.08); }
.btn { border: 0; border-radius: 12px; padding: 15px 18px; font-weight: 700; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-wide { width: 100%; font-size: 20px; }
.error { color: var(--danger); min-height: 24px; margin-top: 12px; }
.success { background:#ecfdf3; color:#166534; border:1px solid #bbf7d0; padding:12px 14px; border-radius:10px; margin:12px 0; }

.section-title { font-size: 29px; margin: 42px 0 14px; }
.product-row {
  width: 100%;
  border-top: 1px solid var(--line);
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.product-info { min-width: 0; flex: 1 1 auto; padding-right: 4px; }
.product-name { font-size: 21px; font-weight: 700; line-height: 1.25; overflow-wrap:anywhere; }
.product-price { color: var(--muted); margin-top: 5px; font-size: 18px; }
.stepper {
  display:grid;
  grid-template-columns: 54px 54px 54px;
  border:1px solid #d5dbe3;
  border-radius:12px;
  overflow:hidden;
  flex:0 0 auto;
}
.stepper button, .stepper span {
  width: 54px;
  height: 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  background:#f8fafc;
  font-size:24px;
}
.stepper span { background:#fff; font-weight:700; border-left:1px solid #d5dbe3; border-right:1px solid #d5dbe3; }

.checkout { position: fixed; left:0; right:0; bottom:0; background:#fff; border-top:1px solid var(--line); padding:16px 18px 20px; z-index:25; }
.checkout-inner { width:min(720px, 100%); margin:auto; }
.total-line { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:24px; font-weight:800; margin-bottom:12px; }

.toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:24px; }
.toolbar-actions { display:flex; gap:10px; flex-wrap:wrap; }
.badge { background:#e8f7ed; color:#1d7b3b; border-radius:999px; padding:7px 12px; font-weight:700; font-size:14px; white-space:nowrap; }
.orders-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px; }
.order-card { min-width:0; border:1px solid #dbe1e8; border-radius:12px; padding:22px; background:#fff; }
.order-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; border-bottom:1px solid var(--line); padding-bottom:14px; }
.order-head strong { font-size:25px; overflow-wrap:anywhere; }
.order-time { color:var(--muted); font-size:18px; white-space:nowrap; }
.order-items { padding:16px 0; min-height:110px; }
.order-item { font-size:20px; margin:7px 0; overflow-wrap:anywhere; }
.order-total { border-top:1px solid var(--line); padding-top:16px; margin-bottom:14px; font-size:20px; font-weight:800; }
.empty { color:var(--muted); border:1px dashed #d1d5db; border-radius:12px; padding:28px; text-align:center; }

.table-wrap { overflow-x:auto; border:1px solid #dbe1e8; border-radius:12px; }
table { border-collapse:collapse; width:100%; min-width:720px; }
th, td { padding:20px 24px; border-bottom:1px solid var(--line); text-align:left; }
th { color:var(--muted); background:#fbfcfd; }
tr:last-child td { border-bottom:0; }
.switch { position:relative; width:58px; height:32px; display:inline-block; vertical-align:middle; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; inset:0; border-radius:999px; background:#d1d5db; transition:.18s; }
.slider:before { content:""; position:absolute; width:24px; height:24px; left:4px; top:4px; background:#fff; border-radius:50%; transition:.18s; box-shadow:0 1px 3px rgba(0,0,0,.15); }
.switch input:checked + .slider { background:var(--green); }
.switch input:checked + .slider:before { transform:translateX(26px); }
.history-list { display:grid; gap:12px; }
.history-card { border:1px solid var(--line); border-radius:10px; padding:16px; }
.hidden { display:none !important; }

@media (max-width: 780px) {
  .header { min-height:72px; gap:12px; padding:8px 14px; }
  .header-logo { width:155px; flex-basis:155px; }
  .header-title { font-size:20px; }
  .orders-grid { grid-template-columns:1fr; }
  .container { margin-top:20px; }
  .toolbar { align-items:flex-start; flex-direction:column; }
}

@media (max-width: 560px) {
  .header {
    position: static;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px 12px;
  }
  .header-logo { width:150px; flex:0 0 150px; }
  .header-actions { margin-left:auto; }
  .header-title {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    font-size: clamp(24px, 8vw, 31px);
    padding-top: 8px;
  }
  .logout-btn { padding:8px 10px; font-size:13px; }
  .mobile-container { width: calc(100% - 28px); margin-top:18px; }
  .section-title { font-size:27px; margin-top:36px; }
  .product-name { font-size:19px; }
  .product-price { font-size:17px; }
  .stepper { grid-template-columns:44px 44px 44px; }
  .stepper button, .stepper span { width:44px; height:50px; font-size:22px; }
  .total-line { font-size:22px; }
}

@media (max-width: 390px) {
  .mobile-container { width: calc(100% - 22px); }
  .product-row { gap:8px; }
  .product-name { font-size:18px; }
  .stepper { grid-template-columns:40px 40px 40px; }
  .stepper button, .stepper span { width:40px; height:48px; font-size:21px; }
  .checkout { padding-left:11px; padding-right:11px; }
}
