/* =====================================================
   DUKAN MANAGER — Design System v3
   ===================================================== */
:root {
  --primary:       #F97316;
  --primary-dark:  #EA580C;
  --primary-light: #FED7AA;
  --success:       #16A34A;
  --success-light: #BBF7D0;
  --danger:        #DC2626;
  --danger-light:  #FECACA;
  --warning:       #D97706;
  --warning-light: #FDE68A;
  --info:          #2563EB;
  --info-light:    #BFDBFE;

  --bg:            #F3F4F6;
  --surface:       #FFFFFF;
  --border:        #E5E7EB;
  --text:          #111827;
  --text-2:        #374151;
  --muted:         #6B7280;

  --radius-sm:  8px;  --radius-md: 12px;
  --radius-lg:  16px; --radius-xl: 24px; --radius-full: 9999px;

  --shadow:    0 1px 4px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.14);

  --touch:      52px;
  --nav-height: 68px;
  --header-h:   60px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
  min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== LAYOUT ===== */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.hidden { display: none !important; }

/* ===== SUBSCRIPTION BANNER ===== */
.sub-banner {
  background: var(--warning); color: #fff;
  text-align: center; padding: 8px 16px;
  font-size: 13px; font-weight: 700;
  z-index: 99;
}
.sub-banner.expired { background: var(--danger); }
.sub-banner.expiring { background: var(--warning); }

/* ===== HEADER ===== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; box-shadow: var(--shadow);
}
.header-store { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: rgba(255,255,255,.2); touch-action: manipulation;
}
.header-btn:active { background: rgba(255,255,255,.35); }
.sync-indicator { width: 10px; height: 10px; border-radius: 50%; background: var(--success); transition: background .3s; }
.sync-indicator.offline { background: var(--warning); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== MAIN ===== */
.app-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: calc(var(--nav-height) + 8px); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-height); background: var(--surface);
  border-top: 1px solid var(--border); display: flex; z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,.07);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 8px 4px; touch-action: manipulation; transition: color .15s;
}
.nav-item svg { width: 26px; height: 26px; fill: currentColor; }
.nav-item.active { color: var(--primary); }
.nav-item:active { opacity: .7; }

/* ===== LOGIN SCREEN ===== */
.pin-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 16px;
}
.pin-card {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 32px 24px; width: 100%; max-width: 360px;
  text-align: center; box-shadow: var(--shadow-lg);
}
.pin-logo  { font-size: 52px; margin-bottom: 8px; }
.pin-title { font-size: 24px; font-weight: 800; color: var(--text); }
.pin-sub   { font-size: 14px; color: var(--muted); margin-top: 4px; margin-bottom: 8px; }
.pin-display { display: flex; gap: 12px; justify-content: center; margin: 16px 0 6px; }
.pin-display span {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent; transition: background .15s, border-color .15s;
}
.pin-display span.filled { background: var(--primary); border-color: var(--primary); }
.pin-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 6px; font-weight: 600; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.numpad-btn {
  height: var(--touch); border-radius: var(--radius-md);
  font-size: 20px; font-weight: 700; background: var(--bg); color: var(--text);
  touch-action: manipulation; transition: background .1s; user-select: none;
}
.numpad-btn:active { background: var(--primary-light); }
.numpad-clear { background: var(--danger-light); color: var(--danger); }
.numpad-back  { background: var(--warning-light); color: var(--warning); font-size: 22px; }

/* ===== PAGE LOADER ===== */
.page-loader { display: flex; align-items: center; justify-content: center; padding: 64px 0; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== CARDS ===== */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 16px; }

/* ===== KPI ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
.kpi-card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text); margin-top: 4px; line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-card.primary { background: var(--primary); }
.kpi-card.primary .kpi-label, .kpi-card.primary .kpi-value, .kpi-card.primary .kpi-sub { color: rgba(255,255,255,.9); }
.kpi-card.success { background: var(--success); }
.kpi-card.success .kpi-label, .kpi-card.success .kpi-value { color: #fff; }
.kpi-card.warning { background: var(--warning); }
.kpi-card.warning .kpi-label, .kpi-card.warning .kpi-value { color: #fff; }
.kpi-card.danger  { background: var(--danger); }
.kpi-card.danger  .kpi-label, .kpi-card.danger  .kpi-value { color: #fff; }

/* ===== MISC ===== */
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding: 16px 16px 8px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--text-2); }
.empty-state p  { font-size: 14px; margin-top: 4px; }

@media (min-width: 600px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .app-header { padding: 0 24px; } }
