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

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

:root {
  --teal-header: #0a5c5c;
  --teal-dark: #084f4f;
  --teal-done: #0d7373;
  --bg-page: #eef2f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #d1d5db;
  --ah: #16a34a;
  --bh: #dc2626;
  --copy-navy: #1e3a5f;
  --wa-green: #128c7e;
  --pic-blue: #3b82a0;
  --nav-active: #ffd54f;
}

html,
body {
  min-height: 100%;
}

body.cutting-app {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  padding-bottom: 76px;
}

.cutting-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 118px 14px 12px;
  background: var(--teal-header);
  color: #fff;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  isolation: isolate;
}

.cutting-header h1 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.cutting-header__date {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.cutting-header__date svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cutting-header__date strong {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cutting-header__date:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cutting-main {
  width: 100%;
  padding: 8px 8px 16px;
}

.cutting-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cutting-sidebar,
.cutting-content {
  width: 100%;
}

.cutting-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.cutting-select {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1.5px solid #99c2c2;
  border-radius: 12px;
  min-height: 42px;
}

.cutting-select.is-open {
  z-index: 40;
}

.cutting-select svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--teal-header);
}

.cutting-select .custom-select {
  flex: 1;
  min-width: 0;
  position: relative;
}

.custom-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.custom-select__trigger:focus-visible {
  outline: 2px solid rgba(10, 92, 92, 0.35);
  outline-offset: 2px;
}

.custom-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.custom-select__chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

.custom-select.is-open .custom-select__chevron {
  transform: rotate(180deg);
}

.custom-select__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: -34px;
  right: -8px;
  z-index: 100;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(5, 102, 105, 0.55) rgba(8, 92, 92, 0.08);
}

.custom-select__menu::-webkit-scrollbar {
  width: 8px;
}

.custom-select__menu::-webkit-scrollbar-track {
  background: rgba(9, 83, 83, 0.08);
  border-radius: 999px;
}

.custom-select__menu::-webkit-scrollbar-thumb {
  background: rgba(9, 83, 83, 0.45);
  border-radius: 999px;
}

.custom-select__option {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.custom-select__option:hover,
.custom-select__option.is-focused {
  background: #e8f6f6;
  color: var(--teal-header);
}

.custom-select__option.is-selected {
  background: var(--teal-header);
  color: #fff;
}

.custom-select__option.is-selected:hover,
.custom-select__option.is-selected.is-focused {
  background: var(--teal-dark);
  color: #fff;
}

.cutting-sidebar {
  overflow: visible;
}

.cutting-rates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.cutting-rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.cutting-rate-row input,
.cutting-rate-row input.input-number {
  min-width: 0;
  width: 100%;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.cutting-rate-row input:focus {
  border-color: var(--teal-header);
  box-shadow: 0 0 0 2px rgba(10, 92, 92, 0.12);
}

.btn-cutting-done {
  flex-shrink: 0;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: var(--teal-done);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
}

.btn-cutting-done:active {
  transform: scale(0.97);
}

.cutting-share-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
  padding: 8px 6px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-share svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-share--copy {
  background: var(--copy-navy);
}

.btn-share--wa {
  background: var(--wa-green);
}

.btn-share--pic {
  background: var(--pic-blue);
}

.cutting-grid-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 8px 6px;
  border: 1px solid #e5e7eb;
}

.cutting-jodi-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
}

.cutting-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: default;
}

.cutting-cell__num {
  font-size: 0.52rem;
  font-weight: 800;
  color: #374151;
  line-height: 1;
}

.cutting-cell__box {
  width: 100%;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border-radius: 999px;
  border: 1.5px solid #99c2c2;
  background: #fff;
}

