/* --- Theme (unchanged palette) --- */
:root {
  --bg-root: #0c0c10;
  --bg-shell: #0f0f14;
  --bg-card: #18181f;
  --bg-card-hover: #1e1e28;
  --bg-input: #121218;
  --border-subtle: #2a2a35;
  --border-focus: #00b4d8;
  --accent: #00d4ff;
  --accent-soft: rgba(0, 212, 255, 0.12);
  --accent-glow: rgba(0, 212, 255, 0.35);
  --text: #e8e8ed;
  --text-muted: #9898a8;
  --danger: #ff4d6d;
  --danger-soft: rgba(255, 77, 109, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-root);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- App shell --- */
.pos-app {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-shell);
  overflow: hidden;
}

.pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(12, 12, 16, 0.85);
  backdrop-filter: blur(8px);
}

.pos-header__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.pos-header__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
  flex-shrink: 0;
}

.pos-header__icon svg {
  width: 100%;
  height: 100%;
}

.pos-header__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pos-header__tag {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pos-header__actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.pos-header__btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

/* --- Two columns: ~70% / ~30% --- */
.pos-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  gap: 1rem;
  padding: 1rem 1.25rem 1.5rem;
  min-height: 0;
}

.pos-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  min-height: 0;
}

.pos-panel--dict {
  min-height: 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.card--stretch {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.card--cart {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.card__title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card__subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card__hint {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* --- Forms --- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 100px;
}

.field--grow {
  flex: 1;
  min-width: 160px;
}

.field--full {
  width: 100%;
}

.field--no-margin {
  margin-bottom: 0;
}

.field--inline {
  margin: 0;
}

.field__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.field input,
.input-search {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.field input:focus,
.input-search:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.input-search {
  margin-bottom: 0.85rem;
}

.btn {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(180deg, #00c8f0 0%, #0096c7 100%);
  color: #061016;
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
}

.btn--primary:hover {
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.4);
}

.btn--secondary {
  color: var(--accent);
  border-color: rgba(0, 212, 255, 0.45);
  background: var(--accent-soft);
}

.btn--secondary:hover {
  background: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.btn--ghost {
  width: 100%;
  border-color: var(--border-subtle);
  color: var(--text-muted);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.btn--success {
  width: 100%;
  background: linear-gradient(180deg, #2cd4a6 0%, #18a984 100%);
  color: #06140e;
  border-color: rgba(44, 212, 166, 0.55);
  box-shadow: 0 0 18px rgba(44, 212, 166, 0.28);
}

.btn--success:hover {
  box-shadow: 0 0 24px rgba(44, 212, 166, 0.45);
}

.btn--danger {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger);
  border: 1px solid rgba(255, 77, 109, 0.45);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
}

.btn--danger:hover {
  background: rgba(255, 77, 109, 0.28);
}

.btn--danger-solid {
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255, 77, 109, 0.6);
  background: linear-gradient(180deg, #ff5e7a 0%, #e83a59 100%);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.25);
}

.btn--danger-solid:hover {
  box-shadow: 0 0 22px rgba(255, 77, 109, 0.45);
}

/* --- Product grid (compact cards, side-by-side) --- */
.product-list {
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
  padding-right: 2px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  align-content: start;
}

.product-list .empty {
  grid-column: 1 / -1;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s,
    opacity 0.15s;
  min-width: 0;
  position: relative;
  cursor: grab;
}

.product-card:active {
  cursor: grabbing;
}

.product-card.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.product-card.drop-before {
  box-shadow: inset 3px 0 0 var(--accent),
    inset 0 0 0 1px rgba(0, 212, 255, 0.2);
}

.product-card.drop-after {
  box-shadow: inset -3px 0 0 var(--accent),
    inset 0 0 0 1px rgba(0, 212, 255, 0.2);
}

.product-card:hover:not(.is-editing) {
  border-color: rgba(0, 212, 255, 0.25);
  background: var(--bg-card-hover);
}

.product-card.is-editing {
  border-color: rgba(0, 212, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12);
}

.product-card__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  padding: 0.15rem 0.1rem;
  text-align: left;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: var(--radius-sm);
  min-width: 0;
}

.product-card__main:hover {
  color: var(--text);
}

.product-card__main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.product-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-word;
  width: 100%;
  line-height: 1.25;
}

.product-card__price {
  font-size: 0.92rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.product-card__actions {
  display: flex;
  gap: 0.35rem;
  margin-top: auto;
}

.product-card__actions .btn {
  flex: 1;
  min-width: 0;
}

.btn--edit {
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.4);
  background: rgba(0, 212, 255, 0.08);
  border-radius: var(--radius-sm);
}

.btn--edit:hover {
  background: rgba(0, 212, 255, 0.18);
}

/* --- Custom thin dark scrollbars --- */
.product-list,
.receipt,
.modal__list,
.past-day__items {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  -webkit-overflow-scrolling: touch;
}

.product-list::-webkit-scrollbar,
.receipt::-webkit-scrollbar,
.modal__list::-webkit-scrollbar,
.past-day__items::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.product-list::-webkit-scrollbar-track,
.receipt::-webkit-scrollbar-track,
.modal__list::-webkit-scrollbar-track,
.past-day__items::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 8px;
}

.product-list::-webkit-scrollbar-thumb,
.receipt::-webkit-scrollbar-thumb,
.modal__list::-webkit-scrollbar-thumb,
.past-day__items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.product-list::-webkit-scrollbar-thumb:hover,
.receipt::-webkit-scrollbar-thumb:hover,
.modal__list::-webkit-scrollbar-thumb:hover,
.past-day__items::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.28);
  border-color: rgba(0, 212, 255, 0.4);
}

.product-list::-webkit-scrollbar-corner,
.receipt::-webkit-scrollbar-corner,
.modal__list::-webkit-scrollbar-corner,
.past-day__items::-webkit-scrollbar-corner {
  background: transparent;
}

/* --- Cart / receipt --- */
.receipt-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0.75rem;
}

