
@media (max-width: 600px) {
  .topbar.topbar-cafe {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 84px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(90deg, #b4845c 0%, #e2c2a2 100%);
    position: relative;
    z-index: 10;
  }

  .topbar.topbar-cafe .menu-btn {
    display: block !important;
    font-size: 2.6em;
    background: transparent !important;
    border: none;
    color: #6d3b1a;
    margin: 0;
    padding: 0 12px 0 0;
    cursor: pointer;
    flex: 0 0 auto;
    position: relative;
    z-index: 20; /* keep clickable */
    box-shadow: none !important;
  }

  /* ❌ Hide logo on mobile */
  .topbar.topbar-cafe .logo-cafe {
    display: none !important;
  }

  /* ✅ Café title centered without stretching over buttons */
  .topbar.topbar-cafe .cafe-title {
    display: block !important;
    font-size: 1.6em;
    font-weight: bold;
    color: #fffbe7;
    text-align: center;
    flex: 0 1 auto;         /* shrink-wrap text */
    margin: 0 auto;         /* force center */
    pointer-events: none;   /* ensure no blocking clicks */
    max-width: 60%;         /* prevent it from spanning entire header */
    white-space: nowrap;    /* keep single line */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar.topbar-cafe .logout-btn,
  .topbar.topbar-cafe .logout-margin {
    margin: 0;
    width: auto;
    display: block;
    font-size: 1.2em;
    padding: 10px 16px;
    flex: 0 0 auto;
  }
}

/* --- Section Spacing for Dashboard --- */
.card-grid {
  margin-bottom: 2.5rem;
}

@media (max-width: 767.98px) {
  .card-grid {
    margin-bottom: 1.5rem;
  }
}
/* --- Responsive Card Grid Layout --- */
.card-grid, .dashboard-cards, .product-list, .grid.cards {
  display: grid;
  grid-gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
}

@media (max-width: 991.98px) {
  .card-grid, .dashboard-cards, .product-list, .grid.cards {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 14px;
  }
}

@media (max-width: 767.98px) {
  .card-grid, .dashboard-cards, .product-list, .grid.cards {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 10px;
  }
}

@media (max-width: 480px) {
  .card-grid, .dashboard-cards, .product-list, .grid.cards {
    grid-template-columns: 1fr;
  }
}

/* Utility: Make sure .card inside grid stretches full height */
.card-grid .card, .dashboard-cards .card, .product-list .card, .grid.cards .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
/* --- Topbar Cafe: Inline Layout for Mobile --- */
@media (max-width: 600px) {
  .topbar-cafe {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 4px 8px;
    width: 100vw;
    box-sizing: border-box;
    background: linear-gradient(90deg, #b4845c 0%, #e2c2a2 100%);
    position: relative;
    z-index: 10;
  }
  .menu-btn {
    display: block !important;
    font-size: 2em;
    background: none;
    border: none;
    color: #6d3b1a;
    margin: 0;
    padding: 0 8px 0 0;
    cursor: pointer;
    flex: 0 0 auto;
    order: 1;
  }
  .logo-cafe {
    display: block;
    height: 44px;
    margin: 0 auto;
    flex: 1 1 auto;
    object-fit: contain;
    max-width: 80px;
    order: 2;
  }
  .cafe-title {
    display: none !important;
  }
  .logout-btn {
    margin: 0;
    width: auto;
    display: block;
    font-size: 1em;
    padding: 6px 12px;
    flex: 0 0 auto;
    order: 3;
  }
}
/* --- Cafe Title Hide on Mobile, Topbar Layout Fix --- */
@media (max-width: 575.98px) {
  .cafe-title {
    display: none !important;
  }
  .topbar-cafe {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 4px 8px;
  }
  .logo-cafe {
    margin: 0;
    flex: 0 0 auto;
  }
  .menu-btn {
    display: block !important;
    margin-right: 8px;
    font-size: 1.5em;
    background: none;
    border: none;
    color: inherit;
    padding: 0 8px 0 0;
    cursor: pointer;
  }
  .logout-btn {
    margin: 0 0 0 auto;
    width: auto;
    display: block;
    font-size: 1em;
    padding: 6px 12px;
  }
}
/* --- Enhanced Responsive Breakpoints for All Devices --- */

/* Extra small devices (phones, <576px) */
@media (max-width: 575.98px) {
  .sidebar {
    width: 90vw;
    max-width: 320px;
    font-size: 0.98em;
  }
  .topbar-cafe {
    flex-direction: column;
    min-height: 56px;
    padding: 4px 0;
  }
  .logo-cafe {
    height: 44px;
    margin: 0 auto 4px auto;
  }
  .cafe-title {
    font-size: 1.3rem;
    margin: 0 auto;
  }
  .logout-btn {
    margin: 8px auto 0 auto;
    width: 100%;
    display: block;
  }
  .card, .login-card, .order-records-card {
    margin: 6px 0;
    border-radius: 6px;
    box-shadow: 0 1px 4px #0002;
  }
  .table, .table-cafe {
    font-size: 0.8rem;
  }
  .grid.cols-4 {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .btn, .btn-primary, .btn-success, .btn-dark, .btn-outline-primary {
    font-size: 0.95em;
    padding: 6px 6px;
    min-width: 32px;
    min-height: 32px;
  }
  .input, .login-input, .discount-input, .order-discount-input, .edit-order-name, .edit-order-price, .edit-order-qty, .edit-order-variant {
    font-size: 0.98em;
    padding: 6px 6px;
  }
  .hero, .title, .subtitle {
    text-align: center !important;
    font-size: 1.1em;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .sidebar {
    width: 70vw;
    max-width: 320px;
    font-size: 1em;
  }
  .topbar-cafe {
    flex-direction: row;
    min-height: 60px;
    padding: 6px 0;
  }
  .logo-cafe {
    height: 54px;
  }
  .cafe-title {
    font-size: 1.7rem;
  }
  .card, .login-card, .order-records-card {
    margin: 8px 0;
    border-radius: 8px;
    box-shadow: 0 1px 6px #0002;
  }
  .table, .table-cafe {
    font-size: 0.9rem;
  }
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar {
    width: 220px;
    font-size: 1.05em;
  }
  .app {
    margin-left: 220px;
  }
  .topbar-cafe {
    min-height: 70px;
    padding: 8px 0;
  }
  .logo-cafe {
    height: 64px;
    position:relative;
  }
  .cafe-title {
    font-size: 2.1rem;
  }
  .card, .login-card, .order-records-card {
    margin: 12px 0;
    border-radius: 10px;
    box-shadow: 0 2px 8px #0001;
  }
  .table, .table-cafe {
    font-size: 1rem;
  }
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* Large devices (laptops/desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .sidebar {
    width: 330px;
    font-size: 1.08em;
  }
  .app {
    margin-left: 240px;
  }
  .topbar-cafe {
    min-height: 90px;
    padding: 10px 0;
  }
  .logo-cafe {
    height: 80px;
  }
  .cafe-title {
    font-size: 2.5rem;
  }
  .card, .login-card, .order-records-card {
    margin: 16px 0;
    border-radius: 12px;
    box-shadow: 0 2px 12px #0001;
  }
  .table, .table-cafe {
    font-size: 1.08rem;
  }
  .grid.cols-4 {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .sidebar {
    width: 330px;
    font-size: 1.12em;
  }
  .app {
    margin-left: 260px;
  }
  .topbar-cafe {
    min-height: 100px;
    padding: 12px 0;
  }
  .logo-cafe {
    height: 90px;
  }
  .cafe-title {
    font-size: 2.9rem;
  }
  .card, .login-card, .order-records-card {
    margin: 20px 0;
    border-radius: 16px;
    box-shadow: 0 4px 18px #0001;
  }
  .table, .table-cafe {
    font-size: 1.13rem;
  }
  .grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
  }
}
/* --- Responsive & Mobile-Friendly Improvements --- */

html {
  scroll-behavior: smooth;
}

body {
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* Sidebar responsive */
.sidebar {
  width: 330px;
  min-width: 220px;
  background: #fffbe7;
  box-shadow: 2px 0 12px #0001;
  border-right: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  position: relative;
  z-index: 1100;
  left: 0;
  height: auto;
  transition: none;
  margin-top: 20px; /* space for header */
}
@media (max-width: 600px) {
  .card-grid, .dashboard-cards {
    grid-template-columns: 1fr;
  }
  .product-list, .grid.cards, .menu-grid, .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .sidebar.open {
    left: 0;
  }
  .app {
    margin-left: 0 !important;
  }
}

/* Main app area responsive */
.app {
  margin-left: 240px;
  transition: margin-left 0.3s;
}
@media (max-width: 900px) {
  .app {
    margin-left: 0;
  }
}

/* Topbar responsive */
.topbar-cafe {
  flex-wrap: wrap;
  padding: 0 8px;
}
@media (max-width: 600px) {
  .topbar-cafe {
    flex-direction: column;
    min-height: 70px;
    padding: 8px 0;
  }
  .logo-cafe {
    margin-left: 0;
    height: 60px;
    border-radius: 10px;
  }
  .cafe-title {
    font-size: 2rem;
  }
  .logout-btn {
    margin-right: 0;
    margin-top: 8px;
  }
}

/* Responsive tables */
table {
  width: 100%;
  border-collapse: collapse;
}
.table-cafe th, .table-cafe td {
  white-space: nowrap;
}
.table, .table-cafe {
  font-size: 1rem;
}
@media (max-width: 700px) {
  .table, .table-cafe {
    font-size: 0.92rem;
  }
  .table-cafe th, .table-cafe td {
    padding: 6px 4px;
  }
}
@media (max-width: 500px) {
  .table, .table-cafe {
    font-size: 0.85rem;
  }
  .table-cafe th, .table-cafe td {
    padding: 4px 2px;
  }
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Responsive cards */
.card, .login-card, .order-records-card {
  border-radius: 14px;
  box-shadow: 0 2px 12px #0001;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .card, .login-card, .order-records-card {
    margin: 8px 0;
    border-radius: 8px;
    box-shadow: 0 1px 6px #0002;
  }
}

/* Responsive forms */
form, .login-form, .discount-form, .place-order-form {
  width: 100%;
  max-width: 100vw;
}
.input, .login-input, .discount-input, .order-discount-input, .edit-order-name, .edit-order-price, .edit-order-qty, .edit-order-variant {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  .input, .login-input, .discount-input, .order-discount-input, .edit-order-name, .edit-order-price, .edit-order-qty, .edit-order-variant {
    font-size: 1em;
    padding: 6px 8px;
  }
}

/* Responsive buttons */
.btn, .btn-primary, .btn-success, .btn-dark, .btn-outline-primary {
  min-width: 44px;
  min-height: 36px;
  font-size: 1em;
  border-radius: 8px;
  padding: 6px 14px;
  transition: background 0.2s, color 0.2s;
}
@media (max-width: 600px) {
  .btn, .btn-primary, .btn-success, .btn-dark, .btn-outline-primary {
    min-width: 36px;
    font-size: 0.98em;
    padding: 6px 8px;
  }
}

/* Utility: hide scrollbars on mobile for sidebar/app */
@media (max-width: 900px) {
  .sidebar, .app {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar, .app::-webkit-scrollbar {
    display: none;
  }
}

/* Utility: make .row.wrap stack on mobile */
@media (max-width: 700px) {
  .row.wrap {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
}

/* Utility: make .grid.cols-4 responsive */
.grid.cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 900px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
@media (max-width: 600px) {
  .grid.cols-4 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Utility: make .product-actions and .meta stack on mobile */
@media (max-width: 600px) {
  .product-actions, .meta {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
}

/* Utility: make .hero section text center on mobile */
@media (max-width: 600px) {
  .hero, .title, .subtitle {
    text-align: center !important;
  }
}
/* --- Extracted from login.php --- */
.hero-login {
  --hero-img: url('images/login.avif');
}
.login-card {
  max-width: 480px;
  margin: 24px auto;
}
.login-form {
  margin-top: 10px;
  gap: 8px;
}
.login-input {
  flex: 1 1 100%;
}
.login-btn {
  flex: 1 1 100%;
}
.login-error-msg {
  margin-top: 8px;
  color: #b91c1c;
}
/* --- Extracted from orders.php (part 2) --- */
.add-btn {
  min-width: 54px;
  padding: 4px 10px;
  font-size: 0.95em;
}
.add-form {
  display: inline;
}
/* --- Extracted from orders.php (part 1) --- */
.hero-orders {
  --hero-img: url('images/orders.avif');
  min-height: calc(100vh - 100px);
}
.orders-category-title {
  margin-top: 24px;
  color: #a97c50;
  border-bottom: 1px solid #e0c9a6;
  padding-bottom: 4px;
}
.orders-price-final {
  color: #a97c50;
  font-weight: 600;
}
.product-actions {
  padding: 0 12px 12px;
}
/* --- Extracted from orders.php header/main --- */
/* Reuse .topbar-cafe, .menu-toggle-hide, .logo-cafe, .flex-center, .cafe-title, .logout-btn from previous extractions */
@media print {
  .logout-btn,
  #printOrdersBtn {
    display: none !important;
  }
}
/* --- Extracted from order-records.php header/main --- */
.hero-order-records {
  --hero-img: url('images/order-records.avif');
}
.order-records-header {
  margin-bottom: 18px;
  align-items: center;
  justify-content: space-between;
}
.order-records-title {
  margin: 0;
  font-family: 'Brush Script MT', cursive;
  color: #7a4b33;
  font-size: 2rem;
}
.print-orders-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 999;
  background: linear-gradient(90deg, #a97c50, #c19a6b);
  color: #fff;
  font-weight: 600;
}
.order-records-card {
  border-radius: 18px;
  padding: 18px;
  background: #fffbe7;
  box-shadow: 0 4px 24px #0001;
}
.order-records-table {
  border-radius: 12px;
  overflow: hidden;
  font-size: 1.05rem;
}
/* --- Extracted from invoices.php forms/buttons --- */
.discount-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.discount-input {
  width: 70px;
}
.print-form {
  margin: 0;
}
.print-btn {
  min-width: 120px;
  font-size: 1.1rem;
}
/* --- Extracted from invoices.php header/main --- */
.topbar-cafe {
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #a97c50 0%, #c19a6b 100%);
}
.menu-toggle-hide {
  display: none;
}
.logo-cafe {
  height: 90px;
  width: auto;
  margin-left: 32px;
  border-radius: 16px;
  box-shadow: 0 2px 8px #0002;
  background: #fff;
}
.flex-center {
  flex: 1;
  text-align: center;
}
.cafe-title {
  font-family: 'Brush Script MT', cursive;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fffbe7;
  text-shadow: 0 2px 8px #0004;
}
.logout-btn {
  margin-right: 32px;
}
.hero-invoices {
  --hero-img: url('images/invoices.avif');
}
/* --- Classes for inline styles from invoice-records.php --- */
.logout-btn { margin-right: 32px !important; }
.btn-menu-mobile { display: none !important; position: absolute; right: 32px; top: 18px; z-index: 1200; }
.btn-menu-mobile span { font-size: 1.6rem; line-height: 1; }
.row-mb-18 { margin-bottom: 18px !important; align-items: center !important; justify-content: space-between !important; }
.h2-cafe { margin: 0 !important; font-family: 'Brush Script MT', cursive; color: #7a4b33; font-size: 2rem; }
.form-select-180 { max-width: 180px !important; display: inline-block !important; }
.btn-gradient { background: linear-gradient(90deg,#a97c50,#c19a6b) !important; color: #fff !important; font-weight: 600 !important; }
.ml-8 { margin-left: 8px !important; }
.btn-print-fixed { position: fixed !important; bottom: 32px !important; right: 32px !important; z-index: 999 !important; }
.card-invoice { border-radius: 18px !important; padding: 18px !important; background: #fffbe7 !important; box-shadow: 0 4px 24px #0001 !important; }
.table-invoice { border-radius: 12px !important; overflow: hidden !important; font-size: 1.05rem !important; }
.flex-gap-8 { display: flex !important; gap: 8px !important; align-items: center !important; }
.tr-subtotal { background: #f8f0e3 !important; font-weight: bold !important; }
.modal-center { text-align: center !important; margin: 10px 0 !important; }
.qr-img { margin: 0 auto !important; display: block !important; width: 110px !important; height: 110px !important; }
.modal-note { font-size: 0.8rem !important; color: #888 !important; margin-top: 2px !important; }
@media print {
  .logout-btn, #printInvoicesBtn { display: none !important; }
}
/* --- End inline style classes for invoice-records.php --- */
/* --- Classes for inline styles from expenses.php --- */
.form-gap-12 { gap: 12px !important; }
.form-gap-10 { gap: 10px !important; }
.form-mt-16 { margin-top: 16px !important; }
.form-mb-16 { margin-bottom: 16px !important; }
.form-inline-block { display: inline !important; }
.form-inline-flex { display: inline-flex !important; align-items: center; gap: 6px; }
.flex-1 { flex: 1 1 0 !important; }
.flex-2 { flex: 2 1 0 !important; }
.minw-100 { min-width: 100px !important; }
.minw-120 { min-width: 120px !important; }
.minw-160 { min-width: 160px !important; }
.w-160 { width: 160px !important; }
.color-danger { color: #b91c1c !important; }
.mt-8 { margin-top: 8px !important; }
.mt-24 { margin-top: 24px !important; }
.fw-500 { font-weight: 500 !important; }
.btn-white { color: #fff !important; }
.inline-block { display: inline-block !important; }
/* --- End inline style classes for expenses.php --- */
/* --- Classes for inline styles from dashboard.php --- */
.topbar-cafe {
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #a97c50 0%, #c19a6b 100%);
}
.menu-toggle-hidden { display: none; }
.logo-cafe {
  height: 90px;
  width: auto;
  margin-left: 32px;
  border-radius: 16px;
  box-shadow: 0 2px 8px #0002;
  background: #fff;
}
.flex-center { flex: 1; text-align: center; }
.cafe-title {
  font-family: 'Brush Script MT', cursive;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fffbe7;
  text-shadow: 0 2px 8px #0004;
}
.logout-margin { margin-right: 32px; }
.mt-12 { margin-top: 12px !important; }
.mt-24 { margin-top: 24px !important; }
.mb-12 { margin-bottom: 12px !important; }
.table-mt-8 { margin-top: 8px !important; }
.ul-no-margin { margin: 0; padding-left: 18px; }
/* --- End inline style classes --- */
/* ---------- updated styles.css ---------- */
/* Fonts + tokens */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;800&display=swap');

:root {
  --bg: #f7f3ef;
  --bg-2: #f1e8e1;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #6b5f58;
  --border: #eadfd6;
  --primary: #7a4b33;
  --primary-2: #caa17f;
  --accent: #d97706;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 10px 30px rgba(122, 75, 51, .18);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin:0;
  font-family:'Poppins', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  color:var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #fff, transparent), var(--bg);
}

/* Topbar */
.topbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 20px;
  background: linear-gradient(100deg, var(--primary), var(--primary-2));
  color:#fff;
  position: sticky; top:0; z-index:1200;
  box-shadow:0 8px 24px rgba(0,0,0,.15);
  backdrop-filter: saturate(140%) blur(6px);
}
.topbar .logo {
  width:90px; height:auto;
  border-radius:16px; object-fit:cover;
  box-shadow:0 2px 8px rgba(0,0,0,.12);
  background:#fff;
}
.topbar .title {
  font-family: 'Brush Script MT',cursive;
  font-size:2.4rem; color:#fffbe7;
  text-shadow:0 2px 8px rgba(0,0,0,.18);
}

/* Layout - desktop */
.app {
  display:grid;
  grid-template-columns:260px 1fr;
  min-height: calc(100vh - 64px);
  gap: 16px;
  padding: 18px;
}

/* Sidebar - desktop */
.sidebar {
  background: linear-gradient(90deg, #f7ede2 0%, #f1e3c6 100%);
  border-right: 1px solid var(--border);
  padding:16px;
  border-radius:12px;
  position:relative;
  z-index: 1100;
}

/* main view */
.view { padding: 18px; }

/* Cards */
.card {
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  box-shadow:var(--shadow);
}
.kpi .value { font-size:24px; font-weight:800; }

/* Grid */
.grid { display:grid; gap:12px; }

/* Product / gallery items */
.product, .product-card, .gallery-card {
  background:var(--card);
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  box-shadow:0 4px 12px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s;
  padding:8px;
  display:flex; flex-direction:column; align-items:center;
  min-width:0;
}
.product img, .product-card img, .gallery-card img {
  width:48px; height:48px; object-fit:cover;
  border-radius:8px; display:block; margin-bottom:6px;
}
.product .meta, .product-card .meta, .gallery-card .meta {
  display:flex; flex-direction:column; align-items:center;
  font-size:.92rem; width:100%; padding:4px;
}

/* Menu actions */
.menu-actions {
  display:flex; flex-direction:row; gap:8px; margin-top:8px;
  align-items:center; flex-wrap:wrap;
}
.menu-actions form {
  margin:0; display:inline-flex; align-items:center; gap:6px;
}

/* Hero */
.hero {
  position:relative; border-radius:18px; padding:28px;
  color:#2b1e17; overflow:hidden;
  background:transparent;
  box-shadow:var(--shadow); margin-bottom:14px;
  border:1.5px solid #e5ded7;
}
.hero::before {
  content:""; position:absolute; inset:0; z-index:0;
  background-size:cover; background-position:center center;
  filter: saturate(110%) contrast(105%);
  pointer-events:none;
}
.hero > * { position:relative; z-index:2; }

/* Inputs + buttons */
.input, select, textarea {
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 14px;
  background:white;
  width:100%; max-width:100%;
}
.btn {
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center; justify-content:center;
}
.btn.btn-dark { background:#111827; color:#fff; }

/* Hamburger - only visible on mobile/tablet */
#menuToggle {
  display: none !important;
}
@media (max-width: 900px) {
  #menuToggle {
    display: block !important;
    position: fixed;
    left: 12px; top: 12px;
    z-index: 1500;
    width: 44px; height: 44px;
    border-radius: 8px; border: none;
    font-size: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
  }
}
@media (max-width: 900px) {
  /* Sidebar off-canvas for mobile/tablet */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 1400;
    transition: transform 260ms ease, left 260ms ease;
    transform: translateX(-100%);
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    border-radius: 0 12px 12px 0;
    overflow:auto;
  }
  .sidebar.open { transform: translateX(0); left:0; }

  /* Hamburger only on mobile/tablet */
  /* Hide menu button by default (desktop) */
  #menuToggle {
    display: none !important;
  }

  @media (max-width: 900px) {
    /* Show menu button and off-canvas sidebar on mobile/tablet */
    #menuToggle {
      display: block !important;
      position: fixed;
      left: 12px; top: 12px;
      z-index: 1500;
      width: 44px; height: 44px;
      border-radius: 8px; border: none;
      font-size: 20px;
      background: linear-gradient(135deg, var(--primary), var(--primary-2));
      color: #fff;
      box-shadow: 0 6px 16px rgba(0,0,0,.12);
    }
    .sidebar {
      position: fixed;
      top: 0; bottom: 0;
      left: 0px;
      width: 260px;
      height: 100vh;
      z-index: 1400;
      transition: transform 260ms ease, left 260ms ease;
      transform: translateX(-100%);
      box-shadow: 0 10px 30px rgba(0,0,0,.12);
      border-radius: 0 12px 12px 0;
      overflow:auto;
    }
    .sidebar.open { transform: translateX(0); left:0; }
  }
}

  .view { padding:14px 12px; margin-left:0; }

  /* Grids */
  .menu-grid, .product-grid, .gallery, .grid.cols-2, .grid.cols-3, .grid.cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap:12px;
  }

  /* Forms stack */
  form.row, form#addProductForm, .row.wrap {
    display:flex; flex-direction:column; gap:10px; align-items:stretch;
  }
  .row { gap:8px; }
  input.input, select.input, .input[type="file"], input[type="number"], input[type="text"], textarea {
    width:100% !important; max-width:100% !important;
  }

  /* Variant rows */
  #variantRows { display:flex; flex-direction:column; gap:8px; width:100%; }
  .variant-row { display:flex; flex-direction:row; gap:8px; flex-wrap:wrap; }
  .variant-row .input { flex:1 1 auto; min-width:0; }

  /* Product cards */
  .product img, .product-card img, .gallery-card img {
    width:72px; height:auto;
  }

  th, td { padding:8px; font-size:.95rem; }


/* Small phones */
@media (max-width: 600px) {
  html { font-size:14px; }
  .view { padding:12px 10px; }
  .sidebar { width:80vw; min-width:200px; }
  .menu-grid, .product-grid, .gallery, .grid.cols-2, .grid.cols-3, .grid.cols-4 {
    grid-template-columns:1fr; gap:10px;
  }
  button, .btn { min-width:60px; font-size:.95rem; padding:8px 10px; }
  table { min-width:100%; }
  .table-container { overflow-x:auto; }
  .hero { padding:18px; }
  .topbar .logo { height:60px; width:auto; }
}

/* Force override inline widths */
@media (max-width: 900px) {
  #addProductForm input, #addProductForm select,
  #addProductForm .input, .menu-actions .input,
  details form input, details form select, details form .input {
    width:100% !important; max-width:100% !important;
  }
}

/* Helpers */
.hide-mobile { display:block; }
@media (max-width:600px) { .hide-mobile { display:none !important; } }
.show-mobile { display:none; }
@media (max-width:600px) { .show-mobile { display:block !important; } }

/* Modal fix */
.modal-backdrop, .modal-backdrop.show, .modal-backdrop.fade.show {
  display:none !important; opacity:0 !important; pointer-events:none !important;
}
body.modal-open { overflow:auto !important; }

/* Sidebar navigation links */
.sidebar .nav {
  display: block;
  padding: 12px 18px;
  margin-bottom: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.sidebar .nav.active,
.sidebar .nav:hover {
  background: var(--primary-2);
  color: #fff;
}

/* Final override for mobile grids */
@media (max-width: 600px) {
  .menu-grid, .product-grid, .gallery, 
  .grid.cols-2, .grid.cols-3, .grid.cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px;
  }
}
/* Fix grid layout for menu page on mobile */
@media (max-width: 600px) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px;
  }
  .card-grid > * {
    min-width: 0; /* allow items to shrink */
  }
}
/* Login button */
.login-btn {
  background-color: #a97c50 !important; /* your café primary color */
  border-color: #a97c50 !important;
  color: #fff !important; /* keep text white for contrast */
}
.login-btn:hover {
  background-color: #8b6840 !important; /* darker shade */
  border-color: #8b6840 !important;
  color: #fff !important;
}

/* Add button (order page) */
.add-btn {
  background-color: #a97c50 !important;
  border-color: #a97c50 !important;
  color: #fff !important;
}
.add-btn:hover {
  background-color: #8b6840 !important;
  border-color: #8b6840 !important;
  color: #fff !important;
}
/* --- Force Edit / Delete side-by-side in menu actions --- */
.menu-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

/* Make every direct child inline and non-stretching */
.menu-actions > * {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
}

/* Specifically ensure forms are inline and do not expand to 100% */
.menu-actions form {
  display: inline-flex !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
}

/* Keep details/summary inline; when details opens, allow inner form to stack */
.menu-actions details {
  display: inline-flex !important;
  position: relative;
}
.menu-actions summary {
  display: inline-flex !important;
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
}

/* When details is open, keep the inner form full-width under the details (so edit UI can use full width) */
.menu-actions details[open] > form {
  display: block !important;
  width: 100% !important;
  margin-top: 8px !important;
}

/* Tidy buttons inside menu-actions */
.menu-actions .btn {
  min-width: 0 !important;
}
/* Add product card tweaks */
.add-product-card .card-header {
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: 8px 8px 0 0;
}
.add-product-card .card-body {
  padding: 16px;
}

/* ===== Login Page Mobile Fixes ===== */
@media (max-width: 600px) {
  /* Header adjustments */
  .page-login .topbar.topbar-cafe {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    min-height: auto;
    text-align: center;
  }

  .page-login .topbar.topbar-cafe .logo-cafe {
    height: auto;
    width: clamp(80px, 30vw, 120px);
    margin-bottom: 6px;
  }

  .page-login .topbar.topbar-cafe .cafe-title {
    font-size: 1.3em;
    color: #fffbe7;
    margin: 0;
  }

  /* Main hero section */
  .page-login .hero-login {
    padding: 20px 12px;
    text-align: center;
  }

  .page-login .hero-login .title {
    font-size: 1.6em;
  }

  .page-login .hero-login .subtitle {
    font-size: 1em;
  }

  /* Login card */
  .page-login .login-card {
    max-width: 100%;
    margin: 0 auto;
    padding: 18px;
    border-radius: 12px;
  }

  /* Login form inputs */
  .page-login .login-form {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .page-login .login-input {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    font-size: 1em;
  }

  .page-login .login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
  }

  .page-login .login-error-msg {
    margin-top: 10px;
    font-size: 0.9em;
    color: #b71c1c;
  }
}


/* ---------- end styles.css ---------- */
@media (max-width: 600px) {
  .topbar-cafe .cafe-title {
    display: block !important;
    flex: 1;
    text-align: center;
    font-size: 1.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 0;
  }
}
@media (max-width: 600px) {
  .topbar-cafe {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    min-height: 56px;
    width: 100%;
    /* background: transparent !important; remove background */
  }

  .topbar-cafe .menu-btn {
    flex: 0 0 auto;
    font-size: 2em;
    background: transparent !important;
    border: none;
    color: #6d3b1a;
    z-index: 20;
  }

  .topbar-cafe .logout-btn {
    flex: 0 0 auto;
  }
}
@media (max-width: 600px) {
  .app {
    margin-left: 0 !important;
    padding: 12px;
  }

  .view {
    padding: 12px 0;
    width: 100%;
    overflow-x: hidden;
  }

  .card-grid, .menu-grid, .product-grid, .gallery, 
  .grid.cols-2, .grid.cols-3, .grid.cols-4 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  table, .table-cafe {
    width: 100% !important;
    overflow-x: auto;
    display: block;
  }
}
/* Mobile responsive tables only */
@media (max-width: 600px) {
  /* Wrap table in horizontal scroll */
  .card-invoice {
    overflow-x: auto;
  }

  #invoiceRecordsTable {
    width: 100%;
    min-width: 700px; /* adjust based on column content */
    border-collapse: collapse;
  }

  /* Prevent text wrapping in header and cells */
  #invoiceRecordsTable th,
  #invoiceRecordsTable td {
    white-space: nowrap;
    padding: 6px 8px;  /* smaller padding on mobile */
    font-size: 0.85rem; /* slightly smaller font for mobile */
  }

  /* Footer row adjustments */
  #invoiceRecordsTable tfoot tr.tr-subtotal td {
    font-size: 0.85rem;
    padding: 6px 8px;
  }

  /* Optional: make table slightly rounded for mobile */
  .card-invoice {
    border-radius: 12px;
    margin: 0 4px;
  }
}
/* Mobile responsive tables only */
@media (max-width: 600px) {
  /* Wrap order-records table in horizontal scroll */
  .order-records-card {
    overflow-x: auto;
  }

  #orderRecordsTable {
    width: 100%;
    min-width: 900px; /* adjust based on column content */
    border-collapse: collapse;
  }

  /* Prevent text wrapping in header and cells */
  #orderRecordsTable th,
  #orderRecordsTable td {
    white-space: nowrap;
    padding: 6px 8px;  /* smaller padding for mobile */
    font-size: 0.85rem; /* slightly smaller font for mobile */
  }

  /* Footer row adjustments */
  #orderRecordsTable tfoot tr td {
    font-size: 0.85rem;
    padding: 6px 8px;
  }

  /* Optional: make card slightly rounded for mobile */
  .order-records-card {
    border-radius: 12px;
    margin: 0 4px;
  }
}
@media (max-width: 600px) {
  /* Login page topbar */
  .page-login .topbar.topbar-cafe {
    display: flex;
    align-items: center;
    justify-content: center; /* center content horizontally */
    padding: 12px 16px;
    background: linear-gradient(100deg, #a97c50, #c19a6b);
    position: relative;
    z-index: 10;
  }

  /* Logo on the left */
  .page-login .topbar.topbar-cafe .logo-cafe {
    position: absolute;
    left: 16px;
    width: 50px;
    height: auto;
    flex-shrink: 0;
  }

  /* Title centered */
  .page-login .topbar.topbar-cafe .cafe-title {
    font-size: 2.1rem;
    font-weight: 700;
    white-space: normal; /* allow wrapping */
    text-align: center;
    color: #fffbe7;
    margin: 0;
    padding: 0 16px;   /* add padding so text doesn't touch edges */
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .page-login .topbar.topbar-cafe .cafe-title {
    font-size: 1.6rem; /* scale down font */
  }

  .page-login .topbar.topbar-cafe .logo-cafe {
    width: 40px; /* smaller logo */
  }
}

.sidebar {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 0 !important;
  height: 100vh !important; /* ensure full height */
}

.sidebar .nav {
  display: block !important;
  padding: 12px 16px !important;
  text-decoration: none !important;
  color: #333 !important;
}

.sidebar .nav.active {
  background-color: #c19a6b !important;
  color: #fff !important;
}

/* Keep logout at bottom */
.sidebar .logout-margin {
  margin-top: auto !important; /* pushes it to bottom */
}
@media (max-width: 600px) {
  .menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* two columns side by side */
    gap: 10px;
  }

  .menu-grid > .product {
    min-width: 0; /* allow shrinking */
  }
}
/* Force menu/grid products side-by-side on mobile */
@media (max-width: 600px) {
  /* Target only the menu/product grid */
  .menu-grid, .product-grid, .card-grid {
    display: grid !important;                       /* ensure grid */
    grid-template-columns: repeat(2, 1fr) !important; /* 2 columns */
    gap: 10px !important;                           /* spacing between items */
  }

  /* Allow items to shrink and not break the grid */
  .menu-grid > *, 
  .product-grid > *, 
  .card-grid > * {
    min-width: 0 !important;
    flex: none !important;
  }
}
/* ===== Order Page: Side-by-side on mobile ===== */
@media (max-width: 600px) {
  /* Target the product/order grid */
  .order-grid, .order-records-grid, .product-list, .grid.cards {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 2 items per row */
    gap: 10px !important;
  }

  /* Ensure individual cards shrink properly */
  .order-grid > *, 
  .order-records-grid > *, 
  .product-list > *, 
  .grid.cards > * {
    min-width: 0 !important;
    flex: none !important;
  }
}
@media (max-width: 600px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .grid.cols-4 > .product {
    min-width: 0 !important;
  }
}

/* ✅ Edge devices: extra narrow screens */
@media (max-width: 360px) {
  .topbar-cafe {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 10px !important;
    min-height: 56px !important;
    box-sizing: border-box !important;
  }

  .topbar-cafe .menu-btn {
    font-size: 1.6rem !important;
    margin-right: 6px !important;
    flex: 0 0 auto !important;
  }

  .topbar-cafe .logo-cafe {
    height: 38px !important;
    width: auto !important;
    margin: 0 auto !important;
    flex: 0 0 auto !important;
  }

  .topbar-cafe .cafe-title {
    display: none !important; /* hide title only on tiny screens */
  }

  .topbar-cafe .logout-btn {
    font-size: 0.9rem !important;
    padding: 4px 8px !important;
    flex: 0 0 auto !important;
  }
}
/* ===== Prices Page Grid Only ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin-top: 12px;
}

@media (max-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (max-width: 700px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* ✅ Edge fix for ultra-narrow phones (≤340px) */
@media (max-width: 340px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}
