/* =========================================================================
   style.css — shared styles for landing page + app
   ========================================================================= */
:root {
  /* Fluffy brand palette: #2F478E dark blue · #4468B1 blue · #8EACD9 light blue · #FFF6E9 cream */
  --bg: #f6f3ec;            /* soft cream background */
  --surface: #ffffff;
  --ink: #1e2a4a;          /* deep blue-ink */
  --muted: #6b7896;
  --line: #e6e1d6;
  --brand: #4468B1;        /* primary blue */
  --brand-dark: #2F478E;   /* darker blue (hover) */
  --brand-light: #8EACD9;  /* light blue accent */
  --cream: #FFF6E9;
  --sidebar: #2F478E;      /* brand dark blue sidebar */
  --pos: #16a34a;
  --neg: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 49, 96, .06), 0 8px 24px rgba(31, 49, 96, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- Buttons ---------- */
.btn {
  background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn.full { width: 100%; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f1f5f9; }
.btn.danger-outline { background: #fff; color: var(--neg); border: 1px solid #fca5a5; }
.btn.danger-outline:hover { background: #fef2f2; }
.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; font-size: 15px; padding: 4px 8px; color: var(--muted);
}
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.icon-btn.danger:hover { background: #fef2f2; color: var(--neg); }

/* ---------- Badges / pills ---------- */
.badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge.owner { background: #ede9fe; color: #6d28d9; }
.badge.manager { background: #dcfce7; color: #15803d; }
.badge.employee { background: #e0f2fe; color: #0369a1; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.danger { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.cat-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; color: #fff; white-space: nowrap; }
.qstep { display: inline-flex; align-items: center; gap: 8px; }
.qbtn { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; color: var(--brand-dark); }
.qbtn:hover { background: #eaf2fb; border-color: var(--brand); }
.qbtn:active { transform: translateY(1px); }
.cellqty { display: inline-flex; align-items: center; gap: 3px; }
.chip-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.chip-btn:hover .cat-chip { outline: 2px solid #8EACD9; outline-offset: 1px; }
.inv-table th, .inv-table td { white-space: nowrap; }
.notify-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-btn { background: #25d366; text-decoration: none; }
.wa-btn:hover { background: #1ebe5b; }
.contact-row { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.contact-row input { width: 100%; }
@media (max-width: 640px) { .contact-row { grid-template-columns: 1fr 1fr; } }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.ft-tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.ft-tag.fd { background: #dcfce7; color: #166534; }
.ft-tag.nf { background: #e2e8f0; color: #475569; }

/* =====================================================================
   LANDING PAGE
   ===================================================================== */
.lp-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 6vw; position: sticky; top: 0; background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); z-index: 10;
}
.lp-logo { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--brand); }
.lp-hero {
  text-align: center; padding: 90px 6vw 70px;
  background: radial-gradient(1200px 400px at 50% -10%, #d3e2f3, transparent), var(--bg);
}
.lp-hero h1 { font-size: clamp(32px, 5vw, 54px); margin: 0 0 16px; line-height: 1.1; }
.lp-hero h1 span { color: var(--brand-dark); }
.lp-hero p { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0 auto 28px; }
.lp-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.lp-section { padding: 60px 6vw; max-width: 1100px; margin: 0 auto; }
.lp-section h2 { text-align: center; font-size: 30px; margin: 0 0 8px; }
.lp-section .sub { text-align: center; color: var(--muted); margin: 0 0 40px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.feature .ico { font-size: 28px; }
.feature h3 { margin: 12px 0 6px; }
.feature p { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.6; }
.lp-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.lp-roles-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 820px) { .lp-roles-3 { grid-template-columns: 1fr; } }
.role-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.role-box ul { padding-left: 18px; color: var(--muted); line-height: 1.9; margin: 12px 0 0; }
.lp-foot { text-align: center; padding: 40px 6vw 60px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 40px; }
@media (max-width: 640px) { .lp-roles { grid-template-columns: 1fr; } }

/* =====================================================================
   APP LAYOUT
   ===================================================================== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: #2F478E; color: #cbd5e1; display: flex; flex-direction: column;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; padding: 8px 8px 2px; }
.brand-logo { height: 30px; }
.brand-sub { color: #94a3b8; font-size: 12px; font-weight: 600; padding: 0 8px 16px; }
.logo-img { display: block; width: auto; max-width: 100%; }
.brand img, .login-brand img, .lp-logo img, .lp-hero img { max-height: 96px; }
.nav-logo { height: 30px; }
.hero-logo { height: 84px; max-width: 80%; margin: 0 auto 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; background: transparent; border: 0;
  color: #cbd5e1; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px;
  text-align: left; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: var(--brand-light); color: #1c2c55; font-weight: 700; }
.nav-icon { width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.18); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.who-name { color: #fff; font-size: 14px; font-weight: 600; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 28px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; margin: 0; flex: 1; }
.hamburger { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.content { padding: 28px; max-width: 1200px; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-left: 4px solid var(--brand); }
.kpi-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.kpi-value { font-size: 24px; font-weight: 800; }
.kpi.rev { border-left-color: #4468B1; }
.kpi.exp { border-left-color: #f59e0b; }
.kpi.pos { border-left-color: var(--pos); }
.kpi.neg { border-left-color: var(--neg); }
.kpi.warn { border-left-color: var(--warn); }
.kpi.inv { border-left-color: #06b6d4; }
.kpi.units { border-left-color: #a855f7; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; }
tbody tr:hover { background: #f8fafc; }
.row-actions { text-align: right; white-space: nowrap; }
.search { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px; min-width: 220px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; }
.bar-rev { fill: #4468B1; }
.bar-exp { fill: #f59e0b; }
.bar:hover { opacity: .82; }
.grid { stroke: #eef2f7; stroke-width: 1; }
.axis-x, .axis-y { fill: #94a3b8; font-size: 11px; }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend-inline .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend-inline .sw.rev { background: #4468B1; }
.legend-inline .sw.exp { background: #f59e0b; }

.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut { width: 160px; height: 160px; flex: none; }
.donut-c1 { font-size: 17px; font-weight: 800; fill: var(--ink); }
.donut-c2 { font-size: 10px; fill: var(--muted); text-transform: uppercase; }
.legend { flex: 1; min-width: 160px; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-name { flex: 1; }
.legend-val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Location switch ---------- */
.segmented { display: inline-flex; background: #eef2f7; border-radius: 10px; padding: 3px; gap: 2px; }
.seg { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg:hover { color: var(--ink); }
.seg.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); }
.loc-bar { margin-bottom: 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.loc-bar .search { min-width: 200px; }
.sec-food { border-top: 3px solid #16a34a; }
.sec-nonfood { border-top: 3px solid #64748b; }
.loc-pill { display: inline-block; background: #ede9fe; color: #5b21b6; font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 999px; }

/* ---------- Approvals ---------- */
.approval-card { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.ac-main { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 220px; }
.ac-summary { font-weight: 600; }
.ac-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Activity log ---------- */
.log-row { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #f1f5f9; }
.log-row:last-child { border-bottom: 0; }
.log-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; background: #f1f5f9; display: grid; place-items: center; font-size: 15px; }
.log-main { flex: 1; min-width: 0; }
.log-main .pill { margin-left: 4px; }

/* ---------- Receipt scanning ---------- */
.dropzone { display: block; border: 2px dashed #8EACD9; border-radius: 14px; padding: 30px; text-align: center;
  cursor: pointer; background: #f8faff; transition: background .15s, border-color .15s; margin: 6px 0 4px; }
.dropzone:hover { background: #eaf2fb; border-color: var(--brand); }
.dz-ico { font-size: 36px; margin-bottom: 8px; }
.dz-inner { color: var(--muted); font-weight: 600; }
.ai-loading { text-align: center; padding: 36px 10px; color: var(--muted); }
.spinner { width: 40px; height: 40px; border: 4px solid #e2e8f0; border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 14px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rcpt-table th, .rcpt-table td { padding: 6px 6px; }
.rcpt-table input { padding: 6px 8px; width: 100%; }

/* ---------- Permissions cards ---------- */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.perm-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 860px) { .perm-grid-3 { grid-template-columns: 1fr; } }
.perm-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.perm-card ul { padding-left: 18px; line-height: 1.8; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---------- Forms / modals ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid #8EACD9; border-color: var(--brand); }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 540px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .15s ease; }
.modal.sm { max-width: 400px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 14px; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -10%, #8EACD9, transparent), var(--bg); }
.login-card { background: #fff; padding: 34px; border-radius: 18px; width: 100%; max-width: 400px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-brand { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.login-card h2 { margin: 8px 0 0; }
.login-card p { margin: 0 0 8px; }
.demo-creds { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.demo-title { font-size: 12px; color: var(--muted); }
.demo-chip { text-align: left; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; cursor: pointer; font-size: 13px; }
.demo-chip:hover { background: #eaf2fb; border-color: #8EACD9; }
.back-link { text-align: center; font-size: 13px; text-decoration: none; margin-top: 4px; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #2F478E; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 80; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Reports / misc ---------- */
.warn-text { color: var(--warn); }
.report-head { border-bottom: 2px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.report-head h2 { margin: 0 0 4px; }
.report-print table { width: 100%; border-collapse: collapse; }
.report-print h3 { font-size: 15px; margin: 0 0 8px; }

@media print {
  .sidebar, .bottom-nav, .topbar, .no-print, #toast, .hamburger { display: none !important; }
  .layout { display: block; }
  .main { width: 100%; }
  .content { padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #d0d5dd; break-inside: avoid; }
}

/* ---------- Mobile bottom tab bar ---------- */
.bottom-nav { display: none; }

/* ---------- Responsive: phones & iPads ---------- */
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -280px; z-index: 60; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { left: 0; }
  .hamburger { display: block; font-size: 24px; padding: 4px 8px; }
  .content { padding: 16px 14px 92px; }       /* bottom space for the tab bar */
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }

  /* the bottom tab bar */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #2F478E; border-top: 1px solid rgba(255,255,255,.18); gap: 2px;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .bnav-item { position: relative; flex: 1 0 auto; min-width: 60px; background: transparent; border: 0;
    color: #cbd5e1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; cursor: pointer; }
  .bnav-item.active { background: var(--brand-light); color: #1c2c55; }
  .bnav-ic { font-size: 19px; line-height: 1; }
  .bnav-badge { position: absolute; top: 2px; right: 8px; background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }

  /* bigger, finger-friendly controls */
  body { font-size: 15px; }
  .btn { padding: 12px 18px; font-size: 15px; }
  .btn.sm { padding: 9px 14px; font-size: 14px; }
  .icon-btn { font-size: 18px; padding: 8px 10px; }
  .qbtn { width: 38px; height: 38px; font-size: 20px; }
  input, select, textarea { font-size: 16px; padding: 12px; }   /* 16px stops iOS zoom-on-tap */
  .kpi-value { font-size: 22px; }
  .modal { max-width: 100%; }
}