.receipt {
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
  padding: 0.25rem 0;
}

.receipt__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.receipt__row:last-child {
  border-bottom: none;
}

.receipt__left {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.receipt__idx {
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.receipt__name {
  word-break: break-word;
  font-weight: 500;
}

.qty {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.45);
  flex-shrink: 0;
  align-self: center;
}

.receipt__right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.receipt__price {
  color: var(--accent);
  font-weight: 600;
}

.receipt__remove {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.receipt__remove:hover,
.receipt__remove:focus-visible {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 77, 109, 0.35);
  outline: none;
}

.quick-add {
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.quick-add .field__label {
  display: block;
  margin-bottom: 0.4rem;
}

.quick-add__row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.kasa-total {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.4);
  background: rgba(0, 212, 255, 0.07);
  box-shadow: inset 0 0 28px rgba(0, 212, 255, 0.06);
  margin-bottom: 0.85rem;
}

.kasa-total__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.kasa-total__value {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-align: right;
  line-height: 1.2;
  text-shadow: 0 0 24px var(--accent-glow);
}

.empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

.kasa-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* --- Modal: Günün Özeti --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  cursor: pointer;
  animation: modal-fade 0.18s ease-out;
}

.modal__panel {
  position: relative;
  width: min(540px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.4rem 1.5rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 212, 255, 0.06);
  animation: modal-pop 0.2s ease-out;
}

.modal__panel--wide {
  width: min(620px, 100%);
}

/* Geçmiş Günler: sabit gövde; sadece gün listesi kayar */
#past-days-modal .modal__panel--past-days {
  overflow: hidden;
  flex-shrink: 0;
  min-height: 0;
}

.modal__hint {
  margin: -0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@keyframes modal-pop {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  border: 1px solid transparent;
  background: transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.modal__close:hover,
.modal__close:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  outline: none;
}

.modal__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-right: 2.5rem;
}

