:root{
  --bg: #0b1220;
  --bg-soft: #111827;
  --panel: rgba(17,24,39,.88);
  --panel-2: rgba(15,23,42,.92);
  --line: rgba(148,163,184,.16);
  --line-strong: rgba(148,163,184,.28);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --title: #f8fafc;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --ok-bg: rgba(22,163,74,.14);
  --ok-line: rgba(34,197,94,.35);
  --ok-text: #bbf7d0;
  --err-bg: rgba(127,29,29,.25);
  --err-line: rgba(239,68,68,.35);
  --err-text: #fecaca;
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,.12);
  --badge-bg: rgba(148,163,184,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.22);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 270px;
  --topbar-h: 72px;
  --input-bg: rgba(2,6,23,.45);
}

body[data-theme="light"]{
  --bg: #eef2f7;
  --bg-soft: #ffffff;
  --panel: rgba(255,255,255,.92);
  --panel-2: rgba(255,255,255,.97);
  --line: rgba(15,23,42,.08);
  --line-strong: rgba(15,23,42,.16);
  --text: #111827;
  --muted: #64748b;
  --title: #0f172a;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --ok-bg: rgba(22,163,74,.10);
  --ok-line: rgba(34,197,94,.22);
  --ok-text: #166534;
  --err-bg: rgba(239,68,68,.10);
  --err-line: rgba(239,68,68,.22);
  --err-text: #991b1b;
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,.10);
  --badge-bg: rgba(15,23,42,.06);
  --shadow: 0 10px 24px rgba(15,23,42,.08);
  --input-bg: rgba(255,255,255,.95);
}

*{
  box-sizing: border-box;
}

html{
  scroll-behavior: smooth;
}

