/* X-Wireless admin panel */
body.admin { background: #eef1f6; font-size: 15px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% -10%, rgba(64,120,255,.45), transparent 60%), linear-gradient(160deg, #071737, #0d2a66); }
.login-card { background: #fff; border-radius: 18px; padding: 34px 30px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card img { height: 52px; width: auto; margin-bottom: 16px; }
.login-card h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--navy); }
.login-err { color: var(--alert); font-weight: 600; margin-top: 12px; }

.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #cfd8ea; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side-logo { height: 40px; width: auto; margin: 4px 8px 24px; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { text-align: left; background: none; border: 0; color: #dfe6f3; font: inherit; font-weight: 600; padding: 11px 12px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.tabs button:hover { background: rgba(255,255,255,.08); }
.tabs button.is-on { background: #fff; color: var(--navy); }
.cnt { background: var(--blue); color: #fff; border-radius: 999px; font-size: .75rem; padding: 1px 8px; min-width: 22px; text-align: center; }
.cnt:empty { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px; font-size: .9rem; }
.side-foot a, .link-btn { color: #cfd8ea; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.side-foot a:hover, .link-btn:hover { color: #fff; text-decoration: underline; }

.main { padding: 22px 28px 60px; min-width: 0; }
.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.bar h2 { margin: 0; font-size: 1.6rem; color: var(--navy); }
.bar-tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.bar-tools select, .bar-tools input { font: inherit; font-size: 14px; padding: 8px 12px; border: 1.5px solid #cfd6e2; border-radius: 10px; background: #fff; }
.bar-tools input { width: 230px; }
.updated { width: 100%; font-size: .8rem; color: var(--muted); margin-top: -6px; }
.warns:empty { display: none; }
.warns { background: #fff7e6; border: 1px solid #f3d38b; color: #7a5300; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: .88rem; }
.warns div + div { margin-top: 4px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 14px; padding: 16px 18px; border: 1px solid var(--line); }
.kpi .k-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi .k-val { font-size: 1.75rem; font-weight: 800; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .8rem; color: var(--muted); }
.kpi.alert .k-val { color: var(--blue); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.box { background: #fff; border-radius: 14px; border: 1px solid var(--line); padding: 18px; }
.box-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.box-head h3 { margin: 0; font-size: 1rem; }
.chart { position: relative; height: 230px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: #e7eaf0; stroke-width: 1; }
.chart .ax text { fill: var(--muted); font-size: 11px; }
.chart rect.bar { fill: var(--blue); }
.chart rect.hit { fill: transparent; cursor: pointer; }
.chart g.col:hover path { fill: #123ba6; }
.tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: .82rem; white-space: nowrap; transform: translate(-50%, -110%); display: none; }
.chart-table { margin-top: 8px; font-size: .85rem; }
.chart-table table { border-collapse: collapse; margin-top: 6px; }
.chart-table td, .chart-table th { padding: 3px 12px 3px 0; text-align: left; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.feed li:last-child { border: 0; }
.feed .when { color: var(--muted); font-size: .8rem; white-space: nowrap; margin-left: auto; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chips .push { margin-left: auto; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; }
.item.is-new { border-left: 4px solid var(--blue); }
.item-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item-top strong { font-size: 1.02rem; }
.item-meta { color: var(--muted); font-size: .85rem; }
.item-body { grid-column: 1 / -1; font-size: .92rem; white-space: pre-line; background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; }
.item-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.item-actions select { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 10px; border: 1.5px solid #cfd6e2; }
.item-note { grid-column: 1 / -1; display: flex; gap: 8px; }
.item-note input { flex: 1; font: inherit; font-size: 14px; padding: 7px 10px; border: 1.5px solid #cfd6e2; border-radius: 10px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--ink); }
.badge.paid { background: #e3f6eb; color: #0c7a3c; }
.badge.pickup { background: #fff3db; color: #8a5a00; }
.badge.stripe { background: #ece9ff; color: #4b3cc4; }
.badge.paypal { background: #e5f0ff; color: #0b4fae; }
.badge.refund { background: #fdecee; color: #a3121f; }
.badge.store { background: #e8edf7; color: var(--navy); }
.empty-note { background: #fff; border: 1px dashed #cfd6e2; border-radius: 14px; padding: 30px; text-align: center; color: var(--muted); }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl input[type=number] { width: 96px; font: inherit; padding: 6px 8px; border: 1.5px solid #cfd6e2; border-radius: 8px; text-align: right; }
.tbl tr.changed td { background: #f2f6ff; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--green); }
.markup { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: .9rem; }
.markup input, .markup select { font: inherit; font-size: 14px; padding: 6px 8px; border: 1.5px solid #cfd6e2; border-radius: 8px; width: auto; }
.markup input { width: 80px; }

.setup-list { list-style: none; margin: 0; padding: 0; }
.setup-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setup-list .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: none; background: #c5cad4; }
.setup-list .dot.on { background: var(--green); }
.setup-list code { background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; font-size: .85em; }

.modal { position: fixed; inset: 0; background: rgba(6,20,51,.55); display: grid; place-items: center; z-index: 200; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:hover { background: #a3121f; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; z-index: 20; padding: 10px 12px; flex-direction: row; align-items: center; gap: 10px; overflow-x: auto; }
  .side-logo { height: 28px; margin: 0 6px 0 0; }
  .tabs { flex-direction: row; }
  .tabs button { white-space: nowrap; padding: 8px 10px; }
  .side-foot { display: none; }
  .main { padding: 16px 14px 60px; }
  .bar-tools { margin-left: 0; width: 100%; }
  .bar-tools input { flex: 1; width: auto; }
  .item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-start; }
}
.badge.pending { background: #fff3db; color: #8a5a00; }
.badge.approved { background: #e3f6eb; color: #0c7a3c; }
.badge.disabled, .badge.rejected { background: #fdecee; color: #a3121f; }
.dealer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 18px; font-size: .88rem; color: var(--muted); white-space: normal; }
.dealer-grid b { color: var(--ink); font-weight: 600; }
.item-note { flex-wrap: wrap; align-items: center; }
/* Add Products */
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mp-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.mp-img { background: var(--bg-soft); height: 170px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.mp-img img { width: 100%; height: 100%; object-fit: contain; }
.mp-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.mp-cat { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.mp-price { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.mp-body .badge { align-self: flex-start; }
.mp-actions { display: flex; gap: 8px; margin-top: 6px; }
.pf-photo { display: block; cursor: pointer; margin-bottom: 14px; }
.pf-preview { display: grid; place-items: center; text-align: center; gap: 2px; height: 200px; border: 2px dashed #cfd6e2; border-radius: 14px; background: var(--bg-soft); color: var(--navy); overflow: hidden; }
.pf-preview:hover { border-color: var(--blue); }
.pf-preview small { color: var(--muted); }
.pf-preview img { width: 100%; height: 100%; object-fit: contain; }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
#modal-card form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-card { max-height: 92vh; overflow: auto; }

.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--red, #1a518c); text-decoration: underline; cursor: pointer; }
.id-viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(5, 15, 40, .72); display: grid; place-items: center; padding: 16px; }
.id-viewer-card { background: #fff; border-radius: 14px; width: min(900px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.id-viewer-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #e3e7ef; flex-wrap: wrap; }
.id-viewer-card img { display: block; max-width: 100%; max-height: calc(92vh - 64px); object-fit: contain; margin: 0 auto; }
.id-viewer-card iframe { width: 100%; height: calc(92vh - 64px); border: 0; }
