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

:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --primary: #007AFF;
  --primary-dark: #0056CC;
  --success: #34C759;
  --danger: #FF3B30;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #AEAEB2;
  --sep: #E5E5EA;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);
  --radius: 14px;
  --radius-sm: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

.screen {
  display: flex;
  flex-direction: column;
}

/* ── NAV BAR ─────────────────────────── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sep);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-back {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  padding: 6px 0;
  font-family: inherit;
  min-width: 60px;
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  flex: 1;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-action {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

.nav-confirmed {
  font-size: 14px;
  color: var(--success);
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

/* ── PAGE HEADER ─────────────────────── */
.page-header {
  padding: 24px 20px 12px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-sub {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 6px;
}

.page-date {
  font-size: 15px;
  color: var(--text-2);
}

.page-count {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}

.btn-unconfirm {
  margin-top: 8px;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ── HOME SCREEN ─────────────────────── */
.screen-home {
  background: var(--bg);
  padding-bottom: 130px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.logo-sub {
  font-size: 12px;
  color: var(--text-2);
}

.today-badge {
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 20px;
  padding: 6px 12px;
  white-space: nowrap;
}

.home-content {
  padding: 8px 22px 0;
}

.home-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1.5px;
  line-height: 1.05;
}

.home-sub {
  font-size: 17px;
  color: var(--text-2);
  margin-top: 8px;
  margin-bottom: 32px;
}

.user-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--sep);
}

.user-option {
  display: flex;
  align-items: center;
  padding: 17px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--sep);
  user-select: none;
  transition: background 0.1s;
}

.user-option:last-child { border-bottom: none; }
.user-option:active { background: #F0F0F5; }

.user-radio-wrap { margin-right: 14px; }

.radio-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sep);
  transition: all 0.18s;
  position: relative;
  flex-shrink: 0;
}

.radio-circle.checked {
  border-color: var(--primary);
  background: var(--primary);
}

.radio-circle.checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.user-name {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.red {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255,59,48,0.15);
}

.status-dot.green {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52,199,89,0.2);
}
.status-dot.gray {
  background: var(--text-3);
  box-shadow: 0 0 0 3px rgba(174,174,178,0.2);
}

.vacation-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  margin-right: 10px;
  user-select: none;
}

.vacation-check {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0,0,0,0);
  overflow: hidden;
}

.home-footer {
  padding: 0 22px;
  margin-top: 8px;
}

/* ── BUTTONS ─────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
  user-select: none;
  letter-spacing: -0.2px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.98); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.93); }
.btn-success:active { transform: scale(0.98); }

.btn-disabled {
  background: #E5E5EA;
  color: #AEAEB2;
  cursor: not-allowed;
}

.btn-danger-outline {
  background: none;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  flex: 0 0 auto;
  width: auto;
  padding: 15px 20px;
}

.btn-danger-outline:hover { background: rgba(255,59,48,0.06); }

/* ── BOTTOM BAR ─────────────────────── */
.bottom-bar {
  padding: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

/* ── LOG LIST ────────────────────────── */
.log-list {
  padding: 8px 20px;
}

.log-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  user-select: none;
}

.log-card:hover { box-shadow: var(--shadow); }
.log-card:active { transform: scale(0.98); }
.log-card.locked { cursor: default; opacity: 0.75; }
.log-card.locked:hover { box-shadow: var(--shadow-sm); }
.log-card.locked:active { transform: none; }

.log-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-type { background: rgba(0,122,255,0.1); color: var(--primary); }
.badge-cat { background: #F0F0F5; color: var(--text-2); }

.log-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-arrow {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-3);
}

.log-delete {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  line-height: 1;
  transition: all 0.15s;
}

.log-delete:hover {
  background: rgba(255,59,48,0.1);
  color: var(--danger);
}

/* ── EMPTY STATE ─────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.35; }
.empty-text { font-size: 17px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.empty-sub { font-size: 14px; color: var(--text-3); }

/* ── OPTION CARDS ────────────────────── */
.options-list {
  padding: 12px 20px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.option-card.selected {
  border-color: var(--primary);
  background: rgba(0,122,255,0.03);
  box-shadow: 0 0 0 4px rgba(0,122,255,0.08);
}

.option-card:active { transform: scale(0.98); }

.option-radio {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--sep);
  flex-shrink: 0;
  transition: all 0.18s;
  position: relative;
}

.option-radio.checked {
  border-color: var(--primary);
  background: var(--primary);
}

.option-radio.checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.option-title { font-size: 17px; font-weight: 600; color: var(--text); }
.option-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* ── ENTRY SCREEN ────────────────────── */
.entry-area {
  padding: 8px 20px;
}

.entry-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.work-textarea {
  width: 100%;
  flex: 1;
  min-height: 200px;
  border: 1.5px solid var(--sep);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 16px;
  line-height: 1.65;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.work-textarea:focus { border-color: var(--primary); }
.work-textarea::placeholder { color: var(--text-3); }

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
}

/* ── CONFIRM BADGE ───────────────────── */
.confirm-done {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: rgba(52,199,89,0.1);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-weight: 600;
  font-size: 15px;
}

/* ── TOAST ───────────────────────────── */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(28,28,30,0.9);
  color: #fff;
  padding: 11px 20px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.22s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

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

.toast-error { background: rgba(255,59,48,0.92); }

/* ── SCROLLBAR ───────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sep); border-radius: 2px; }

/* ── HOME ACTION ROW ─────────────────── */
.home-action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--sep);
  font-size: 14px;
  font-weight: 500;
  padding: 13px 8px;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0;
}
.btn-secondary:hover { background: var(--bg); }
.btn-secondary:active { transform: scale(0.97); }

