@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f0f4f8;
  --ink: #151b18;
  --muted: #627079;
  --line: #dbe4ea;
  --panel: #ffffff;
  --soft: #f6f9fb;
  --accent: #0b7a75;
  --accent-2: #d8b45f;
  --blue: #2563eb;
  --green: #059669;
  --amber: #d97706;
  --rose: #be185d;
  --violet: #7c3aed;
  --danger: #b42318;
  --sidebar: #132238;
  --sidebar-soft: #203653;
  font-family: "Poppins", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(216, 180, 95, 0.14), transparent 34%),
    var(--bg);
  color: var(--ink);
}

.auth-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(19, 34, 56, 0.78);
  backdrop-filter: blur(10px);
}

.auth-shell.open {
  display: flex;
}

.auth-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 280px 1fr;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #132238 0%, #1f3f68 45%, #ffffff 45%, #ffffff 100%);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.28);
}

.auth-brand {
  padding: 28px;
  color: white;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand small {
  color: rgba(255, 255, 255, 0.78);
  margin-top: 4px;
}

.auth-form {
  display: grid;
  gap: 12px;
  padding: 30px;
  background: white;
}

.auth-form h2 {
  margin: 0;
  color: #132238;
}

.auth-form p {
  margin: 0 0 4px;
}

.auth-message {
  min-height: 22px;
  color: var(--danger);
  font-weight: 800;
}

.auth-debug {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-line;
}

.demo-login {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(216, 180, 95, 0.1));
}

.demo-login-title {
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #132238;
}

.demo-login p {
  margin: 0 0 10px;
  color: var(--muted);
}

.demo-login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.demo-btn {
  background: linear-gradient(135deg, #2563eb, #0b7a75);
  color: white;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.24);
}

.primary-link-btn,
.ghost-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
}

.primary-link-btn {
  background: var(--blue);
  color: white;
}

.ghost-link-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.settings-surface {
  margin-top: 18px;
}

.inner-head {
  margin-bottom: 12px;
}

.admin-page {
  min-height: 100vh;
  padding: 28px;
}

.admin-shell {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-guard {
  padding: 22px;
}

.link-btn {
  min-height: 36px;
  justify-self: start;
  padding: 0;
  background: transparent;
  color: var(--blue);
  box-shadow: none !important;
}

.hidden-auth {
  display: none;
}

button, input, select { font: inherit; }

body,
button,
input,
select,
textarea,
table,
th,
td {
  font-family: "Poppins", Arial, Helvetica, sans-serif;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 31, 45, 0.12);
}

input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

table { width: 100%; border-collapse: collapse; }

th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: var(--sidebar);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent-2);
  color: #16150f;
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand small { color: #a8c0ba; margin-top: 3px; }

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: #d9ebe7;
  text-align: left;
}

