/* =========================================================
   BAHER - KHAU — Restaurant POS Theme
   Palette: Deep Forest Green (brand) / Warm Gold-Wood (accent) / Cream (surface)
========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root{
  --forest:      #1B4332;
  --forest-2:    #2D6A4F;
  --forest-dark: #0F2A1E;
  --gold:        #B08D57;
  --gold-light:  #D4B483;
  --gold-soft:   #FBF3E7;
  --leaf:        #40916C;
  --leaf-soft:   #E6F4EC;
  --red:         #E63946;
  --red-soft:    #FDECEE;
  --amber:       #E8A33D;
  --amber-soft:  #FBF0DE;
  --blue-soft:   #E8F0FE;

  --bg:          #F7F4EE;
  --surface:     #FFFFFF;
  --border:      #E8E1D3;
  --text:        #23291F;
  --text-dim:    #746C5C;
  --text-faint:  #A79E8C;

  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   22px;
  --shadow-sm:   0 1px 3px rgba(27,67,50,0.08);
  --shadow:      0 8px 24px rgba(27,67,50,0.10);
  --shadow-lg:   0 18px 44px rgba(27,67,50,0.18);

  --font-display:'Fraunces', serif;
  --font-body:   'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  --topbar-h: 64px;
  --sidebar-w: 232px;
  --bottomnav-h: 66px;
}

*{ box-sizing:border-box; }
html{ overflow-x:hidden; max-width:100%; }
html,body{ margin:0; padding:0; }
body.rp{
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  max-width:100%;
}
.rp h1,.rp h2,.rp h3,.rp h4,.rp .font-display{ font-family:var(--font-display); letter-spacing:-0.01em; }
.rp a{ text-decoration:none; color:inherit; }
.rp button{ font-family:var(--font-body); cursor:pointer; }
.rp .mono{ font-family:var(--font-mono); }
.rp ::-webkit-scrollbar{ width:6px; height:6px; }
.rp ::-webkit-scrollbar-thumb{ background:#DCD3BE; border-radius:10px; }

/* ---------------- Layout shell ---------------- */
.rp-shell{ display:flex; min-height:100vh; }

