* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
  background: #f6f9ff;
  color: #0b2447;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #0E65B7;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

h1 {
  font-size: 18px;
  margin: 0;
}

main {
  max-width: 840px;
  margin: 16px auto;
  padding: 0 12px;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, .06);
  padding: 16px 16px 20px;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d6e0ff;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: #0b2447;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.25;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0E65B7;
  box-shadow: 0 0 0 3px rgba(14, 101, 183, .15);
}

.primary {
  background: #0E65B7;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.primary:disabled {
  opacity: .6;
}

.action {
  display: block;
  width: 100%;
  margin: 14px 0 8px;
  font-size: 18px;
}

.attendance-modal {
  width: min(430px, 92vw);
}

.attendance-confirm-body {
  text-align: center;
  padding: 20px 20px 14px !important;
}

.attendance-confirm-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 17px;
  background: #eaf4ff;
  color: #0E65B7;
}

.attendance-confirm-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.attendance-confirm-body p {
  margin: 0;
  color: #1d2939;
  font-size: 16px;
  line-height: 1.5;
}

.attendance-confirm-meta {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #f3f7fb;
  color: #5d6b7d;
  font-size: 12px;
  line-height: 1.4;
}

.attendance-confirm-actions {
  justify-content: flex-end;
  gap: 8px;
}

.attendance-confirm-actions button {
  min-height: 42px;
}

