html, body { max-width: 100%; overflow-x: hidden; }
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #e5e5e5;
  --card: #ffffff;
  --accent: #111111;
}

* { box-sizing: border-box; }
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 10px;
  display: grid;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.subcard {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.status {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fafafa;
}
.status.ok { border-color: #b7e4c7; background: #f2fbf5; }
.status.warn { border-color: #f2cd7d; background: #fff9e9; color: #7a4b00; }
.status.err { border-color: #ffccd5; background: #fff5f6; }

h1, h2, h3 { margin: 0 0 10px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }

/* iPhone-like accordion */
details.accordion { padding: 0; overflow: hidden; }
.accordion-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary::after {
  content: "›";
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform 140ms ease;
}
details.accordion:not([open]) .accordion-summary::after { transform: rotate(0deg); }
@keyframes acc-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-grid {
  grid-auto-rows: 80px;
}

.weekday-row {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.day-cell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 80px;
  height: 80px;
  padding: 6px;
  padding-top: 20px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.day-num {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: #111827;
}
.day-cell.outside { color: #aaa; background: #fafafa; }
.day-cell.today { border-color: var(--line); }
.day-cell.selected { outline: none; box-shadow: inset 0 0 0 3px #111; }

.entry-chip {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  max-width: 100%;
}
.entry-chip .tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 4px;
  margin-right: 4px;
}

.form { display: grid; gap: 8px; }
.form label { display: grid; gap: 4px; font-size: 13px; }
.form .field-hint {
  color: var(--muted);
  font-size: 12px;
}
.form .sync-key-label {
  font-weight: 700;
}
.form input, .form select, .form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 16px;
  background: #fff;
}
.form.compact { grid-template-columns: 1fr; }
.inline { display: flex !important; align-items: center; gap: 8px; }
.hidden { display: none !important; }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid #111;
  background: #111;
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 80ms ease, opacity 80ms ease, background-color 120ms ease, border-color 120ms ease;
  touch-action: manipulation;
}
.btn.secondary {
  background: #fff;
  color: #111;
  border-color: var(--line);
}

/* Pressed feedback (mobile friendly) */
button:active,
.btn:active,
.text-btn:active,
.weekday-btn:active {
  transform: scale(0.97);
  opacity: 0.88;
}

button:disabled,
.btn:disabled,
.text-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  border-top: 1px solid var(--line);
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.list li:first-child { border-top: 0; }

.one-line {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-actions { display: flex; gap: 6px; }
.text-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.master-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.inline-form { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-form input { flex: 1; }

.weekday-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.weekday-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 0;
  font-size: 12px;
  cursor: pointer;
}
.weekday-btn.on {
  border-color: #111;
  background: #111;
  color: #fff;
}

/* Toast */
.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  display: grid;
  justify-items: center;
  pointer-events: none;
  z-index: 9999;
}
.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: min(520px, calc(100% - 24px));
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { border-color: #b7e4c7; }
.toast.warning { border-color: #f2cd7d; background: rgba(255, 249, 233, 0.98); }
.toast.error { border-color: #ffccd5; }
.toast.info { border-color: #cfe8ff; }
.toast__body { min-width: 0; }
.toast__title { font-weight: 750; line-height: 1.35; }
.toast__detail { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.toast__action {
  margin-top: 7px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 720px) {
  .container { padding: 8px 10px; }
  .master-grid { grid-template-columns: 1fr; }

}


/* Compact admin buttons + bottom-sheet panels */
.admin-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.admin-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.admin-btn.active {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.roadside-shipment-form {
  gap: 12px;
}

.roadside-quantity-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.roadside-quantity-field > span {
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

/* Backdrop covers entire screen */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.25);
  display: block;
}

.sheet-backdrop.hidden {
  display: none !important;
}

/* Bottom sheet panel */
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 720px);
  max-height: 85vh;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
}

.sheet-header h3 {
  margin: 0;
  font-size: 16px;
}

.shipment-template-suggestions {
  margin: -2px 0 2px;
}

.shipment-template-suggestions.hidden {
  display: none;
}

.shipment-template-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.shipment-template-suggestion {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sheet-body {
  max-height: calc(85vh - 56px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

.sheet input,
.sheet select,
.sheet textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.icon-btn {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  font-size: 13px;
  color: #374151;
}

.admin-card {
  padding-top: 10px;
  padding-bottom: 10px;
  opacity: 0.92;
  position: sticky;
  bottom: 10px;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
}

.admin-bar--bottom {
  margin-top: 12px;
  justify-content: flex-start;
}

@media (min-width: 720px) {
  .admin-card {
    padding-top: 10px;
    padding-bottom: 10px;
    opacity: 0.92;
    position: sticky;
    bottom: 10px;
    z-index: 10;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
  }
}

.subline {
  margin-top: 12px;
  font-size: 12px;
  color: #6b7280;
}
/* Today highlight */
.day-num.is-today {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #000000;
  color: #ffffff;
  font-weight: 700;
}





/* Pills in calendar */
.entry-chip {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.10);
  margin-bottom: 3px;
  font-size: 10px;
  line-height: 1.25;
}
.entry-chip.t-shipment { background: rgba(59,130,246,0.10); }
.entry-chip.t-event { background: rgba(17,24,39,0.06); }
.entry-chip.t-memo { background: rgba(245,158,11,0.16); }

.entry-chip .tag {
  border: 0;
  background: transparent;
  padding: 0;
  margin-right: 4px;
  color: rgba(17,24,39,0.70);
}

/* Compact empty lists */
.list.is-empty {
  padding-top: 4px;
}
.list.is-empty li {
  padding: 6px 0;
  color: var(--muted);
}

.today-meta {
  margin: -6px 0 8px;
  font-size: 12px;
}

/* Slight background hint for today cell (keep subtle) */
.day-cell.today {
  background: rgba(0,0,0,0.03);
}

.today-title { font-size: 14px; font-weight: 700; color: #111827; margin: 0 0 2px; }
.today-count { font-size: 12px; color: #374151; margin: 0; }


/* Entry list (today/selected day) */
.entry-row { align-items: flex-start; }
.entry-main { flex: 1; min-width: 0; }
.entry-line { display: flex; align-items: baseline; gap: 8px; }
.entry-content { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.entry-time { font-size: 12px; color: #6b7280; font-variant-numeric: tabular-nums; }
.entry-title { font-size: 14px; color: #111827; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.10);
  font-size: 11px;
  line-height: 1;
  color: rgba(17,24,39,0.75);
  background: rgba(17,24,39,0.04);
  flex: 0 0 auto;
}
.pill--shipment { background: rgba(59,130,246,0.10); }
.pill--event { background: rgba(17,24,39,0.06); }
.pill--memo { background: rgba(245,158,11,0.16); }


.pill--recurring {
  background: rgba(17, 24, 39, 0.08);
}/* Make action buttons less prominent */
.row-actions .text-btn {
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 999px;
  opacity: 0.9;
}

/* Shipment second spec UI */
.btn.small { height: 32px; padding: 0 12px; font-size: 12px; }
.spec2-toggle { margin-top: 6px; }
.spec2-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }

.entry-spec { margin-top: 2px; font-size: 13px; color: #111827; }

.unread-indicator {
  display: inline-block;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3e8a61;
  box-shadow: 0 0 0 2px #e7f1eb;
}

.unread-summary {
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  margin: -2px 0 8px;
  padding: 4px 9px;
  border: 1px solid #cfe1d5;
  border-radius: 8px;
  background: #f2f7f4;
  color: var(--primary-dark);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

.unread-summary:hover, .unread-summary:focus-visible { background: #e7f1eb; }
.unread-summary:focus-visible { outline: 2px solid rgba(23, 107, 67, .28); outline-offset: 2px; }

.selected-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.section-flash {
  animation: sectionFlash 1.2s ease;
}

@keyframes sectionFlash {
  0% { background: rgba(17, 24, 39, 0.08); border-radius: 8px; }
  100% { background: transparent; border-radius: 8px; }
}

.form-highlight {
  box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.18), 0 0 0 1px rgba(17, 24, 39, 0.06);
  transition: box-shadow 0.2s ease;
}

.choice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.choice-backdrop.hidden {
  display: none;
}

.choice-modal {
  width: min(100%, 440px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.choice-modal__body {
  padding: 16px;
}

.choice-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.choice-modal__text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

.choice-modal__actions {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.choice-modal__actions .btn,
.choice-modal__actions .text-btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  font-size: 15px;
}

@media (max-width: 600px) {
  .choice-backdrop {
    align-items: center;
  }

  .choice-modal {
    width: min(100%, 360px);
  }
}

.shipment-actual-control {
  border-color: #9ac4aa;
  color: var(--primary-dark);
  white-space: nowrap;
}
.shipment-actual-control.is-completed {
  border-color: transparent;
  background: #edf7f0;
  color: #256244;
  font-weight: 700;
}
.shipment-actual-notice {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.shipment-actual-schedule-control {
  flex: 0 0 auto;
  align-self: center;
  padding: 4px 6px;
  font-size: 11px;
}
.monthly-schedule-item .monthly-schedule-detail { flex: 1 1 auto; }
.shipment-actual-sheet { max-height: 90vh; }
.shipment-actual-customer { margin: 0 0 14px; font-size: 18px; }
.shipment-actual-line {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf9;
}
.shipment-actual-line__heading { display: flex; justify-content: space-between; gap: 8px; font-weight: 750; }
.shipment-actual-line label { display: grid; gap: 4px; font-size: 13px; }
.shipment-actual-line__price { color: var(--muted); font-size: 12px; }
.shipment-actual-calculation { display: grid; gap: 5px; margin-top: 14px; padding: 12px; border-radius: 12px; background: #f1f7f2; }
.shipment-actual-calculation > div { display: flex; justify-content: space-between; gap: 12px; }
.shipment-actual-calculation strong { white-space: nowrap; }
.shipment-actual-calculation .shipment-actual-net { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--primary-dark); font-size: 16px; }
.shipment-actual-detail-list { display: grid; gap: 8px; margin-bottom: 12px; }
.shipment-actual-detail-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shipment-actual-warning { margin: 0 0 6px; color: #a33c35; font-weight: 750; }
.shipment-actual-actions { margin-top: 16px; }
.shipment-actual-actions .btn { min-height: 44px; }
.shipment-actual-actions .is-cancel-action { border-color: #d8aaa4; background: #fff; color: #9a3b35; }
.shipment-actual-actions .is-loading { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.shipment-actual-actions .is-loading::before { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: currentColor; border-radius: 50%; animation: shipment-actual-spin .8s linear infinite; }
@keyframes shipment-actual-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .shipment-actual-control { padding: 5px 6px; font-size: 11px; }
  .shipment-actual-schedule-control { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .shipment-actual-line__heading { display: grid; gap: 2px; }
  .shipment-actual-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .shipment-actual-actions .is-loading::before { animation: none; }
}



input,
select,
textarea,
button { font-size: 16px; max-width: 100%; }

.qty-unit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.qty-unit-row label { margin: 0; }

@media (max-width: 420px) {
  .qty-unit-row { grid-template-columns: 1fr 1fr; }
}


/* Hard guard against horizontal scroll on mobile */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.container, .card, .sheet, .form-row, .calendar, .admin-card {
  max-width: 100%;
  min-width: 0;
}

.one-line, .muted, .status, label, .sheet-body {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}



/* Overflow guard for grid/flex children */
.calendar-grid, .weekday-row, .day-cell, .sheet, .sheet-body, form, .form, .actions, .row-actions { min-width: 0; }



/* PWA horizontal scroll lock */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
  position: relative;
}

body {
  margin: 0;
  touch-action: pan-y;
}

#app,
.container,
.card,
.calendar-card,
.calendar-wrap,
.calendar-grid,
.weekday-row,
.sheet,
.sheet-body,
form,
.form-row,
.form-grid {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

input,
select,
textarea,
button {
  max-width: 100%;
  min-width: 0;
  font-size: 16px;
}



/* Overflow debug panel (debugOverflow=1) */
.overflow-debug{position:fixed;left:8px;right:8px;bottom:88px;max-height:38vh;overflow:auto;z-index:2000;background:rgba(0,0,0,0.82);color:#fff;border-radius:12px;padding:10px;font-size:12px;line-height:1.35;}
.overflow-debug__head{font-weight:700;margin:0 0 8px;}
.overflow-debug__row{padding:6px 0;border-top:1px solid rgba(255,255,255,0.15);}
.overflow-debug__k{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;overflow-wrap:anywhere;word-break:break-word;}
.overflow-debug__v{opacity:0.85;}
.overflow-debug__empty{opacity:0.75;}



/* Debug bar */
.debug-bar{position:sticky;bottom:0;z-index:20;background:rgba(255,255,255,0.94);backdrop-filter:blur(8px);border:1px solid #e5e7eb;border-radius:14px;padding:8px 10px;margin:10px 0 0;max-width:100%;overflow:hidden;}
.debug-bar__row{display:flex;justify-content:space-between;gap:8px;min-width:0;}
.debug-bar__row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.debug-bar__err{margin-top: 12px;padding-top:6px;border-top:1px solid #eef2f7;color:#b91c1c;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;}


.qty-unit-row label > input,
.qty-unit-row label > select { width: 100%; }



/* Detail list: aligned shipment rows */
.entry-line--shipment {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1.6fr) 5.5ch 7ch;
  gap: 8px;
  align-items: center;
}

.entry-content--shipment {
  display: contents;
}

.pill--spacer {
  opacity: 0;
  width: auto;
}

.entry-destination {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-standard,
.entry-quantity {
  white-space: nowrap;
}

.entry-line--shipment2 {
  margin-top: 4px;
}




.entry-standard{font-variant-numeric:tabular-nums;}
.entry-quantity{font-variant-numeric:tabular-nums;text-align:right;}



/* Shipment debug pre (debug=1) */
.shipment-debug-pre{position:fixed;left:8px;right:8px;bottom:88px;max-height:38vh;overflow:auto;z-index:2500;background:rgba(0,0,0,0.85);color:#fff;border-radius:12px;padding:10px;font-size:11px;line-height:1.35;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;}



/* Strong override: force shipment row grid */
.entry-line.entry-line--shipment {
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) 64px 64px;
  column-gap: 8px;
  align-items: center;
}
.entry-line.entry-line--shipment .pill { grid-column: 1; }
.entry-line.entry-line--shipment .entry-destination { grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-line.entry-line--shipment .entry-standard { grid-column: 3; white-space: nowrap; }
.entry-line.entry-line--shipment .entry-quantity { grid-column: 4; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }



/* Fix: constrain detail list rows to card width (iOS PWA) */
.entry-row {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.entry-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.entry-line.entry-line--shipment {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) 56px 56px !important;
  column-gap: 6px;
  align-items: center;
}

.entry-line.entry-line--shipment > * {
  min-width: 0;
}

.entry-line.entry-line--shipment .entry-destination {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-line.entry-line--shipment .entry-standard,
.entry-line.entry-line--shipment .entry-quantity {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.entry-line.entry-line--shipment .entry-quantity {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .entry-line.entry-line--shipment {
    grid-template-columns: 38px minmax(0, 1fr) 48px 50px !important;
    column-gap: 4px;
  }
  .row-actions .text-btn {
    font-size: 12px;
    padding: 4px 6px;
  }
}


/* Shipment detail: standard + quantity wrapper */
.entry-standardqty { display: contents; }

@media (max-width: 600px) {
  /* Mobile: show destination on first line, standard+qty on second line (no over-truncation) */
  .entry-line.entry-line--shipment {
    grid-template-columns: 42px minmax(0, 1fr) !important;
    grid-auto-rows: 80px;
    row-gap: 2px;
    column-gap: 8px;
    align-items: start;
  }

  .entry-line.entry-line--shipment .pill { grid-column: 1; grid-row: 1; }

  .entry-line.entry-line--shipment .entry-destination {
    grid-column: 2;
    grid-row: 1;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .entry-line.entry-line--shipment .entry-standardqty {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    align-items: baseline;
    flex-wrap: wrap;
    min-width: 0;
  }

  .entry-line.entry-line--shipment .entry-standard {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .entry-line.entry-line--shipment .entry-quantity {
    white-space: nowrap;
    text-align: left;
  }

  /* 2nd spec line: no destination; keep standard+qty aligned */
  .entry-line.entry-line--shipment2 .pill--spacer { grid-column: 1; grid-row: 1; }
  .entry-line.entry-line--shipment2 .entry-destination { display: none; }
  .entry-line.entry-line--shipment2 .entry-standardqty { grid-row: 1; }
}
/* Date input width guard (avoid horizontal scroll on iOS/PWA) */
input[type="date"],
input[type="datetime-local"],
.date-input,
#shipmentDate,
#eventDate,
#memoDate,
#startDate,
#endDate {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* Form/layout overflow guard */
form,
.form,
.form-row,
.form-grid,
.qty-unit-row {
  max-width: 100%;
  min-width: 0;
}

/* Compact shipment layout for detail lists (today/selected day)
   Goal: keep destination and spec close (avoid overly wide 4-column table look). */
.entry-line.entry-line--shipment {
  /* Override older 4-col rules */
  grid-template-columns: 42px minmax(0, 1fr) !important;
  grid-auto-rows: 80px;
  row-gap: 2px;
  column-gap: 10px;
  align-items: start;
}

.entry-line.entry-line--shipment .entry-destination {
  font-weight: 700;
}

/* Standard + quantity should stay visually close */
.entry-standardqty {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
  min-width: 0;
}

.entry-standardqty .entry-standard,
.entry-standardqty .entry-quantity {
  min-width: 0;
  white-space: nowrap;
}

/* Keep the existing mobile 2-line layout override (max-width:600px) below working;
   it will re-override .entry-standardqty to a grid for alignment. */


/* Shipment detail card (today/selected day) */
.shipment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.shipment-detail {
  min-width: 0;
  max-width: 100%;
}

.shipment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shipment-destination {
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.shipment-specs {
  margin-left: 52px;
  margin-top: 4px;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shipment-spec {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Date input visual alignment (match select look) */
input[type="date"],
#shipmentDate,
#eventDate,
#memoDate,
#startDate,
#endDate {
  text-align: left;
  padding: 9px 10px;
  line-height: 1.2;
}

/* Safari/Chromium date text alignment */
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Form compact grid */
.form.form--compact label { font-size: 12px; }
.form.form--compact label { gap: 3px; }

.form-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.form-destination-row {
  max-width: 100%;
  min-width: 0;
}

#referenceRuleFields {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  max-width: 100%;
  min-width: 0;
}

.weekday-picker {
  max-width: 100%;
  min-width: 0;
}

.small-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.reference-items-list {
  display: grid;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.reference-item-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) minmax(0, 0.8fr) 88px auto;
  gap: 8px;
  align-items: end;
  max-width: 100%;
  min-width: 0;
}

.reference-item-row label {
  min-width: 0;
}

.reference-item-row input,
.reference-item-row select {
  width: 100%;
  min-width: 0;
}

.reference-item-remove {
  align-self: end;
  padding: 0 8px;
  height: 38px;
}

@media (max-width: 600px) {
  .reference-item-row {
    grid-template-columns: 72px minmax(0, 1fr) minmax(0, 0.7fr) 72px auto;
    gap: 6px;
  }
}

.form-spec-row {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.8fr;
  gap: 8px;
  align-items: end;
  max-width: 100%;
  min-width: 0;
}

.form-memo-row {
  max-width: 100%;
  min-width: 0;
}

.form-top-row > label,
.form-spec-row > label {
  min-width: 0;
}

@media (max-width: 390px) {
  .form-top-row {
    grid-template-columns: 1fr 1fr;
  }
  /* date spans full row on narrow screens */
  #spotDateRow,
  #eventDateRow,
  #memoDateRow {
    grid-column: 1 / -1;
  }
}

/* iOS/PWA auto-zoom guard: keep form controls >= 16px */
input,
select,
textarea {
  font-size: 16px !important;
}

input[type="number"],
input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
  font-size: 16px !important;
}

textarea {
  line-height: 1.4;
}

textarea::placeholder,
input::placeholder {
  font-size: 16px;
}

/* Calendar overflow visible (avoid clipping selection ring) */
.calendar-grid,
.weekday-row {
  overflow: visible;
}

.day-cell {
  overflow: hidden;
}

/* Calendar day cells must stay fixed-height even when many entries exist */
.calendar-grid {
  grid-auto-rows: 80px !important;
}

.calendar-grid > .day-cell {
  height: 80px !important;
  min-height: 80px !important;
  max-height: 80px !important;
}


.calendar-grid .entry-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  padding: 1px 4px;
  margin-bottom: 1px;
}

.calendar-grid .entry-chip.entry-chip--more {
  display: block;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 9px;
  line-height: 1;
  text-align: left;
  margin-top: 0;
}

/* Admin spacing unify: avoid "stuck to form" look on mobile */
@media (max-width: 720px) {
  .admin-card {
    position: static;
    bottom: auto;
    z-index: auto;
    opacity: 1;
    background: #fff;
    backdrop-filter: none;
    margin-top: 0;
  }

  .admin-bar--bottom {
    margin-top: 0;
  }
}

/* Next week shipment summary */
.nextweek-card {\r\n  border: 1px solid var(--line);\r\n  border-radius: 14px;\r\n  background: #fff;
  padding: 10px 12px;
}

.nextweek-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.nextweek-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.nextweek-range {
  font-size: 12px;
}

.nextweek-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.nextweek-item {
  font-size: 12px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nextweek-dest {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}

.nextweek-specs {
  margin-top: 2px;
  padding-left: 12px;
  display: grid;
  gap: 2px;
}

.nextweek-spec {
  font-size: 12px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Next week shipment summary (date-grouped) */
.nextweek-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.nextweek-range {
  font-size: 12px;
  color: #6b7280;
}

.nextweek-list {
  margin-top: 10px;
  gap: 10px;
}

.nextweek-day {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.nextweek-day:first-child {
  border-top: 0;
  padding-top: 0;
}

.nextweek-dayhead {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.nextweek-daybody {
  margin-top: 6px;
  display: grid;
  gap: 8px;
}

.nextweek-destblock {
  display: grid;
  gap: 2px;
}

.nextweek-destline {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nextweek-speclist {
  padding-left: 12px;
  display: grid;
  gap: 2px;
}

.nextweek-specline {
  font-size: 12px;
  color: #111827;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 720px) {
  /* On desktop, place date and lines on one row for compact scanning */
  .nextweek-day {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
  }
  .nextweek-dayhead { padding-top: 2px; }
  .nextweek-daybody { margin-top: 0; }
  .nextweek-destblock {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .nextweek-speclist {
    padding-left: 0;
  }
}

/* Next week shipment summary (list-first layout) */
.nextweek-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.nextweek-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.nextweek-range {
  font-size: 12px;
  color: #6b7280;
}

.nextweek-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.nextweek-day {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.nextweek-day:first-child {
  border-top: 0;
}

.nextweek-date {
  font-weight: 700;
  white-space: nowrap;
  color: #111827;
}

.nextweek-items {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.nextweek-dest {
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nextweek-spec {
  margin-left: 1.2em;
  color: #111827;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 600px) {
  .nextweek-head {
    display: block;
  }
  .nextweek-range {
    margin-top: 4px;
  }
  .nextweek-day {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .nextweek-items {
    padding-left: 8px;
  }
}

/* Next week summary accordion */
.nextweek-details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.nextweek-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 14px 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.nextweek-summary::-webkit-details-marker { display: none; }

.nextweek-chevron {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.nextweek-details[open] .nextweek-chevron {
  transform: rotate(-135deg);
}

.nextweek-card {
  border: 0;
  border-radius: 0;
  padding: 0 16px 14px;
}

.nextweek-list { margin-top: 0; }


/* Weekend/holiday coloring in calendar */
.weekday-row .wk-sun { color: #dc2626; }
.weekday-row .wk-sat { color: #2563eb; }

.day-num.is-sun,
.day-num.is-holiday { color: #dc2626; }

.day-num.is-sat { color: #2563eb; }

/* Today badge stays black/white */
.day-num.is-today { color: #ffffff; }

/* Monthly shipment totals */
.monthly-shipment-card {
  background: #fff;
}

.monthly-shipment-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.monthly-shipment-head h2 {
  margin: 0;
}

.monthly-shipment-head .muted {
  flex: 0 0 auto;
  font-size: 12px;
}

.monthly-shipment-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.monthly-shipment-spec {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.monthly-shipment-spec:first-child {
  border-top: 0;
}

.monthly-shipment-spec-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
}

.monthly-shipment-spec-summary::-webkit-details-marker {
  display: none;
}

.monthly-shipment-spec-summary::marker {
  content: "";
}

.monthly-shipment-standard {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 700;
}

.monthly-shipment-quantity {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #111;
  font-size: 16px;
  text-align: right;
}

.monthly-shipment-toggle {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.monthly-shipment-toggle::after {
  display: inline-block;
  margin-left: 4px;
  content: "›";
  font-size: 16px;
  line-height: 1;
  transition: transform 140ms ease;
}

.monthly-shipment-spec[open] .monthly-shipment-toggle::after {
  transform: rotate(90deg);
}

.monthly-shipment-breakdown {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f7f8;
  list-style: none;
}

.monthly-shipment-breakdown li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
}

.monthly-shipment-breakdown li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.monthly-shipment-breakdown li strong {
  flex: 0 0 auto;
  max-width: 50%;
  overflow-wrap: anywhere;
  text-align: right;
}

.monthly-shipment-empty {
  margin: 0;
  font-size: 13px;
}

.customer-yearly-card {
  background: #fff;
  border: 1px solid rgba(31, 91, 58, 0.10);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(31, 91, 58, 0.07);
}

.customer-yearly-head h2 {
  margin: 0 0 8px;
}
.customer-yearly-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-yearly-back { flex: 0 0 auto; min-height: 32px; padding: 5px 10px; border: 1px solid var(--primary); border-radius: 8px; background: #fff; color: var(--primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }

.customer-yearly-controls {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

.customer-yearly-controls label {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
}
.customer-yearly-controls select { min-height: 38px; padding: 6px 9px; font-size: 13px; }

.customer-yearly-summary {
  display: block;
  min-width: 0;
  border-top: 1px solid var(--line);
}

.customer-yearly-comparison { min-width: 0; }
.customer-yearly-comparison-head {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(120px, 1.25fr) minmax(88px, .8fr) minmax(88px, .8fr);
  gap: 10px;
  align-items: start;
}
.customer-yearly-comparison-head { padding: 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.customer-yearly-comparison-head span:not(:first-child) { text-align: right; }
.customer-yearly-comparison-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) minmax(0, 2.85fr); width: 100%; padding: 10px 4px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.customer-yearly-comparison-row:hover { background: #f7faf7; }
.customer-yearly-destination { min-width: 0; padding-top: 2px; font-weight: 750; overflow-wrap: anywhere; }
.customer-yearly-comparison-metrics { display: grid; gap: 4px; min-width: 0; }
.customer-yearly-comparison-metric { display: grid; grid-template-columns: minmax(120px, 1.25fr) minmax(88px, .8fr) minmax(88px, .8fr); gap: 10px; min-width: 0; font-size: 12px; line-height: 1.45; }
.customer-yearly-comparison-metric > span { min-width: 0; text-align: right; white-space: nowrap; }
.customer-yearly-total { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.customer-yearly-comparison-metric .is-up { color: var(--primary); font-weight: 700; }
.customer-yearly-comparison-metric .is-down { color: #c63b3b; font-weight: 700; }
.customer-yearly-comparison-metric .is-neutral { color: var(--muted); }

.customer-yearly-month {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  min-width: 0;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.customer-yearly-month-label {
  padding: 3px 4px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-yearly-month-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.customer-yearly-month-content.is-empty { color: var(--muted); font-size: 12px; }
.customer-yearly-token { display: inline-flex; gap: 3px; white-space: nowrap; }
.customer-yearly-token:not(:last-child)::after { content: "・"; margin-left: 3px; color: #aab6af; }
.customer-yearly-token strong { font-weight: 750; }

.customer-yearly-delta {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.customer-yearly-empty {
  margin: 0;
}

@media (max-width: 600px) {
  .monthly-shipment-card {
    padding: 12px;
  }

  .monthly-shipment-head h2 {
    font-size: 17px;
  }

  .customer-yearly-card {
    padding: 12px;
  }

  .customer-yearly-head h2 {
    font-size: 17px;
  }

  .customer-yearly-controls {
    grid-template-columns: 1fr;
  }
  .customer-yearly-comparison-head { display: none; }
  .customer-yearly-comparison-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 10px 2px;
  }
  .customer-yearly-destination { font-size: 14px; }
  .customer-yearly-comparison-metrics { gap: 9px; }
  .customer-yearly-comparison-metric { grid-template-columns: minmax(0, 1fr); gap: 1px; padding: 7px 8px; border-radius: 8px; background: var(--surface-soft); }
  .customer-yearly-comparison-metric > span { text-align: left; }
  .customer-yearly-total { font-size: 13px; }
}

/* Compact iOS-style month card on phones. */
@media (max-width: 600px) {
  section[aria-label="カレンダー"] {
    padding: 10px 8px 12px;
    border-color: #e5e5ea;
    border-radius: 16px;
    background: #fff;
  }

  section[aria-label="カレンダー"] .calendar-head {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 4px;
  }

  section[aria-label="カレンダー"] .calendar-head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 32px;
    text-align: center;
    white-space: nowrap;
  }

  section[aria-label="カレンダー"] .calendar-head .btn {
    min-width: 0;
    height: 30px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 11px;
  }

  section[aria-label="カレンダー"] .weekday-row,
  section[aria-label="カレンダー"] .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
  }

  section[aria-label="カレンダー"] .weekday-row {
    margin: 5px 0 2px;
    font-size: 10px;
    line-height: 18px;
  }

  section[aria-label="カレンダー"] .calendar-grid {
    grid-auto-rows: 56px !important;
  }

  section[aria-label="カレンダー"] .day-cell {
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    padding: 28px 2px 2px;
    border-color: transparent;
    border-radius: 8px;
    background: #fff;
  }

  section[aria-label="カレンダー"] .day-cell.outside {
    background: #fff;
    opacity: 0.36;
  }

  section[aria-label="カレンダー"] .day-cell.today {
    border-color: transparent;
    background: #fff;
  }

  section[aria-label="カレンダー"] .day-cell.selected {
    box-shadow: none;
  }

  section[aria-label="カレンダー"] .day-num {
    top: 3px;
    left: 50%;
    display: inline-flex;
    width: 23px;
    height: 23px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    transform: translateX(-50%);
  }

  section[aria-label="カレンダー"] .day-cell.selected .day-num {
    box-shadow: inset 0 0 0 1.5px #111;
  }

  section[aria-label="カレンダー"] .day-cell.selected .day-num.is-today {
    box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px #111;
  }

  section[aria-label="カレンダー"] .entry-chip {
    display: block;
    height: 11px;
    margin: 0 0 1px;
    padding: 0 2px;
    border: 0;
    border-radius: 3px;
    font-size: 8px;
    line-height: 11px;
    text-align: left;
  }

  section[aria-label="カレンダー"] .entry-chip .tag {
    display: none;
  }

  section[aria-label="カレンダー"] .entry-chip.entry-chip--more {
    height: 9px;
    padding: 0 2px;
    font-size: 8px;
    line-height: 9px;
    text-align: center;
  }
}
/* 2026-07 dashboard refresh: visual-only overrides */
:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --text: #26322c;
  --muted: #748078;
  --line: #dfe6e1;
  --primary: #315f49;
  --primary-dark: #244b39;
  --primary-soft: #e3efe8;
  --card: var(--surface);
  --accent: var(--primary);
  --shipment: #397457;
  --event: #667f98;
  --memo: #8a6d4d;
}

html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: min(940px, calc(100% - 20px));
  margin: max(8px, env(safe-area-inset-top)) auto 8px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(49, 95, 73, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 18px rgba(36, 75, 57, 0.10);
  backdrop-filter: blur(14px);
}

.app-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.app-brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px 3px 10px 3px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  transform: rotate(-8deg);
}
.app-brand strong, .app-brand small { display: block; line-height: 1.15; }
.app-brand strong { font-size: 12px; color: var(--muted); font-weight: 650; }
.app-brand small { margin-top: 2px; color: var(--primary-dark); font-size: 16px; font-weight: 750; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.header-action,
.header-actions .admin-btn {
  min-width: auto;
  width: auto;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.header-action:hover, .header-actions .admin-btn:hover { background: var(--primary-soft); }
.settings-menu { position: relative; }
.settings-menu > summary { display: grid; place-items: center; list-style: none; }
.settings-menu > summary::-webkit-details-marker { display: none; }
.settings-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 150px;
  padding: 6px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(36, 75, 57, 0.16);
}
.settings-menu__panel .admin-btn { width: 100%; justify-content: flex-start; text-align: left; }

.container {
  max-width: 960px;
  padding: 4px 10px calc(24px + env(safe-area-inset-bottom));
  gap: 16px;
}
.container > .calendar-card { order: 1; }
.container > #selectedDayCard { order: 2; }
.container > .week-summary-group { order: 3; }
.container > .monthly-shipment-card { order: 4; }
.container > .customer-yearly-card { order: 5; }
.container > #entryCard { order: 6; }
.container > .sheet-backdrop, .container > .debug-bar { order: 10; }

.card {
  padding: 18px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: none;
}
.calendar-card {
  box-shadow: 0 8px 28px rgba(36, 75, 57, 0.09);
}
.week-summary-group { display: grid; gap: 14px; min-width: 0; }
.week-summary-group .card, .customer-yearly-card, #entryCard { background: var(--surface-soft); }
.subcard { border-color: var(--line); background: rgba(255,255,255,.72); }
h2 { color: var(--text); }

.btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--primary);
}
.text-btn { color: var(--primary); }
input, select, textarea { border-color: var(--line); color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); }

.calendar-head { grid-template-columns: 42px minmax(0, 1fr) 42px; margin-bottom: 12px; }
.calendar-head h2 { margin: 0; text-align: center; font-size: 20px; color: var(--primary-dark); }
.month-nav.btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 28px;
  line-height: 1;
}
.weekday-row, .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.weekday-row { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.calendar-grid { grid-auto-rows: 80px !important; }
.calendar-grid > .day-cell {
  height: 80px !important;
  min-height: 80px !important;
  max-height: 80px !important;
  padding: 5px 3px 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}
.calendar-grid > .day-cell:hover { background: #f7faf7; }
.day-cell.selected { border-color: #75a58b; background: var(--primary-soft); box-shadow: none; }
.calendar-card .day-cell.selected {
  border-color: #75a58b !important;
  background: var(--primary-soft) !important;
  box-shadow: none !important;
}
.calendar-card .day-cell.selected .day-num.is-today { box-shadow: none !important; }
.day-cell.outside { background: transparent; color: var(--muted); opacity: .38; }
.day-cell.today { border-color: transparent; }
.day-num { width: 25px; height: 25px; margin: 0 auto 3px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; }
.day-num.is-today { background: var(--primary); color: #fff !important; font-weight: 750; }
.calendar-grid .entry-chip {
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 3px;
  background: transparent;
  font-size: 9px;
  line-height: 1.35;
}
.calendar-grid .entry-chip.t-shipment { color: var(--shipment); background: #e8f2ec; }
.calendar-grid .entry-chip.t-event { color: var(--event); background: #edf1f5; }
.calendar-grid .entry-chip.t-memo { color: var(--memo); background: #f4eee7; }
.calendar-grid .entry-chip.entry-chip--more { color: var(--muted); text-align: right; font-weight: 700; }

#selectedDayCard { scroll-margin-top: 86px; }
.selected-day-head { gap: 10px; align-items: flex-start; }
.selected-day-head h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.selected-day-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.add-entry-btn { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }
#selectedDayList .entry-row {
  position: relative;
  padding: 12px 10px 12px 16px;
  border-top: 0;
  border-radius: 10px;
  background: #fafcfb;
  overflow: hidden;
}
#selectedDayList .entry-row + .entry-row { margin-top: 8px; }
#selectedDayList .entry-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--event); }
#selectedDayList .entry-type-shipment::before { background: var(--shipment); }
#selectedDayList .entry-type-memo::before { background: var(--memo); }
#selectedDayList .entry-row.has-unread-update { background: #f7faf8; }
#selectedDayList .entry-row.has-unread-update::before { width: 3px; background: var(--primary-dark); }
#selectedDayList .entry-row.has-unread-update .unread-indicator { margin-left: 1px; }
.unread-updated-by { color: #587064; font-size: 11px; }
#selectedDayList .shipment-destination { color: var(--text); font-size: 15px; font-weight: 750; }
#selectedDayList .shipment-specs { color: var(--muted); }
#selectedDayList .row-actions .btn, #selectedDayList .row-actions button { font-size: 12px; }
.list.is-empty li { padding: 18px 8px; color: var(--muted); text-align: center; }

.monthly-shipment-card {
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.monthly-shipment-card h2, .monthly-shipment-card .muted,
.monthly-shipment-standard, .monthly-shipment-quantity, .monthly-shipment-toggle { color: #fff; }
.monthly-shipment-spec { border-color: rgba(255,255,255,.18); }
.monthly-shipment-quantity { font-size: 24px; line-height: 1; }
.monthly-shipment-breakdown { background: rgba(255,255,255,.10); }

.customer-yearly-month { border-color: var(--line); }
.customer-yearly-month-preview { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-yearly-breakdown { background: var(--surface-soft); }

@media (min-width: 768px) {
  .week-summary-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 20px; }
}

@media (max-width: 600px) {
  .app-header { width: calc(100% - 16px); margin-bottom: 6px; border-radius: 14px; }
  .app-brand__mark { width: 28px; height: 28px; }
  .app-brand small { font-size: 15px; }
  .container { padding-inline: 8px; gap: 14px; }
  .card, .monthly-shipment-card, .customer-yearly-card { padding: 14px; border-radius: 16px; }
  .calendar-card { padding: 12px 6px 10px !important; }
  .calendar-head { padding: 0 6px; }
  .calendar-head h2 { font-size: 18px; }
  .calendar-grid { grid-auto-rows: 72px !important; }
  .calendar-grid > .day-cell { height: 72px !important; min-height: 72px !important; max-height: 72px !important; padding-inline: 2px; border-radius: 8px; }
  .day-num { width: 23px; height: 23px; margin-bottom: 2px; }
  .selected-day-head { display: flex; flex-wrap: wrap; }
  .selected-day-head h2 { flex: 1 1 220px; font-size: 16px; }
  .selected-day-actions { margin-left: auto; }
}

@media (max-width: 390px) {
  .app-header { padding-inline: 9px; }
  .app-brand strong { font-size: 10px; }
  .app-brand small { font-size: 14px; }
  .header-action, .header-actions .admin-btn { padding-inline: 7px; }
  .container { padding-inline: 6px; }
  .calendar-card { padding-inline: 4px !important; }
  .weekday-row, .calendar-grid { gap: 2px; }
  .calendar-grid { grid-auto-rows: 68px !important; }
  .calendar-grid > .day-cell { height: 68px !important; min-height: 68px !important; max-height: 68px !important; }
  .calendar-grid .entry-chip { padding-inline: 2px; font-size: 8px; }
}

/* Monthly schedule list view (all viewport sizes) */
.calendar-view-switch { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(260px, 100%); margin: 0 auto 12px; padding: 3px; border-radius: 10px; background: #edf3ee; }
.calendar-view-btn { min-height: 34px; border: 0; border-radius: 8px; background: transparent; color: #526158; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.calendar-view-btn.is-active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(23,107,67,.2); }
.monthly-schedule-view { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.schedule-drag-hint { padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f8fbf9; color: var(--muted); font-size: 11px; line-height: 1.45; }
.monthly-schedule-row { display: grid; grid-template-columns: 48px 42px minmax(0, 1fr); width: 100%; min-height: 43px; padding: 6px 8px; align-items: start; gap: 0; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; font: inherit; }
.monthly-schedule-row[data-date] { cursor: pointer; transition: background-color 120ms ease, box-shadow 120ms ease; }
.monthly-schedule-row[data-date]:hover { background: #f7faf7; }
.monthly-schedule-row[data-date]:focus-visible { outline: 2px solid rgba(23, 107, 67, .36); outline-offset: -2px; }
.monthly-schedule-row:last-child { border-bottom: 0; }
.monthly-schedule-header { min-height: 32px; padding-block: 6px; background: #f2f6f2; color: var(--muted); font-size: 12px; font-weight: 700; }
.monthly-schedule-day, .monthly-schedule-weekday { padding-top: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.monthly-schedule-weekday.is-sun { color: #d84a4a; }
.monthly-schedule-weekday.is-sat { color: #2876c9; }
.monthly-schedule-row.is-today { background: #f0f8f2; }
.monthly-schedule-row.is-selected { box-shadow: inset 3px 0 0 var(--primary); background: #e8f2ec; }
.monthly-schedule-items { display: grid; min-width: 0; gap: 5px; }
.monthly-schedule-item { display: flex; min-width: 0; align-items: flex-start; gap: 6px; line-height: 1.4; }
.monthly-schedule-item.is-shipment-movable { align-items: center; padding: 4px 3px 4px 6px; border: 1px solid transparent; border-radius: 8px; background: #f8fbf9; cursor: grab; transition: opacity 120ms ease, box-shadow 120ms ease, transform 120ms ease; }
.monthly-schedule-item.is-shipment-movable:active { cursor: grabbing; }
.monthly-schedule-item.is-dragging { z-index: 2; opacity: .48; box-shadow: 0 8px 18px rgba(36, 75, 57, .18); transform: scale(.99); }
.monthly-schedule-item.is-long-press-active { opacity: .62; }
.monthly-schedule-tag { flex: 0 0 auto; margin-top: 1px; padding: 1px 5px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.monthly-schedule-tag.t-shipment { background: #e1f0e6; color: #176b43; }
.monthly-schedule-tag.t-event { background: #e7effb; color: #2869ad; }
.monthly-schedule-tag.t-memo { background: #fff0db; color: #b76b10; }
.monthly-schedule-detail { min-width: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; }
.monthly-schedule-item.has-unread-update { border-left: 3px solid var(--primary-dark); padding-left: 6px; }
.monthly-schedule-item .unread-indicator { margin-left: auto; }
.schedule-drag-handle { flex: 0 0 42px; align-self: stretch; min-width: 42px; min-height: 42px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #52705e; font: inherit; font-size: 15px; font-weight: 800; letter-spacing: -3px; line-height: 1; cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.schedule-drag-handle:hover, .schedule-drag-handle:focus-visible, .schedule-drag-handle.is-active { background: var(--primary-soft); color: var(--primary-dark); }
.schedule-drag-handle:focus-visible { outline: 2px solid rgba(23, 107, 67, .35); outline-offset: 1px; }
.schedule-drag-ghost { position: fixed; inset: 0 auto auto 0; z-index: 1000; max-width: calc(100vw - 16px); margin: 0; opacity: .96; pointer-events: none; box-shadow: 0 12px 28px rgba(28, 64, 46, .28); transform-origin: top left; transition: none !important; will-change: transform; }
.is-schedule-dragging { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.is-schedule-dragging .monthly-schedule-row.is-drop-zone { background: #f1f8f3; box-shadow: inset 0 0 0 1px rgba(23, 107, 67, .18); }
.is-schedule-dragging .monthly-schedule-row.is-drop-target { background: #dff0e4; box-shadow: inset 0 0 0 2px var(--primary); }
.monthly-schedule-item.is-reschedule-saving { opacity: .68; cursor: progress; }
.monthly-schedule-item.is-reschedule-saving .schedule-drag-handle { cursor: progress; opacity: .55; }
.monthly-schedule-row.is-reschedule-saving-target { background: #f1f8f3; box-shadow: inset 0 0 0 1px rgba(23, 107, 67, .2); }
.schedule-reschedule-loading { display: inline-flex; width: fit-content; max-width: 100%; min-height: 32px; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid #c9ddcf; border-radius: 999px; background: #f5faf6; color: var(--primary-dark); font-size: 12px; font-weight: 700; line-height: 1.35; cursor: progress; }
.schedule-reschedule-loading.is-floating { position: fixed; z-index: 1500; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); box-shadow: 0 8px 22px rgba(36, 75, 57, .18); }
.schedule-reschedule-spinner { flex: 0 0 18px; width: 18px; height: 18px; border: 2px solid #c8ddd0; border-top-color: var(--primary-dark); border-radius: 50%; animation: schedule-reschedule-spin .9s linear infinite; }
@keyframes schedule-reschedule-spin { to { transform: rotate(360deg); } }
.monthly-schedule-row.is-move-saved { animation: schedule-move-saved 1.2s ease; }
@keyframes schedule-move-saved {
  0% { background: #d9eddf; box-shadow: inset 3px 0 0 var(--primary); }
  100% { background: #e8f2ec; box-shadow: inset 3px 0 0 var(--primary); }
}
@media (max-width: 767px) {
  .monthly-schedule-row { grid-template-columns: 44px 40px minmax(0, 1fr); padding-inline: 6px; }
  .monthly-schedule-detail { font-size: 13px; }
  .monthly-schedule-item.is-shipment-movable { padding-left: 5px; }
  .schedule-drag-handle { flex-basis: 42px; min-width: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .monthly-schedule-row[data-date], .monthly-schedule-item.is-shipment-movable { transition: none; }
  .monthly-schedule-row.is-move-saved { animation: none; }
  .schedule-reschedule-spinner { animation: none; border-color: var(--primary-dark); border-right-color: transparent; }
}

/* Unified weekly shipment schedule */
.container > .weekly-schedule-card { order: 3; }
.weekly-schedule-card {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(36, 75, 57, 0.07);
}
.weekly-schedule-head h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.weekly-segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-soft);
}
.weekly-segment {
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.weekly-segment.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(36, 75, 57, 0.18);
}
.weekly-segment:focus-visible { outline: 3px solid rgba(49, 95, 73, 0.24); outline-offset: 2px; }
.weekly-panel { min-width: 0; animation: weekly-panel-in 160ms ease-out; }
.weekly-range { margin: 10px 2px 2px; font-size: 12px; text-align: right; }
.weekly-schedule-card .nextweek-card { padding: 0; background: transparent; }
.weekly-schedule-card .nextweek-list { display: block; margin: 0; }
.weekly-schedule-card .nextweek-day {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 2px;
  border-top: 1px solid var(--line);
}
.weekly-schedule-card .nextweek-day:first-child { border-top: 0; }
.weekly-schedule-card .nextweek-date {
  display: grid;
  grid-template-columns: auto 24px;
  gap: 4px;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.weekly-weekday {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}
.weekly-schedule-card .nextweek-items { display: grid; gap: 9px; min-width: 0; padding: 0; }
.weekly-schedule-card .nextweek-destblock {
  display: grid;
  grid-template-columns: minmax(78px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.weekly-schedule-card .nextweek-destblock.has-unread-update { padding-left: 7px; border-left: 3px solid var(--primary-dark); }
.weekly-schedule-card .nextweek-dest {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.weekly-destination-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.weekly-schedule-card .nextweek-speclist { min-width: 0; padding: 0; }
.weekly-schedule-card .nextweek-spec {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.weekly-schedule-card .nextweek-list > .muted { padding: 18px 2px 8px; font-size: 13px; text-align: center; }

@keyframes weekly-panel-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .weekly-schedule-card { padding: 14px; }
  .weekly-schedule-card .nextweek-day { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
  .weekly-schedule-card .nextweek-destblock { grid-template-columns: minmax(72px, 0.75fr) minmax(0, 1.25fr); gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .weekly-segment { transition: none; }
  .weekly-panel { animation: none; }
}

/* Collapsible entry form and segmented controls */
#entryCard { scroll-margin-top: 84px; }
.entry-card.is-collapsed {
  padding: 0;
  background: transparent;
}
.entry-launcher-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  box-shadow: none;
  font-size: 15px;
  font-weight: 750;
}
.entry-panel { min-width: 0; animation: entry-panel-in 180ms ease-out; }
.entry-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.entry-panel-head h2 { margin: 0; font-size: 19px; }
.entry-close-btn {
  min-width: 54px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.entry-control-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.segment-field { position: relative; display: grid; gap: 5px; min-width: 0; }
.entry-type-field, .shipment-kind-field { grid-column: 1 / -1; }
.segment-field-label { color: var(--text); font-size: 12px; font-weight: 650; }
.entry-segments {
  display: grid;
  width: 100%;
  padding: 3px;
  border-radius: 11px;
  background: #e7ece8;
}
.entry-segments--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.entry-segments--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.entry-segment {
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.entry-segment.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(36, 75, 57, 0.18);
}
.entry-segment:focus-visible { outline: 3px solid rgba(49, 95, 73, 0.25); outline-offset: 2px; }
.segment-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.entry-advanced-details {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.entry-advanced-details > summary {
  min-height: 44px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.entry-advanced-details > summary::-webkit-details-marker { display: none; }
.entry-advanced-details > summary::after { content: "＋"; color: var(--primary); font-size: 16px; }
.entry-advanced-details[open] > summary::after { content: "−"; }
.entry-advanced-body { padding: 0 12px 12px; }
.entry-advanced-body .subcard { margin-top: 8px; }
.recurring-rule-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #f8fbf9;
}
.recurring-rule-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recurring-rule-title { color: var(--primary-dark); font-size: 15px; font-weight: 800; }
.recurrence-family-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.recurrence-family-btn,
.recurrence-option-btn {
  min-width: 0;
  min-height: 48px;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  cursor: pointer;
}
.recurrence-family-btn.is-active,
.recurrence-option-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.recurrence-family-btn:focus-visible,
.recurrence-option-btn:focus-visible { outline: 3px solid rgba(49, 95, 73, 0.24); outline-offset: 2px; }
.recurrence-detail-field { display: grid; gap: 6px; }
.recurrence-option-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.recurrence-option-buttons--stack { grid-template-columns: 1fr; }
.recurrence-option-buttons--stack .recurrence-option-btn { display: grid; gap: 3px; justify-items: start; text-align: left; }
.recurrence-option-btn small { color: var(--muted); font-size: 11px; font-weight: 550; }
.recurrence-option-btn.is-active small { color: var(--primary-dark); }
.recurring-rule-card .weekday-picker,
.recurring-rule-card #monthDayPicker,
.recurring-rule-card #referenceRuleFields { margin: 0; }
.recurring-rule-card .weekday-buttons { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.recurring-rule-card .weekday-btn { min-width: 0; padding: 8px 3px; }
.input-with-suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.input-with-suffix > span { color: var(--muted); font-weight: 700; }
.recurrence-preview {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-left: 4px solid var(--primary);
  border-radius: 4px 10px 10px 4px;
  background: #fff;
}
.recurrence-preview-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.recurrence-preview strong { color: var(--primary-dark); font-size: 14px; line-height: 1.55; }
.recurrence-next-dates { line-height: 1.55; }
.recurrence-extra-details {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.recurrence-extra-details > summary {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.recurrence-extra-details[open] > summary { margin-bottom: 9px; }
.recurrence-period-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
#recurringOverrideFields { border-left: 4px solid var(--primary); background: #f8fbf9; }
.choice-action--danger { color: #a93434; border-color: rgba(169, 52, 52, 0.28); }
.entry-spec2-details .spec2-toggle { margin-top: 4px; }
.entry-panel .actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 16px -4px -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(238, 244, 239, 0), var(--surface-soft) 14px);
}
.entry-panel .actions .btn { min-height: 48px; }

@keyframes entry-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
  .entry-panel { max-width: 760px; margin: 0 auto; }
}

@media (max-width: 600px) {
  .entry-card:not(.is-collapsed) { padding: 14px; }
  .entry-control-row { grid-template-columns: 1fr; }
  .entry-panel .actions { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .recurrence-period-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .entry-panel { animation: none; }
  .entry-segment { transition: none; }
}

/* Reference dashboard alignment */
:root {
  --primary: #176b43;
  --primary-dark: #0f5132;
  --primary-soft: #e6f1ea;
  --event: #2563eb;
  --memo: #f59e0b;
}

body { background: #f5f7f4; }
.container {
  width: 100%;
  max-width: 980px;
  padding: 12px 14px 32px;
  display: grid;
  gap: 18px;
}
.dashboard-left,
.dashboard-right {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}
.dashboard-compact-card { display: none; }

.card,
.app-header {
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 91, 58, 0.08);
}

.app-header {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
}
.app-brand { gap: 12px; }
.app-brand__logo {
  display: block;
  width: min(210px, 46vw);
  height: auto;
  flex: 0 1 auto;
  object-fit: contain;
}
.app-brand__product {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.header-actions { gap: 8px; }
.header-action,
.header-actions .admin-btn {
  width: 58px;
  height: 58px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 11px;
}
.header-action__icon { font-size: 25px; line-height: 1; }
.settings-menu__panel .admin-btn { height: 40px; display: block; font-size: 13px; }

.shipment-terms-sheet { max-height: 90vh; }
.terms-customer-picker { display: grid; gap: 4px; font-size: 13px; }
.settlement-settings { display: grid; gap: 7px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbf9; }
.settlement-settings__heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settlement-settings__heading h4 { margin: 0; color: var(--primary-dark); font-size: 14px; }
.settlement-settings__heading p { margin: 2px 0 0; font-size: 11px; }
.settlement-settings__heading .btn { flex: 0 0 auto; min-height: 36px; padding-inline: 10px; font-size: 12px; }
.settlement-settings select { width: 100%; min-height: 40px; }
.settlement-type-description { min-height: 2.8em; margin: 0; font-size: 12px; line-height: 1.5; }
.terms-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 6px; }
.terms-list-head h4 { margin: 0; font-size: 14px; }
.terms-list-head .btn { flex: 0 0 auto; min-height: 40px; }
.terms-list { border-top: 1px solid var(--line); }
.terms-list li.shipment-term-item { align-items: flex-start; padding: 12px 0; }
.shipment-term-item__content { min-width: 0; display: grid; gap: 4px; }
.shipment-term-item__details { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.terms-form { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbf9; }
.terms-form-title { color: var(--primary-dark); font-size: 15px; font-weight: 800; }
.terms-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

@media (max-width: 600px) {
  .settlement-settings__heading { align-items: stretch; flex-direction: column; }
  .settlement-settings__heading .btn { width: 100%; }
  .terms-list-head { align-items: stretch; flex-direction: column; }
  .terms-list-head .btn { width: 100%; }
  .terms-form-grid { grid-template-columns: 1fr; }
}

.calendar-card { padding: 20px 22px 18px !important; }
.calendar-head {
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: start;
  margin-bottom: 12px;
}
.calendar-title-group { display: grid; justify-items: center; gap: 6px; }
.calendar-head h2 { font-size: 25px; line-height: 1.2; color: #111827; }
.month-nav.btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: #111827;
  font-size: 34px;
  box-shadow: 0 3px 10px rgba(38, 50, 44, 0.06);
}
.current-month-btn {
  min-height: 30px;
  padding: 4px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.weekday-row { padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: 13px; }
.calendar-card .calendar-grid { gap: 4px; grid-auto-rows: 68px !important; }
section.calendar-card .calendar-grid > .day-cell {
  height: 68px !important;
  min-height: 68px !important;
  max-height: 68px !important;
  padding: 7px 2px 4px !important;
  border: 1px solid transparent !important;
  border-radius: 10px;
  background: transparent !important;
}
section.calendar-card .calendar-grid > .day-cell.selected {
  border-color: #75a58b !important;
  background: #f0f7f3 !important;
}
.calendar-card .day-num { width: 34px; height: 34px; margin-bottom: 3px; font-size: 14px; }
.calendar-card .day-num.is-today { background: var(--primary); box-shadow: 0 5px 14px rgba(23, 107, 67, 0.24) !important; }
.day-markers {
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}
.day-marker { width: 7px; height: 4px; border-radius: 999px; flex: 0 0 auto; }
.day-marker--shipment { background: var(--primary); }
.day-marker--event { background: var(--event); }
.day-marker--memo { background: var(--memo); }
.day-marker-more { color: var(--text); font-size: 9px; font-weight: 750; line-height: 1; }
.calendar-legend {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 9vw, 54px);
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
}
.calendar-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot--shipment { background: var(--primary); }
.legend-dot--event { background: var(--event); }
.legend-dot--memo { background: var(--memo); }

#selectedDayCard { padding: 18px 20px; }
.selected-day-head { align-items: center; margin-bottom: 8px; }
.selected-day-head h2 { font-size: 20px; }
.add-entry-btn {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #70a88a;
  border-radius: 9px;
  background: #fff;
}
#selectedDayList { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
#selectedDayList .entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0;
  padding: 11px 12px 11px 18px;
  border-radius: 0;
  border-top: 1px solid var(--line);
  background: #fff;
}
#selectedDayList .entry-row:first-child { border-top: 0; }
#selectedDayList .entry-row::before { width: 4px; }
#selectedDayList .row-actions { align-self: center; opacity: .68; }
#selectedDayList .row-actions .text-btn { padding: 4px; font-size: 11px; }
#selectedDayList .pill { background: transparent; color: var(--text); font-weight: 750; }
#selectedDayList .pill::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--event); }
#selectedDayList .pill--shipment::before { background: var(--primary); }
#selectedDayList .pill--memo::before { background: var(--memo); }
.selected-day-footer {
  min-height: 34px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.selected-day-updated { font-size: 11px; text-align: right; }
.weekly-schedule-card { padding: 18px 20px; }
.weekly-schedule-head h2 { font-size: 19px; }
.weekly-segments { background: #f1f3f2; }
.weekly-schedule-card .nextweek-day { padding: 11px 2px; }
.weekly-schedule-card .weekly-range { font-size: 11px; }

.monthly-shipment-card {
  position: relative;
  overflow: hidden;
  padding: 20px !important;
  background: linear-gradient(135deg, #176b43, #0f5132 75%);
  box-shadow: 0 12px 30px rgba(15, 81, 50, .18);
}
.monthly-shipment-card::after {
  content: "";
  position: absolute;
  right: -35px;
  bottom: -45px;
  width: 190px;
  height: 190px;
  border-radius: 65% 35% 65% 35%;
  background: rgba(255,255,255,.06);
  transform: rotate(-25deg);
  pointer-events: none;
}
.monthly-shipment-head { position: relative; z-index: 1; margin-bottom: 14px; }
.monthly-shipment-head h2 { font-size: 19px; }
.monthly-shipment-summary {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.monthly-shipment-spec {
  padding: 2px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
}
.monthly-shipment-spec:first-child { border: 0; }
.monthly-shipment-spec-summary { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 10px 0; }
.monthly-shipment-standard { font-size: 13px; }
.monthly-shipment-quantity { font-size: clamp(20px, 4vw, 28px); text-align: left; }
.monthly-shipment-toggle { display: none; }
.monthly-shipment-breakdown { background: rgba(255,255,255,.12); }

.customer-yearly-card { padding: 18px 20px; background: #fff; }
.customer-yearly-head h2 { font-size: 19px; }
.customer-yearly-controls { grid-template-columns: minmax(100px, .7fr) minmax(150px, 1.3fr); }
.customer-yearly-month { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.customer-yearly-month-summary { padding: 10px 4px; }

.entry-card:not(.is-collapsed) { background: #fff; box-shadow: 0 10px 30px rgba(31, 91, 58, .08); }
.entry-launcher-btn { background: var(--primary); }
.entry-panel-head h2 { font-size: 20px; }
.entry-close-btn { min-width: 44px; width: 44px; padding: 0; border: 0; font-size: 27px; }
.entry-type-field { order: 1; }
#spotDateRow, #eventDateRow, #eventTimeRow, #memoDateRow, #memoPriorityRow { order: 2; }
.shipment-kind-field { order: 3; }
.entry-panel .form input,
.entry-panel .form select { min-height: 46px; }
.entry-panel .form-spec-row { grid-template-columns: minmax(100px, 1fr) minmax(80px, 1.2fr) minmax(66px, .55fr); }
.entry-panel .actions { background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 14px); }

@media (min-width: 1100px) {
  .container {
    width: min(1440px, calc(100% - 32px));
    max-width: none;
    margin: 0 auto;
    padding: 16px 0 34px;
    grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr);
    gap: 18px;
    align-items: start;
  }
  .dashboard-left { grid-column: 1; }
  .dashboard-right { grid-column: 2; }
  .dashboard-compact-card { display: block; }
  .dashboard-right #entryCard { order: 1; }
  .dashboard-right .compact-monthly-card { order: 2; }
  .app-header { position: sticky; top: 12px; z-index: 40; }
  .calendar-card .calendar-grid { grid-auto-rows: 74px !important; }
  section.calendar-card .calendar-grid > .day-cell { height: 74px !important; min-height: 74px !important; max-height: 74px !important; }
  .dashboard-compact-card { padding: 17px; }
  .compact-card-head { display: grid; justify-items: center; gap: 5px; margin-bottom: 10px; text-align: center; }
  .compact-card-head h2 { margin: 0; font-size: 17px; }
  .compact-card-head .muted { font-size: 11px; }
  .compact-summary-body .monthly-shipment-summary,
  .compact-summary-body { display: grid; gap: 6px; }
  .compact-summary-body .monthly-shipment-spec,
  .compact-summary-body .customer-yearly-month {
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
  }
  .compact-summary-body .monthly-shipment-spec-summary { grid-template-columns: minmax(0,1fr) auto; padding: 9px 2px; }
  .compact-summary-body .monthly-shipment-standard,
  .compact-summary-body .monthly-shipment-quantity { color: var(--text); font-size: 13px; }
  .compact-summary-body .monthly-shipment-quantity { text-align: right; }
  .compact-summary-body .monthly-shipment-toggle { display: none; }
  .compact-summary-body .customer-yearly-month-summary { padding: 8px 2px; }
  .compact-summary-body .customer-yearly-month-preview { font-size: 11px; }
}

@media (max-width: 1099px) {
  .dashboard-compact-card { display: none; }
  .dashboard-right #entryCard { order: 1; }
}

@media (max-width: 767px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .container { padding: max(8px, env(safe-area-inset-top)) 8px 24px; gap: 14px; }
  .dashboard-left, .dashboard-right { gap: 14px; }
  .app-header { position: sticky; top: max(6px, env(safe-area-inset-top)); padding: 9px 10px; border-radius: 15px; }
  .app-brand__logo { width: min(158px, 43vw); }
  .app-brand__product { display: none; }
  .header-actions { gap: 5px; }
  .header-action, .header-actions .admin-btn { width: 44px; height: 44px; border-radius: 10px; font-size: 9px; }
  .header-action__icon { font-size: 19px; }
  .calendar-card { padding: 14px 8px 12px !important; }
  .calendar-head { grid-template-columns: 40px minmax(0,1fr) 40px; }
  .calendar-head h2 { font-size: 20px; }
  .month-nav.btn { width: 40px; height: 40px; font-size: 28px; }
  .current-month-btn { min-height: 28px; padding: 3px 10px; font-size: 11px; }
  .weekday-row { font-size: 11px; }
  .calendar-card .calendar-grid { grid-auto-rows: 58px !important; }
  section.calendar-card .calendar-grid > .day-cell { height: 58px !important; min-height: 58px !important; max-height: 58px !important; padding-top: 4px !important; }
.calendar-card .day-num { width: 29px; height: 29px; font-size: 12px; }

/* Monthly schedule list view */
.calendar-view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(260px, 100%);
  margin: 0 auto 12px;
  padding: 3px;
  border-radius: 10px;
  background: #edf3ee;
}
.calendar-view-btn {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #526158;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.calendar-view-btn.is-active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(23,107,67,.2); }
.monthly-schedule-view { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.monthly-schedule-row {
  display: grid;
  grid-template-columns: 48px 42px minmax(0, 1fr);
  width: 100%;
  min-height: 43px;
  padding: 6px 8px;
  align-items: start;
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
}
button.monthly-schedule-row { cursor: pointer; }
button.monthly-schedule-row:hover { background: #f7faf7; }
.monthly-schedule-row:last-child { border-bottom: 0; }
.monthly-schedule-header { min-height: 32px; padding-block: 6px; background: #f2f6f2; color: var(--muted); font-size: 12px; font-weight: 700; }
.monthly-schedule-day, .monthly-schedule-weekday { padding-top: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.monthly-schedule-weekday.is-sun { color: #d84a4a; }
.monthly-schedule-weekday.is-sat { color: #2876c9; }
.monthly-schedule-row.is-today { background: #f0f8f2; }
.monthly-schedule-row.is-selected { box-shadow: inset 3px 0 0 var(--primary); background: #e8f2ec; }
.monthly-schedule-items { display: grid; min-width: 0; gap: 5px; }
.monthly-schedule-item { display: flex; min-width: 0; align-items: flex-start; gap: 6px; line-height: 1.4; }
.monthly-schedule-tag { flex: 0 0 auto; margin-top: 1px; padding: 1px 5px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.monthly-schedule-tag.t-shipment { background: #e1f0e6; color: #176b43; }
.monthly-schedule-tag.t-event { background: #e7effb; color: #2869ad; }
.monthly-schedule-tag.t-memo { background: #fff0db; color: #b76b10; }
.monthly-schedule-detail { min-width: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; }
.monthly-schedule-item .unread-indicator { flex: 0 0 7px; margin-left: auto; }
  .calendar-legend { gap: 24px; padding-top: 9px; }
  #selectedDayCard, .weekly-schedule-card, .customer-yearly-card { padding: 14px; }
  .selected-day-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
  .selected-day-head h2 { min-width: 0; font-size: 15px; white-space: nowrap; }
  .selected-day-actions { margin: 0; }
  .add-entry-btn { min-height: 36px; padding: 6px 9px; font-size: 11px; }
  #selectedDayList .entry-row { padding-right: 8px; }
  #selectedDayList .row-actions { display: grid; gap: 1px; }
  .monthly-shipment-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .monthly-shipment-spec { padding: 2px 8px; }
  .monthly-shipment-quantity { font-size: 19px; }
  .entry-panel .form-spec-row { grid-template-columns: minmax(90px, 1fr) minmax(70px, 1fr) minmax(60px, .65fr); gap: 6px; }
}

@media (max-width: 390px) {
  .app-brand__logo { width: 142px; }
  .calendar-card .calendar-grid { grid-auto-rows: 55px !important; }
  section.calendar-card .calendar-grid > .day-cell { height: 55px !important; min-height: 55px !important; max-height: 55px !important; }
  .day-marker { width: 6px; }
  .calendar-legend { gap: 18px; }
}

/* Save destination and sync-state clarity */
.header-actions .sync-state-control {
  width: auto;
  min-width: 92px;
  padding: 6px 10px;
  flex-direction: row;
  gap: 6px;
  white-space: nowrap;
}
.sync-state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #d19a18;
  box-shadow: 0 0 0 3px rgba(209, 154, 24, 0.13);
}
.sync-state-control[data-sync-state="configured"] .sync-state-dot {
  background: #557064;
  box-shadow: 0 0 0 3px rgba(85, 112, 100, 0.13);
}
.sync-state-control[data-sync-state="cloud"] .sync-state-dot {
  background: #238653;
  box-shadow: 0 0 0 3px rgba(35, 134, 83, 0.13);
}
.sync-state-control[data-sync-state="error"] .sync-state-dot {
  background: #c2413a;
  box-shadow: 0 0 0 3px rgba(194, 65, 58, 0.13);
}
.storage-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #f2cd7d;
  border-radius: 11px;
  background: #fff9e9;
  color: #7a4b00;
  font-size: 12px;
  line-height: 1.4;
}
.storage-notice .text-btn {
  flex: 0 0 auto;
  color: #7a4b00;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .header-actions .sync-state-control {
    width: auto;
    min-width: 78px;
    height: 44px;
    padding-inline: 7px;
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .header-actions .sync-state-control {
    min-width: 72px;
    padding-inline: 6px;
    gap: 5px;
    font-size: 9px;
  }
  .storage-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

.sales-dashboard {
  order: 6;
  border: 1px solid #d7e4d9;
  background: #fbfefb;
}
.sales-dashboard-head,
.sales-dashboard-controls,
.admin-auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sales-dashboard-head { justify-content: space-between; }
.sales-dashboard-head h2 { margin: 0 0 3px; }
.admin-mode-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e3f1e5;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
}
.sales-dashboard-controls { flex-wrap: wrap; margin: 14px 0; }
.sales-dashboard-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.sales-dashboard-controls select { min-height: 36px; padding: 5px 8px; font: inherit; color: var(--text); }
.sales-settlement-status { margin: -5px 0 10px; font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.sales-settlement-status.is-settled { color: var(--primary); }
.sales-settlement-status.is-unsettled { color: #a33c35; }
.sales-mode-switch,
.sales-view-tabs { display: flex; gap: 4px; }
.sales-mode-btn,
.sales-view-btn {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.sales-mode-btn.is-active,
.sales-view-btn.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.sales-summary-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.sales-summary-card { min-width: 0; padding: 11px; border-radius: 10px; background: #edf6ee; }
.sales-summary-card span { display: block; color: var(--muted); font-size: 11px; }
.sales-summary-card strong { display: block; margin-top: 5px; color: var(--text); font-size: 16px; overflow-wrap: anywhere; }
.sales-view-tabs { margin-top: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.sales-breakdown { min-height: 42px; padding: 8px 0; }
.sales-breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.sales-breakdown-row span { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.sales-breakdown-row small { color: var(--muted); }
.sales-breakdown-row strong { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.sales-breakdown-note { margin: 8px 0; }
.sales-subtitle { margin: 14px 0 6px; font-size: 13px; }
.sales-trend { display: grid; gap: 5px; }
.sales-trend-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 7px; align-items: center; font-size: 11px; }
.sales-trend-row i { display: block; width: var(--sales-bar); min-width: 2px; height: 8px; border-radius: 999px; background: var(--primary); }
.sales-trend-row strong { min-width: 78px; text-align: right; font-size: 11px; }
.sales-trend-note { margin: 5px 0 0; font-size: 11px; overflow-wrap: anywhere; }
.sales-actual-list { display: grid; gap: 7px; }
.sales-actual-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.sales-actual-row > div:first-child { min-width: 0; }
.sales-actual-row strong,
.sales-actual-row small { display: block; overflow-wrap: anywhere; }
.sales-actual-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sales-actual-amounts { flex: 0 0 auto; max-width: 48%; text-align: right; font-size: 11px; overflow-wrap: anywhere; }
.sales-actual-amounts strong { margin-top: 3px; color: var(--primary); }
.sales-empty { margin: 9px 0; }
.admin-auth-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-auth-box > label { display: grid; gap: 5px; }
.admin-auth-actions { flex-wrap: wrap; margin-top: 8px; }
.admin-auth-status { color: var(--muted); font-size: 11px; }
.admin-auth-status.is-connected { color: var(--primary); font-weight: 750; }
.admin-auth-status.is-error { color: #bd3e3e; font-weight: 700; }

@media (max-width: 600px) {
  .sales-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-dashboard-controls { align-items: stretch; }
  .sales-mode-switch { width: 100%; }
  .sales-mode-btn { flex: 1; }
  .sales-dashboard-controls label { flex: 1; min-width: 92px; }
  .sales-actual-row { display: grid; gap: 6px; }
  .sales-actual-amounts { display: flex; justify-content: space-between; gap: 8px; max-width: none; text-align: left; }
}

@media (min-width: 768px) {
  .container > .sales-dashboard { order: 6; }
}

.monthly-settlement-dashboard {
  order: 7;
  border: 1px solid #d7e4d9;
  background: #fbfefb;
}
.monthly-settlement-head h2 { margin: 0; }
.monthly-settlement-head p { margin: 4px 0 0; font-size: 12px; }
.monthly-settlement-controls { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(100px, .6fr) minmax(180px, 1.7fr); gap: 8px; margin: 14px 0 8px; }
.monthly-settlement-controls label,
.monthly-settlement-money-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.monthly-settlement-controls select,
.monthly-settlement-money-grid input { min-height: 38px; min-width: 0; padding: 6px 8px; font: inherit; color: var(--text); }
.monthly-settlement-status { margin: 8px 0; font-size: 12px; }
.monthly-settlement-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbf9; }
.monthly-settlement-summary-line { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.monthly-settlement-summary-line > div { display: grid; gap: 3px; min-width: 0; }
.monthly-settlement-summary-line strong { overflow-wrap: anywhere; }
.monthly-settlement-hint { margin: 10px 0; padding: 9px; border-radius: 8px; background: #edf6ee; color: var(--primary-dark); font-size: 12px; }
.monthly-settlement-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 8px; }
.monthly-settlement-section-head h3 { margin: 0; font-size: 14px; }
.monthly-settlement-section-head p { margin: 3px 0 0; font-size: 11px; }
.monthly-settlement-items { display: grid; gap: 8px; }
.monthly-settlement-item-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(70px, .7fr) minmax(90px, .9fr) minmax(100px, .9fr) minmax(105px, 1fr) auto; gap: 6px; align-items: center; }
.monthly-settlement-item-row input { min-width: 0; min-height: 38px; padding: 6px 7px; font: inherit; }
.monthly-settlement-shipped-reference { min-width: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.monthly-settlement-remove-item { padding: 4px; font-size: 11px; }
.monthly-settlement-money-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.monthly-settlement-money-grid input[readonly] { background: #edf2ee; color: var(--muted); }
.monthly-settlement-net { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 11px 12px; border-radius: 9px; background: #e3f1e5; color: var(--primary-dark); }
.monthly-settlement-net strong { font-size: 20px; }
.monthly-settlement-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 600px) {
  .monthly-settlement-controls { grid-template-columns: 1fr 1fr; }
  .monthly-settlement-customer-field { grid-column: 1 / -1; }
  .monthly-settlement-summary-line { align-items: flex-start; flex-direction: column; }
  .monthly-settlement-section-head { align-items: stretch; flex-direction: column; }
  .monthly-settlement-section-head .btn { width: 100%; }
  .monthly-settlement-item-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr); }
  .monthly-settlement-shipped-reference { grid-column: 1 / -1; }
  .monthly-settlement-item-row .monthly-settlement-sold-quantity,
  .monthly-settlement-item-row .monthly-settlement-sales-amount { grid-row: 3; }
  .monthly-settlement-item-row .monthly-settlement-remove-item { grid-row: 4; grid-column: 1 / -1; justify-self: end; }
  .monthly-settlement-money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monthly-settlement-actions { display: grid; grid-template-columns: 1fr; }
}

