:root {
  color-scheme: light;
  --ink: #14231f;
  --muted: #61726d;
  --line: #dbe6e1;
  --soft: #f4faf7;
  --paper: #ffffff;
  --brand: #146d5b;
  --brand-2: #0e8b72;
  --accent: #f0a23a;
  --danger: #bd3b3b;
  --shadow: 0 18px 48px rgba(25, 45, 38, 0.12);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(20, 109, 91, 0.08), transparent 250px),
    #f8fbfa;
  color: var(--ink);
}

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

button,
.file-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ghost-button,
.icon-button,
.file-button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  color: var(--danger);
}

.icon-button {
  width: 42px;
  flex: 0 0 42px;
  padding: 0;
  font-size: 22px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card h1,
.app-header h1,
.panel h2,
.memo-dialog h2,
.photo-dialog h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-copy {
  margin: 10px 0 22px;
  color: var(--muted);
  font-weight: 700;
}

.login-form,
.memo-dialog form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  line-height: 1.55;
  resize: vertical;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.app-view {
  min-height: 100vh;
  padding: 18px 18px 92px;
}

.app-header,
.site-bar,
.panel-head,
.calendar-toolbar,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-header {
  max-width: 1120px;
  margin: 0 auto 14px;
}

.site-bar {
  max-width: 1120px;
  margin: 0 auto 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.site-bar label {
  flex: 1;
}

main {
  max-width: 1120px;
  margin: 0 auto;
}

.panel {
  display: none;
  min-height: 60vh;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 10px 34px rgba(25, 45, 38, 0.07);
}

.panel.active {
  display: block;
}

.panel-head {
  margin-bottom: 14px;
  align-items: flex-start;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 10px;
  margin-bottom: 14px;
}

.memo-list,
.photo-list,
.day-detail {
  display: grid;
  gap: 10px;
}

.memo-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.memo-date {
  color: var(--brand);
  font-weight: 900;
}

.memo-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-weight: 700;
}

.photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 74px;
  padding: 0 14px;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-list {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.photo-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--soft);
}

.photo-card-body {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.photo-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card span,
.status-line {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.calendar-toolbar {
  justify-content: center;
  margin-bottom: 14px;
}

.calendar-toolbar button {
  min-width: 86px;
}

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

.calendar-weekday,
.calendar-day {
  min-height: 74px;
  border-radius: 8px;
}

.calendar-weekday {
  display: grid;
  place-items: center;
  min-height: 32px;
  color: var(--muted);
  font-weight: 900;
}

.calendar-day {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  text-align: left;
  color: var(--ink);
}

.calendar-day.outside {
  opacity: 0.42;
}

.calendar-day.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(20, 109, 91, 0.14);
}

.day-number {
  font-weight: 900;
}

.day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.badge {
  border-radius: 999px;
  background: #eaf4f1;
  color: var(--brand);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
}

.day-detail {
  margin-top: 16px;
}

.day-detail h3 {
  margin: 0;
}

.day-photos {
  margin-top: 4px;
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.bottom-tabs button {
  background: #edf5f2;
  color: var(--muted);
}

.bottom-tabs button.active {
  background: var(--brand);
  color: #fff;
}

.memo-dialog,
.photo-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(780px, calc(100dvh - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: var(--shadow);
}

.memo-dialog::backdrop,
.photo-dialog::backdrop {
  background: rgba(9, 21, 18, 0.48);
}

.memo-dialog form {
  padding: 20px;
}

.photo-dialog-body {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff;
}

.photo-dialog img {
  width: 100%;
  max-height: 62dvh;
  object-fit: contain;
  border-radius: 8px;
  background: #eef4f1;
}

.photo-dialog-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-weight: 800;
}

.memo-dialog textarea {
  min-height: 320px;
  font-size: 16px;
}

.dialog-actions {
  grid-template-columns: auto 1fr auto auto;
}

.photo-dialog-actions {
  grid-template-columns: 1fr auto;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

@media (max-width: 680px) {
  .app-view {
    padding: 14px 10px 88px;
  }

  .app-header,
  .site-bar,
  .panel-head {
    align-items: stretch;
  }

  .site-bar,
  .panel-head {
    flex-direction: column;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .memo-item {
    grid-template-columns: 1fr;
  }

  .memo-item button {
    width: 100%;
  }

  .photo-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .photo-actions button,
  .photo-actions .file-button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
  }

  .photo-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-grid {
    gap: 5px;
  }

  .calendar-day {
    min-height: 68px;
    padding: 6px;
  }

  .calendar-weekday {
    font-size: 12px;
  }

  .badge {
    padding: 2px 5px;
    font-size: 10px;
  }

  .memo-dialog,
  .photo-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .memo-dialog form,
  .photo-dialog-body {
    padding: 14px;
  }

  .memo-dialog textarea {
    min-height: 42dvh;
  }
}

@media (max-width: 420px) {
  .calendar-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-toolbar button {
    min-width: 0;
    padding: 0 8px;
  }
}