@media (max-width: 480px) {
  .attendance-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attendance-confirm-actions button {
    width: 100%;
  }

  .attendance-confirm-actions.has-alternate button:last-child {
    grid-column: 1 / -1;
  }
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.between {
  justify-content: space-between;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.stat {
  background: #f0f6ff;
  border: 1px solid #e1ecff;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.stat .label {
  font-size: 12px;
  color: #446;
}

.stat .val {
  font-size: 22px;
  font-weight: 800;
  color: #0E65B7;
}

.timeblock {
  text-align: right;
  min-width: 0;
}

.time {
  font-size: 22px;
  font-weight: 800;
}

.date {
  font-size: 12px;
  color: #335;
}

.hello {
  font-size: 14px;
  color: #335;
}

.name {
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

footer {
  max-width: 840px;
  margin: 16px auto;
  padding: 0 12px 20px;
  color: #667;
}

.link {
  background: transparent;
  border: none;
  color: #0E65B7;
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
}

.link.danger {
  color: #b71c1c;
}

.muted {
  color: #657;
  opacity: .9;
}

.tiny {
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  z-index: 3;
}

.badge {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.badge.offline {
  background: #b71c1c;
}

/* --- iOS safe-area (notch) --- */
:root{
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Fallback iOS lawas (pakai constant()) */
@supports (padding: constant(safe-area-inset-top)) {
  :root{
    --safe-top:  constant(safe-area-inset-top);
    --safe-left: constant(safe-area-inset-left);
    --safe-right: constant(safe-area-inset-right);
  }
}

/* Header menyesuaikan status bar */
header{
  padding-top: calc(12px + var(--safe-top));
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  min-height: calc(48px + var(--safe-top));
}

/* Opsional: konten juga aman dari sisi kiri/kanan notch */
main{
  padding-left: calc(12px + var(--safe-left));
  padding-right: calc(12px + var(--safe-right));
}

/* ========== MODAL (native + fallback iOS PWA) ========== */
/* Native <dialog> (untuk non-iOS) */
.modal { 
  width: min(720px, 92vw);
  border: none; 
  border-radius: 12px; 
  padding: 0;
}
.modal::backdrop { background: rgba(0,0,0,.35); }

/* Fallback (pakai .open di iOS PWA & browser lama) */
.modal { display: none; }             /* disembunyikan default */
.modal.open {
  display: block;
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  width: min(720px, 92vw);
  max-height: 70vh;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  z-index: 10001;
}
.modal .modal-body {
  padding: 12px 14px;
  max-height: 60vh; 
  overflow: auto;
  -webkit-overflow-scrolling: touch; /* iOS momentum */
}

/* Header & Footer (dipakai baik native maupun fallback) */
.modal-header, .modal-footer {
  padding: 10px 14px; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  border-bottom: 1px solid #eee;
}
.modal-footer { border-top: 1px solid #eee; border-bottom: none; }
.modal .close { 
  background: transparent; 
  border: none; 
  font-size: 18px; 
  cursor: pointer; 
}

/* Backdrop fallback (untuk iOS PWA) */
.modal-backdrop {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,.35); 
  z-index: 10000; 
  pointer-events: auto;
}

/* Tahan scroll body saat modal terbuka (fallback) */
.no-scroll { overflow: hidden; }

/* Tabel di dalam modal */
.table-wrap { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { 
  border-bottom: 1px solid #eee; 
  padding: 8px; 
  text-align: left; 
  font-size: 14px; 
}
.table tbody tr:hover { background: #fafafa; }

/* Link & tombol sekunder (single source of truth) */
.link { 
  background: none; 
  border: none; 
  color: #0E65B7; 
  cursor: pointer; 
  padding: 0; 
  font-weight: 600;
}
.link.danger { color: #b71c1c; }
.secondary { 
  background: #f3f5f8; 
  border: 1px solid #e6eaef; 
  padding: 8px 12px; 
  border-radius: 8px; 
  cursor: pointer; 
}
.subactions{
  display: flex;
  justify-content: center;     /* center horizontal */
  margin-top: 6px;
}

.subaction{
  appearance: none;
  border: 1px solid #e1ecff;
  background: #f7fbff;
  color: #0E65B7;
  padding: 10px 14px;
  border-radius: 999px;        /* pill */
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform .05s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 2px 10px rgba(14,101,183,.08);
}
.subaction:hover{ background:#eef6ff; }
.subaction:active{ transform: translateY(1px); }
.subaction:disabled{ opacity:.6; cursor: default; }

/* ========== Sales debug module ========== */
.sales-panel {
  margin-top: 14px;
}

.sales-head,
.section-line,
.sales-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sales-head h2,
.section-line h3 {
  margin: 0;
}

.sales-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.sales-tab {
  border: 1px solid #d8e6f8;
  background: #f7fbff;
  color: #0E65B7;
  border-radius: 10px;
  min-height: 42px;
  font-weight: 800;
}

.sales-tab.active {
  background: #0E65B7;
  color: #fff;
  border-color: #0E65B7;
}

.notice {
  background: #eef6ff;
  border: 1px solid #d8e6f8;
  border-radius: 10px;
  color: #17446f;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 13px;
}

.notice.warn {
  background: #fff6e8;
  border-color: #ffe1aa;
  color: #704500;
}

.sales-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.sales-status > div {
  background: #f8fbff;
  border: 1px solid #e1ecff;
  border-radius: 10px;
  padding: 10px;
}

.sales-status strong,
.sales-status span {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 12px 0;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.item-list {
  border: 1px solid #e6eef8;
  border-radius: 10px;
  margin: 10px 0 14px;
  overflow: hidden;
}

.item-list.empty {
  padding: 12px;
  color: #667;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef3f8;
}

.item-row:last-child {
  border-bottom: none;
}

.item-row button {
  align-self: center;
}

.item-title {
  font-weight: 800;
}

.item-meta {
  color: #667;
  font-size: 12px;
  margin-top: 2px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.bar-list {
  margin: 12px 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 78px 1fr 82px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  margin: 8px 0;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e7eef8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #0E65B7;
  border-radius: 999px;
  min-width: 2px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-link {
  border: 1px solid #d8e6f8;
  border-radius: 10px;
  background: #f7fbff;
  color: #0E65B7;
  padding: 14px;
  text-decoration: none;
  font-weight: 800;
}

@media (max-width: 640px) {
  .sales-tabs,
  .sales-status,
  .form-grid,
  .metric-grid,
  .link-grid {
    grid-template-columns: 1fr;
  }

  .sales-head,
  .section-line,
  .sales-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 72px 1fr;
  }

  .bar-row .bar-value {
    grid-column: 2;
  }
}

/* ========== Sales UX polish ========== */
body {
  background: #f2f6fb;
}

.card {
  border: 1px solid rgba(14, 101, 183, .06);
  border-radius: 12px;
}

.sales-panel {
  padding: 18px;
}

.sales-head {
  align-items: flex-start;
}

.sales-head h2 {
  color: #08264d;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.sales-date-label {
  margin-top: 5px;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}

.sales-refresh {
  min-width: 94px;
  min-height: 40px;
  font-weight: 800;
}

.sales-tabs {
  position: sticky;
  top: calc(48px + var(--safe-top));
  z-index: 5;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  margin: 16px -4px 12px;
  background: rgba(246, 249, 255, .96);
  border: 1px solid #dce8f5;
  border-radius: 12px;
}

.sales-tab {
  flex: 1 0 max-content;
  min-width: 84px;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #24537f;
  box-shadow: none;
}

.sales-tab.active {
  background: #0E65B7;
  color: #fff;
  box-shadow: 0 6px 14px rgba(14, 101, 183, .22);
}

.sales-status {
  grid-template-columns: 1.1fr 1.4fr 1fr;
}

.sales-status > div,
.sales-summary-strip,
.sales-section {
  background: #fbfdff;
  border: 1px solid #dfeaf6;
  border-radius: 10px;
}

.sales-status > div {
  min-height: 72px;
}

.sales-status .label {
  margin-bottom: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.sales-status strong {
  color: #08264d;
  font-size: 15px;
  line-height: 1.25;
}

.sales-store-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sales-store-row strong {
  flex: 1 1 auto;
  min-width: 0;
}

.sales-store-switch {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.sales-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  overflow: hidden;
  margin: 12px 0;
}

.sales-summary-strip div {
  padding: 11px 12px;
  border-right: 1px solid #e8eff7;
}

.sales-summary-strip div:last-child {
  border-right: 0;
}

.sales-summary-strip span {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.sales-summary-strip strong {
  display: block;
  margin-top: 3px;
  color: #0E65B7;
  font-size: 20px;
  line-height: 1;
}

.sales-section {
  padding: 14px;
  margin-top: 12px;
}

.section-line {
  margin-bottom: 10px;
}

.section-line h3 {
  color: #08264d;
  font-size: 17px;
  line-height: 1.2;
}

.compact {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.form-grid {
  margin-bottom: 0;
}

label {
  color: #344054;
}

input,
select,
textarea {
  min-height: 44px;
  border-color: #d9e4f0;
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

button,
.primary,
.secondary,
.sales-tab,
.product-link {
  touch-action: manipulation;
}

input,
select,
textarea,
.modal input,
.modal select,
.modal textarea {
  font-size: 16px !important;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.item-list {
  background: #fff;
  border-color: #dfeaf6;
  border-radius: 10px;
}

.item-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
}

.item-title {
  color: #08264d;
  line-height: 1.2;
}

.item-meta {
  line-height: 1.35;
}

.empty-state {
  display: grid;
  gap: 3px;
  padding: 6px 0;
}

.empty-state strong {
  color: #344054;
}

.empty-state span {
  color: #667085;
  font-size: 13px;
}

.danger-soft {
  color: #a11919;
  border-color: #f0d2d2;
  background: #fff6f6;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.photo-card {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.photo-field {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 190px;
  margin: 0;
  padding: 10px;
  border: 1px dashed #b9cce2;
  border-radius: 15px;
  background: #f8fbff;
  color: #344054;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.photo-field.has-photo {
  border-style: solid;
  border-color: #a9cbea;
  background: #f4f9fe;
  box-shadow: 0 8px 20px rgba(30, 64, 99, .06);
}

.photo-field-title {
  padding-right: 44px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.photo-field.required::after {
  content: "Wajib";
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff6e8;
  color: #704500;
  font-size: 10px;
  font-weight: 800;
  z-index: 3;
}

.photo-field.has-photo.required::after {
  display: none;
}

.photo-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 104px;
  overflow: hidden;
  border: 1px solid #dce8f3;
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(14, 101, 183, .045), rgba(43, 182, 115, .045)),
    #eef4f9;
}

.photo-preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px;
  color: #678098;
  text-align: center;
}

.photo-placeholder svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: #0e65b7;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-placeholder span {
  color: #5f7890;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  white-space: normal;
}

.photo-field.has-preview .photo-placeholder {
  display: none;
}

.photo-field input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.photo-field .photo-file-label {
  align-self: end;
  min-width: 0;
  color: #667085;
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-field .photo-file-label.filled {
  color: #0E65B7;
}

.photo-gallery {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #b9cce2;
  border-radius: 11px;
  background: #fff;
  color: #0e65b7;
  font-size: 12px;
  font-weight: 800;
}

.photo-gallery:active {
  background: #edf6ff;
}

.photo-gallery:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.photo-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(161, 25, 25, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #a11919;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(30, 64, 99, .13);
}

.sales-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin: 16px -18px -18px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid #e5edf5;
  backdrop-filter: blur(10px);
}

.sales-actions .primary,
.sales-actions .secondary {
  min-height: 46px;
}

.sales-actions .primary {
  flex: 1;
}

.modal.open {
  border-radius: 14px;
}

.modal-header h3 {
  margin: 0;
  color: #08264d;
}

.modal .modal-body > input[type="search"] {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 10px;
  background: #fff;
}

.product-link {
  min-height: 56px;
  display: flex;
  align-items: center;
}

@media (max-width: 640px) {
  .row.between {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .timeblock {
    text-align: left;
  }

  .grid {
    gap: 8px;
  }

  .stat {
    padding: 10px 8px;
  }

  .stat .val {
    font-size: 20px;
  }

  main {
    margin-top: 10px;
  }

  .sales-panel {
    padding: 16px;
  }

  .sales-head {
    flex-direction: row;
    align-items: flex-start;
  }

  .sales-head h2 {
    font-size: 26px;
  }

  .sales-refresh {
    min-width: 82px;
  }

  .sales-tabs {
    grid-template-columns: none;
  }

  .sales-status {
    grid-template-columns: 1fr;
  }

  .sales-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sales-section {
    padding: 12px;
  }

  .section-line {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .section-line .compact {
    width: 100%;
    max-width: 100%;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-field {
    min-height: 236px;
  }

  .photo-preview-frame {
    min-height: 170px;
    aspect-ratio: 16 / 10;
  }

  .sales-actions {
    flex-direction: row;
    gap: 10px;
  }

  .sales-actions .secondary {
    flex: 0 0 38%;
    min-width: 0;
  }

  .sales-actions .primary {
    min-width: 0;
  }

  .modal.open {
    inset: auto 0 0 0;
    width: 100vw;
    max-height: 82vh;
    transform: none;
    border-radius: 18px 18px 0 0;
  }

  .modal .modal-body {
    max-height: 68vh;
  }
}

.notice.success {
  background: #edf9f1;
  border-color: #bfe6cb;
  color: #176b36;
}

.notice.correction {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff6e8;
  border-color: #f2cf91;
  color: #704500;
}

.notice.correction.hidden {
  display: none !important;
}

.item-actions,
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status-chip.active {
  background: #edf9f1;
  color: #176b36;
}

.status-chip.pending {
  background: #fff6e8;
  color: #704500;
}

.status-chip.revised {
  background: #eef3f8;
  color: #526273;
}

.status-chip.void {
  background: #fff0f0;
  color: #a11919;
}

.photo-link-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.photo-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #d8e6f8;
  border-radius: 8px;
  background: #f7fbff;
  color: #0E65B7;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.form-error {
  margin-top: 8px;
  color: #a11919;
  font-size: 12px;
  font-weight: 700;
}

.bar-value small {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 9px;
  font-weight: 600;
}

.incentive-total {
  color: #176b36;
  font-size: 28px;
}

.promotion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.promotion-list.empty-state {
  grid-template-columns: 1fr;
  padding: 24px;
  border: 1px dashed #b9cce2;
  border-radius: 12px;
  background: #f8fbff;
  text-align: center;
}

.promotion-card {
  display: grid;
  grid-template-rows: 132px 1fr;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce8f5;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  box-shadow: 0 5px 18px rgba(14, 48, 82, .08);
}

.promotion-card:active {
  transform: translateY(1px);
}

.promotion-media,
.promotion-detail-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0E65B7, #35a5d8);
}

.promotion-media.sell-out,
.promotion-detail-hero.sell-out,
.promotion-card.sell-out .promotion-media {
  background: linear-gradient(135deg, #cb5d16, #f0ad35);
}

.promotion-media img,
.promotion-detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promotion-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #0E65B7;
  font-size: 10px;
  font-weight: 900;
}

.promotion-copy {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.promotion-copy strong {
  color: #08264d;
  font-size: 16px;
}

.promotion-copy span,
.promotion-period {
  color: #0E65B7;
  font-size: 12px;
  font-weight: 800;
}

.promotion-copy small,
.promotion-content {
  color: #526273;
  line-height: 1.45;
}

.promotion-detail-hero {
  min-height: 180px;
  max-height: 260px;
  margin: -2px -2px 16px;
  border-radius: 10px;
}

.promotion-content {
  padding: 12px;
  border: 1px solid #e4edf6;
  border-radius: 10px;
  background: #fbfdff;
}

@media (max-width: 640px) {
  .notice.correction {
    align-items: stretch;
    flex-direction: column;
  }

  .item-actions {
    flex-direction: column;
  }

  .promotion-list {
    grid-template-columns: 1fr;
  }

  .promotion-card {
    grid-template-rows: 150px 1fr;
  }
}

/* ========== Sales visual refresh 2026-07-30 ========== */
.sales-panel {
  position: relative;
  padding: 20px;
  border: 1px solid rgba(14, 101, 183, .08);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(63, 155, 229, .11), transparent 220px),
    #fff;
  box-shadow: 0 18px 46px rgba(30, 64, 99, .10);
  overflow: hidden;
}

.sales-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sales-head-copy {
  min-width: 0;
}

.sales-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #41617f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.sales-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2bb673;
  box-shadow: 0 0 0 4px rgba(43, 182, 115, .12);
}

.sales-head h2 {
  margin: 0;
  color: #09294c;
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.sales-date-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #687b8f;
  font-size: 13px;
  font-weight: 700;
}

.sales-date-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a4b5c5;
}

.sales-refresh {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 104px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgba(14, 101, 183, .12);
  border-radius: 13px;
  background: rgba(255, 255, 255, .88);
  color: #0e65b7;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(30, 64, 99, .08);
  backdrop-filter: blur(8px);
}

.sales-refresh-icon {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
}

.sales-refresh.is-loading .sales-refresh-icon {
  animation: sales-spin .8s linear infinite;
}

@keyframes sales-spin {
  to { transform: rotate(360deg); }
}

.sales-tabs {
  position: relative;
  top: auto;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 18px 0 14px;
  padding: 6px;
  overflow: visible;
  border: 1px solid #e2eaf2;
  border-radius: 19px;
  background: linear-gradient(180deg, #f5f8fb, #eef4f8);
  box-shadow:
    inset 0 1px 2px rgba(30, 64, 99, .04),
    0 8px 24px rgba(30, 64, 99, .055);
}

.sales-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  padding: 7px 3px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #6b7f92;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: none;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease, transform .12s ease;
}

.sales-tab-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sales-tab:active {
  transform: scale(.96);
}

.sales-tab.active {
  border-color: transparent;
  background: rgba(255, 255, 255, .96);
  color: #0e65b7;
  box-shadow:
    0 7px 18px rgba(30, 64, 99, .12),
    inset 0 0 0 1px rgba(14, 101, 183, .06);
}

.sales-tab.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #0e65b7;
}

.sales-status {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 1fr;
  gap: 9px;
  margin: 12px 0;
}

.sales-status > div {
  min-width: 0;
  min-height: 70px;
  padding: 13px;
  border: 1px solid rgba(14, 101, 183, .10);
  border-radius: 15px;
  background: linear-gradient(145deg, #fbfdff, #f5f9fd);
  box-shadow: 0 8px 20px rgba(30, 64, 99, .055);
}

.sales-status > div:last-child {
  border-color: rgba(43, 182, 115, .15);
  background: linear-gradient(145deg, #f7fffb, #eefaf4);
}

.sales-status .label {
  margin-bottom: 6px;
  color: #77889a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.sales-status strong {
  overflow-wrap: anywhere;
  color: #09294c;
  font-size: 15px;
  line-height: 1.25;
}

.sales-status > div:last-child strong {
  color: #168653;
}

.sales-summary-strip {
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 15px;
  background: #eef5fb;
}

.sales-summary-strip div {
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .72);
  text-align: center;
}

.sales-summary-strip span {
  color: #7b8c9d;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sales-summary-strip strong {
  margin-top: 5px;
  font-size: 19px;
}

.sales-section {
  padding: 16px;
  border: 1px solid rgba(14, 101, 183, .09);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 28px rgba(30, 64, 99, .065);
}

.sales-section .section-line h3 {
  font-size: 16px;
  letter-spacing: -.01em;
}

.sales-panel input,
.sales-panel select,
.sales-panel textarea {
  min-height: 44px;
  border-color: #dbe5ee;
  border-radius: 12px;
  background: #fbfdff;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.sales-panel textarea {
  min-height: 88px;
}

.sales-panel input:focus,
.sales-panel select:focus,
.sales-panel textarea:focus {
  outline: none;
  border-color: #4797d6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(14, 101, 183, .10);
}

.sales-panel .compact {
  border-radius: 11px;
}

.sales-actions {
  margin-top: 14px;
}

.sales-actions button {
  min-height: 46px;
  border-radius: 13px;
}

.notice.correction {
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(112, 69, 0, .07);
}

@media (max-width: 640px) {
  .sales-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .sales-head {
    flex-direction: row;
    align-items: center;
  }

  .sales-head h2 {
    font-size: 28px;
  }

  .sales-refresh {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 13px;
  }

  .sales-refresh > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sales-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    margin-inline: -2px;
    padding: 5px;
  }

  .sales-tab {
    grid-column: auto;
    width: 100%;
    min-width: 0;
    min-height: 57px;
    font-size: 9.5px;
  }

  .sales-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sales-status > div {
    min-height: 68px;
    padding: 11px;
  }

  .sales-status > div:nth-child(3) {
    grid-column: 1 / -1;
  }

  .sales-summary-strip div {
    padding: 9px 5px;
  }

  .sales-section {
    padding: 14px;
  }

  .sales-section .section-line {
    flex-direction: row;
    align-items: center;
  }

  .sales-section .section-line .compact {
    width: auto;
  }

  .sales-actions {
    flex-direction: row;
  }
}

@media (max-width: 370px) {
  .sales-eyebrow {
    gap: 5px;
    font-size: 10px;
  }

  .sales-head h2 {
    font-size: 26px;
  }

  .sales-tab {
    font-size: 9px;
    letter-spacing: -.02em;
  }

  .sales-tab-icon {
    width: 19px;
    height: 19px;
  }
}

/* ========== Attendance card refresh ========== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.attendance-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(14, 101, 183, .10);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 4%, rgba(14, 101, 183, .10), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 16px 42px rgba(26, 72, 118, .10);
}

.attendance-card > * {
  position: relative;
  z-index: 1;
}

.attendance-card .row.between {
  align-items: flex-start;
  flex-wrap: nowrap;
}

.attendance-card .hello {
  color: #607086;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .025em;
}

.attendance-card .name {
  margin-top: 2px;
  color: #08264d;
  font-size: clamp(21px, 5.7vw, 25px);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -.025em;
}

.attendance-card .timeblock {
  text-align: right;
}

.attendance-card .time {
  color: #08264d;
  font-size: clamp(25px, 7vw, 31px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1;
}

.attendance-card .date {
  margin-top: 5px;
  color: #68788d;
  font-size: 12px;
  font-weight: 650;
}

.attendance-card .grid {
  gap: 9px;
  margin: 20px 0 16px;
}

.attendance-card .stat {
  min-width: 0;
  padding: 13px 8px 12px;
  border: 1px solid #deebf7;
  border-radius: 16px;
  background: rgba(243, 248, 254, .92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86);
}

.attendance-card .stat .label {
  color: #6a788a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.attendance-card .stat .val {
  margin-top: 4px;
  color: #0E65B7;
  font-size: clamp(21px, 6vw, 26px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.attendance-card .action {
  min-height: 58px;
  margin: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #1680d6 0%, #0E65B7 58%, #09579e 100%);
  box-shadow: 0 10px 22px rgba(14, 101, 183, .23);
  font-size: 17px;
  letter-spacing: .005em;
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
}

.attendance-card .action:active:not(:disabled) {
  transform: translateY(1px) scale(.995);
  box-shadow: 0 6px 14px rgba(14, 101, 183, .20);
}

.attendance-card .action:disabled {
  box-shadow: none;
}

.attendance-utilities {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: 12px;
}

.gps-indicator {
  appearance: none;
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #d8e3ee;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  color: #526175;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(35, 72, 108, .07);
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .12s ease;
}

.gps-indicator:active {
  transform: scale(.98);
}

.gps-indicator #gpsAccuracyValue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gps-accuracy-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a2b3;
  box-shadow: 0 0 0 4px rgba(152, 162, 179, .13);
}

.gps-indicator-refresh {
  flex: 0 0 auto;
  margin-left: auto;
  color: currentColor;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  opacity: .62;
}

.gps-indicator.gps-waiting .gps-accuracy-dot {
  animation: gps-indicator-pulse 1.45s ease-in-out infinite;
}

.gps-indicator.gps-waiting .gps-indicator-refresh {
  animation: gps-indicator-spin 1.2s linear infinite;
}

.gps-indicator.gps-good {
  border-color: #b9e2c6;
  background: #f0faf3;
  color: #19713b;
}

.gps-indicator.gps-good .gps-accuracy-dot {
  background: #209653;
  box-shadow: 0 0 0 4px rgba(32, 150, 83, .13);
}

.gps-indicator.gps-medium {
  border-color: #ecd38d;
  background: #fff9e9;
  color: #8a6200;
}

.gps-indicator.gps-medium .gps-accuracy-dot {
  background: #d99a00;
  box-shadow: 0 0 0 4px rgba(217, 154, 0, .13);
}

.gps-indicator.gps-poor,
.gps-indicator.gps-error {
  border-color: #efc4c4;
  background: #fff4f4;
  color: #a72b2b;
}

.gps-indicator.gps-poor .gps-accuracy-dot,
.gps-indicator.gps-error .gps-accuracy-dot {
  background: #c83b3b;
  box-shadow: 0 0 0 4px rgba(200, 59, 59, .12);
}

.attendance-card .subactions {
  flex: 0 0 auto;
  margin: 0;
}

.attendance-card .subaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border-color: #d8e5f2;
  background: rgba(255, 255, 255, .86);
  color: #0E65B7;
  font-size: 12px;
  box-shadow: 0 3px 12px rgba(35, 72, 108, .07);
}

.attendance-card .subaction svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

@keyframes gps-indicator-pulse {
  0%, 100% { opacity: .52; transform: scale(.88); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes gps-indicator-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .attendance-card {
    padding: 19px 17px 18px;
    border-radius: 20px;
  }

  .attendance-card .row.between {
    flex-wrap: nowrap;
  }

  .attendance-card .timeblock {
    text-align: right;
  }

  .attendance-card .grid {
    gap: 7px;
    margin-top: 18px;
  }

  .attendance-card .stat {
    padding-inline: 5px;
  }

  .attendance-card .subaction,
  .gps-indicator {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gps-indicator.gps-waiting .gps-accuracy-dot,
  .gps-indicator.gps-waiting .gps-indicator-refresh {
    animation: none;
  }
}

/* ========== Flexible attendance history ========== */
.history-modal {
  width: min(820px, 96vw);
}

.history-modal.modal.open {
  width: min(820px, 96vw);
  max-height: 90vh;
}

.history-period-label {
  margin: 3px 0 0;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.history-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 68vh !important;
  padding: 14px !important;
  background: #f7f9fc;
}

.history-range-panel {
  min-width: 0;
  padding: 13px;
  border: 1px solid #dce7f3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(26, 72, 118, .06);
}

.history-range-fields {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.history-range-fields label {
  display: block;
  min-width: 0;
  margin: 0;
  color: #59687b;
  font-size: 11px;
  font-weight: 800;
}

.history-date-control {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid #d8e4f0;
  border-radius: 10px;
  background: #fbfdff;
}

.history-date-control:focus-within {
  border-color: #0E65B7;
  box-shadow: 0 0 0 3px rgba(14, 101, 183, .15);
}

.history-range-fields input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  min-height: 43px;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.history-range-fields input[type="date"]:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.history-apply {
  min-height: 43px;
  padding: 9px 16px;
  border-radius: 10px;
}

.history-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.history-presets button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #d9e5f1;
  border-radius: 999px;
  background: #f5f9fd;
  color: #175f9f;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.history-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  padding: 0 2px;
  color: #667085;
  font-size: 12px;
}

.history-list-meta strong {
  flex: 0 0 auto;
  color: #0E65B7;
}

.history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 70px;
  color: #617085;
  font-size: 13px;
  font-weight: 700;
}

.history-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid #d8e6f3;
  border-top-color: #0E65B7;
  border-radius: 50%;
  animation: gps-indicator-spin .85s linear infinite;
}

.history-day-list {
  display: grid;
  gap: 9px;
}

.history-day-card {
  appearance: none;
  display: block;
  width: 100%;
  padding: 13px;
  border: 1px solid #dce7f2;
  border-radius: 14px;
  background: #fff;
  color: #122c4d;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29, 72, 112, .055);
  transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}

.history-day-card:active {
  transform: scale(.995);
}

.history-day-card:hover {
  border-color: #b9d5ec;
  box-shadow: 0 7px 18px rgba(29, 72, 112, .085);
}

.history-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-day-head > span:first-child {
  min-width: 0;
}

.history-day-head strong,
.history-day-head small {
  display: block;
}

.history-day-head strong {
  color: #102e53;
  font-size: 14px;
  line-height: 1.3;
}

.history-day-head small {
  margin-top: 3px;
  color: #738196;
  font-size: 11px;
  font-weight: 650;
}

.history-status-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: #536174;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.history-status-chip.complete {
  background: #eaf8ef;
  color: #1d7540;
}

.history-status-chip.alert,
.history-status-chip.empty {
  background: #fff0f0;
  color: #b12d2d;
}

.history-day-times,
.attendance-day-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.history-day-times {
  margin-top: 11px;
}

.history-day-times > span,
.attendance-day-summary > div {
  padding: 9px 8px;
  border-radius: 10px;
  background: #f4f8fc;
  text-align: center;
}

.history-day-times small,
.history-day-times strong,
.attendance-day-summary span,
.attendance-day-summary strong {
  display: block;
}

.history-day-times small,
.attendance-day-summary span {
  color: #748196;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.history-day-times strong,
.attendance-day-summary strong {
  margin-top: 3px;
  color: #0E65B7;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.history-day-store,
.attendance-day-store {
  display: block;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #edf1f5;
  color: #607086;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 22px;
  border: 1px dashed #ccd9e6;
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
  color: #718096;
  text-align: center;
}

.history-empty strong {
  color: #405169;
  font-size: 14px;
}

.history-empty span {
  margin-top: 4px;
  font-size: 12px;
}

.history-footer {
  flex-wrap: wrap;
  gap: 8px;
}

.history-export-actions {
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  margin-right: auto;
}

.history-footer button,
.history-export-actions button {
  min-height: 40px;
}

.attendance-day-modal {
  width: min(600px, 94vw);
}

.attendance-day-modal .modal-header > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.attendance-day-summary {
  margin-bottom: 8px;
}

.attendance-day-counts {
  color: #68788d;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.attendance-day-section-title {
  margin: 17px 0 8px;
  color: #263f60;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.attendance-activity-list {
  display: grid;
  gap: 8px;
}

.attendance-activity {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid #e0e8f0;
  border-radius: 12px;
  background: #fbfdff;
}

.attendance-activity-time {
  color: #0E65B7;
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.attendance-activity-copy {
  min-width: 0;
}

.attendance-activity-type {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
}

.attendance-activity-type.in {
  background: #eaf8ef;
  color: #1d7540;
}

.attendance-activity-type.out {
  background: #fff0f0;
  color: #b12d2d;
}

.attendance-activity-copy strong,
.attendance-activity-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.attendance-activity-copy strong {
  margin-top: 6px;
  color: #263f60;
  font-size: 12px;
}

.attendance-activity-copy small {
  margin-top: 4px;
  color: #728096;
  font-size: 11px;
}

.attendance-pdf-modal,
.attendance-pdf-modal.modal.open {
  width: min(980px, 97vw);
  max-height: 94vh;
}

.attendance-pdf-body {
  height: min(72vh, 760px);
  max-height: none !important;
  padding: 0 !important;
  background: #e9eef4;
  overflow: hidden !important;
}

.attendance-pdf-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.attendance-pdf-fallback {
  display: none;
  margin: 0;
  padding: 10px 14px;
  color: #5f6e82;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 640px) {
  .history-modal.modal.open,
  .attendance-day-modal.modal.open,
  .attendance-pdf-modal.modal.open {
    inset: auto 0 0 0;
    width: 100vw;
    max-height: 92vh;
    transform: none;
    border-radius: 20px 20px 0 0;
  }

  .history-modal-body {
    max-height: 68vh !important;
  }

  .history-range-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-apply {
    grid-column: 1 / -1;
  }

  .history-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .history-export-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
  }

  .history-footer > button {
    width: 100%;
  }

  .attendance-pdf-body {
    height: 72vh;
  }

  .attendance-pdf-fallback {
    display: block;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, .94);
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-spinner {
    animation: none;
  }
}

/* Sales history: verification and recognition match the Android workflow. */
#salesHistoryTotal { padding: 0; background: transparent; border: 0; }
.sales-history-totals { display: grid; grid-template-columns: minmax(0, 1fr); }
.sales-history-total { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; border: 1px solid; }
.sales-history-total.verified { background: #edf8f2; border-color: #bedfcf; color: #185b3a; }
.sales-history-total > span { font-size: 13px; font-weight: 700; }
.sales-history-total > strong { font-size: clamp(16px, 4.5vw, 22px); overflow-wrap: anywhere; }
.sales-history-total-note { margin: 10px 0 14px; font-size: 12px; line-height: 1.5; color: #526176; }
.sales-history-row > div { width: 100%; min-width: 0; }
.sales-history-row { cursor: pointer; }
.sales-history-row:focus-visible { outline: 3px solid #0e65b7; outline-offset: 2px; }
.sales-history-row-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sales-history-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sales-review-chip { display: inline-block; padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.sales-review-chip.verified { background: #e3f4e9; color: #185b3a; }
.sales-review-chip.waiting { background: #fff0cb; color: #79520b; }
.sales-review-chip.excluded { background: #edf0f4; color: #526176; }
.sales-recognition-note { margin-top: 8px; line-height: 1.5; }
/* ========== Sales tablet shell ========== */
.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, .78);
  font-size: 11px;
  font-weight: 600;
}

.header-actions,
.session-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-actions {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.session-actions .secondary {
  border-color: rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

#loginView {
  width: min(460px, 100%);
  margin: 9vh auto 0;
  padding: 26px;
}

#loginView h2 {
  margin: 0 0 6px;
}

#loginView .primary {
  width: 100%;
  margin-top: 14px;
}

@media (min-width: 900px) {
  main {
    max-width: 1180px;
    padding: 0 24px;
  }

  header {
    padding-inline: max(24px, calc((100vw - 1132px) / 2));
  }

  .sales-panel {
    padding: 26px;
  }

  .sales-status {
    grid-template-columns: 1.2fr 1.8fr 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-subtitle,
  #sessionOperator {
    display: none;
  }

  header {
    padding: 10px 12px;
  }

  #loginView {
    margin-top: 28px;
    padding: 20px;
  }
}