.modal__revenue {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 212, 255, 0.4);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: inset 0 0 28px rgba(0, 212, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.modal__revenue-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal__revenue-value {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.modal__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.modal__list {
  overflow-y: auto;
  max-height: 38vh;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.modal__list .empty {
  margin: 0.5rem;
  border: none;
}

.modal__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px dashed var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.modal__row:last-child {
  border-bottom: none;
}

.modal__row-name {
  font-weight: 600;
  word-break: break-word;
}

.modal__row-qty {
  color: var(--accent);
  font-weight: 700;
}

.modal__row-total {
  color: var(--text-muted);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* --- Past Days modal --- */
.past-days-list-wrap {
  /* ~7 kapalı gün satırı + aralıklar; 430px üst sınır */
  --past-days-row: 3.25rem;
  --past-days-gap: 0.5rem;
  --past-days-scroll-h: min(
    430px,
    calc(7 * var(--past-days-row) + 6 * var(--past-days-gap))
  );
  height: var(--past-days-scroll-h);
  max-height: var(--past-days-scroll-h);
  flex: 0 0 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.45) rgba(18, 18, 24, 0.95);
}

.past-days-list-wrap::-webkit-scrollbar {
  width: 10px;
}

.past-days-list-wrap::-webkit-scrollbar-track {
  background: rgba(10, 10, 14, 0.95);
  border-radius: 10px;
  margin: 6px 0;
  border: 1px solid rgba(42, 42, 53, 0.6);
}

.past-days-list-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(0, 212, 255, 0.42),
    rgba(0, 140, 180, 0.28)
  );
  border-radius: 10px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.past-days-list-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(0, 212, 255, 0.58),
    rgba(0, 180, 220, 0.4)
  );
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.past-days-list-wrap::-webkit-scrollbar-corner {
  background: transparent;
}

.past-days-list {
  display: flex;
  flex-direction: column;
  gap: var(--past-days-gap, 0.5rem);
  padding: 0.35rem 0.35rem 0.35rem 0.5rem;
  margin: 0;
  overflow: visible;
  min-height: min-content;
}

.past-days-list .empty {
  margin: 0;
}

.past-day {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
  opacity: 1;
  transition: border-color 0.15s, background 0.15s, opacity 0.3s ease;
}

.past-day:hover {
  border-color: rgba(0, 212, 255, 0.25);
}

.past-day.is-open {
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.1);
}

.past-day.dim {
  opacity: 0.4;
}

.past-day.dim:hover {
  opacity: 0.65;
}

.past-day__head {
  display: flex;
  align-items: stretch;
  min-height: var(--past-days-row, 3.25rem);
}

