/* ============ Innovative Graphics Design & Computer Solutions ============ */
:root {
  --red: #e52620;
  --red-dark: #c31d18;
  --yellow: #f7d908;
  --blue: #2036c8;
  --blue-dark: #16277e;
  --blue-soft: #e8ecfb;
  --ink: #17181c;
  --muted: #6b7280;
  --line: #e3e5ea;
  --bg: #f4f5f8;
  --card: #ffffff;
  --green: #178a3a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 24, 40, .09), 0 4px 14px rgba(20, 24, 40, .05);
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
}
.hidden { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; }

/* ============ login ============ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--blue-dark) 0%, var(--blue) 55%, #4056d6 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 34px 34px 26px; width: 100%; max-width: 430px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center;
  border-top: 6px solid var(--red);
}
.login-logo { width: 100%; max-width: 330px; margin-bottom: 8px; }
.login-card h1 { font-size: 19px; color: var(--blue-dark); margin-bottom: 20px; }
.login-card form { text-align: left; }
.login-foot { color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ============ layout ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, #141a3d, var(--blue-dark));
  color: #fff; position: fixed; inset: 0 auto 0 0; z-index: 40;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.brand-logo-box { background: #fff; border-radius: 10px; padding: 6px 10px; flex: 1; }
.brand-logo { width: 100%; max-height: 74px; object-fit: contain; display: block; }
.sidebar-close { display: none; margin-left: auto; color: #fff; }

.nav { padding: 10px 8px; flex: 1; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #8f9bd6; padding: 12px 12px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: #dbe1fb; padding: 9px 12px;
  border-radius: 8px; font-size: 14px; margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,.09); text-decoration: none; }
.nav a.active { background: var(--red); color: #fff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.sidebar-foot { padding: 12px 16px; font-size: 11.5px; color: #8f9bd6; border-top: 1px solid rgba(255,255,255,.14); }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  padding: 10px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
#menu-btn { display: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  background: none; border: none; font-size: 19px; cursor: pointer; padding: 6px 8px;
  border-radius: 8px; color: inherit;
}
.icon-btn:hover { background: var(--bg); }
.bell { position: relative; }
.bell-count {
  position: absolute; top: 0; right: 0; background: var(--red); color: #fff; font-size: 10.5px;
  min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; padding: 0 3px;
}
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user-chip:hover { background: var(--bg); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-meta { line-height: 1.2; }
.user-meta .u-name { font-weight: 600; font-size: 13.5px; }
.user-meta .u-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* global search */
.global-search { position: relative; flex: 1; max-width: 440px; }
.global-search input {
  width: 100%; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  font-size: 14px; background: var(--bg); outline: none;
}
.global-search input:focus { border-color: var(--blue); background: #fff; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 380px; overflow-y: auto; z-index: 50;
}
.search-item { padding: 10px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.search-item:hover { background: var(--blue-soft); }
.search-item .s-sub { color: var(--muted); font-size: 12.5px; }

.content { padding: 20px 22px 44px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ============ page furniture ============ */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .spacer { flex: 1; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

/* stat tiles */
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; border-left: 5px solid var(--blue); min-width: 0;
}
.stat .s-label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .s-value { font-size: 24px; font-weight: 800; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.red { border-color: var(--red); }
.stat.yellow { border-color: var(--yellow); }
.stat.green { border-color: var(--green); }

/* ============ tables ============ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--line);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #f8f9fc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-link { cursor: pointer; }
.empty-state { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty-state .big { font-size: 34px; }

/* badges */
.badge {
  display: inline-block; padding: 2.5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  text-transform: capitalize;
}
.badge.paid, .badge.ok, .badge.active { background: #d9f2e1; color: var(--green); }
.badge.unpaid, .badge.critical, .badge.inactive, .badge.voided { background: #fddede; color: var(--red-dark); }
.badge.partial, .badge.warning, .badge.low { background: #fdf3c8; color: #8a6d00; }
.badge.info { background: var(--blue-soft); color: var(--blue-dark); }
.badge.role-admin { background: var(--red); color: #fff; }
.badge.role-manager { background: var(--blue); color: #fff; }
.badge.role-staff { background: #e3e5ea; color: #444; }

/* ============ buttons & forms ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  background: #e8eaef; color: var(--ink); transition: filter .12s;
}
.btn:hover { filter: brightness(.95); text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #333; }
input, select, textarea {
  width: 100%; padding: 9px 11px; margin-top: 4px; border: 1.5px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
textarea { resize: vertical; min-height: 66px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.form-error {
  background: #fddede; color: var(--red-dark); padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; margin-bottom: 12px;
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-label input { width: auto; margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { margin-bottom: 0; min-width: 130px; flex: 0 1 auto; }
.filters .btn { height: 38px; }

/* ============ modal ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 16, 38, .55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 14px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px; padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4); animation: pop .14s ease-out; margin-bottom: 4vh;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 17px; }
@keyframes pop { from { transform: translateY(10px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ============ toasts ============ */
.toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 17px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); animation: pop .15s ease-out; max-width: 340px;
}
.toast.error { background: var(--red-dark); }
.toast.success { background: var(--green); }

/* ============ notifications panel ============ */
.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw; background: #fff;
  z-index: 90; box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.notif-item .n-msg { flex: 1; font-size: 13.5px; cursor: pointer; }
.notif-item .n-msg:hover { color: var(--blue); }

/* ============ POS / line editor ============ */
.line-editor table.data td { padding: 6px 6px; }
.line-editor input, .line-editor select { margin-top: 0; }
.totals-box { margin-left: auto; max-width: 320px; font-size: 14.5px; }
.t-row { display: flex; justify-content: space-between; gap: 18px; padding: 4px 0; }
.t-total { font-size: 20px; font-weight: 800; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; }

/* product thumbnails */
.thumb { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: var(--bg); border: 1px solid var(--line); }

/* ============ invoice ============ */
.invoice-sheet { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px; max-width: 820px; margin: 0 auto; }
.inv-top { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--red); padding-bottom: 16px; }
.inv-top img { max-width: 300px; height: auto; }
.inv-biz { text-align: right; font-size: 13px; color: #333; }
.inv-biz .b-name { font-weight: 800; font-size: 15px; color: var(--blue-dark); }
.inv-meta { display: flex; justify-content: space-between; gap: 20px; margin: 18px 0; flex-wrap: wrap; }
.inv-meta h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.inv-title { font-size: 26px; font-weight: 800; color: var(--blue-dark); letter-spacing: .04em; }
.inv-qr { text-align: center; font-size: 10.5px; color: var(--muted); }
.inv-qr img { width: 86px; height: 86px; }
.inv-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.inv-status-stamp {
  display: inline-block; padding: 4px 16px; border: 3px solid; border-radius: 8px;
  font-weight: 800; text-transform: uppercase; letter-spacing: .1em; transform: rotate(-4deg);
}
.inv-status-stamp.paid { color: var(--green); border-color: var(--green); }
.inv-status-stamp.unpaid { color: var(--red); border-color: var(--red); }
.inv-status-stamp.partial { color: #8a6d00; border-color: #d9b400; }

/* charts */
.chart-box { position: relative; height: 260px; }

/* leaderboard */
.lb-rank { font-weight: 800; font-size: 15px; width: 34px; display: inline-block; }
.lb-section { margin-bottom: 4px; }
.lb-section h2 { display: flex; align-items: center; gap: 8px; }

/* user guide */
.guide details {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; padding: 0 18px;
}
.guide summary {
  cursor: pointer; font-weight: 700; font-size: 15.5px; padding: 15px 0;
  list-style-position: inside;
}
.guide details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.guide .g-body { padding-bottom: 16px; line-height: 1.65; }
.guide .g-body h4 { margin: 14px 0 4px; }
.guide .g-body code {
  background: var(--blue-soft); color: var(--blue-dark); padding: 1px 7px;
  border-radius: 6px; font-size: 13px; font-family: inherit; font-weight: 600;
}
.guide .g-step { display: flex; gap: 10px; margin: 7px 0; }
.guide .g-step .n {
  background: var(--blue); color: #fff; min-width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
}
.tip {
  background: #fdf7dd; border-left: 4px solid var(--yellow); padding: 9px 13px;
  border-radius: 0 8px 8px 0; margin: 9px 0; font-size: 13.5px;
}

/* ============ print ============ */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toast-root, .notif-panel, .sidebar-backdrop { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .invoice-sheet, .card { box-shadow: none; border-radius: 0; padding: 10px; }
}

/* ============ responsive ============ */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease-out; width: 272px; }
  .sidebar.open { transform: none; }
  .sidebar-close { display: block; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .main { margin-left: 0; }
  #menu-btn { display: block; }
  .content { padding: 14px 12px 40px; }
  .grid-2, .grid-3, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .user-meta { display: none; }
  .stat .s-value { font-size: 20px; }
  .invoice-sheet { padding: 18px; }
  .global-search { max-width: none; }
  table.data { font-size: 13px; }
  .modal { padding: 16px; }
}
