/* ============================================================
   Ceygate POS — app shell, sell screen, receipts
   (theme variables come from style.css; tables/pills from admin.css)
   ============================================================ */

.pos-body { background: var(--bg-alt); min-height: 100vh; display: flex; }

/* ---- Sidebar ---- */
.pos-sidebar {
  width: 210px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--panel-edge);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.pos-brand { display: flex; align-items: center; gap: 8px; padding: 18px 16px; border-bottom: 1px solid var(--panel-edge); }
.pos-badge { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.16em; color: var(--red); border: 1px solid rgba(237,28,36,0.45); border-radius: 5px; padding: 2px 6px; }
.pos-nav { flex: 1; padding: 12px 8px; display: grid; gap: 2px; align-content: start; }
.pos-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 500; font-size: 0.95rem; transition: background .15s, color .15s;
}
.pos-nav a:hover { color: var(--text); background: var(--bg-alt); }
.pos-nav a.active { color: var(--red); background: var(--red-soft); font-weight: 600; }
.pos-nav-icon { width: 22px; text-align: center; }
.pos-sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--panel-edge); }
.pos-org-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-logout { font-size: 0.82rem; color: var(--muted); }
.pos-logout:hover { color: var(--red); }

.pos-main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pos-trial-banner {
  padding: 8px 20px; font-size: 0.85rem; text-align: center;
  background: var(--panel); border-bottom: 1px solid var(--panel-edge); color: var(--muted);
}
.pos-trial-banner a { color: var(--red); font-weight: 600; }
.pos-trial-banner.warn { background: rgba(224,162,0,0.12); color: var(--text); }
.pos-trial-banner.expired { background: var(--red-soft); color: var(--text); }
.pos-main { flex: 1; padding: 26px 28px 60px; }
.pos-page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pos-page-head h1 { font-size: 1.5rem; }