.rp-sidebar{
  width:var(--sidebar-w);
  background:linear-gradient(180deg,var(--forest-dark) 0%, var(--forest) 100%);
  color:#fff;
  position:fixed; top:0; left:0; bottom:0;
  display:flex; flex-direction:column;
  padding:20px 14px;
  z-index:40;
  overflow-y:auto;
}
.rp-brand{ display:flex; align-items:center; gap:10px; padding:2px 6px 20px; }
.rp-brand-mark{
  width:38px; height:38px; border-radius:10px;
  background:linear-gradient(135deg,var(--gold),var(--gold-light));
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-weight:800; color:var(--forest-dark); font-size:16px;
}
.rp-brand-name{ font-family:var(--font-display); font-weight:700; font-size:15px; color:#fff; line-height:1.2; }
.rp-brand-sub{ font-size:10px; color:#9CB8A9; margin-top:1px; }

.rp-nav-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:#7C9A87; margin:14px 10px 6px; }

.rp-link{
  display:flex; align-items:center; gap:11px;
  padding:9px 11px; border-radius:11px; margin:1px 0;
  color:#CFE0D5; font-size:13px; font-weight:500;
  transition:background .15s, color .15s;
}
.rp-link svg{ width:17px; height:17px; flex-shrink:0; }
.rp-link:hover{ background:rgba(255,255,255,0.07); color:#fff; }
.rp-link.active{ background:rgba(176,141,87,0.22); color:var(--gold-light); }

.rp-sidebar-foot{ margin-top:auto; }
.rp-user-chip{ display:flex; align-items:center; gap:9px; padding:9px; border-radius:11px; background:rgba(255,255,255,0.06); }
.rp-avatar{ width:32px; height:32px; border-radius:9px; background:var(--gold); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; color:var(--forest-dark); flex-shrink:0; }
.rp-user-chip .un{ font-size:12.5px; font-weight:600; color:#fff; }
.rp-user-chip .ur{ font-size:10.5px; color:#9CB8A9; text-transform:capitalize; }

.rp-main{ flex:1; margin-left:var(--sidebar-w); min-width:0; max-width:calc(100% - var(--sidebar-w)); display:flex; flex-direction:column; overflow-x:hidden; }

.rp-topbar{
  height:var(--topbar-h); position:sticky; top:0; z-index:30;
  background:rgba(247,244,238,0.9); backdrop-filter:blur(10px);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 22px; border-bottom:1px solid var(--border);
}
.rp-page-title{ font-size:18px; font-weight:700; font-family:var(--font-display); }
.rp-page-sub{ font-size:12px; color:var(--text-dim); margin-top:1px; }

.rp-content{ padding:20px 22px 100px; flex:1; min-width:0; max-width:100%; overflow-x:hidden; }

/* ---------------- Buttons ---------------- */
.rp-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 18px; border-radius:12px; border:none; font-size:13.5px; font-weight:600;
  transition:transform .1s, box-shadow .15s, background .15s; white-space:nowrap;
}
.rp-btn:active{ transform:scale(0.97); }
.rp-btn svg{ width:16px; height:16px; }
.rp-btn-primary{ background:var(--forest); color:#fff; box-shadow:0 4px 14px rgba(27,67,50,0.3); }
.rp-btn-primary:hover{ background:var(--forest-2); color:#fff; }
.rp-btn-gold{ background:var(--gold); color:#fff; box-shadow:0 4px 14px rgba(176,141,87,0.35); }
.rp-btn-gold:hover{ background:#9A7A49; color:#fff; }
.rp-btn-ghost{ background:var(--surface); color:var(--text); border:1.5px solid var(--border); }
.rp-btn-ghost:hover{ background:#F1EDE1; }
.rp-btn-leaf{ background:var(--leaf); color:#fff; }
.rp-btn-danger{ background:var(--red-soft); color:var(--red); }
.rp-btn-sm{ padding:8px 13px; font-size:12.5px; border-radius:10px; }
.rp-btn-lg{ padding:16px 20px; font-size:15px; border-radius:14px; }
.rp-btn-icon{ width:40px; height:40px; padding:0; border-radius:11px; }
.rp-btn-block{ width:100%; }
.rp-fab{
  position:fixed; right:18px; bottom:calc(var(--bottomnav-h) + 18px);
  width:56px; height:56px; border-radius:18px; background:var(--forest); color:#fff;
  display:flex; align-items:center; justify-content:center; box-shadow:0 10px 24px rgba(27,67,50,0.4);
  z-index:45; border:none;
}
@media(min-width:901px){ .rp-fab{ display:none; } }

/* ---------------- Cards / stat tiles ---------------- */
.rp-grid{ display:grid; gap:14px; }
.rp-grid-4{ grid-template-columns:repeat(4,1fr); }
.rp-grid-3{ grid-template-columns:repeat(3,1fr); }
.rp-grid-2{ grid-template-columns:repeat(2,1fr); }
@media(max-width:1100px){ .rp-grid-4{ grid-template-columns:repeat(2,1fr); } .rp-grid-3{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:640px){ .rp-grid-4,.rp-grid-3,.rp-grid-2{ grid-template-columns:1fr 1fr; gap:10px; } }
@media(max-width:420px){ .rp-grid-4{ grid-template-columns:1fr; } }

.rp-card{ background:var(--surface); border-radius:var(--radius); border:1px solid var(--border); box-shadow:var(--shadow-sm); min-width:0; }
.rp-card-pad{ padding:18px; }

.rp-stat{ background:var(--surface); border-radius:var(--radius); padding:16px 18px; border:1px solid var(--border); box-shadow:var(--shadow-sm); position:relative; overflow:hidden; min-width:0; }
.rp-stat .si{ width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; margin-bottom:10px; }
.rp-stat .si svg{ width:18px; height:18px; }
.rp-stat .sv{ font-family:var(--font-display); font-size:23px; font-weight:700; }
.rp-stat .sl{ font-size:11.5px; color:var(--text-dim); margin-top:2px; }
.tone-forest{ background:var(--leaf-soft); color:var(--forest); }
.tone-gold{ background:var(--gold-soft); color:#8A6A3C; }
.tone-leaf{ background:var(--leaf-soft); color:#15803D; }
.tone-red{ background:var(--red-soft); color:var(--red); }
.tone-amber{ background:var(--amber-soft); color:#92660E; }
.tone-blue{ background:var(--blue-soft); color:#1D4ED8; }

/* ---------------- Badges ---------------- */
.rp-badge{ display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; padding:4px 10px; border-radius:20px; white-space:nowrap; }
.badge-gray{ background:#EEEAE0; color:var(--text-dim); }
.badge-amber{ background:var(--amber-soft); color:#92660E; }
.badge-green{ background:var(--leaf-soft); color:#15803D; }
.badge-blue{ background:var(--blue-soft); color:#1D4ED8; }
.badge-red{ background:var(--red-soft); color:var(--red); }
.badge-gold{ background:var(--gold-soft); color:#8A6A3C; }

/* ---------------- Data table -> app cards on mobile ---------------- */
.rp-table{ width:100%; border-collapse:collapse; }
.rp-table th{ text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-faint); padding:12px 14px; border-bottom:1px solid var(--border); }
.rp-table td{ padding:12px 14px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle; }
.rp-table tr:last-child td{ border-bottom:none; }
.rp-table tr:hover td{ background:#FBFAF6; }
.rp-row-name{ font-weight:600; }
.rp-row-sub{ font-size:11.5px; color:var(--text-dim); }

@media(max-width:800px){
  .rp-table thead{ display:none; }
  .rp-table, .rp-table tbody, .rp-table tr, .rp-table td{ display:block; width:100%; }
  .rp-table tr{ background:var(--surface); border:1px solid var(--border); border-radius:14px; margin-bottom:10px; padding:12px 13px; box-shadow:var(--shadow-sm); }
  .rp-table td{ border:none; padding:4px 0; display:flex; justify-content:space-between; gap:10px; text-align:right; }
  .rp-table td[data-label]:before{ content:attr(data-label); font-size:10px; color:var(--text-faint); text-transform:uppercase; letter-spacing:.04em; font-weight:700; text-align:left; flex-shrink:0; }
}

/* ---------------- Forms ---------------- */
.rp-form-group{ margin-bottom:14px; }
.rp-form-group label{ display:block; font-size:12px; font-weight:600; color:var(--text-dim); margin-bottom:5px; }
.rp input[type=text],.rp input[type=email],.rp input[type=password],.rp input[type=number],
.rp input[type=date],.rp input[type=time],.rp input[type=tel],.rp select,.rp textarea{
  width:100%; padding:10px 12px; border-radius:10px; border:1.5px solid var(--border); background:var(--surface);
  font-size:13.5px; color:var(--text); font-family:var(--font-body); transition:border-color .15s;
}
.rp input:focus,.rp select:focus,.rp textarea:focus{ outline:none; border-color:var(--forest); }
.rp textarea{ resize:vertical; min-height:70px; }
.rp-form-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media(max-width:600px){ .rp-form-row{ grid-template-columns:1fr; } }

/* ---------------- Modal / toast ---------------- */
#rpToastHost{ position:fixed; top:16px; right:16px; z-index:9999; display:flex; flex-direction:column; gap:10px; }
.rp-toast{ min-width:230px; max-width:320px; background:var(--forest-dark); color:#fff; padding:12px 15px; border-radius:12px; font-size:12.5px; box-shadow:var(--shadow-lg); display:flex; align-items:center; gap:10px; animation:rpSlideIn .25s ease; }
.rp-toast.success{ border-left:4px solid var(--leaf); }
.rp-toast.error{ border-left:4px solid var(--red); }
.rp-toast.info{ border-left:4px solid var(--gold); }
@keyframes rpSlideIn{ from{ transform:translateX(30px); opacity:0; } to{ transform:translateX(0); opacity:1; } }

.rp-modal-overlay{ position:fixed; inset:0; background:rgba(15,42,30,0.55); backdrop-filter:blur(2px); z-index:200; display:none; align-items:center; justify-content:center; padding:18px; }
.rp-modal-overlay.show{ display:flex; }
.rp-modal-box{ background:var(--surface); border-radius:var(--radius-lg); max-width:460px; width:100%; padding:22px; box-shadow:var(--shadow-lg); animation:rpPopIn .18s ease; max-height:88vh; overflow-y:auto; }
.rp-modal-box.lg{ max-width:720px; }
.rp-modal-box.xl{ max-width:960px; }
@keyframes rpPopIn{ from{ transform:scale(.95); opacity:0; } to{ transform:scale(1); opacity:1; } }
.rp-modal-title{ font-family:var(--font-display); font-size:16px; font-weight:700; margin-bottom:4px; }
.rp-modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:18px; }

/* ---------------- Auth screen ---------------- */
.rp-auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,var(--forest-dark) 0%, var(--forest) 130%); padding:20px; }
.rp-auth-card{ background:var(--surface); border-radius:var(--radius-lg); padding:34px 30px; width:100%; max-width:380px; box-shadow:var(--shadow-lg); }

/* ---------------- Misc ---------------- */
.rp-section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.rp-filters{ display:flex; gap:8px; flex-wrap:wrap; }
.rp-chip-select{ padding:8px 12px; border-radius:10px; border:1.5px solid var(--border); background:var(--surface); font-size:12px; font-weight:600; }
.rp-empty{ text-align:center; padding:44px 18px; color:var(--text-dim); }
.rp-empty svg{ width:48px; height:48px; color:var(--text-faint); margin-bottom:10px; }
.rp-tab-strip{ display:flex; gap:4px; background:#EFEADC; padding:4px; border-radius:12px; margin-bottom:16px; width:fit-content; overflow-x:auto; max-width:100%; }
.rp-tab-btn{ padding:8px 15px; border-radius:9px; font-size:12.5px; font-weight:600; color:var(--text-dim); border:none; background:transparent; white-space:nowrap; }
.rp-tab-btn.active{ background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }

.rp-filter-panel{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px; margin-bottom:16px; }
.rp-filter-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; align-items:end; }
.rp-filter-grid .rp-form-group{ margin-bottom:0; }
@media(max-width:700px){ .rp-filter-grid{ grid-template-columns:1fr 1fr; } }

/* ---------------- Bottom nav (tablet/mobile app feel) ---------------- */
.rp-bottom-nav{
  display:none; position:fixed; left:0; right:0; bottom:0; height:var(--bottomnav-h);
  background:rgba(255,255,255,0.97); backdrop-filter:blur(10px); border-top:1px solid var(--border);
  z-index:50; align-items:center; justify-content:space-around; padding-bottom:env(safe-area-inset-bottom);
}
.rp-bn-item{ display:flex; flex-direction:column; align-items:center; gap:3px; color:var(--text-faint); font-size:10px; font-weight:600; flex:1; padding:6px 0; }
.rp-bn-item svg{ width:21px; height:21px; }
.rp-bn-item.active{ color:var(--forest); }

/* ---------------- Table layout grid (floor plan) ---------------- */
.rp-floor-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:14px; }
.rp-table-card{
  border-radius:16px; padding:16px 14px; text-align:center; cursor:pointer; position:relative;
  border:2px solid transparent; transition:transform .15s, box-shadow .15s; min-height:120px;
  display:flex; flex-direction:column; justify-content:center; gap:4px;
}
.rp-table-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); }
.rp-table-card.available{ background:var(--leaf-soft); border-color:#BFE3CE; }
.rp-table-card.occupied{ background:var(--red-soft); border-color:#F3C0C6; }
.rp-table-card.reserved{ background:var(--amber-soft); border-color:#F0D9A8; }
.rp-table-card.cleaning{ background:#EEEAE0; border-color:var(--border); }
.rp-table-card .tc-num{ font-family:var(--font-display); font-weight:700; font-size:18px; }
.rp-table-card .tc-cap{ font-size:11px; color:var(--text-dim); }
.rp-table-card .tc-total{ font-size:13px; font-weight:700; font-family:var(--font-mono); margin-top:2px; }
.rp-table-card .tc-status{ position:absolute; top:8px; right:8px; width:9px; height:9px; border-radius:50%; }
.rp-table-card.available .tc-status{ background:var(--leaf); }
.rp-table-card.occupied .tc-status{ background:var(--red); }
.rp-table-card.reserved .tc-status{ background:var(--amber); }
.rp-table-card.cleaning .tc-status{ background:var(--text-faint); }

.rp-legend{ display:flex; gap:16px; flex-wrap:wrap; margin-bottom:16px; font-size:12px; color:var(--text-dim); }
.rp-legend span{ display:inline-flex; align-items:center; gap:6px; }
.rp-legend .dot{ width:9px; height:9px; border-radius:50%; }

/* ---------------- Menu item picker (order screen) ---------------- */
.rp-menu-item{ background:var(--surface); border:1.5px solid var(--border); border-radius:14px; padding:12px; cursor:pointer; transition:.15s; text-align:center; }
.rp-menu-item:hover{ border-color:var(--gold); transform:translateY(-2px); box-shadow:var(--shadow-sm); }
.rp-menu-item.unavailable{ opacity:.4; pointer-events:none; }
.rp-menu-item img{ width:100%; aspect-ratio:1; object-fit:cover; border-radius:10px; margin-bottom:8px; background:var(--bg); }
.rp-menu-item .mi-name{ font-size:12.5px; font-weight:600; line-height:1.3; }
.rp-menu-item .mi-price{ font-size:12px; color:var(--forest); font-weight:700; margin-top:3px; font-family:var(--font-mono); }

.rp-cart-row{ display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.rp-cart-row:last-child{ border-bottom:none; }
.rp-qty-stepper{ display:flex; align-items:center; gap:6px; }
.rp-qty-stepper button{ width:26px; height:26px; border-radius:8px; border:1px solid var(--border); background:var(--surface); font-weight:700; }
.rp-qty-stepper span{ min-width:20px; text-align:center; font-weight:600; font-size:13px; }

/* ---------------- KDS ticket cards ---------------- */
.rp-kds-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }
.rp-kds-ticket{ background:var(--surface); border-radius:14px; border:1px solid var(--border); box-shadow:var(--shadow-sm); overflow:hidden; }
.rp-kds-ticket .kt-head{ padding:10px 14px; display:flex; justify-content:space-between; align-items:center; font-weight:700; font-size:13px; }
.rp-kds-ticket.pending .kt-head{ background:#EEEAE0; }
.rp-kds-ticket.preparing .kt-head{ background:var(--amber-soft); color:#92660E; }
.rp-kds-ticket.ready .kt-head{ background:var(--leaf-soft); color:#15803D; }
.rp-kds-ticket .kt-body{ padding:12px 14px; }
.rp-kds-ticket .kt-notes{ font-size:11.5px; color:var(--red); margin-top:4px; }
.rp-kds-ticket .kt-time{ font-size:11px; color:var(--text-faint); }
.rp-kds-ticket .kt-actions{ display:flex; gap:8px; padding:10px 14px; border-top:1px solid var(--border); }

/* ---------------- Print receipt ---------------- */
.rp-receipt{ font-family:'JetBrains Mono', monospace; font-size:12px; max-width:320px; margin:0 auto; color:#000; background:#fff; padding:16px; }
.rp-receipt h2{ text-align:center; font-size:15px; margin:0 0 2px; }
.rp-receipt .center{ text-align:center; }
.rp-receipt hr{ border:none; border-top:1px dashed #000; margin:8px 0; }
.rp-receipt table{ width:100%; border-collapse:collapse; font-size:11px; }
.rp-receipt table td{ padding:2px 0; }
@media print{
  body *{ visibility:hidden; }
  .rp-receipt, .rp-receipt *{ visibility:visible; }
  .rp-receipt{ position:absolute; top:0; left:0; }
}

/* ---------------- Responsive shell switching ---------------- */
@media(max-width:900px){
  .rp-sidebar{ display:none; }
  .rp-main{ margin-left:0; }
  .rp-bottom-nav{ display:flex; }
  .rp-content{ padding:14px 12px 90px; }
  .rp-topbar{ padding:0 14px; }
}
@media(min-width:901px){ .rp-mobile-only{ display:none !important; } }
@media(max-width:900px){ .rp-desktop-only{ display:none !important; } }

.rp-table-scroll{ overflow-x:auto; }
@media(max-width:800px){ .rp-table-scroll{ overflow-x:visible; width:100%; } }
