:root {
  --sirb-green: #1e5631;
  --sirb-green-dark: #123a1f;
  --sirb-orange: #f5941e;
  --sirb-orange-dark: #d97e0a;
  --sirb-gold: #e8b923;
  --sirb-white: #ffffff;
  --sirb-gray: #f4f6f4;
  --sirb-text: #232823;
  --shadow: 0 2px 10px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--sirb-gray);
  color: var(--sirb-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---------- Header ---------- */
.site-header {
  background: var(--sirb-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--sirb-green);
  font-weight: 800;
  font-size: 1.3rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand img { height: 60px; width: auto; }
.brand-text { line-height: 1.15; }

.cart-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.header-username {
  font-weight: 700;
  color: var(--sirb-green);
  font-size: 0.82rem;
  white-space: nowrap;
}

.header-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  box-shadow: var(--shadow);
  border-radius: 24px;
  overflow: hidden;
}
.header-search input {
  flex: 1;
  border: none;
  padding: 10px 16px;
  font-size: 0.92rem;
  outline: none;
  min-width: 0;
}
.header-search button {
  border: none;
  padding: 0 18px;
  background: var(--sirb-green);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}
.header-search button:hover { background: var(--sirb-green-dark); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* Account dropdown */
.account-dropdown { position: relative; }
.account-dropdown summary {
  list-style: none;
  cursor: pointer;
}
.account-dropdown summary::-webkit-details-marker { display: none; }
.account-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  box-shadow: var(--shadow);
  border-radius: 8px;
  overflow: hidden;
  min-width: 160px;
  z-index: 60;
}
.account-dropdown .dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--sirb-green);
  font-weight: 600;
  font-size: 0.9rem;
}
.account-dropdown .dropdown-menu a:hover { background: var(--sirb-gray); color: var(--sirb-orange); }

/* Referral bonus summary disclosure */
.bonus-summary { text-align: right; }
.bonus-summary summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--sirb-green);
  font-size: 0.92rem;
}
.bonus-summary summary::-webkit-details-marker { display: none; }
.bonus-summary .view-link { color: var(--sirb-orange); font-weight: 800; }
.bonus-breakdown {
  background: white;
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 10px;
  text-align: left;
  min-width: 220px;
}

/* ---------- Body layout: sidebar + main, footer always pinned ---------- */
.site-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  width: 100%;
}
.site-main { flex: 1; min-width: 0; }

.client-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--sirb-green-dark);
  color: white;
  position: relative;
  transition: width 0.15s ease;
}
.client-sidebar.collapsed { width: 44px; }
.client-sidebar.collapsed .sidebar-nav { display: none; }
.sidebar-toggle {
  position: absolute;
  top: 14px;
  right: 10px;
  background: rgba(255,255,255,0.12);
  color: white;
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 0.9rem;
}
.client-sidebar.collapsed .sidebar-toggle { right: 9px; transform: rotate(180deg); }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding-top: 60px;
}
.sidebar-nav a, .sidebar-nav .sidebar-logout {
  display: block;
  color: #d9ecd9;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
}
.sidebar-nav a:hover, .sidebar-nav .sidebar-logout:hover { background: rgba(255,255,255,0.08); color: var(--sirb-orange); }

/* ---------- Back link ---------- */
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--sirb-green);
  font-weight: 700;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--sirb-orange); }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.92rem;
  transition: filter .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-orange { background: var(--sirb-orange); color: white; }
.btn-orange:hover { filter: brightness(1.07); }
.btn-green { background: var(--sirb-green); color: white; }
.btn-green:hover { filter: brightness(1.15); }
.btn-outline-green { background: transparent; color: var(--sirb-green); border: 2px solid var(--sirb-green); }
.btn-outline-green:hover { background: var(--sirb-green); color: white; }
.btn-ticket {
  background: var(--sirb-green-dark);
  color: white;
  position: relative;
}
.btn-ticket .badge {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--sirb-orange);
  color: white;
  font-size: 0.7rem;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}

/* ---------- Search ---------- */
.search-wrap {
  max-width: 700px;
  margin: 28px auto 6px;
  padding: 0 20px;
}
.search-bar {
  width: 100%;
  display: flex;
  box-shadow: var(--shadow);
  border-radius: 30px;
  overflow: hidden;
}
.search-bar input {
  flex: 1;
  border: none;
  padding: 16px 22px;
  font-size: 1.05rem;
  outline: none;
}
.search-bar button {
  border: none;
  padding: 0 26px;
  background: var(--sirb-green);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.search-bar button:hover { background: var(--sirb-green-dark); }

/* ---------- Layout ---------- */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.category-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 26px;
}
.category-pills a {
  background: white;
  padding: 7px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sirb-green);
}
.category-pills a.active, .category-pills a:hover {
  background: var(--sirb-green);
  color: white;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--sirb-white);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-card .gallery { position: relative; }
.product-card img {
  width: 100%;
  height: 115px;
  object-fit: cover;
  background: #eee;
  display: block;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: white;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}
