* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Login Screen */
.screen {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.login-container h1 {
  color: var(--primary);
  margin-bottom: 0.25rem;
  font-size: 1.75rem;
}

.login-container h2 {
  color: var(--text-light);
  font-weight: 400;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

#login-form input {
  width: 100%;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

#login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#login-form button {
  width: 100%;
  padding: 0.875rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#login-form button:hover {
  background: var(--primary-dark);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left h1 {
  font-size: 1.25rem;
  color: var(--primary);
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tokyo-time {
  font-size: 0.8125rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
}

#user-name {
  font-weight: 500;
  color: var(--text-light);
}

#logout-btn {
  padding: 0.5rem 1rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

/* Sidebar */
#sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: 220px;
  height: calc(100vh - 60px);
  background: white;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.3s ease;
}

#sidebar ul {
  list-style: none;
  padding: 1rem 0;
}

#sidebar li a {
  display: block;
  padding: 0.875rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

#sidebar li a:hover {
  background: var(--bg);
  color: var(--primary);
}

#sidebar li a.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border-right: 3px solid var(--primary);
}

/* Main Content */
main {
  margin-left: 220px;
  margin-top: 60px;
  padding: 1.5rem;
  min-height: calc(100vh - 60px);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tab-header h2 {
  font-size: 1.5rem;
}

.header-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: white;
  padding: 1.25rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.stat-card p {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Search Bar */
.search-bar {
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Products List - Bar Style */
.products-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.product-card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0.75rem;
  gap: 1rem;
}

.product-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-image {
  width: 60px;
  height: 60px;
  min-width: 60px;
  object-fit: cover;
  background: var(--bg);
  border-radius: 8px;
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.product-name {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-stock {
  color: var(--text-light);
  font-size: 0.875rem;
  white-space: nowrap;
}

.product-stock.low {
  color: var(--danger);
  font-weight: 500;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.product-actions button {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

/* Order Tabs */
.order-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.order-tab {
  padding: 0.625rem 1.25rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.order-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Orders List */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.order-id {
  font-weight: 600;
  color: var(--primary);
}

.order-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.order-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.order-status.shipped {
  background: #dbeafe;
  color: #1e40af;
}

.order-status.confirmed {
  background: #d1fae5;
  color: #065f46;
}

.order-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.25rem;
}

.order-customer {
  font-weight: 500;
}

.order-date {
  font-size: 0.8125rem;
  color: var(--text-light);
}

.order-address {
  color: var(--text-light);
  font-size: 0.875rem;
}

.order-items-summary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-light);
}

.order-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Purchases List */
.purchases-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.purchase-card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.purchase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.purchase-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.purchase-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.purchase-status.completed {
  background: #d1fae5;
  color: #065f46;
}

/* Users List - Bar Style */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-name {
  font-weight: 600;
}

.user-role {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-light);
}

.user-username {
  color: var(--text-light);
  font-size: 0.875rem;
  flex: 1;
}

.user-actions {
  flex-shrink: 0;
  margin-left: auto;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-content.modal-large {
  max-width: 600px;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  padding-right: 2rem;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

.close:hover {
  color: var(--text);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.image-preview {
  max-width: 100%;
  max-height: 150px;
  margin-top: 0.5rem;
  border-radius: 6px;
}

/* Order Item Rows */
.order-item-row,
.purchase-item-row {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.purchase-item-row {
  grid-template-columns: 1fr 70px 80px 40px;
}

.btn-remove-item {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Order Detail */
#order-detail-content {
  font-size: 0.9375rem;
}

#order-detail-content p {
  margin-bottom: 0.5rem;
}

#order-detail-content strong {
  color: var(--text-light);
  font-weight: 500;
}

.detail-items {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.detail-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
}

.detail-attachment {
  margin-top: 1rem;
}

.detail-attachment img {
  max-width: 100%;
  border-radius: 6px;
}

.detail-attachment a {
  color: var(--primary);
}

/* Mobile Styles */
@media (max-width: 768px) {
  .menu-btn {
    display: block;
  }

  #sidebar {
    transform: translateX(-100%);
  }

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

  main {
    margin-left: 0;
    padding: 1rem;
  }

  .header-right #user-name,
  .header-right .tokyo-time {
    display: none;
  }

  .tab-header {
    flex-direction: column;
    align-items: stretch;
  }

  .tab-header h2 {
    font-size: 1.25rem;
  }

  /* Product bar on tablet */
  .product-card {
    padding: 0.625rem;
    gap: 0.75rem;
  }

  .product-image {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .product-info {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .product-name {
    font-size: 0.875rem;
    flex-basis: 100%;
  }

  .product-stock {
    font-size: 0.8125rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card p {
    font-size: 1.5rem;
  }

  .order-tabs {
    justify-content: center;
  }

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

  .order-item-row {
    grid-template-columns: 1fr 60px 32px;
  }

  .purchase-item-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 6px;
  }

  .purchase-item-row select,
  .purchase-item-row input {
    width: 100%;
  }

  .purchase-item-row .btn-remove-item {
    width: 100%;
    height: auto;
    padding: 0.5rem;
  }

  /* Users bar mobile */
  .user-card {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .user-name {
    font-size: 0.9375rem;
  }

  .user-role {
    font-size: 0.6875rem;
  }

  .user-username {
    font-size: 0.8125rem;
  }

  .modal-content {
    padding: 1rem;
    margin: 0.5rem;
  }
}

@media (max-width: 480px) {
  /* Smaller product bar on small screens */
  .product-card {
    padding: 0.5rem;
    gap: 0.625rem;
  }

  .product-image {
    width: 45px;
    height: 45px;
    min-width: 45px;
    border-radius: 6px;
  }

  .product-name {
    font-size: 0.8125rem;
  }

  .product-stock {
    font-size: 0.75rem;
  }

  .product-actions button {
    padding: 0.35rem 0.5rem;
    font-size: 0.6875rem;
  }

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-state p {
  font-size: 1.125rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* Overlay for mobile sidebar */
#sidebar-overlay {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 85;
}

#sidebar-overlay.show {
  display: block;
}

/* =============================================
   FLOATING ACTION BUTTON (Desktop)
   ============================================= */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  z-index: 100;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

/* =============================================
   MOBILE BOTTOM NAVIGATION
   ============================================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px;
}

.bottom-nav-item i {
  font-size: 20px;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.fab-trigger {
  position: relative;
}

.bottom-nav-item.fab-trigger i {
  font-size: 32px;
  color: var(--primary);
}

/* Quick Actions Overlay */
.quick-actions-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 80px;
}

.quick-actions-overlay.active {
  display: flex;
}

.quick-actions-menu {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: white;
  border-radius: 20px;
  margin: 0 16px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 30px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: white;
  min-width: 100px;
  background: var(--primary);
}

.quick-action-btn i {
  font-size: 28px;
}

.quick-action-btn.order {
  background: var(--primary);
}

/* More Menu */
.more-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  align-items: flex-end;
}

.more-menu-overlay.active {
  display: flex;
}

.more-menu {
  width: 100%;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 16px;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  max-height: 70vh;
  overflow-y: auto;
}

.more-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.more-menu-header span {
  font-size: 18px;
  font-weight: 600;
}

.more-menu-header button {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  transition: background 0.2s;
}

.more-menu-item:hover, .more-menu-item:active {
  background: var(--bg);
}

.more-menu-item i {
  font-size: 20px;
  width: 28px;
  text-align: center;
  color: var(--text-light);
}

.more-menu-item.logout {
  color: var(--danger);
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
}

.more-menu-item.logout i {
  color: var(--danger);
}

.admin-only-menu {
  display: none;
}

/* =============================================
   ORDER FILTERS
   ============================================= */
.order-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.account-filter select {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  min-width: 160px;
}

.account-filter select:focus {
  outline: none;
  border-color: var(--primary);
}

/* =============================================
   ACCOUNTS LIST
   ============================================= */
.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.account-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--primary);
}

.account-info {
  color: var(--text-light);
  font-size: 0.875rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

.account-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Order account name badge */
.order-account {
  display: inline-block;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .order-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .account-filter {
    width: 100%;
  }

  .account-filter select {
    width: 100%;
  }

  .account-card {
    padding: 0.875rem;
  }

  .account-name {
    font-size: 0.9375rem;
  }

  .account-info {
    font-size: 0.8125rem;
  }

  .account-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .account-actions {
    align-self: flex-end;
  }
}

/* =============================================
   MOBILE RESPONSIVE OVERRIDES
   ============================================= */
@media (max-width: 768px) {
  /* Show bottom nav */
  .bottom-nav {
    display: flex;
  }

  /* Hide desktop sidebar */
  #sidebar {
    display: none !important;
  }

  #sidebar-overlay {
    display: none !important;
  }

  /* FAB above bottom nav */
  .fab {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  /* Simpler mobile header */
  .menu-btn {
    display: none;
  }

  header {
    justify-content: center;
  }

  .header-right {
    position: absolute;
    right: 1rem;
  }

  .header-right #user-name,
  .header-right .tokyo-time {
    display: none;
  }

  /* Adjust main content for bottom nav */
  main {
    margin-left: 0;
    margin-top: 60px;
    padding: 12px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    min-height: calc(100vh - 60px);
  }

  /* Better page headers on mobile */
  .tab-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .tab-header h2 {
    font-size: 1.125rem;
    flex-shrink: 1;
    min-width: 0;
  }

  .tab-header .btn-primary {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  /* Mobile-friendly stats */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
    border-radius: 10px;
  }

  .stat-card h3 {
    font-size: 11px;
  }

  .stat-card p {
    font-size: 1.25rem;
  }

  /* Product bar mobile */
  .product-card {
    padding: 0.625rem;
    gap: 0.75rem;
    border-radius: 10px;
  }

  .product-image {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 8px;
  }

  .product-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .product-name {
    font-size: 0.875rem;
  }

  .product-stock {
    font-size: 0.75rem;
  }

  .product-actions {
    flex-direction: row;
    gap: 0.375rem;
  }

  .product-actions button {
    padding: 0.375rem 0.5rem;
    font-size: 0.6875rem;
  }

  /* Order tabs */
  .order-tabs {
    gap: 6px;
    margin-bottom: 1rem;
  }

  .order-tab {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  /* Order cards mobile */
  .order-card {
    padding: 0.75rem;
    border-radius: 10px;
  }

  .order-header {
    margin-bottom: 0.5rem;
  }

  .order-id {
    font-size: 0.875rem;
  }

  .order-status {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
  }

  .order-customer {
    font-size: 0.9375rem;
  }

  .order-address {
    font-size: 0.8125rem;
  }

  .order-items-summary {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }

  .order-actions {
    margin-top: 0.75rem;
    gap: 0.375rem;
  }

  .order-actions button {
    padding: 0.4rem 0.625rem;
    font-size: 0.75rem;
    flex: 1;
  }

  /* Purchase cards mobile */
  .purchase-card {
    padding: 0.75rem;
    border-radius: 10px;
  }

  .purchase-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .purchase-status {
    font-size: 0.6875rem;
  }

  /* Modal bottom sheet style */
  .modal-content {
    max-width: 100%;
    max-height: 85vh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem;
    padding-bottom: 2rem;
    overflow-y: auto;
  }

  .modal-content h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
  }

  .modal.show {
    align-items: flex-end;
    padding-bottom: 0;
  }

  /* Form elements in modal */
  .modal-content .form-group {
    margin-bottom: 0.875rem;
  }

  .modal-content .form-group label {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
  }

  .modal-content .form-group input,
  .modal-content .form-group select,
  .modal-content .form-group textarea {
    padding: 0.625rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .modal-content .btn-primary {
    width: 100%;
    padding: 0.875rem;
    margin-top: 0.5rem;
  }

  /* Search bar */
  .search-bar input {
    font-size: 16px;
  }

  /* Toast for mobile */
  .toast {
    bottom: 80px;
    left: 12px;
    right: 12px;
  }
}

/* Very small screens */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Compact product bar */
  .product-card {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .product-image {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .product-name {
    font-size: 0.8125rem;
  }

  .product-actions {
    flex-direction: row;
  }

  .product-actions button {
    padding: 0.3rem 0.4rem;
    font-size: 0.625rem;
  }

  .quick-actions-menu {
    flex-direction: column;
    gap: 10px;
  }

  .quick-action-btn {
    flex-direction: row;
    justify-content: center;
    padding: 14px 20px;
  }
}
