:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #cfdae8;
  --soft-line: #e8eef6;
  --text: #07162f;
  --muted: #6e7c90;
  --green: #11bd78;
  --green-soft: #e8fbf3;
  --blue: #1f6feb;
  --blue-soft: #edf5ff;
  --yellow: #ffd75e;
  --yellow-soft: #fff7dd;
  --red: #d93025;
  --red-soft: #fff0ee;
  --violet: #7048e8;
  --violet-soft: #f1edff;
  --orange: #d76b00;
  --orange-soft: #fff2dd;
  --shadow: 0 18px 45px rgba(20, 37, 63, 0.13);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

html, body { height: 100%; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background:
    linear-gradient(90deg, rgba(201, 214, 232, 0.55) 1px, transparent 1px),
    linear-gradient(0deg, rgba(201, 214, 232, 0.45) 1px, transparent 1px),
    var(--bg);
  background-size: 112px 112px;
}

.phone-app {
  width: min(100vw, 480px);
  height: 100vh;
  height: 100dvh;
  background: #f7f9fc;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
}

.boot, .loading {
  margin: auto;
  padding: 24px;
  color: var(--muted);
}

.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 92px;
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.top-left, .top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.top-actions { justify-content: flex-end; }

.top-date {
  color: #53657d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-btn, .back-btn {
  min-width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.back-btn {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 10px 12px;
}

.bottom-nav {
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #111827;
  background: #fff;
  position: relative;
  z-index: 22;
}

.bottom-nav button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #0b1020;
  font-size: 22px;
}

.bottom-nav button:last-child { border-right: 0; }
.bottom-nav .active { color: var(--green); font-weight: 800; }

.card, .list-card, .table-card, .auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.section { margin: 10px 0; }

.section-title {
  height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.muted { color: var(--muted); font-size: 13px; font-weight: 500; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 19px; font-weight: 800; }
.row-sub { margin-top: 2px; color: var(--muted); font-size: 13px; }
.chev { color: #9aa7b9; font-size: 24px; }

.badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #657386;
  background: #eff3f8;
}

.badge.green { color: #008a5d; background: var(--green-soft); }
.badge.yellow { color: #7a5300; background: var(--yellow); }
.badge.orange { color: var(--orange); background: var(--orange-soft); }
.badge.blue { color: var(--blue); background: var(--blue-soft); }
.badge.violet { color: var(--violet); background: var(--violet-soft); }

.search-line {
  margin: 0 0 10px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
}

.friend-float {
  position: fixed;
  left: 50%;
  bottom: 72px;
  width: min(calc(100vw - 20px), 460px);
  transform: translateX(-50%);
  box-shadow: var(--shadow);
  z-index: 21;
}

.auth-wrap {
  width: min(100vw, 480px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 24px 16px;
}

.auth-card { width: 100%; padding: 20px; }
.brand { text-align: center; margin-bottom: 20px; }
.brand h1 { margin: 0; font-size: 31px; }
.brand p { margin: 8px 0 0; color: var(--muted); }

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button, .pill-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f2f6fb;
  height: 42px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.tabs .active, .pill-btn.active {
  background: var(--green-soft);
  border-color: #88e2be;
  color: #008a5d;
}

[data-form="monthSetting"] .pill-btn.active {
  background: #5f6673;
  border-color: #4f5866;
  color: #e32626;
}

[data-form="monthSetting"] .wage-setting-field {
  position: relative;
}

[data-form="monthSetting"] .wage-input-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  position: relative;
}

[data-form="monthSetting"] .wage-mode-label {
  border: 0;
  border-right: 1px solid var(--line);
  background: #f4f8fd;
  color: #24364f;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-form="monthSetting"] .wage-input-row .input {
  border: 0;
  border-radius: 0;
}

[data-form="monthSetting"] .wage-input-row:focus-within {
  border-color: #8fb7ff;
  box-shadow: 0 0 0 2px rgba(120, 168, 255, .18);
}

[data-form="monthSetting"] .wage-mode-picker {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: 74px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 35, 64, .18);
}

[data-form="monthSetting"] .wage-mode-picker[hidden] {
  display: none;
}

[data-form="monthSetting"] .wage-mode-option {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #10233f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 18px;
}

[data-form="monthSetting"] .wage-mode-option:last-child {
  border-bottom: 0;
}

[data-form="monthSetting"] .wage-mode-radio {
  width: 20px;
  height: 20px;
  border: 2px solid #7b8798;
  border-radius: 50%;
  box-sizing: border-box;
}

[data-form="monthSetting"] .wage-mode-option.active .wage-mode-radio {
  border: 6px solid #009b8a;
}

.form-grid { display: grid; gap: 10px; }
.field { display: grid; gap: 6px; }
.field label { color: #40506a; font-size: 13px; font-weight: 700; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 50px;
}

.eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: grid;
  place-items: center;
}

.eye-btn span {
  width: 22px;
  height: 14px;
  border: 2px solid #7b8798;
  border-radius: 999px / 70%;
  position: relative;
}

.eye-btn span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #7b8798;
}

