/* EONA ERP - Stil */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #D4AF37;
  --primary-dark: #B8860B;
  --primary-light: rgba(212,175,55,.12);
  --bg-grad-1: #1a1a2e;
  --bg-grad-2: #B8860B;
}
body.theme-gold {
  --primary: #D4AF37; --primary-dark: #A67C00; --primary-light: rgba(212,175,55,.12);
  --bg-grad-1: #1c1c1c; --bg-grad-2: #B8860B;
}
body.theme-pink {
  --primary: #DB7093; --primary-dark: #B03060; --primary-light: rgba(219,112,147,.12);
  --bg-grad-1: #4a1942; --bg-grad-2: #DB7093;
}
body.theme-blue {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-light: rgba(37,99,235,.10);
  --bg-grad-1: #1a2a4f; --bg-grad-2: #2563eb;
}

body { font-family: 'Segoe UI', -apple-system, Roboto, Arial, sans-serif; background: #f4f3f0; color: #26221c; font-size: 14px; }
.hidden { display: none !important; }

/* Giriş */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 14px; width: 380px; box-shadow: 0 25px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { max-width: 120px; max-height: 90px; margin: 0 auto 14px; display: block; }
.login-box h1 { font-size: 30px; letter-spacing: .5px; color: #26221c; }
.login-box h1 span { color: var(--primary-dark); }
.login-box .sub { color: #999; margin: 6px 0 24px; font-size: 13px; }
.login-box input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #e2ddd0; border-radius: 8px; font-size: 14px; }
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-box button { width: 100%; padding: 13px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; letter-spacing: .3px; box-shadow: 0 6px 16px var(--primary-light); }
.login-box button:hover { filter: brightness(1.08); }
.err { color: #dc2626; font-size: 13px; margin-bottom: 8px; min-height: 16px; }

/* Header */
header { background: #fff; display: flex; align-items: center; gap: 16px; padding: 0 18px; height: 62px; box-shadow: 0 2px 10px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50; flex-wrap: wrap; border-bottom: 2px solid var(--primary-light); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: #26221c; min-width: 120px; }
.header-logo { max-height: 38px; max-width: 100px; }
.brand .accent { color: var(--primary-dark); }
#mainNav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
#mainNav button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: #665f4f; border-radius: 7px; font-size: 12.5px; font-weight: 500; transition: .15s; }
#mainNav button:hover { background: var(--primary-light); color: var(--primary-dark); }
#mainNav button.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #666; }
.branch-switcher { padding: 7px 10px; border-radius: 7px; border: 1px solid #e2ddd0; font-size: 12.5px; font-weight: 600; color: var(--primary-dark); background: var(--primary-light); }

main { max-width: 1250px; margin: 0 auto; padding: 24px 18px; }
h2 { margin-bottom: 16px; color: #26221c; font-weight: 700; }
h3 { margin-bottom: 10px; color: #3a352a; font-size: 15px; font-weight: 700; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { margin: 0; }
.muted { color: #999; }
.loading { color: #999; padding: 30px; text-align: center; }
.red { color: #dc2626; } .green { color: #16a34a; }
.mt { margin-top: 14px; }
.warn-text { color: #b45309; font-size: 12px; margin: -6px 0 10px; }
.warn-box { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; padding: 14px; border-radius: 10px; font-size: 13px; }

/* Kartlar */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: #fff; border-radius: 12px; padding: 17px; box-shadow: 0 2px 10px rgba(0,0,0,.05); border-left: 4px solid var(--primary); }
.card.warn { border-left-color: #f59e0b; }
.card h4 { font-size: 11.5px; color: #999; text-transform: uppercase; margin-bottom: 6px; letter-spacing: .3px; }
.card .big { font-size: 23px; font-weight: 800; color: #26221c; }
.card small { color: #aaa; }

.panel { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.05); margin-bottom: 16px; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

/* Cədvəl */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 8px; color: #9a9282; border-bottom: 2px solid #f0ede5; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
td { padding: 9px 8px; border-bottom: 1px solid #f5f3ee; }
tr:hover td { background: var(--primary-light); }
code { background: #f3f1ea; padding: 2px 5px; border-radius: 4px; font-size: 12px; }

/* Düymələr */
button { font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px; box-shadow: 0 4px 12px var(--primary-light); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { background: #dc2626; color: #fff; border: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { background: var(--primary-light); color: var(--primary-dark); border: 0; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: none; display: inline-block; }
.btn-sm:hover { filter: brightness(.97); background: var(--primary-light); }
.btn-sm.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-xs { background: none; border: 0; cursor: pointer; font-size: 11px; opacity: .6; }
.btn-xs:hover { opacity: 1; }
.wide { width: 100%; }

input, select, textarea { padding: 9px 10px; border: 1px solid #e2ddd0; border-radius: 7px; font-size: 13px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input.wide, textarea.wide { width: 100%; margin-bottom: 12px; }
textarea { resize: vertical; }

/* AUTO qiymət nişanı */
.badge-auto { display: inline-block; background: #fef3c7; color: #92400e; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: middle; }
.badge-count { display: inline-block; background: #dc2626; color: #fff; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.badge-pending { display: inline-block; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }

/* POS */
.pos-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
@media (max-width: 900px) { .pos-grid { grid-template-columns: 1fr; } }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; }
.pos-card { border: 1px solid #ece8dd; border-radius: 10px; padding: 11px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.pos-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px var(--primary-light); transform: translateY(-1px); }
.pos-card.out { opacity: .4; cursor: not-allowed; }
.pos-card b { font-size: 12px; }
.pos-card .price { color: var(--primary-dark); font-weight: 800; }
.pos-card small { color: #999; font-size: 11px; }
.cart-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f5f3ee; font-size: 13px; }
.cart-ctrl { display: flex; align-items: center; gap: 6px; }
.cart-ctrl button { width: 26px; height: 26px; border: 1px solid #e2ddd0; background: #fff; border-radius: 5px; cursor: pointer; flex-shrink: 0; }
.cart-qty-input { width: 48px; text-align: center; padding: 4px 2px; font-weight: 700; -moz-appearance: textfield; }
.cart-qty-input::-webkit-outer-spin-button, .cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pos-opts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.pos-opts label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: #555; }
.pos-opts select, .pos-opts input { width: 55%; }
.pos-totals { border-top: 2px solid var(--primary-light); padding: 10px 0; margin-bottom: 10px; }
.trow { display: flex; justify-content: space-between; padding: 4px 0; color: #666; font-size: 13px; }
.trow.grand { font-size: 18px; font-weight: 800; color: #26221c; border-top: 1px solid #f0ede5; margin-top: 6px; padding-top: 8px; }

canvas { max-width: 100%; }

/* Barkod etiketi */
.barcode-label { text-align: center; padding: 20px; border: 2px dashed #e2ddd0; border-radius: 10px; margin-bottom: 14px; }
.bc-name { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.bc-price { font-weight: 800; font-size: 20px; color: var(--primary-dark); margin-top: 8px; }
#bcSvg { max-width: 100%; }

/* Çek */
.receipt { background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.receipt-inner { font-family: 'Courier New', monospace; max-width: 280px; margin: 0 auto; }
.receipt-logo { max-width: 90px; display: block; margin: 0 auto 8px; }
.receipt-shop { font-weight: 800; text-align: center; font-size: 17px; }
.receipt-branch, .receipt-meta, .receipt-footer { text-align: center; font-size: 11px; color: #555; }
.receipt-line { border-top: 1px dashed #bbb; margin: 8px 0; }
.receipt-item { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; }
.receipt-total { font-weight: 800; font-size: 15px; }

/* Tənzimləmələr */
.current-logo { max-width: 140px; max-height: 100px; display: block; margin: 10px 0; border: 1px solid #eee; border-radius: 8px; padding: 8px; }
.theme-picker { display: flex; gap: 16px; flex-wrap: wrap; }
.theme-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; padding: 8px 14px; border: 1px solid #eee; border-radius: 8px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.swatch-gold { background: linear-gradient(135deg, #D4AF37, #A67C00); }
.swatch-pink { background: linear-gradient(135deg, #DB7093, #B03060); }
.swatch-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(20,15,5,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-box { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-x { background: none; border: 0; font-size: 26px; cursor: pointer; color: #999; line-height: 1; }
.modal-box label { display: block; margin-bottom: 10px; font-size: 13px; color: #555; }
.modal-box label input, .modal-box label select { width: 100%; margin-top: 4px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.frow label { margin-bottom: 10px; }
.modal-box hr { border: 0; border-top: 1px solid #f0ede5; margin: 12px 0; }
.modal-box .btn-primary.wide { margin-top: 12px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #16a34a; color: #fff; padding: 12px 22px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 200; font-size: 14px; }
.toast-err { background: #dc2626; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* Hesabat qruplaşdırması */
.sub-head { margin: 14px 0 8px; color: var(--primary-dark); font-size: 13px; font-weight: 700; border-bottom: 2px solid var(--primary-light); padding-bottom: 4px; }
.sub-head:first-child { margin-top: 0; }
table.mb { margin-bottom: 10px; }
.total-row td { border-top: 2px solid var(--primary-light); font-weight: 800; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   MOBİL UYĞUNLUQ (Responsive)
   ============================================================ */

@media (max-width: 1024px) {
  .pos-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  main { padding: 14px 10px; }

  header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .brand { min-width: 0; font-size: 17px; }
  .header-logo { max-height: 30px; }

  #mainNav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  #mainNav button { flex: 0 0 auto; white-space: nowrap; padding: 8px 11px; }

  .userbox { margin-left: auto; font-size: 12px; gap: 8px; }
  .userbox #userName { display: none; } /* yer qənaəti - kiçik ekranda ad gizlədilir */
  .branch-switcher { font-size: 12px; padding: 6px 8px; max-width: 130px; }

  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head > span { display: flex; flex-wrap: wrap; gap: 6px; }

  h2 { font-size: 19px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card { padding: 12px; }
  .card .big { font-size: 18px; }

  .grid2 { grid-template-columns: 1fr; }

  table { font-size: 12px; }
  th, td { padding: 7px 5px; }

  .panel { padding: 12px; border-radius: 10px; }

  .pos-products { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); max-height: 45vh; }
  .pos-opts label { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pos-opts select, .pos-opts input { width: 100%; }

  .modal-box { padding: 16px; max-width: 100%; border-radius: 12px; }
  .frow { grid-template-columns: 1fr; gap: 0; }

  .login-box { width: 100%; padding: 28px 22px; }

  .theme-picker { flex-direction: column; gap: 8px; }

  .toast { left: 12px; right: 12px; transform: none; bottom: 12px; text-align: center; }
}

@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
  #mainNav button { font-size: 11.5px; padding: 7px 9px; }
  .brand span, .brand .accent { font-size: 15px; }
}