.past-day__toggle {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.past-day__toggle:hover {
  background: rgba(255, 255, 255, 0.035);
}

.past-day__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.past-day__date {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.past-day__total {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
}

.past-day__chev {
  width: 1.2rem;
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1;
  transition: transform 0.2s ease, color 0.15s;
}

.past-day.is-open .past-day__chev {
  transform: rotate(90deg);
  color: var(--accent);
}

.past-day__delete {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  border: none;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.past-day__delete:hover,
.past-day__delete:focus-visible {
  color: var(--danger);
  background: var(--danger-soft);
  outline: none;
}

.past-day__delete svg {
  width: 17px;
  height: 17px;
}

.past-day__details {
  padding: 0 0.9rem 0.65rem;
  border-top: 1px dashed var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.past-day__details[hidden] {
  display: none;
}

.past-day__items {
  display: block;
  margin-top: 0.45rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.past-day__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.past-day__item:last-child {
  border-bottom: none;
}

.past-day__item-name {
  font-weight: 500;
  word-break: break-word;
}

.past-day__item-qty {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
}

.past-day__item-total {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn--link {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 0.35rem 0.25rem;
}

.btn--link:hover {
  color: var(--accent);
}

/* --- Responsive --- */

/* Tablet: tek sütun, dikey kaydırma */
@media (max-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .pos-app {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }

  .pos-grid {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 0.85rem 1rem 1.25rem;
  }

  .pos-panel--dict,
  .pos-panel--cart .card--cart {
    min-height: auto;
  }

  .card--stretch {
    min-height: 320px;
  }

  .product-list {
    max-height: min(55vh, 480px);
  }

  .receipt {
    max-height: min(35vh, 280px);
  }
}

/* Mobil: header, formlar, dokunmatik hedefler */
@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  .pos-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .pos-header__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
  }

  .pos-header__tag {
    text-align: center;
    font-size: 0.78rem;
  }

  .pos-header__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.65rem 1rem;
    min-height: 44px;
  }

  .pos-grid {
    gap: 0.75rem;
    padding: 0.75rem 0.85rem 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .card {
    padding: 1rem;
  }

  .card__title {
    font-size: 1.1rem;
  }

  .card__hint {
    font-size: 0.82rem;
    margin-bottom: 0.85rem;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field,
  .field--grow {
    min-width: 0;
    width: 100%;
  }

  .field input {
    min-height: 44px;
    font-size: 16px; /* iOS zoom önleme */
  }

  .form-actions {
    width: 100%;
  }

  .form-actions .btn--primary {
    flex: 1;
    min-height: 44px;
  }

  .product-list {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 0.5rem;
    max-height: none;
    min-height: 240px;
  }

  .product-card__main {
    min-height: 44px;
  }

  .product-card__actions .btn {
    min-height: 36px;
  }

  .receipt {
    max-height: min(40vh, 320px);
  }

  .receipt__remove {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }

  .quick-add__row {
    flex-wrap: wrap;
  }

  .quick-add__row .btn {
    min-height: 44px;
  }

  .kasa-actions {
    gap: 0.45rem;
  }

  .kasa-actions .btn {
    min-height: 48px;
  }

  /* Modallar: alt sayfa (sheet) tarzı */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal__panel,
  .modal__panel--wide {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem 1rem 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .modal__panel--past-days {
    max-height: 94vh;
    max-height: 94dvh;
  }

  .modal__list {
    max-height: min(42vh, 360px);
  }

  .modal__footer {
    flex-direction: column;
  }

  .modal__footer .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .past-days-list-wrap {
    --past-days-scroll-h: min(
      50vh,
      calc(5 * var(--past-days-row) + 4 * var(--past-days-gap))
    );
  }

  .past-day__toggle {
    min-height: 48px;
    padding: 0.65rem 0.75rem;
  }

  .past-day__delete {
    width: 48px;
    min-width: 48px;
  }
}

/* Küçük ekran: sıkışık tablolar ve tek sütun ürün grid */
@media (max-width: 480px) {
  .pos-header__tag {
    display: none;
  }

  .product-list {
    grid-template-columns: 1fr 1fr;
  }

  .modal__row,
  .past-day__item {
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.65rem;
  }

  .modal__row-name,
  .past-day__item-name {
    grid-column: 1 / -1;
  }

  .modal__row-qty,
  .past-day__item-qty {
    font-size: 0.82rem;
  }

  .modal__row-total,
  .past-day__item-total {
    font-size: 0.82rem;
    text-align: right;
  }

  .past-day__toggle {
    grid-template-columns: 1fr auto auto;
    gap: 0.4rem 0.5rem;
  }

  .past-day__date {
    font-size: 0.92rem;
  }

  .past-day__total {
    font-size: 0.85rem;
  }

  .quick-add__row {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-add__row .btn {
    width: 100%;
  }

  .kasa-total__value {
    font-size: 1.65rem;
  }
}

@media (max-width: 360px) {
  .product-list {
    grid-template-columns: 1fr;
  }

  .kasa-actions {
    grid-template-columns: 1fr;
  }

  .product-card__actions {
    flex-direction: column;
  }
}

/* Yatay mod (düşük yükseklik) */
@media (max-height: 500px) and (orientation: landscape) {
  .modal {
    align-items: center;
    padding: 0.5rem;
  }

  .modal__panel,
  .modal__panel--wide {
    max-height: 96vh;
    max-height: 96dvh;
    border-radius: var(--radius);
  }

  .modal__list {
    max-height: 28vh;
  }

  .past-days-list-wrap {
    --past-days-scroll-h: min(36vh, 220px);
  }
}