.eye-btn span::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 2px;
  transform: rotate(-28deg);
  background: transparent;
}

.eye-btn.active span {
  border-color: var(--green);
}

.eye-btn.active span::after {
  background: var(--green);
}

.eye-btn:not(.active) span::before {
  background: #7b8798;
}

.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #78a8ff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.inline { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; }

.primary, .secondary, .danger {
  height: 46px;
  border: 0;
  border-radius: 10px;
  font-weight: 900;
}

.primary { background: var(--green); color: #fff; }
.secondary { background: #eef3f8; color: #23324a; }
.danger { background: var(--red-soft); color: var(--red); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

.notice, .error {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.notice { background: var(--blue-soft); color: #25466f; }
.error { background: var(--red-soft); color: var(--red); }

.profile-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: center;
  padding: 18px 12px;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #dce9f8;
  color: #08294f;
  font-weight: 900;
  font-size: 19px;
}

.profile-name { font-size: 24px; font-weight: 900; }

.record-head {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.record-title {
  text-align: center;
  padding: 10px 8px 6px;
  font-size: 23px;
  font-weight: 900;
}

.record-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #f1f5fa;
  color: #42526b;
}

.record-user span:first-child {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.record-user span:last-child {
  text-align: right;
}

.weather {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.period-table {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fff;
}

.period-row {
  display: grid;
  grid-template-columns: 68px 46px minmax(0, 1fr) 54px;
  min-height: 104px;
  border-bottom: 1px solid var(--line);
}

.period-name, .period-value, .period-photo {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
}

.period-name strong {
  display: block;
  font-size: 26px;
  font-weight: 500;
}

.period-name small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.period-value input {
  width: 40px;
  border: 0;
  background: transparent;
  text-align: center;
  color: #27466b;
  font-size: 18px;
  font-weight: 500;
  outline: none;
}

.period-value input:not(:placeholder-shown) {
  color: #071a34;
  font-size: 22px;
  font-weight: 900;
}

.period-value input.has-value {
  color: #071a34;
  font-size: 22px;
  font-weight: 900;
}

.period-body { position: relative; padding: 6px; }

.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}

.chips input, .chips button {
  width: 100%;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-align: center;
  color: #0c2746;
  padding: 0 2px;
}

.chips .leave-on {
  color: #111827;
  border-color: #cbd5e1;
  background: #eef1f5;
  font-weight: 900;
}

.chips button:not(.leave-on) {
  color: var(--muted);
}

.chips button:disabled {
  opacity: 1;
}

.detail-input {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  width: 100%;
  resize: none;
  padding: 8px 28px 8px 8px;
  outline: none;
}

.detail-input:focus { border-color: #78a8ff; background: #fbfdff; }
.voice-dot { position: absolute; right: 14px; bottom: 12px; color: #24746b; font-size: 18px; }

.photo-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.photo-btn.photo-on {
  border-color: #74d9b0;
  background: var(--green-soft);
  color: #008a5d;
  font-weight: 900;
}

.camera-icon {
  width: 24px;
  height: 18px;
  border: 2px solid #071a34;
  border-radius: 5px;
  position: relative;
  display: inline-block;
  box-sizing: border-box;
}

.camera-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid #071a34;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}

.camera-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: -6px;
  width: 8px;
  height: 5px;
  border: 2px solid #071a34;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #fff;
  box-sizing: border-box;
}

.photo-btn.photo-on .camera-icon,
.photo-btn.photo-on .camera-icon::before,
.photo-btn.photo-on .camera-icon::after {
  border-color: #008a5d;
}

.photo-btn.photo-on .camera-icon::after {
  background: var(--green-soft);
}

.home-photo-thumb {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: contain;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
}

.summary-cell {
  padding: 8px 12px;
  text-align: center;
  border-right: 1px solid var(--line);
  color: #506079;
}

.summary-cell:last-child { border-right: 0; }
.summary-cell strong { color: #061a36; font-size: 20px; margin-left: 8px; }

.recent-days {
  width: calc(100% + 20px);
  margin: 8px -10px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}

.recent-days table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.recent-days th,
.recent-days td {
  height: 20px;
  border: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: #1c3554;
  padding: 2px;
}

.recent-days th {
  background: #f7fbff;
  color: #17385e;
  font-weight: 900;
}

.recent-days td:last-child {
  color: #008a5d;
  font-weight: 900;
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.grid-table th, .grid-table td {
  border: 1px solid var(--line);
  min-height: 42px;
  height: 42px;
  text-align: center;
  padding: 4px;
  font-size: 14px;
}

.grid-table thead th {
  background: #f7fbff;
  color: #17385e;
  font-weight: 900;
  position: sticky;
  top: 56px;
  z-index: 3;
}

.attendance-card .grid-table thead th {
  top: 0;
}

.month-page-card .grid-table thead th {
  top: 0;
}

.table-title {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 90px;
  align-items: center;
  padding: 10px 12px;
  background: #eafbf3;
  border-bottom: 1px solid var(--line);
}

.table-title h2 { margin: 0; text-align: center; font-size: 22px; }

.month-top-nav {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 56px;
}

.month-top-nav span {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.month-step-btn {
  height: 48px;
  border: 0;
  background: transparent;
  color: #008a5d;
  font-size: 38px;
  line-height: 1;
  font-weight: 700;
}

.month-step-btn:active {
  background: #d8f6e9;
}

.month-title-year-btn {
  justify-self: center;
  padding: 7px 10px;
  background: var(--green-soft);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.top-attendance-btn {
  padding: 6px 10px;
  background: var(--green-soft);
  font-size: 26px;
  line-height: 1;
  min-width: 124px;
  white-space: nowrap;
}

.topbar:has(.top-attendance-btn) {
  grid-template-columns: 56px minmax(0, 1fr) 132px;
}

.top-actions:has(.top-attendance-btn) {
  padding-right: 4px;
}

.day-detail-card {
  border-radius: 8px;
}

.day-detail-turn-next,
.day-detail-turn-prev {
  position: relative;
  overflow: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

.day-detail-turn-next::after,
.day-detail-turn-prev::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
}

.day-detail-turn-next {
  transform-origin: right center;
  animation: dayDetailBookNext 520ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
}

.day-detail-turn-next::after {
  background:
    radial-gradient(120% 92% at 100% 50%, rgba(255, 255, 255, 0.92) 0 8%, rgba(255, 255, 255, 0.48) 18%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(90deg, rgba(15, 35, 55, 0) 46%, rgba(15, 35, 55, 0.22) 72%, rgba(255, 255, 255, 0.8) 100%);
  animation: dayDetailCurlNext 520ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
}

.day-detail-turn-prev {
  transform-origin: left center;
  animation: dayDetailBookPrev 520ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
}

.day-detail-turn-prev::after {
  background:
    radial-gradient(120% 92% at 0% 50%, rgba(255, 255, 255, 0.92) 0 8%, rgba(255, 255, 255, 0.48) 18%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(270deg, rgba(15, 35, 55, 0) 46%, rgba(15, 35, 55, 0.22) 72%, rgba(255, 255, 255, 0.8) 100%);
  animation: dayDetailCurlPrev 520ms cubic-bezier(0.16, 0.82, 0.18, 1) both;
}

@keyframes dayDetailBookNext {
  0% {
    opacity: 0.34;
    filter: brightness(0.9);
    box-shadow: -30px 0 34px rgba(15, 35, 55, 0.2);
    transform: perspective(820px) translateX(68px) rotateY(-58deg) skewY(-1.2deg) scale(0.965);
  }
  48% {
    opacity: 0.88;
    filter: brightness(1.04);
    box-shadow: -12px 0 26px rgba(15, 35, 55, 0.16);
    transform: perspective(820px) translateX(10px) rotateY(-16deg) skewY(-0.4deg) scale(0.995);
  }
  78% {
    opacity: 1;
    filter: brightness(1);
    box-shadow: 4px 0 12px rgba(15, 35, 55, 0.08);
    transform: perspective(820px) translateX(-3px) rotateY(4deg) scale(1);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    box-shadow: none;
    transform: translateX(0);
  }
}

@keyframes dayDetailBookPrev {
  0% {
    opacity: 0.34;
    filter: brightness(0.9);
    box-shadow: 30px 0 34px rgba(15, 35, 55, 0.2);
    transform: perspective(820px) translateX(-68px) rotateY(58deg) skewY(1.2deg) scale(0.965);
  }
  48% {
    opacity: 0.88;
    filter: brightness(1.04);
    box-shadow: 12px 0 26px rgba(15, 35, 55, 0.16);
    transform: perspective(820px) translateX(-10px) rotateY(16deg) skewY(0.4deg) scale(0.995);
  }
  78% {
    opacity: 1;
    filter: brightness(1);
    box-shadow: -4px 0 12px rgba(15, 35, 55, 0.08);
    transform: perspective(820px) translateX(3px) rotateY(-4deg) scale(1);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    box-shadow: none;
    transform: translateX(0);
  }
}

@keyframes dayDetailCurlNext {
  0% { opacity: 0.95; clip-path: polygon(76% 0, 100% 0, 100% 100%, 58% 100%); transform: translateX(0); }
  48% { opacity: 0.72; clip-path: polygon(58% 0, 100% 0, 100% 100%, 38% 100%); transform: translateX(-12px); }
  100% { opacity: 0; clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%); transform: translateX(-28px); }
}

@keyframes dayDetailCurlPrev {
  0% { opacity: 0.95; clip-path: polygon(0 0, 24% 0, 42% 100%, 0 100%); transform: translateX(0); }
  48% { opacity: 0.72; clip-path: polygon(0 0, 42% 0, 62% 100%, 0 100%); transform: translateX(12px); }
  100% { opacity: 0; clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); transform: translateX(28px); }
}

.day-detail-context {
  min-height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--line);
  color: #52657d;
  font-size: 12px;
  text-align: center;
}

.day-detail-context span {
  min-width: 0;
  padding: 4px 6px;
}

.day-detail-context span:first-child {
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.day-detail-context span + span {
  border-left: 1px solid var(--line);
}

.day-context-tags {
  display: grid;
  gap: 2px;
  margin-bottom: 4px;
  color: #52657d;
  font-size: 11px;
  line-height: 1.35;
}

.day-context-tags span {
  display: block;
  overflow-wrap: anywhere;
}

.day-detail-table .day-period-col { width: 70px; }
.day-detail-table .day-value-col { width: 54px; }
.day-detail-table .day-photo-col { width: 52px; }

.day-detail-table td {
  height: 88px;
}

.day-detail-card.has-photo-preview .day-detail-table td {
  height: 62px;
}

.day-detail-text {
  text-align: left !important;
  overflow-wrap: anywhere;
}

.day-value-edit,
.day-text-edit {
  width: 100%;
  min-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
}

.day-value-modified,
.day-text-addition,
.day-adjustment-modified {
  color: #d92d20;
}

.day-adjustments {
  color: var(--muted);
}

.day-adjustment-on {
  border-radius: 3px;
  background: #eef1f5;
  color: #111827;
  font-weight: 700;
}

.day-adjustment-on.day-adjustment-modified {
  color: #d92d20;
}

.day-adjustments em {
  margin-left: 2px;
  border: 1px solid currentColor;
  padding: 0 1px;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

.day-photo-status {
  padding: 2px !important;
}

.day-photo-empty-pick {
  width: 100%;
  height: 100%;
  min-height: 54px;
  display: grid;
  place-items: center;
  color: #52657d;
  cursor: pointer;
}

.day-photo-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: #eef4fb;
  overflow: hidden;
}

.day-photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.day-photo-supplement {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 2px;
  border: 1px solid #0aa477;
  background: rgba(255, 255, 255, 0.88);
  color: #087e5e;
  font-size: 10px;
  line-height: 1.1;
}

.day-photo-preview {
  height: min(50dvh, 432px);
  min-height: 230px;
  margin-top: 8px;
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.day-photo-preview header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--green-soft), var(--blue-soft));
}

.day-photo-preview header span {
  overflow: hidden;
  color: #52657d;
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-photo-preview-body,
.day-photo-preview-body button,
.day-photo-frame {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.day-photo-preview-body {
  display: grid;
}

.day-photo-preview-body button {
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #eef4fb;
}

.day-photo-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.day-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.day-photo-source {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  max-width: calc(100% - 16px);
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.9);
  white-space: nowrap;
}

.day-photo-empty {
  display: grid;
  place-items: center;
  color: #94a3b8;
  background: #fff;
}

.day-photo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 0;
  background: rgba(0, 0, 0, 0.9);
}

.day-photo-fullscreen .day-photo-frame {
  max-width: 100%;
  max-height: 100%;
}

.day-photo-fullscreen img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.year-btn {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0b8a60;
  padding: 8px 10px;
  font-weight: 900;
}

.top-year-btn {
  background: var(--green-soft);
  white-space: nowrap;
}

.cell-green { background: var(--green-soft); color: #008a5d; font-weight: 900; }
.cell-blue { background: var(--blue-soft); color: #0b55c7; font-weight: 900; }
.cell-violet { background: var(--violet-soft); color: #5a32d6; font-weight: 900; }
.cell-red { background: var(--red-soft); color: var(--red); font-weight: 900; }
.cell-orange { background: var(--orange-soft); color: var(--orange); font-weight: 900; }
.cell-total { background: #e6fae9; color: #007a51; font-weight: 900; }

.month-metric-link {
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: inherit;
}

.month-value-modified {
  color: var(--red) !important;
  font-weight: 900;
}

.year-inline-btn {
  border: 0;
  border-radius: 999px;
  background: #eef8ff;
  color: #17385e;
  font-weight: 900;
  padding: 6px 12px;
}

.month-count {
  color: #ef2f2f;
  font-weight: 900;
}

.year-total-label {
  color: #17385e;
  font-weight: 900;
}

.year-rest-note {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.2;
}

.rest-over {
  color: var(--red);
  font-weight: 900;
}

.chat-panel {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages {
  flex: 1;
  min-height: 360px;
  overflow: auto;
  padding: 10px 8px;
}

.chat-empty {
  margin-top: 22px;
  color: var(--muted);
  text-align: center;
}

.chat-bubble {
  width: fit-content;
  max-width: 78%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.45;
}

.chat-bubble.mine {
  margin-left: auto;
  background: var(--green-soft);
  border-color: #bdeed8;
}

.chat-bubble small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.chat-send {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chat-send .primary {
  height: 44px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(16, 24, 40, 0.38);
  padding: 58px 14px 14px;
}

.modal {
  width: min(100%, 450px);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  align-items: center;
  height: 52px;
  border-bottom: 1px solid var(--line);
}

.modal-head strong { text-align: center; font-size: 18px; }
.modal-head button { border: 0; background: transparent; color: var(--muted); }
.modal-body { padding: 12px; }

.year-picker-list {
  max-height: min(42dvh, 330px);
  display: grid;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.year-picker-manual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
}

.detail-edit-overlay {
  z-index: 65;
}

.detail-edit-modal .form-grid {
  display: grid;
  gap: 12px;
}

.detail-original {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f3f7fb;
  color: #52657d;
}

.detail-original p {
  margin: 6px 0 0;
  color: #16243a;
  white-space: pre-wrap;
}

.detail-addition-input {
  min-height: 96px;
  resize: vertical;
}

.detail-adjustment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-leave-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9eb;
  color: #ad5700;
}

.detail-leave-toggle input {
  width: 18px;
  height: 18px;
}

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #f7f9fc;
  display: flex;
  justify-content: center;
}

.editor-panel {
  width: min(100vw, 480px);
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.editor-textarea {
  flex: 1;
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  padding: 18px;
  font-size: 20px;
  line-height: 1.65;
  color: var(--text);
}

.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.stat b { display: block; font-size: 24px; }
.admin-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-mini-btn { width: auto; min-height: 32px; padding: 0 12px; border-radius: 16px; font-size: 13px; }
.empty { padding: 30px 14px; color: var(--muted); text-align: center; }

@media (max-width: 560px) {
  .phone-app {
    width: 100vw;
    max-width: none;
    border-left: 0;
    border-right: 0;
  }
  .content { padding-left: 8px; padding-right: 8px; }
}