body{
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 30%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a{
  color: inherit;
  text-decoration: none;
}

img{
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea{
  font: inherit;
}

input,
select,
textarea{
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus{
  border-color: rgba(37,99,235,.65);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}

textarea{
  resize: vertical;
  min-height: 110px;
}

label{
  font-size: 14px;
  color: var(--muted);
}

h1,h2,h3,h4{
  color: var(--title);
}

.muted{
  color: var(--muted);
}

.row{
  display: flex;
  gap: 10px;
  align-items: center;
}

.row-between{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grid{
  display: grid;
  gap: 14px;
}

.grid-2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.grid-3{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}

.grid-4{
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card-pad{
  padding: 18px;
}

.table-wrap{
  overflow: auto;
  width: 100%;
}

.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table th,
.table td{
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th{
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table td{
  font-size: 14px;
}

.table tr:last-child td{
  border-bottom: none;
}

.badge,
.pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.badge.danger,
.pill.danger{
  background: var(--danger-bg);
  border-color: rgba(239,68,68,.38);
  color: #fecaca;
}

body[data-theme="light"] .badge.danger,
body[data-theme="light"] .pill.danger{
  color: #991b1b;
}

.flash{
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.flash-ok{
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok-text);
}

.flash-err{
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--err-text);
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: .18s ease;
}

.btn:hover{
  background: var(--primary-2);
}

.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

.btn-primary{
  background: var(--primary);
  color: #fff;
}

.btn-ghost,
.btn.ghost{
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost:hover,
.btn.ghost:hover{
  background: rgba(148,163,184,.08);
}

.btn-danger{
  background: #b91c1c;
  color: #fff;
}

.btn-danger:hover{
  background: #991b1b;
}

.btn-sm,
.btn-xs{
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.auth-shell{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel{
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(12px);
}

.auth-brand{
  margin-bottom: 20px;
}

.auth-logo{
  font-size: 28px;
  font-weight: 900;
  color: var(--title);
}

.auth-subtitle{
  color: var(--muted);
  margin-top: 6px;
}

.login-card__title{
  margin: 0 0 8px;
}

.login-card__subtitle{
  margin: 0 0 18px;
  color: var(--muted);
}

.form-grid{
  display: grid;
  gap: 14px;
}

.app-shell{
  display: flex;
  min-height: 100vh;
}

.sidebar{
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  backdrop-filter: blur(12px);
}

.sidebar__brand{
  padding: 10px 10px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.sidebar__logo{
  font-size: 24px;
  font-weight: 900;
  color: var(--title);
}

.sidebar__caption{
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.snav{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snav__label{
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 0 10px;
  margin-top: 6px;
}

.snav__section{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.snav__item{
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid transparent;
}

.snav__item:hover{
  background: rgba(148,163,184,.08);
  border-color: var(--line);
}

.snav__item.is-active{
  background: rgba(37,99,235,.18);
  border-color: rgba(37,99,235,.25);
  color: #dbeafe;
}

body[data-theme="light"] .snav__item.is-active{
  color: #1d4ed8;
}

.main-shell{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar{
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  background: rgba(11,18,32,.45);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}

body[data-theme="light"] .topbar{
  background: rgba(255,255,255,.7);
}

.topbar__left{
  min-width: 0;
}

.topbar__title{
  font-size: 20px;
  font-weight: 900;
  color: var(--title);
}

.topbar__path{
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.topbar__right{
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle{
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:hover{
  background: rgba(148,163,184,.08);
}

.user-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148,163,184,.06);
}

.user-chip__name{
  font-weight: 700;
}

.user-chip__role{
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.main-content{
  padding: 20px;
}

.dashboard-grid{
  display: grid;
  gap: 16px;
}

.stats-grid{
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 14px;
}

.stat-card{
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card__label{
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card__value{
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  color: var(--title);
  margin-top: 12px;
}

.stat-card__link{
  margin-top: 14px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 700;
}

body[data-theme="light"] .stat-card__link{
  color: #1d4ed8;
}

.dashboard-columns{
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

.dashboard-column{
  display: grid;
  gap: 16px;
}

.list-compact{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-compact__item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(148,163,184,.04);
}

.list-compact__item:hover{
  border-color: var(--line-strong);
  background: rgba(148,163,184,.07);
}

.list-compact__title{
  font-weight: 700;
  color: var(--title);
}

.list-compact__meta{
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.quick-links{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.quick-links__item{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(148,163,184,.05);
  font-weight: 700;
}

.quick-links__item:hover{
  background: rgba(37,99,235,.12);
  border-color: rgba(37,99,235,.25);
}

.sep{
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.pos-shell{
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 16px;
}

.pos-searchbar{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 12px 0;
}

.product-card{
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(148,163,184,.04);
}

.product-card img{
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.product-meta .name{
  font-weight: 800;
  color: var(--title);
  margin-bottom: 4px;
}

.product-meta .line{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.product-actions{
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.price{
  font-size: 22px;
  font-weight: 900;
  color: var(--title);
}

.cart{
  padding: 18px;
}

.cart-items{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item{
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(148,163,184,.04);
}

.qty .input{
  text-align: center;
}

.ticket-wrap{
  max-width: 460px;
  margin: 0 auto;
}

.ticket-head{
  text-align: center;
  margin-bottom: 10px;
}

.ticket-business{
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
  color: var(--title);
}

.ticket-line{
  font-size: 13px;
  margin-top: 4px;
}

.ticket-meta{
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.ticket-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ticket-table th,
.ticket-table td{
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ticket-table th:last-child,
.ticket-table td:last-child{
  text-align: right;
}

.ticket-total{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  margin-top: 10px;
}

.ticket-total strong{
  font-size: 30px;
  color: var(--title);
}

.ticket-thanks{
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
}

@media print{
  body{
    background: #fff !important;
    color: #000 !important;
  }

  .sidebar,
  .topbar,
  .flash,
  .no-print{
    display: none !important;
  }

  .main-content,
  .main-shell,
  .app-shell{
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    width: 100% !important;
  }

  .card,
  .ticket-wrap{
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
  }
}

@media (max-width: 1280px){
  .stats-grid{
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

@media (max-width: 980px){
  .app-shell{
    flex-direction: column;
  }

  .sidebar{
    width: 100%;
    min-width: 100%;
    height: auto;
    position: relative;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar{
    position: relative;
  }

  .dashboard-columns,
  .pos-shell{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px){
  .main-content{
    padding: 14px;
  }

  .stats-grid{
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .quick-links{
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4{
    grid-template-columns: 1fr;
  }

  .product-card{
    grid-template-columns: 1fr;
  }

  .product-actions{
    align-items: stretch;
  }

  .cart-item{
    grid-template-columns: 1fr;
  }

  .pos-searchbar{
    grid-template-columns: 1fr;
  }

  .row-between{
    flex-wrap: wrap;
  }
}

@media (max-width: 520px){
  .stats-grid{
    grid-template-columns: 1fr;
  }

  .auth-panel{
    padding: 22px;
  }

  .topbar{
    padding: 12px 14px;
  }
}