:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --page: #f4f7fb;
  --panel: #ffffff;
  --calendar: #202020;
  --calendar-soft: #2a2a2a;
  --calendar-line: #3b3b3b;
  --calendar-muted: #7f7f7f;
  --calendar-text: #f3f3f3;
  --blue: #00a2ff;
  --danger: #c81e1e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  font-size: 16px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.simple-home {
  width: min(100vw - 32px, 430px);
  margin: 0 auto;
  padding: 20px 0 28px;
}

.simple-logo-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  margin-bottom: 16px;
}

.simple-logo-row span,
.simple-logo-row strong,
.simple-section-title strong,
.simple-section-title span,
.simple-link-button,
.folder-open-button {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  background: transparent;
  line-height: 1.2;
  text-decoration: none;
}

.simple-logo-row span {
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: #fff;
  background: #1f7a70;
  font-size: 13px;
  font-weight: 800;
}

.simple-logo-row strong {
  font-size: 22px;
}

.simple-section-title {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 12px 0 8px;
  min-height: 24px;
}

.simple-section-title span {
  color: var(--muted);
  font-size: 13px;
}

.home-calendar-panel {
  width: 100%;
  margin-top: 0;
  padding: 16px 14px 10px;
  color: var(--calendar-text);
  background: var(--calendar);
  background-image: linear-gradient(135deg, #242424, #1c1c1c);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.calendar-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.calendar-topline h3 {
  margin: 0;
  color: #d8d8d8;
  font-size: 15px;
  font-weight: 400;
}

.calendar-nav {
  display: flex;
  gap: 18px;
}

.calendar-nav-button {
  width: 26px;
  height: 26px;
  border: 0;
  color: #d8d8d8;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.calendar-weekdays,
.main-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.calendar-weekdays {
  margin-bottom: 16px;
  color: #f1f1f1;
  font-size: 13px;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 28px;
  padding: 0;
  border: 0;
  color: #f8f8f8;
  background: transparent;
  font-size: 16px;
  line-height: 1;
}

.calendar-day.outside-month {
  color: var(--calendar-muted);
}

.calendar-day.selected {
  background: var(--blue);
  color: #fff;
  border-radius: 4px;
  outline: 2px solid #0b6fd3;
  outline-offset: 2px;
}

.schedule-count-badge {
  position: absolute;
  right: -5px;
  top: -5px;
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 10px;
  font-weight: 700;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
}

.schedule-card strong,
.schedule-card p,
.schedule-card small {
  margin: 0;
}

.schedule-card p,
.schedule-card small {
  color: var(--muted);
}

.schedule-card button {
  grid-row: span 3;
  border: 0;
  color: var(--danger);
  background: transparent;
}

.simple-folder-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.folder-management-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-items: center;
}

.folder-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 18px 12px;
  align-items: center;
  margin-top: 14px;
}

.simple-link-button,
.folder-open-button {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  justify-content: center;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.folder-card {
  position: relative;
  min-height: 86px;
  margin-top: 0;
}

.folder-card.is-managing {
  animation: folder-wiggle 0.34s infinite alternate ease-in-out;
}

.folder-card.drag-over-before {
  filter: drop-shadow(-5px 0 0 var(--blue));
}

.folder-card.drag-over-after {
  filter: drop-shadow(5px 0 0 var(--blue));
}

@keyframes folder-wiggle {
  0% {
    transform: rotate(-0.7deg) translateY(0);
  }
  100% {
    transform: rotate(0.7deg) translateY(-1px);
  }
}

.folder-card-body {
  display: none;
}

.folder-card-header {
  display: block;
}

.folder-delete-button {
  position: absolute;
  right: -6px;
  top: 2px;
  display: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--danger);
  border-radius: 50%;
  color: var(--danger);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
}

.folder-card.is-deleting .folder-delete-button {
  display: grid;
  place-items: center;
}

.folder-open-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.16;
  min-height: 84px;
  border: 0;
  border-radius: 8px;
  padding: 24px 10px 10px;
  color: #fff;
  background: var(--folder-color);
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.14), 0 2px 4px rgba(31, 42, 68, 0.12);
  font-size: 17px;
  font-weight: 900;
  text-align: center;
  overflow: visible;
}

.folder-open-button::before {
  content: "";
  position: absolute;
  left: 0;
  top: -10px;
  width: 42%;
  height: 24px;
  border-radius: 8px 13px 0 0;
  background: var(--folder-color);
  filter: brightness(1.04);
}

.folder-open-button::after {
  content: "";
  position: absolute;
  left: 34%;
  top: -6px;
  width: 64%;
  height: 16px;
  border-radius: 10px 8px 0 0;
  background: var(--folder-color);
  filter: brightness(1.04);
}

