/* =========================
   Mimo - Pixel Pink Theme
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 16px;

  background-color: #fff7fa;
  background-image:
    radial-gradient(#f4c8d7 1px, transparent 1px);
  background-size: 16px 16px;

  font-family: "Segoe UI", "Yu Gothic", sans-serif;
  color: #604b54;
}

button,
input,
select {
  font-family: inherit;
}


/* =========================
   APP
========================= */

.app {
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  padding: 24px 18px 18px;

  background: rgba(255, 255, 255, 0.96);

  border: 2px solid #ebb3c7;
  border-radius: 22px;

  box-shadow: 6px 6px 0 #f5d3df;
}

.screen {
  width: 100%;
}

.hidden {
  display: none !important;
}


/* =========================
   HOME
========================= */

.header {
  text-align: center;
}

h1 {
  margin: 0;
  color: #d77d9e;
  font-size: 30px;
  letter-spacing: 2px;
}

.subtitle {
  margin: 3px 0 25px;
  color: #b99ba7;
  font-size: 11px;
  letter-spacing: 1.5px;
}

.month-section {
  margin-bottom: 14px;
}

.hello {
  margin: 0;
  color: #d89ab1;
  font-size: 11px;
}

h2 {
  margin: 3px 0 0;
  color: #6e535e;
  font-size: 21px;
}


/* =========================
   HOME SALARY
========================= */

.salary-card {
  margin-bottom: 16px;
  padding: 18px;

  background: #fff8fb;

  border: 2px solid #efbed0;
  border-radius: 16px;

  box-shadow: 4px 4px 0 #f5d5e0;
}

.card-label {
  margin: 0;
  color: #ae8997;
  font-size: 12px;
}

.salary {
  margin: 5px 0 15px;
  color: #d26f95;
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 1px;
}

.goal-info {
  display: flex;
  justify-content: space-between;

  margin-bottom: 5px;

  color: #a78592;
  font-size: 10px;
}

.goal-bar {
  height: 12px;
  overflow: hidden;

  background: #ffffff;

  border: 2px solid #e6a9bf;
  border-radius: 2px;
}

.goal-progress {
  width: 0%;
  height: 100%;

  background:
    repeating-linear-gradient(
      90deg,
      #e58cab 0,
      #e58cab 7px,
      #f5b8cc 7px,
      #f5b8cc 10px
    );
}

.goal-text {
  margin: 9px 0 0;
  color: #b58e9d;
  font-size: 10px;
  text-align: right;
}


/* =========================
   MAIN BUTTON
========================= */

.record-button {
  width: 100%;

  margin-bottom: 18px;
  padding: 14px;

  border: 2px solid #d98ba8;
  border-radius: 11px;

  background: #f7c7d8;
  color: #704d5a;

  font-size: 14px;
  font-weight: bold;

  cursor: pointer;

  box-shadow: 3px 3px 0 #d98ba8;
}

.record-button:hover {
  background: #f3b8ce;
}

.record-button:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}


/* =========================
   HOME MENU
========================= */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);

  gap: 10px;

  margin-bottom: 20px;
}

.menu-card {
  min-height: 92px;
  padding: 12px 8px;

  background: #fffafd;
  color: #775965;

  border: 2px solid #efd0db;
  border-radius: 12px;

  cursor: pointer;
}

.menu-card:hover {
  background: #fff1f6;
}

.menu-card span {
  display: block;
}

.pixel-icon {
  margin-bottom: 5px;
  color: #dc86a6;
  font-size: 22px;
}

.menu-card small {
  display: block;
  margin-top: 3px;
  color: #b89aa5;
  font-size: 9px;
}


/* =========================
   BOTTOM NAV
========================= */

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);

  padding-top: 13px;

  border-top: 2px dashed #f0c6d5;
}

.bottom-nav button {
  border: 0;
  background: transparent;
  color: #c28fa2;
  font-size: 18px;
  cursor: pointer;
}

.bottom-nav span {
  display: block;
  margin-top: 2px;
  font-size: 8px;
}


/* =========================
   SCREEN HEADER
========================= */

.screen-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;

  margin-bottom: 7px;
}

.screen-header h2 {
  margin: 0;
  color: #d77d9e;
  text-align: center;
  font-size: 22px;
}

.back-button {
  width: 34px;
  height: 34px;

  padding: 0;

  border: 2px solid #efc1d1;
  border-radius: 9px;

  background: #fff8fb;
  color: #d77d9e;

  font-size: 18px;
  cursor: pointer;
}

.back-button:hover {
  background: #fff0f5;
}

.setting-description {
  margin: 0 0 22px;
  color: #b89aa5;
  font-size: 10px;
  text-align: center;
}


/* =========================
   HEADINGS
========================= */

.settings-group {
  margin-bottom: 22px;
}

