:root {
  --bg: #08111f;
  --bg-soft: #0d1a2d;
  --panel: rgba(16, 30, 50, 0.82);
  --panel-strong: #12233a;
  --line: rgba(255,255,255,.09);
  --text: #edf4ff;
  --muted: #93a4bc;
  --primary: #6c7cff;
  --primary-2: #40d0ff;
  --success: #2ed19f;
  --warning: #ffb84d;
  --danger: #ff617d;
  --shadow: 0 18px 55px rgba(0,0,0,.28);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 15%, rgba(108,124,255,.14), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(64,208,255,.12), transparent 26%),
    linear-gradient(160deg, #07101d 0%, #0a1525 45%, #07101a 100%);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  overflow: hidden;
}
.login-visual {
  position: relative;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(108,124,255,.20), rgba(64,208,255,.05)),
    radial-gradient(circle at 30% 25%, rgba(108,124,255,.34), transparent 35%);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 8% 8% auto auto;
  width: 320px;
  height: 320px;
  border-radius: 48% 52% 42% 58%;
  background: linear-gradient(135deg, rgba(108,124,255,.32), rgba(64,208,255,.12));
  filter: blur(1px);
  animation: floaty 8s ease-in-out infinite;
}
@keyframes floaty { 50% { transform: translateY(20px) rotate(6deg); } }
.brand { display:flex; align-items:center; gap:12px; font-weight:800; letter-spacing:.2px; position:relative; z-index:2; }
.brand-mark { width:42px; height:42px; border-radius:14px; background:linear-gradient(135deg,var(--primary),var(--primary-2)); box-shadow:0 12px 35px rgba(108,124,255,.35); display:grid; place-items:center; font-weight:900; }
.hero-copy { position:relative; z-index:2; max-width:640px; }
.hero-copy h1 { font-size: clamp(40px, 5vw, 78px); line-height:.98; margin:0 0 24px; letter-spacing:-2.5px; }
.hero-copy p { color:#b9c7da; font-size:18px; max-width:560px; line-height:1.65; }
.kpi-strip { display:flex; gap:16px; flex-wrap:wrap; margin-top:34px; }
.mini-kpi { background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.10); border-radius:18px; padding:16px 18px; backdrop-filter: blur(14px); min-width:150px; }
.mini-kpi strong { display:block; font-size:24px; }
.mini-kpi span { color:#aab8ca; font-size:13px; }
.login-panel { display:grid; place-items:center; padding:34px; }
.login-card { width:min(460px,100%); background:rgba(10,21,36,.82); border:1px solid var(--line); box-shadow:var(--shadow); border-radius:28px; padding:38px; backdrop-filter:blur(22px); }
.login-card h2 { margin:0 0 8px; font-size:30px; }
.login-card p { color:var(--muted); margin:0 0 30px; }
.form-group { display:flex; flex-direction:column; gap:8px; margin-bottom:18px; }
.form-group label { font-size:13px; color:#c3d0e0; font-weight:700; }
.input, .select {
  width:100%; border:1px solid var(--line); background:#0d1a2b; color:var(--text); border-radius:13px; padding:13px 14px; outline:none; transition:.2s ease;
}
.input:focus, .select:focus { border-color:rgba(108,124,255,.8); box-shadow:0 0 0 4px rgba(108,124,255,.12); }
.btn { border:0; border-radius:13px; padding:12px 16px; font-weight:800; transition:.2s ease; display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.btn:hover { transform:translateY(-1px); }
.btn-primary { color:white; background:linear-gradient(135deg,var(--primary),#5264ff); box-shadow:0 10px 25px rgba(108,124,255,.25); }
.btn-secondary { background:#162840; color:#dce7f5; border:1px solid var(--line); }
.btn-success { background:linear-gradient(135deg,#20b988,var(--success)); color:#041910; }
.btn-danger { background:rgba(255,97,125,.13); color:#ff9caf; border:1px solid rgba(255,97,125,.28); }
.btn-warning { background:rgba(255,184,77,.13); color:#ffc972; border:1px solid rgba(255,184,77,.26); }
.btn-block { width:100%; }
.login-hints { margin-top:24px; padding:16px; border-radius:15px; background:rgba(255,255,255,.04); color:#a9b8cb; font-size:13px; line-height:1.7; border:1px solid var(--line); }
.error { color:#ff93a8; min-height:20px; font-size:13px; }

.app-shell { min-height:100vh; display:grid; grid-template-columns:260px 1fr; }
.sidebar { position:sticky; top:0; height:100vh; padding:22px 16px; border-right:1px solid var(--line); background:rgba(7,16,28,.78); backdrop-filter:blur(18px); z-index:20; }
.sidebar .brand { padding:6px 8px 24px; }
.nav { display:flex; flex-direction:column; gap:6px; }
.nav a { display:flex; gap:11px; align-items:center; padding:11px 12px; border-radius:12px; color:#9fb0c8; transition:.18s ease; font-weight:650; }
.nav a:hover, .nav a.active { color:#fff; background:linear-gradient(135deg,rgba(108,124,255,.16),rgba(64,208,255,.07)); border:1px solid rgba(108,124,255,.16); }
.nav .nav-icon { width:24px; text-align:center; }
.sidebar-footer { position:absolute; bottom:18px; left:16px; right:16px; }
.user-chip { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.045); border:1px solid var(--line); padding:11px; border-radius:14px; }
.avatar { width:36px; height:36px; border-radius:12px; display:grid; place-items:center; font-weight:800; background:linear-gradient(135deg,var(--primary),var(--primary-2)); }
.user-meta { min-width:0; }
.user-meta strong, .user-meta span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-meta span { color:var(--muted); font-size:12px; margin-top:2px; }
.logout { margin-left:auto; color:#ff91a5; background:none; border:0; font-size:18px; }
.main { min-width:0; }
.topbar { height:78px; display:flex; align-items:center; justify-content:space-between; padding:0 28px; border-bottom:1px solid var(--line); background:rgba(8,17,31,.58); backdrop-filter:blur(16px); position:sticky; top:0; z-index:15; }
.topbar h1 { margin:0; font-size:22px; }
.topbar .subtitle { color:var(--muted); font-size:13px; margin-top:3px; }
.top-actions { display:flex; gap:10px; align-items:center; }
.content { padding:28px; animation:fadeUp .34s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(8px);} to { opacity:1; transform:none;} }
.grid { display:grid; gap:18px; }
.grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 16px 45px rgba(0,0,0,.18); backdrop-filter:blur(12px); }
.card-pad { padding:20px; }
.metric { padding:20px; position:relative; overflow:hidden; }
.metric::after { content:""; position:absolute; width:90px; height:90px; border-radius:50%; right:-24px; top:-18px; background:radial-gradient(circle,rgba(108,124,255,.18),transparent 70%); }
.metric .label { color:var(--muted); font-size:13px; }
.metric .value { font-size:30px; font-weight:850; margin:8px 0 4px; }
.metric .delta { font-size:12px; color:#8fe1c6; }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:16px; }
.section-head h2 { margin:0; font-size:18px; }
.section-head p { margin:4px 0 0; color:var(--muted); font-size:13px; }
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.search { min-width:230px; }
.table-wrap { overflow:auto; border-radius:14px; border:1px solid var(--line); }
table { width:100%; border-collapse:collapse; min-width:760px; }
th,td { padding:13px 14px; text-align:left; border-bottom:1px solid var(--line); }
th { color:#9eb0c9; font-size:12px; text-transform:uppercase; letter-spacing:.65px; background:#0c192a; position:sticky; top:0; }
td { color:#dbe6f4; font-size:14px; }
tr:hover td { background:rgba(255,255,255,.025); }
.badge { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; font-size:11px; font-weight:800; }
.badge-success { background:rgba(46,209,159,.13); color:#78e9c5; }
.badge-warning { background:rgba(255,184,77,.13); color:#ffd08c; }
.badge-danger { background:rgba(255,97,125,.13); color:#ff9caf; }
.badge-info { background:rgba(108,124,255,.14); color:#aeb7ff; }
.actions { display:flex; gap:7px; }
.icon-btn { width:34px; height:34px; border:1px solid var(--line); border-radius:10px; background:#13233a; color:#dce8f8; display:grid; place-items:center; }
.icon-btn:hover { border-color:rgba(108,124,255,.5); }

.chart-bars { height:250px; display:flex; align-items:flex-end; gap:12px; padding:22px 4px 2px; }
.bar-col { flex:1; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:8px; min-width:0; }
.bar { width:min(42px,75%); background:linear-gradient(180deg,var(--primary-2),var(--primary)); border-radius:10px 10px 4px 4px; transition:height .45s ease; min-height:4px; box-shadow:0 8px 28px rgba(108,124,255,.18); }
.bar-label { font-size:11px; color:var(--muted); }
.activity-list { display:flex; flex-direction:column; gap:11px; }
.activity { display:flex; gap:12px; align-items:flex-start; padding:12px; border-radius:13px; background:rgba(255,255,255,.025); border:1px solid rgba(255,255,255,.045); }
.activity-dot { width:10px; height:10px; border-radius:50%; background:var(--primary-2); margin-top:5px; box-shadow:0 0 0 5px rgba(64,208,255,.08); }
.activity strong { display:block; font-size:13px; }
.activity span { color:var(--muted); font-size:12px; }

.modal-backdrop { position:fixed; inset:0; background:rgba(1,7,14,.72); display:none; place-items:center; z-index:100; padding:20px; backdrop-filter:blur(8px); }
.modal-backdrop.show { display:grid; }
.modal { width:min(620px,100%); max-height:90vh; overflow:auto; background:#0b1728; border:1px solid var(--line); border-radius:22px; box-shadow:0 30px 80px rgba(0,0,0,.55); padding:24px; animation:modalIn .22s ease; }
@keyframes modalIn { from{opacity:0; transform:scale(.97) translateY(8px);} to{opacity:1; transform:none;} }
.modal h3 { margin:0 0 18px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.form-grid .span-2 { grid-column:span 2; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

.toast-stack { position:fixed; top:90px; right:22px; z-index:200; display:flex; flex-direction:column; gap:9px; }
.toast { background:#102138; border:1px solid var(--line); padding:12px 14px; border-radius:13px; box-shadow:var(--shadow); min-width:250px; animation:toastIn .2s ease; }
@keyframes toastIn { from{opacity:0;transform:translateX(10px);} to{opacity:1;transform:none;} }

.pdv-layout { display:grid; grid-template-columns:1fr 390px; gap:18px; align-items:start; }
.product-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.product-card { padding:16px; border-radius:16px; background:rgba(255,255,255,.035); border:1px solid var(--line); transition:.2s; }
.product-card:hover { transform:translateY(-2px); border-color:rgba(108,124,255,.35); }
.product-card .sku { color:var(--muted); font-size:11px; }
.product-card h3 { margin:7px 0 12px; font-size:15px; min-height:38px; }
.product-card .price { font-size:20px; font-weight:850; }
.product-card .stock { color:var(--muted); font-size:12px; margin:3px 0 14px; }
.cart { position:sticky; top:96px; }
.cart-items { display:flex; flex-direction:column; gap:9px; max-height:380px; overflow:auto; padding-right:2px; }
.cart-item { display:grid; grid-template-columns:1fr auto; gap:10px; padding:11px; border-radius:13px; background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.05); }
.cart-item strong { font-size:13px; }
.cart-item small { color:var(--muted); }
.qty-control { display:flex; align-items:center; gap:7px; }
.qty-control button { width:26px; height:26px; border:1px solid var(--line); background:#13243b; color:white; border-radius:8px; }
.summary-row { display:flex; justify-content:space-between; margin:10px 0; color:#b7c5d6; }
.summary-row.total { color:white; font-size:20px; font-weight:850; border-top:1px solid var(--line); padding-top:14px; margin-top:14px; }
.empty { color:var(--muted); text-align:center; padding:28px 14px; }

.permission-grid { display:grid; grid-template-columns:220px repeat(3,1fr); border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.permission-grid > div { padding:13px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.permission-grid > div:nth-child(4n) { border-right:0; }
.permission-grid .head { background:#0d1b2e; font-weight:800; color:#cbd8e8; }
.permission-grid .feature { color:#aebcd0; }
.permission-grid input { accent-color:var(--primary); }

.filter-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.report-summary { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.summary-pill { background:rgba(255,255,255,.04); border:1px solid var(--line); border-radius:13px; padding:10px 13px; }
.summary-pill span { color:var(--muted); font-size:11px; display:block; }
.summary-pill strong { display:block; margin-top:3px; }

.mobile-menu { display:none; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .product-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .pdv-layout { grid-template-columns:1fr 340px; }
}
@media (max-width: 860px) {
  .login-shell { grid-template-columns:1fr; }
  .login-visual { display:none; }
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:-280px; width:260px; transition:.25s ease; box-shadow:var(--shadow); }
  .sidebar.open { left:0; }
  .mobile-menu { display:inline-flex; }
  .pdv-layout { grid-template-columns:1fr; }
  .cart { position:static; }
  .grid-3, .grid-2 { grid-template-columns:1fr; }
  .filter-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .content { padding:18px; }
  .topbar { padding:0 16px; }
  .grid-4 { grid-template-columns:1fr; }
  .product-grid { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid .span-2 { grid-column:span 1; }
  .filter-row { grid-template-columns:1fr; }
  .toolbar { align-items:stretch; }
  .toolbar .input, .toolbar .select, .toolbar .btn { width:100%; }
  .search { min-width:0; }
  .permission-grid { grid-template-columns:170px repeat(3,120px); overflow:auto; }
}