/* ── DATE NAVIGATION ─────────────────── */
.date-nav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 4px;
}

.date-nav-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--sep);
  border-radius: 10px;
  background: var(--surface);
  font-size: 22px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1;
}

.date-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0,122,255,0.05);
}

.date-nav-btn:active:not(:disabled) { transform: scale(0.93); }
.date-nav-btn:disabled { opacity: 0.28; cursor: default; }

.date-nav-center {
  flex: 1;
  text-align: center;
}

.date-nav-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.date-today-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  background: rgba(52,199,89,0.12);
  padding: 2px 9px;
  border-radius: 20px;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.date-today-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.past-date-banner {
  margin: 8px 20px 0;
  padding: 10px 14px;
  background: rgba(0,122,255,0.06);
  border: 1px solid rgba(0,122,255,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-align: center;
}

/* ── ANALYTICS BUTTON ────────────────── */
.btn-analytics {
  background: rgba(0,122,255,0.07);
  color: var(--primary);
  border: 1.5px solid rgba(0,122,255,0.18);
  font-size: 16px;
}
.btn-analytics:hover { background: rgba(0,122,255,0.13); }
.btn-analytics:active { background: rgba(0,122,255,0.2); transform: scale(0.98); }

/* ── ANALYTICS SCREEN ────────────────── */
.an-period-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 20px 10px;
}

.an-period-tab {
  flex: 1;
  padding: 9px 0;
  border: 1.5px solid var(--sep);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.an-period-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.an-content {
  padding: 6px 20px 40px;
}

.an-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.an-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sep);
}

.an-user-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.an-total-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(0,122,255,0.1);
  padding: 4px 13px;
  border-radius: 20px;
}

.an-total-empty {
  color: var(--text-3);
  background: var(--bg);
}

.an-empty {
  font-size: 14px;
  color: var(--text-3);
  text-align: center;
  padding: 10px 0 4px;
}

.an-type-section {
  margin-bottom: 20px;
}

.an-type-section:last-child { margin-bottom: 0; }

.an-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.an-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.an-type-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.an-type-cnt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.an-type-bar-wrap {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.an-type-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.an-cats {
  padding-left: 2px;
}

.an-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.an-cat-name {
  font-size: 13px;
  color: var(--text-2);
  width: 86px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-cat-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
}

.an-cat-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.an-cat-cnt {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── CALENDAR ────────────────────────── */
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}

.cal-month-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--sep);
  border-radius: 10px;
  background: var(--surface);
  font-size: 20px; color: var(--text-2);
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-family: inherit; transition: all 0.15s;
}
.cal-month-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.cal-month-btn:active:not(:disabled) { transform: scale(0.93); }
.cal-month-btn:disabled { opacity: 0.25; cursor: default; }

.cal-month-title {
  font-size: 18px; font-weight: 700; color: var(--text);
}

.cal-wrap { padding: 0 14px; }

.cal-table { width: 100%; border-collapse: collapse; }

.cal-th {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-align: center; padding: 6px 0 10px;
}
.cal-th-sun { color: var(--danger); }
.cal-th-sat { color: var(--primary); }

.cal-cell {
  text-align: center; padding: 3px 1px;
  cursor: pointer; border-radius: 10px;
  transition: background 0.12s; vertical-align: top;
}
.cal-cell:hover:not(.cal-empty):not(.cal-future) { background: rgba(0,0,0,0.04); }
.cal-empty { cursor: default; }
.cal-future { opacity: 0.25; cursor: default; }
.cal-sun-cell .cal-day { color: var(--danger); }
.cal-sat-cell .cal-day { color: var(--primary); }

.cal-day {
  font-size: 14px; font-weight: 500;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; border-radius: 50%;
}

.cal-today .cal-day {
  background: var(--primary); color: #fff !important; font-weight: 700;
}
.cal-selected .cal-day {
  background: rgba(0,122,255,0.15);
  color: var(--primary) !important; font-weight: 700;
}

.cal-dots {
  display: flex; gap: 2px; justify-content: center;
  min-height: 7px; margin-top: 2px; padding-bottom: 2px;
}
.cal-dot {
  width: 5px; height: 5px; border-radius: 50%; display: inline-block;
}

.cal-legend {
  display: flex; gap: 20px; justify-content: center;
  padding: 14px 20px 4px;
  font-size: 12px; color: var(--text-2);
}
.cal-legend-item { display: flex; align-items: center; gap: 5px; }

/* ── SEARCH ──────────────────────────── */
.search-bar { padding: 12px 20px 8px; }

.search-input {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--sep);
  border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit;
  color: var(--text); background: var(--surface);
  outline: none; transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-3); }

.search-results { padding: 4px 20px; }

.search-placeholder {
  text-align: center; padding: 48px 0;
  font-size: 15px; color: var(--text-3);
}

.search-result {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer; transition: all 0.15s;
}
.search-result:hover { box-shadow: var(--shadow); }
.search-result:active { transform: scale(0.98); }

.search-result-meta {
  display: flex; gap: 8px; align-items: center; margin-bottom: 7px;
}
.search-result-date { font-size: 13px; font-weight: 600; color: var(--text); }
.search-result-user {
  font-size: 12px; color: var(--text-3);
  background: var(--bg); padding: 2px 8px; border-radius: 20px;
}
.search-result-badges { display: flex; gap: 5px; margin-bottom: 7px; flex-wrap: wrap; }
.search-result-desc {
  font-size: 13px; color: var(--text-2);
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