.group-heading,
.record-section-title {
  display: flex;
  align-items: center;

  gap: 9px;

  margin-bottom: 10px;
}

.group-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 31px;
  height: 31px;

  flex-shrink: 0;

  background: #f9d9e4;
  color: #d77d9e;

  border: 2px solid #efb9cc;
  border-radius: 8px;

  font-size: 14px;
  font-weight: bold;
}

.group-icon.plus {
  background: #fce5ed;
}

.group-icon.minus {
  background: #fff0f4;
}

.group-heading h3,
.record-section-title h3 {
  margin: 0;
  color: #765965;
  font-size: 14px;
}

.group-heading p,
.record-section-title p {
  margin: 2px 0 0;
  color: #b89aa5;
  font-size: 9px;
}


/* =========================
   INPUTS
========================= */

.setting-box {
  margin-bottom: 9px;
  padding: 13px;

  background: #fff8fb;

  border: 2px solid #efd0db;
  border-radius: 11px;
}

.setting-box label,
.custom-form label,
.record-label {
  display: block;

  margin-bottom: 7px;

  color: #886b76;

  font-size: 11px;
  font-weight: bold;
}

.input-with-unit {
  display: flex;
  align-items: center;

  gap: 7px;

  padding: 9px 10px;

  background: #ffffff;

  border: 2px solid #f0c8d6;
  border-radius: 8px;

  color: #c07f97;
}

.input-with-unit:focus-within {
  border-color: #dc8daa;
}

.input-with-unit input {
  width: 100%;

  border: 0;
  outline: 0;

  background: transparent;
  color: #684f59;

  font-size: 15px;
}

.normal-input {
  width: 100%;

  margin-bottom: 13px;
  padding: 10px;

  border: 2px solid #f0c8d6;
  border-radius: 8px;

  outline: 0;

  background: #ffffff;
  color: #684f59;

  font-size: 13px;
}

.normal-input:focus {
  border-color: #dc8daa;
}


/* =========================
   SETTING ITEMS
========================= */

.custom-items {
  display: grid;
  gap: 8px;
  margin-bottom: 9px;
}

.custom-item {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 10px;

  padding: 11px 12px;

  background: #fffafd;

  border: 2px solid #f0d1dc;
  border-radius: 10px;
}

.custom-item-info {
  min-width: 0;
}

.custom-item-name {
  margin: 0 0 3px;
  color: #765965;
  font-size: 12px;
  font-weight: bold;
}

.custom-item-detail {
  margin: 0;
  color: #b38e9c;
  font-size: 9px;
}

.delete-item-button {
  flex-shrink: 0;

  padding: 5px 8px;

  border: 1px solid #e4b2c4;
  border-radius: 6px;

  background: #fff3f7;
  color: #c87996;

  font-size: 9px;
  cursor: pointer;
}

.add-item-button {
  width: 100%;

  padding: 10px;

  border: 2px dashed #e7b4c7;
  border-radius: 9px;

  background: #fffafd;
  color: #c67e99;

  font-size: 11px;
  font-weight: bold;

  cursor: pointer;
}

.custom-form {
  margin-bottom: 10px;
  padding: 14px;

  background: #fff5f9;

  border: 2px solid #ebb8ca;
  border-radius: 12px;

  box-shadow: 3px 3px 0 #f7dbe5;
}

.form-title {
  margin: 0 0 14px;
  color: #d27899;
  font-size: 13px;
  font-weight: bold;
}

#pay-value-area,
#deduction-value-area {
  margin-bottom: 13px;
}

.form-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 8px;

  margin-top: 14px;
}

.sub-button,
.small-main-button {
  padding: 9px 7px;

  border-radius: 8px;

  font-size: 10px;
  font-weight: bold;

  cursor: pointer;
}

.sub-button {
  border: 2px solid #e5c2cf;
  background: #ffffff;
  color: #a98592;
}

.small-main-button {
  border: 2px solid #d98ba8;
  background: #f7c7d8;
  color: #704d5a;
}

.settings-save-button {
  margin-top: 7px;
  margin-bottom: 10px;
}

.setting-note {
  margin: 0 0 5px;
  color: #c0a2ad;
  font-size: 8px;
  text-align: center;
}


/* =========================
   RECORD
========================= */

.record-section {
  margin-bottom: 14px;
  padding: 14px;

  background: #fff8fb;

  border: 2px solid #efd0db;
  border-radius: 13px;
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.time-grid .normal-input {
  margin-bottom: 9px;
}

.calculation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 9px 2px;

  border-top: 1px dashed #efc6d5;

  color: #9a7784;
  font-size: 10px;
}

.calculation-row strong {
  color: #d17899;
  font-size: 13px;
}

.record-item {
  margin-bottom: 8px;
  padding: 11px;

  background: #ffffff;

  border: 2px solid #f1d2dd;
  border-radius: 10px;
}

