:root {
  --sidebar-width: 240px;
  --brand-color: #ff6b35;
  --brand-dark: #e85a2a;
  --bg-soft: #f4f6f9;
}

body {
  background: var(--bg-soft);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.app-sidebar {
  width: var(--sidebar-width);
  background: #1f2430;
  color: #fff;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .2s ease;
}
.sidebar-brand { color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.app-sidebar .nav-link {
  color: rgba(255,255,255,.75);
  padding: .65rem .9rem;
  border-radius: .5rem;
  margin-bottom: 2px;
  font-size: .93rem;
}
.app-sidebar .nav-link i { width: 20px; margin-right: 8px; text-align: center; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar .nav-link.active { background: var(--brand-color); color: #fff; }

/* ---- Main area ---- */
.app-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid #e6e8ec; position: sticky; top: 0; z-index: 1020; }
.app-content { flex: 1; }

.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-color); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}

/* ---- Cards ---- */
.stat-card {
  border: none; border-radius: 14px; color: #fff;
  padding: 1.25rem; position: relative; overflow: hidden;
}
.stat-card i.bg-icon { position: absolute; right: 12px; top: 12px; font-size: 2.5rem; opacity: .25; }
.stat-card h3 { font-weight: 700; margin-bottom: 0; }
.bg-grad-orange { background: linear-gradient(135deg,#ff6b35,#f7931e); }
.bg-grad-green  { background: linear-gradient(135deg,#11998e,#38ef7d); }
.bg-grad-blue   { background: linear-gradient(135deg,#2193b0,#6dd5ed); }
.bg-grad-purple { background: linear-gradient(135deg,#8e2de2,#4a00e0); }
.bg-grad-red    { background: linear-gradient(135deg,#eb3349,#f45c43); }

.card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }

/* ---- Login page ---- */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1f2430,#3a4358); }
.auth-card { border-radius: 18px; overflow: hidden; max-width: 900px; }
.auth-side { background: linear-gradient(135deg,var(--brand-color),var(--brand-dark)); color: #fff; }

/* ---- POS screen ---- */
.pos-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; align-items: start; }
@media (max-width: 991px) { .pos-grid { grid-template-columns: 1fr; } }
.menu-card { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; border-radius: 12px; }
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.08); }
.menu-card.unavailable { opacity: .45; pointer-events: none; }
.cart-panel { position: sticky; top: 76px; }
.cart-item { border-bottom: 1px solid #eee; padding: .5rem 0; }
.qty-box { width: 108px; }
.qty-box input.form-control { min-width: 34px; padding-left: 2px; padding-right: 2px; }
.qty-box .btn { padding-left: .5rem; padding-right: .5rem; }
.category-pill { border-radius: 20px; white-space: nowrap; }

/* ---- Table layout ---- */
.table-tile { border-radius: 14px; text-align: center; padding: 1.1rem .5rem; cursor: pointer; color: #fff; font-weight: 600; }
.table-available { background: #2ecc71; }
.table-occupied  { background: #e74c3c; }
.table-reserved  { background: #f39c12; }
.table-cleaning  { background: #95a5a6; }

/* ---- Kitchen Display System (KDS) ---- */
.kds-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 991px) { .kds-board { grid-template-columns: 1fr; } }
.kds-column { background: #eef0f3; border-radius: 14px; padding: .75rem; min-height: 60vh; }
.kds-column-header { font-weight: 700; text-transform: uppercase; font-size: .95rem; letter-spacing: .04em;
  padding: .5rem .25rem; display: flex; justify-content: space-between; align-items: center; }
.kds-card { background: #fff; border-radius: 12px; padding: .9rem; margin-bottom: .75rem;
  border-left: 6px solid #95a5a6; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.kds-card.priority-warn { border-left-color: #f39c12; }
.kds-card.priority-danger { border-left-color: #e74c3c; animation: kds-pulse 1.4s infinite; }
.kds-card.new-flash { animation: kds-flash 1.2s ease-in-out 2; }
.kds-card .kds-order-no { font-weight: 700; font-size: 1.1rem; }
.kds-card .kds-elapsed { font-variant-numeric: tabular-nums; font-weight: 600; }
.kds-item-name { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
.kds-item-meta { font-size: .85rem; color: #667; }
.kds-btn { font-size: 1rem; padding: .5rem 1rem; }
@keyframes kds-pulse { 0%,100% { box-shadow: 0 2px 8px rgba(231,76,60,.15); } 50% { box-shadow: 0 2px 20px rgba(231,76,60,.55); } }
@keyframes kds-flash { 0%,100% { background: #fff; } 50% { background: #fff3cd; } }

@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

/* ---- Print / "Save as PDF" support for any authenticated page ---- */
@media print {
  .app-sidebar, .topbar, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  table { font-size: 11px; }
}