.folder-open-button span {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.note-workspace {
  display: none;
  width: min(100vw - 32px, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 28px;
  --active-folder-color: #dec4a7;
  --note-paper-color: #f8e4c8;
  --note-line-color: rgba(204, 132, 63, 0.24);
}

body.note-page-open .simple-home {
  display: none;
}

body.note-page-open .note-workspace {
  display: grid;
  align-content: start;
  gap: 10px;
}

.note-page-header {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: center;
}

.note-page-header .icon-button {
  min-width: 38px;
  height: 38px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

#noteTitleInput {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid var(--active-folder-color);
  border-radius: 0;
  padding: 0 4px;
  color: var(--ink);
  background: transparent;
  font-size: 22px;
  font-weight: 800;
}

.save-state {
  min-width: 52px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.format-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding: 8px 0 10px;
}

.format-toolbar button,
.font-size-tool,
.color-tool {
  flex: 0 0 auto;
}

.font-size-tool {
  width: 44px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 6px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

.color-tool {
  position: relative;
  display: inline-grid;
  grid-template-columns: 20px;
  grid-template-rows: 18px 4px;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 34px;
  width: 34px;
  padding: 3px 4px;
}

.format-toolbar button.is-active,
.color-tool.is-active,
.font-size-tool:focus {
  border-color: #a8d7ff;
  background: #e8f4ff;
  box-shadow: 0 0 0 1px #cde9ff inset;
}

.tool-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.text-color-icon {
  color: #d71920;
}

.text-color-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: #d71920;
}

.background-color-icon {
  color: var(--ink);
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent 0 42%, #fff06a 42% 100%);
}

.background-color-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: #ffe600;
}

.folder-color-icon::before,
.folder-color-icon::after {
  content: "";
  position: absolute;
  background: #2c7be5;
}

.folder-color-icon::before {
  left: 2px;
  top: 4px;
  width: 9px;
  height: 5px;
  border-radius: 3px 3px 0 0;
}

.folder-color-icon::after {
  left: 1px;
  right: 1px;
  bottom: 2px;
  height: 11px;
  border-radius: 3px;
}

.color-swatch-preview {
  grid-column: 1;
  grid-row: 2;
  width: 20px;
  height: 3px;
  border: 0;
  border-radius: 999px;
}


.editor-panel {
  min-height: 430px;
}

.editor-area {
  min-height: min(62vh, 560px);
  padding: 12px 12px 18px;
  border: 1px solid rgba(116, 82, 47, 0.16);
  border-radius: 2px;
  color: #2a2a2a;
  background-color: var(--note-paper-color);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 16px,
    var(--note-line-color) 17px,
    transparent 18px
  );
  background-size: 100% 18px;
  box-shadow: 0 2px 8px rgba(31, 42, 68, 0.1);
  font-size: 16px;
  line-height: 18px;
  outline: none;
  overflow-wrap: anywhere;
}

.editor-area:empty::before {
  content: "메모를 입력하세요";
  color: rgba(23, 32, 51, 0.42);
}

.note-page-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.note-page-options select,
.note-page-options .toggle-row,
.note-page-options .file-button,
.note-page-options .ghost-button {
  width: 100%;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

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

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

.photo-preview img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

.dialog-body,
.color-picker-body {
  display: grid;
  gap: 14px;
  background: #fff;
}

.dialog-body {
  padding: 16px;
}

.dialog-body h3,
.color-picker-head h3 {
  margin: 0;
}

.dialog-body label {
  display: grid;
  gap: 8px;
}

.dialog-actions,
.color-picker-head {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.ghost-button,
.icon-button,
.color-tool,
.format-toolbar button,
.file-button,
.note-page-options select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

#colorDialog {
  width: min(390px, calc(100vw - 24px));
  padding: 0;
}

#scheduleDialog {
  width: min(430px, calc(100vw - 24px));
  padding: 0;
}

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

.schedule-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.schedule-dialog-head h3,
.schedule-dialog-head p {
  margin: 0;
}

.schedule-dialog-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.schedule-dialog-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.schedule-dialog-form input[type="text"],
.schedule-dialog-form input[type="datetime-local"],
.schedule-dialog-form input[type="number"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.schedule-option-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.color-picker-body {
  gap: 16px;
  padding: 18px;
}

.color-sections {
  display: grid;
  gap: 16px;
}

.color-section {
  display: grid;
  gap: 8px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(12, 22px);
  gap: 6px;
  align-items: center;
}

.color-grid.compact-grid {
  grid-template-columns: repeat(12, 24px);
}

.color-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #d8d8d8;
  border-radius: 50%;
  background: var(--swatch-color);
}

.color-swatch.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue);
}

.color-swatch.empty {
  background: #fff;
}

.custom-color-row {
  display: grid;
  gap: 8px;
}

.custom-color-row input {
  width: 64px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 0;
}

@media (max-width: 460px) {
  .simple-home {
    width: calc(100vw - 20px);
    padding-top: 12px;
  }

  .simple-logo-row,
  .simple-section-title {
    grid-template-columns: auto 1fr;
  }

  .home-calendar-panel {
    width: 100%;
  }

  .folder-management-actions,
  .folder-board {
    grid-template-columns: repeat(2, 1fr);
  }
}