.cutting-cell input {
  width: 100%;
  min-width: 0;
  height: 20px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: #111;
  outline: none;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.cutting-cell.has-value .cutting-cell__box {
  border-color: var(--teal-header);
  background: #e8f6f6;
}

.cutting-cell.is-cut.has-value .cutting-cell__box,
.cutting-hcell.is-cut.has-value .cutting-hcell__box {
  border-color: #fda4af !important;
  background: #fff1f2 !important;
  animation: cuttingBoxFade 1.4s ease-in-out infinite;
}

.cutting-cell.is-cut.has-value input,
.cutting-hcell.is-cut.has-value input {
  color: #be123c;
}

@keyframes cuttingBoxFade {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.cutting-haruf {
  margin-top: 10px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 8px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cutting-haruf-row {
  display: grid;
  grid-template-columns: 28px repeat(10, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
}

.cutting-haruf-label {
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.cutting-haruf-label--ah {
  color: var(--ah);
}

.cutting-haruf-label--bh {
  color: var(--bh);
}

.cutting-hcell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: default;
}

.cutting-hcell__num {
  font-size: 0.52rem;
  font-weight: 800;
  color: #374151;
}

.cutting-hcell__box {
  width: 100%;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  padding: 0 2px;
}

.cutting-hcell--ah .cutting-hcell__box {
  border: 1.5px solid #86efac;
}

.cutting-hcell--bh .cutting-hcell__box {
  border: 1.5px solid #fda4af;
}

.cutting-hcell input {
  width: 100%;
  min-width: 0;
  height: 20px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 800;
  outline: none;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.cutting-hcell.has-value.cutting-hcell--ah .cutting-hcell__box {
  background: #ecfdf5;
}

.cutting-hcell.has-value.cutting-hcell--bh .cutting-hcell__box {
  background: #fff1f2;
}

.cutting-totals {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.cutting-total-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
}

.cutting-total-line strong {
  min-width: 72px;
  text-align: right;
  color: #16a34a;
  font-weight: 800;
}

.cutting-total-line--final {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1.5px dashed #cbd5e1;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.cutting-total-line--final strong {
  font-size: 1.05rem;
}

.cutting-boxes {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.cutting-box {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.cutting-box__head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cutting-box__head h2 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #334155;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cutting-box__head h2 span {
  font-weight: 700;
  color: #475569;
}

.cutting-box__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 0.68rem;
  font-weight: 800;
}

.cutting-box__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: flex-start;
}

.cutting-box__list {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  align-content: flex-start;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.55;
  color: #334155;
}

.cutting-box__empty {
  color: #64748b;
  font-weight: 600;
}

.cutting-chip {
  white-space: nowrap;
}

.cutting-chip__val {
  color: #16a34a;
}

.cutting-chip__sep {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 3px;
}

.btn-box-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 42px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--teal-header);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.btn-box-copy svg {
  width: 13px;
  height: 13px;
}

.cutting-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 50;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cutting-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 8px 4px 10px;
  background: var(--teal-header);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-item.active {
  color: var(--nav-active);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-item__icon--jantri {
  -webkit-mask-image: url("../assets/icons/game.svg");
  mask-image: url("../assets/icons/game.svg");
}

.nav-item__icon--cutting {
  -webkit-mask-image: url("../assets/icons/cutting.svg");
  mask-image: url("../assets/icons/cutting.svg");
}

.nav-item__icon--result {
  -webkit-mask-image: url("../assets/icons/result.svg");
  mask-image: url("../assets/icons/result.svg");
}

.nav-item__icon--hisab {
  -webkit-mask-image: url("../assets/icons/hisab.svg");
  mask-image: url("../assets/icons/hisab.svg");
}

.nav-item__icon--lenden {
  -webkit-mask-image: url("../assets/icons/lenden.svg");
  mask-image: url("../assets/icons/lenden.svg");
}

.nav-item__icon--delete {
  -webkit-mask-image: url("../assets/icons/delete.svg");
  mask-image: url("../assets/icons/delete.svg");
}

.nav-item__icon--menu {
  -webkit-mask-image: url("../assets/icons/menu.svg");
  mask-image: url("../assets/icons/menu.svg");
}

@media (min-width: 900px) {
  .cutting-main {
    padding: 12px 14px 20px;
  }

  .cutting-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .cutting-sidebar {
    position: sticky;
    top: 58px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: visible;
  }

  .cutting-selects {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .custom-select__menu {
    left: -34px;
    right: -10px;
    max-height: 280px;
  }

  .cutting-rates {
    margin-bottom: 0;
  }

  .cutting-share-row {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .btn-share {
    font-size: 0.72rem;
    min-height: 44px;
  }

  .cutting-cell__box,
  .cutting-hcell__box {
    min-height: 26px;
  }

  .cutting-cell input,
  .cutting-hcell input {
    height: 24px;
    font-size: 0.68rem;
  }

  .cutting-cell__num,
  .cutting-hcell__num {
    font-size: 0.58rem;
  }

  .cutting-boxes {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 380px) {
  .btn-share {
    font-size: 0.55rem;
    gap: 3px;
    padding: 8px 4px;
  }

  .btn-share svg {
    width: 12px;
    height: 12px;
  }

  .cutting-rate-row {
    gap: 4px;
  }

  .cutting-rate-row input,
  .cutting-rate-row input.input-number {
    height: 38px;
    padding: 0 6px;
    font-size: 0.65rem;
  }

  .btn-cutting-done {
    height: 38px;
    padding: 0 10px;
    font-size: 0.65rem;
  }
}

.date-picker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.date-picker.is-open {
  opacity: 1;
  pointer-events: auto;
}

.date-picker.is-closing {
  opacity: 0;
  pointer-events: none;
}

.date-picker[hidden] {
  display: none !important;
}

.date-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.date-picker__panel {
  position: relative;
  z-index: 1;
  width: min(340px, 100%);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.date-picker.is-open .date-picker__panel {
  transform: translateY(0) scale(1);
}

.date-picker.is-closing .date-picker__panel {
  transform: translateY(12px) scale(0.98);
}

.date-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--teal-header);
  color: #fff;
}

.date-picker__head h2 {
  font-size: 0.95rem;
  font-weight: 800;
}

.date-picker__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.date-picker__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 4px;
}

.date-picker__nav {
  width: 36px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.date-picker__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 12px 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

.date-picker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 12px 12px;
}

.date-picker__day {
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.date-picker__day.is-muted {
  color: #cbd5e1;
}

.date-picker__day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--teal-header);
}

.date-picker__day.is-selected {
  background: var(--teal-header);
  color: #fff;
}

.date-picker__footer {
  padding: 0 12px 14px;
  text-align: center;
}

.date-picker__today {
  min-width: 120px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--teal-done);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 420px) {
  .cutting-header {
    padding-right: 108px;
  }

  .cutting-header__date {
    padding: 4px 8px;
    gap: 4px;
  }

  .cutting-header__date strong {
    font-size: 0.66rem;
  }
}