.record-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 8px;

  margin-bottom: 8px;
}

.record-item-name {
  margin: 0;
  color: #765965;
  font-size: 11px;
  font-weight: bold;
}

.record-item-detail {
  color: #b28d9a;
  font-size: 8px;
}

.counter {
  display: grid;
  grid-template-columns: 34px 1fr 34px;

  align-items: center;

  overflow: hidden;

  border: 2px solid #f0c8d6;
  border-radius: 8px;

  background: #fffafd;
}

.counter button {
  height: 34px;

  border: 0;

  background: #f9d9e4;
  color: #b96987;

  font-size: 17px;
  font-weight: bold;

  cursor: pointer;
}

.counter-value {
  text-align: center;
  color: #6e535e;
  font-size: 13px;
  font-weight: bold;
}

.record-money-input {
  display: flex;
  align-items: center;

  gap: 7px;

  padding: 8px 10px;

  border: 2px solid #f0c8d6;
  border-radius: 8px;

  background: #fffafd;

  color: #c07f97;
}

.record-money-input input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #684f59;
  font-size: 13px;
}

.deduction-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

.toggle-left {
  display: flex;
  align-items: center;

  gap: 9px;

  min-width: 0;
}

.toggle-checkbox {
  width: 18px;
  height: 18px;

  accent-color: #df88a7;

  cursor: pointer;
}

.deduction-amount {
  flex-shrink: 0;
  color: #c77795;
  font-size: 10px;
  font-weight: bold;
}

.empty-record,
.empty-message {
  margin: 0;
  padding: 10px;

  border: 2px dashed #efd0db;
  border-radius: 9px;

  color: #b99ba7;
  font-size: 9px;
  text-align: center;

  background: #fffafd;
}


/* =========================
   ESTIMATE
========================= */

.estimate-card {
  margin: 18px 0;
  padding: 18px;

  background: #fff1f6;

  border: 2px solid #e8a8bf;
  border-radius: 15px;

  box-shadow: 4px 4px 0 #f4cedc;

  text-align: center;
}

.estimate-card > p {
  margin: 0 0 4px;
  color: #aa8190;
  font-size: 10px;
}

.estimate-card > strong {
  display: block;

  margin-bottom: 15px;

  color: #cf6e92;

  font-size: 29px;
}

.estimate-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;

  gap: 6px 12px;

  padding-top: 11px;

  border-top: 1px dashed #e7b4c7;

  color: #a58490;

  font-size: 9px;
  text-align: left;
}

.estimate-breakdown span:nth-child(even) {
  color: #855f6e;
  text-align: right;
  font-weight: bold;
}


/* =========================
   CALENDAR
========================= */

.calendar-month-nav {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;

  margin: 4px 0 15px;
}

.calendar-month-nav h3 {
  margin: 0;

  color: #745764;

  font-size: 17px;
  text-align: center;
}

.calendar-month-nav button {
  width: 34px;
  height: 34px;

  padding: 0;

  border: 2px solid #efc1d1;
  border-radius: 9px;

  background: #fff8fb;
  color: #d77d9e;

  font-size: 22px;

  cursor: pointer;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);

  margin-bottom: 5px;

  color: #b58f9d;

  font-size: 8px;
  text-align: center;
}

.calendar-weekdays span:first-child {
  color: #dc86a6;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);

  gap: 4px;
}

.calendar-day {
  position: relative;

  min-width: 0;
  min-height: 48px;

  padding: 5px 2px;

  border: 1px solid #efd0db;
  border-radius: 7px;

  background: #fffafd;
  color: #765965;

  text-align: center;

  cursor: pointer;
}

.calendar-day:hover {
  background: #fff0f5;
}

.calendar-day.empty {
  border-color: transparent;
  background: transparent;

  cursor: default;
}

.calendar-day.today {
  border: 2px solid #e394b1;
}

.calendar-day.has-record {
  background: #fff0f5;
  border-color: #e9a9c0;
}

.calendar-day-number {
  display: block;

  font-size: 10px;
  font-weight: bold;
}

.calendar-day-heart {
  display: block;

  margin-top: 2px;

  color: #da7e9f;

  font-size: 10px;
  line-height: 1;
}

.calendar-day-pay {
  display: block;

  margin-top: 2px;

  overflow: hidden;

  color: #b4758d;

  font-size: 6px;
  font-weight: bold;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar-day.selected {
  background: #f9d7e3;

  border: 2px solid #da84a4;

  box-shadow: 2px 2px 0 #f2c2d3;
}

.calendar-legend {
  margin: 8px 0 18px;

  color: #ba95a3;

  font-size: 8px;
  text-align: right;
}


/* =========================
   CALENDAR DETAIL
========================= */

.calendar-detail {
  margin-top: 10px;
  padding: 15px;

  background: #fff7fa;

  border: 2px solid #e9aec3;
  border-radius: 14px;

  box-shadow: 3px 3px 0 #f4d3df;
}

.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 13px;
}