.nav-item.active, .nav-item:hover {
  background: var(--sidebar-soft);
  box-shadow: inset 4px 0 0 var(--accent-2);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.session-badge {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.main {
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-weight: 800;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 34px; }
h2 { font-size: 20px; }
p { color: var(--muted); }

.topbar-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-stats span, .topbar-stats strong, .balance {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
  padding: 0 12px;
  box-shadow: 0 10px 24px rgba(19, 34, 56, 0.06);
}

.panel { display: none; }
.panel.active { display: block; }

.surface, .checkout, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(25, 34, 30, 0.06);
}

.surface { padding: 18px; }

.panel h2 {
  color: #132238;
  font-weight: 900;
}

.panel.active > .section-head,
.panel.active > form,
.panel.active > .table-wrap {
  border-top: 4px solid var(--accent);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-head p {
  margin: 5px 0 0;
}

.product-panel .section-head h2 {
  display: inline-block;
  color: #a0226f;
  font-size: 28px;
  font-weight: 900;
  padding-bottom: 6px;
  border-bottom: 4px solid var(--accent-2);
}

.product-panel .table-wrap th:nth-child(1) { background: #8a2f7d; }
.product-panel .table-wrap th:nth-child(2) { background: #0b7568; }
.product-panel .table-wrap th:nth-child(3) { background: #c05a22; }
.product-panel .table-wrap th:nth-child(4) { background: #7a5a13; }
.product-panel .table-wrap th:nth-child(5) { background: #245fa8; }
.product-panel .table-wrap th:nth-child(6) { background: #6f4bb3; }
.product-panel .table-wrap th:nth-child(7) { background: #1f7a3d; }
.product-panel .table-wrap th:nth-child(8) { background: #343a40; }

.sale-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.cashier-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.cashier-card {
  min-height: 92px;
  border-radius: 8px;
  padding: 16px;
  color: white;
  box-shadow: 0 16px 36px rgba(19, 34, 56, 0.14);
}

.cashier-card span {
  display: block;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.88;
  text-transform: uppercase;
}

.cashier-card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.cashier-card.blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.cashier-card.green { background: linear-gradient(135deg, #059669, #047857); }
.cashier-card.amber { background: linear-gradient(135deg, #d97706, #b45309); }
.cashier-card.rose { background: linear-gradient(135deg, #be185d, #9d174d); }

.cashier-workbench {
  border-top: 4px solid var(--blue);
}

.cashier-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cashier-focus {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8f0ff, #f8fbff);
  border: 1px solid #c9d9ff;
}

.scan-box {
  display: grid;
  grid-template-columns: 1fr 104px;
  gap: 10px;
}

.scan-box input {
  min-height: 66px;
  font-size: 24px;
  font-weight: 800;
  border: 2px solid #93b4ff;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
}

.message {
  min-height: 28px;
  padding-top: 8px;
  color: var(--accent);
  font-weight: 800;
}

.message.error { color: var(--danger); }

.quick-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.quick-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.quick-card {
  min-height: 86px;
  padding: 10px;
  border: 1px solid #c9d9ff;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #edf4ff);
  text-align: left;
  color: var(--ink);
}

.quick-card small, .muted, small { color: var(--muted); }

.checkout {
  padding: 18px;
  border-top: 4px solid var(--green);
  position: sticky;
  top: 22px;
}

.checkout-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.summary-line, .summary-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.summary-total {
  margin: 12px -6px;
  padding: 16px 6px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 28px;
  border-bottom: 0;
}

.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.pay-btn {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.pay-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pay-btn[data-pay="Nakit"].active { background: var(--green); }
.pay-btn[data-pay="Kart"].active { background: var(--blue); }
.pay-btn[data-pay="Acik Hesap"].active { background: var(--amber); }
.pay-btn[data-pay="Parcali"].active { background: var(--violet); }

#completeSaleBtn {
  min-height: 58px;
  font-size: 18px;
  background: linear-gradient(135deg, #059669, #047857);
}

.last-receipt {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #b6c4d1;
}

.last-receipt:empty { display: none; }
.last-receipt b { color: var(--green); font-size: 20px; }

.primary { background: var(--accent); }
.ghost, .soft-btn {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  color: white;
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
}

.danger { color: var(--danger); }
.full { width: 100%; }
.file-btn { margin: 0; cursor: pointer; }
.file-btn input { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
  border-top: 4px solid var(--violet);
}

.form-grid.compact {
  grid-template-columns: 150px 1fr 180px 1fr auto;
}

.field { min-width: 0; }
.double { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; align-items: end; }

.photo-preview-wrap {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: end;
}

.photo-preview {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f4f6f5, #f4f6f5 8px, #e7ece9 8px, #e7ece9 16px);
}

.photo-preview.empty {
  opacity: 0.65;
}

.inline-form, .filter-row {
  display: grid;
  grid-template-columns: 220px 170px 150px 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
}

.filter-row {
  grid-template-columns: 1fr 220px;
}

.table-wrap {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(19, 34, 56, 0.05);
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 34px 42px 34px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-control button {
  min-height: 34px;
  border-radius: 0;
  padding: 0;
  background: var(--soft);
  color: var(--ink);
}

.qty-control span { text-align: center; font-weight: 900; }

.barcode-svg {
  display: block;
  width: 150px;
  height: 48px;
}

.thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
}

.cart-photo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: linear-gradient(135deg, #edf4ff, #fff7db);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.cart-photo.empty::after,
#confirmPhoto.empty::after {
  content: "";
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sale-product strong {
  font-size: 15px;
}

.category-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff2c4;
  color: #6f4100;
  border: 1px solid #e4bd54;
  font-weight: 900;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.metric { padding: 16px; border-top: 4px solid var(--blue); }
.metric:nth-child(2) { border-top-color: var(--green); }
.metric:nth-child(3) { border-top-color: var(--amber); }
.metric:nth-child(4) { border-top-color: var(--rose); }
.metric span { display: block; color: var(--muted); font-weight: 800; margin-bottom: 8px; }
.metric strong { font-size: 24px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.list { border-top: 1px solid var(--line); margin-top: 12px; }
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.label-sheet { display: none; }

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(19, 34, 56, 0.62);
}

.confirm-modal.open {
  display: flex;
}

.confirm-card {
  display: grid;
  grid-template-columns: 240px minmax(320px, 520px);
  width: min(820px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.26);
}

.compact-confirm {
  grid-template-columns: minmax(320px, 580px);
}

.full-confirm {
  width: 100%;
}

.confirm-media {
  min-height: 300px;
  background: linear-gradient(135deg, #edf4ff, #fff7db);
}

.confirm-media img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  display: block;
}

.confirm-media img.empty {
  opacity: 0;
}

.confirm-content {
  padding: 22px;
}

.confirm-content h2 {
  margin-bottom: 14px;
  color: #132238;
  font-size: 28px;
}

.customer-reminder {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8f0ff, #ecfdf5);
  color: #1d4ed8;
  border: 2px solid #93b4ff;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}

.neutral-reminder {
  background: linear-gradient(135deg, #f8fafc, #edf4ff);
  color: #132238;
  border-color: #c9d9ff;
}

.confirm-customer {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.confirm-customer > strong {
  color: #132238;
}

.confirm-customer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.confirm-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-details div {
  border-radius: 8px;
  padding: 10px;
  background: #f6f9fb;
  border: 1px solid var(--line);
}

.confirm-details span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.confirm-delete-message {
  padding: 14px;
  border-radius: 8px;
  background: #fff7db;
  border: 1px solid #f3d37a;
  color: #6b4f00;
  font-weight: 800;
}

.discount-panel .section-head h2 {
  display: inline-block;
  color: var(--violet);
  font-size: 28px;
  padding-bottom: 6px;
  border-bottom: 4px solid var(--amber);
}

.admin-panel .section-head h2 {
  display: inline-block;
  color: var(--rose);
  font-size: 28px;
  padding-bottom: 6px;
  border-bottom: 4px solid var(--blue);
}

.settings-panel .section-head h2 {
  display: inline-block;
  color: var(--blue);
  font-size: 28px;
  padding-bottom: 6px;
  border-bottom: 4px solid var(--green);
}

.discount-line strong {
  color: var(--rose);
}

.settings-pin-form {
  grid-template-columns: 1fr auto auto;
}

.locked-settings {
  opacity: 0.55;
  filter: grayscale(0.15);
  pointer-events: none;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .nav { grid-template-columns: repeat(3, 1fr); }
  .sale-grid, .two-col, .report-grid, .cashier-strip, .cashier-focus { grid-template-columns: 1fr; }
  .confirm-card { grid-template-columns: 1fr; }
  .confirm-media, .confirm-media img { min-height: 190px; }
  .confirm-details, .confirm-customer-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.compact, .inline-form, .filter-row { grid-template-columns: 1fr; }
  .double { grid-column: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media print {
  body > :not(.label-sheet) { display: none !important; }
  .label-sheet { display: grid; gap: 3mm; padding: 7mm; }
  .label-sheet[data-size="40x20"] { grid-template-columns: repeat(4, 40mm); }
  .label-sheet[data-size="50x30"] { grid-template-columns: repeat(3, 50mm); }
  .label-sheet[data-size="60x30"] { grid-template-columns: repeat(3, 60mm); }
  .print-label {
    border: 1px solid #ddd;
    padding: 2mm;
    font-family: Arial, Helvetica, sans-serif;
    page-break-inside: avoid;
    text-align: center;
  }
  .label-sheet[data-size="40x20"] .print-label { width: 40mm; height: 20mm; }
  .label-sheet[data-size="50x30"] .print-label { width: 50mm; height: 30mm; }
  .label-sheet[data-size="60x30"] .print-label { width: 60mm; height: 30mm; }
  .print-label svg { width: 100%; height: 11mm; }
  .print-label strong, .print-label span { display: block; font-size: 9px; }
}