/* ---- Auth (signup/login/landing reuse site chrome) ---- */
.pos-auth-wrap { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 24px; background: var(--bg-alt); }
.pos-auth-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 36px 34px; }
.pos-auth-card h1 { font-size: 1.3rem; margin-bottom: 6px; }
.pos-auth-card .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 22px; }
.pos-auth-card label { display: block; font-size: 0.87rem; font-weight: 600; margin-bottom: 6px; }
.pos-auth-card input { width: 100%; padding: 12px 14px; border-radius: 9px; font: inherit; background: var(--bg); border: 1px solid var(--panel-edge); color: var(--text); margin-bottom: 16px; }
.pos-auth-card input:focus { outline: none; border-color: var(--red); }
.pos-auth-note { text-align: center; font-size: 0.88rem; color: var(--muted); margin-top: 16px; }
.pos-auth-note a { color: var(--red); font-weight: 600; }
.pos-trial-chip { display: inline-block; background: rgba(33,163,102,0.12); color: #1c8a50; border: 1px solid rgba(33,163,102,0.35); font-size: 0.8rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
:root[data-theme="dark"] .pos-trial-chip { color: #7ee2a8; }

/* ---- Sell screen ---- */
.sell-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.sell-search { width: 100%; padding: 13px 16px; border-radius: 10px; font: inherit; font-size: 1rem; background: var(--panel); border: 1px solid var(--panel-edge); color: var(--text); margin-bottom: 14px; }
.sell-search:focus { outline: none; border-color: var(--red); }
.sell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sell-card {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 10px;
  padding: 14px; cursor: pointer; font: inherit; text-align: left; color: var(--text);
  transition: border-color .15s, transform .1s; min-height: 88px; display: flex; flex-direction: column; justify-content: space-between;
}
.sell-card:hover { border-color: var(--red); transform: translateY(-1px); }
.sell-card b { font-size: 0.92rem; line-height: 1.3; }
.sell-card .price { color: var(--red); font-weight: 700; font-size: 0.9rem; margin-top: 6px; }
.sell-card .stock { color: var(--gray); font-size: 0.75rem; }
.sell-card.out { opacity: 0.45; cursor: not-allowed; }

.cart-panel { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 20px; position: sticky; top: 16px; }
.cart-panel h3 { font-size: 1.05rem; margin-bottom: 12px; }
.cart-items { max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.cart-row { display: grid; grid-template-columns: 1fr 64px 84px 26px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--panel-edge); font-size: 0.9rem; }
.cart-row input.qty { width: 100%; padding: 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--panel-edge); color: var(--text); text-align: center; font: inherit; font-size: 0.88rem; }
.cart-row .line { text-align: right; font-weight: 600; white-space: nowrap; }
.cart-row .rm { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.cart-row .rm:hover { color: var(--red); }
.cart-empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 0.9rem; }
.cart-totals { font-size: 0.92rem; display: grid; gap: 6px; margin: 12px 0; }
.cart-totals .row { display: flex; justify-content: space-between; color: var(--muted); }
.cart-totals .row b { color: var(--text); }
.cart-totals .grand { font-size: 1.25rem; border-top: 2px solid var(--red); padding-top: 10px; }
.cart-totals .grand b { color: var(--red); }
.cart-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.cart-controls label { font-size: 0.78rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.cart-controls input, .cart-controls select { width: 100%; padding: 9px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--panel-edge); color: var(--text); font: inherit; font-size: 0.9rem; }
.cart-change { text-align: center; font-size: 0.95rem; color: var(--muted); margin-bottom: 10px; min-height: 1.3em; }
.cart-change b { color: #21a366; font-size: 1.1rem; }
.btn-complete { width: 100%; padding: 15px; font-size: 1.05rem; }

/* ---- Receipt ---- */
.receipt-sheet {
  max-width: 380px; margin: 0 auto; background: #fff; color: #111;
  padding: 26px 24px; border-radius: 8px; border: 1px solid var(--panel-edge);
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.5;
}
.receipt-sheet h2 { text-align: center; font-size: 15px; margin-bottom: 2px; }
.receipt-sheet .r-sub { text-align: center; color: #555; margin-bottom: 12px; }
.receipt-sheet hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.receipt-sheet table { width: 100%; border-collapse: collapse; }
.receipt-sheet td { padding: 2px 0; vertical-align: top; }
.receipt-sheet td.r { text-align: right; white-space: nowrap; }
.receipt-sheet .tot td { font-weight: 700; font-size: 14px; }
.receipt-sheet .r-foot { text-align: center; color: #555; margin-top: 12px; }
.receipt-actions { max-width: 380px; margin: 16px auto 0; display: flex; gap: 10px; justify-content: center; }
@media print {
  body * { visibility: hidden !important; }
  .receipt-sheet, .receipt-sheet * { visibility: visible !important; }
  .receipt-sheet { position: absolute; inset: 0; margin: 0; border: 0; border-radius: 0; max-width: none; }
  .pos-sidebar, .pos-trial-banner, .receipt-actions { display: none !important; }
}

/* ---- Landing ---- */
.pos-landing-hero { text-align: center; padding: 90px 24px 60px; background: radial-gradient(ellipse 60% 50% at 50% 0%, var(--hero-tint), transparent 60%), var(--bg); }
.pos-landing-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); max-width: 780px; margin: 0 auto 18px; }
.pos-landing-hero h1 em { font-style: normal; color: var(--red); }
.pos-landing-hero p { color: var(--muted); font-size: 1.15rem; max-width: 620px; margin: 0 auto 30px; }
.pos-price-card { max-width: 420px; margin: 40px auto 0; background: var(--panel); border: 2px solid var(--red); border-radius: var(--radius); padding: 30px; text-align: center; }
.pos-price-card .big { font-size: 2.4rem; font-weight: 800; color: var(--red); }
.pos-price-card p { font-size: 0.95rem; margin: 8px auto 18px; }

/* ---- Responsive ---- */
@media (max-width: 980px) { .sell-layout { grid-template-columns: 1fr; } .cart-panel { position: static; } }
@media (max-width: 760px) {
  .pos-body { flex-direction: column; }
  .pos-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .pos-brand { border-bottom: 0; padding: 10px 12px; }
  .pos-nav { display: flex; padding: 6px; }
  .pos-nav a { padding: 9px 10px; white-space: nowrap; }
  .pos-sidebar-foot { border-top: 0; margin-left: auto; white-space: nowrap; }
  .pos-main { padding: 18px 14px 50px; }
}