.detail-small {
  margin: 0 0 2px;

  color: #c398a7;

  font-size: 8px;
  letter-spacing: 1px;
}

.detail-heading h3 {
  margin: 0;

  color: #765965;

  font-size: 16px;
}

.detail-heart {
  color: #db82a2;
  font-size: 25px;
}

.detail-main-pay {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 12px;
  padding: 11px;

  background: #ffffff;

  border: 2px solid #f0ccd9;
  border-radius: 10px;
}

.detail-main-pay span {
  color: #aa8492;
  font-size: 9px;
}

.detail-main-pay strong {
  color: #d16f94;
  font-size: 20px;
}

.detail-list {
  margin-bottom: 13px;
}

.detail-list div {
  display: flex;
  justify-content: space-between;

  gap: 10px;

  padding: 8px 2px;

  border-bottom: 1px dashed #edc7d5;

  color: #a1808d;

  font-size: 9px;
}

.detail-list strong {
  color: #775965;
  text-align: right;
}

.danger-button {
  width: 100%;

  padding: 9px;

  border: 1px solid #e2a1b8;
  border-radius: 8px;

  background: #fff6f9;
  color: #c26e8c;

  font-size: 9px;

  cursor: pointer;
}

.danger-button:hover {
  background: #fce5ed;
}

.calendar-empty-message {
  margin: 18px 0 3px;

  padding: 12px;

  border: 2px dashed #efd0db;
  border-radius: 10px;

  background: #fffafd;
  color: #b99ba7;

  font-size: 9px;
  text-align: center;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 420px) {

  body {
    padding: 15px 10px;
  }

  .app {
    padding: 21px 15px 16px;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    min-height: 45px;
  }
}

/* Room for native date/time controls on iPhone. */
.time-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.time-grid > div {
  min-width: 0;
}
@media (max-width: 480px) {
  .time-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .time-grid .record-label {
    font-size: 16px;
    margin-bottom: 8px;
  }
  #record-screen input[type="time"],
  #record-screen input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 48px;
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1.5;
  }
  .time-grid .normal-input {
    margin-bottom: 0;
  }
}

/* Safari's native date/time appearance must respect the content box. */
#record-screen input[type="date"],
#record-screen input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
#record-screen input::-webkit-date-and-time-value {
  min-width: 0;
  margin: 0;
  text-align: left;
}
#record-screen input::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}
/* Memo */
.memo-date-filter { display: flex; gap: 8px; align-items: start; }
.memo-date-filter input { min-width: 0; flex: 1; }
.memo-date-filter button { flex-shrink: 0; min-height: 44px; }
.memo-group-date { font-size: 14px; color: #886b76; margin: 20px 0 8px; }
.memo-card { display: block; width: 100%; min-width: 0; padding: 14px; margin: 0 0 10px; border: 2px solid #efd0db; border-radius: 13px; background: #fff8fb; color: #684f59; text-align: left; cursor: pointer; }
.memo-card strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.memo-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; font-size: 14px; line-height: 1.6; }
.memo-card small { color: #9a7784; }
.memo-card:focus-visible { outline: 2px solid #d16f94; outline-offset: 3px; }
#memo-screen .normal-input, #memo-editor-screen .normal-input { font-family: inherit; font-size: 16px; min-height: 48px; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; }
#memo-body { resize: vertical; line-height: 1.7; }
.memo-message { color: #a64d70; font-size: 14px; line-height: 1.6; }
#memo-delete { min-height: 44px; margin-top: 12px; font-size: 14px; }
.calendar-day-memo { color: #b9698b; font-size: 13px; line-height: 1; }
.calendar-memo-card { cursor: default; }
.calendar-memo-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; font-size: 14px; line-height: 1.7; }
#calendar-memos { margin-top: 18px; font-size: 14px; }
#calendar-memos-open { min-height: 44px; width: 100%; margin-top: 10px; }
.backup-section { margin-top: 28px; }
.backup-note { font-size: 13px; line-height: 1.7; color: #886b76; }
.backup-section .record-label { margin-top: 18px; }
.backup-section .normal-input { font-size: 16px; max-width: 100%; min-width: 0; }
.backup-panel { padding: 14px; background: #fff8fb; border: 2px solid #efd0db; border-radius: 13px; }
#backup-summary { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.8; }
.backup-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; font-size: 14px; line-height: 1.6; }
.backup-confirm input { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.backup-section .sub-button { min-height: 44px; font-size: 13px; }
#backup-restore:disabled { opacity: .5; cursor: not-allowed; }
#backup-undo { margin-top: 16px; }