.gallery-nav.prev { left: 6px; }
.gallery-nav.next { right: 6px; }
.discount-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--sirb-orange);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  z-index: 2;
}
.product-card .price-old { color: #999; font-size: 0.78rem; text-decoration: line-through; margin-top: -4px; }
.product-card .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { margin: 0; font-size: 0.88rem; }
.product-card .price { color: var(--sirb-green); font-weight: 800; font-size: 0.92rem; }
.product-card .actions { margin-top: auto; display: flex; gap: 6px; }
.product-card .actions form, .product-card .actions .btn { flex: 1; text-align: center; padding: 7px 8px; font-size: 0.78rem; }

/* ---------- Forms ---------- */
.form-card {
  max-width: 460px;
  margin: 40px auto;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.form-card h2 { color: var(--sirb-green); margin-top: 0; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; display: block; color: #555; }
.form-links { text-align: center; margin-top: 14px; font-size: 0.9rem; }
.form-links a { color: var(--sirb-orange); font-weight: 700; }

.divider-or { text-align: center; color: #999; margin: 16px 0; font-size: 0.85rem; }

/* ---------- Cards / tables ---------- */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
table.simple-table { width: 100%; border-collapse: collapse; }
table.simple-table th, table.simple-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; }
.totals-row.grand { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--sirb-green); margin-top: 8px; padding-top: 12px; }

.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: white;
}
.status-pending_payment { background: #999; }
.status-unfinished { background: #b08d57; }
.status-proof_uploaded { background: var(--sirb-orange); }
.status-confirmed { background: #2b7bd1; }
.status-completed { background: var(--sirb-green); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--sirb-green-dark);
  color: white;
  padding: 15px 20px;
  margin-top: 50px;
  text-align: center;
  width: 100%;
}
.site-footer p { margin: 0; }
.site-footer a { color: #dfe; }

.messages-list { max-width: 1200px; margin: 14px auto 0; padding: 0 20px; }
.msg-alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 0.9rem; }
.msg-alert.success { background: #e3f4e6; color: #1e5631; }
.msg-alert.error { background: #fbe3e3; color: #a3262f; }
.msg-alert.info { background: #eaf2fb; color: #1c5a91; }

.empty-state { text-align: center; padding: 60px 20px; color: #777; }

/* ---------- Admin Dashboard ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: var(--sirb-green-dark);
  color: white;
  padding: 20px 0;
  flex-shrink: 0;
}
.admin-sidebar .brand-mini {
  color: white; font-weight: 800; padding: 0 20px 20px; display:flex; align-items:center; gap:8px;
  border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 10px;
}
.admin-sidebar .brand-mini img { height: 32px; }
.admin-sidebar a {
  display: flex; align-items: center; justify-content: space-between;
  color: #d9ecd9; padding: 11px 20px; font-weight: 600; font-size: 0.92rem;
}
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,0.08); color: white; border-left: 3px solid var(--sirb-orange); }
.admin-submenu summary {
  display: flex; align-items: center; justify-content: space-between;
  color: #d9ecd9; padding: 11px 20px; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; list-style: none;
}
.admin-submenu summary::-webkit-details-marker { display: none; }
.admin-submenu summary::after {
  content: '\25BE';
  margin-left: 8px;
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}
.admin-submenu[open] summary::after { transform: rotate(180deg); }
.admin-submenu summary:hover, .admin-submenu summary.active { background: rgba(255,255,255,0.08); color: white; }
.admin-submenu .submenu-link {
  display: block; padding: 9px 20px 9px 36px; color: #b9d9bb; font-weight: 600; font-size: 0.86rem;
}
.admin-submenu .submenu-link:hover { background: rgba(255,255,255,0.08); color: var(--sirb-orange); }
.admin-sidebar .nav-badge {
  background: var(--sirb-orange); color:white; border-radius:10px; font-size:0.7rem; padding:1px 7px; font-weight:800;
}
.admin-main { flex: 1; padding: 26px 30px; }
.admin-topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 20px; }
.admin-search { max-width: 360px; }
.admin-search input { width:100%; padding: 10px 14px; border-radius: 8px; border:1px solid #ddd; }

.admin-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.admin-product-card { background:white; border-radius:10px; box-shadow: var(--shadow); overflow:hidden; }
.admin-product-card img { width:100%; height:120px; object-fit:cover; background:#eee; }
.admin-product-card .body { padding: 10px 12px; }

.tab-row { display:flex; gap:8px; margin-bottom:18px; }
.tab-row a { padding:8px 18px; border-radius:8px; background:white; box-shadow:var(--shadow); font-weight:700; color:var(--sirb-green); font-size:0.9rem; }
.tab-row a.active { background: var(--sirb-green); color:white; }

/* ---------- Simple modal (e.g. custom delivery location) ---------- */
.sirb-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.sirb-modal {
  background: white; border-radius: 12px; padding: 24px; max-width: 380px; width: 90%;
  box-shadow: var(--shadow);
}
