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

:root {
  --primary: #4f6ef7;
  --primary-hover: #3b57e8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Schedule list */
.schedule-list { display: flex; flex-direction: column; gap: 12px; }

.schedule-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: start;
  transition: box-shadow .15s, border-color .15s;
}
.schedule-card:hover { box-shadow: var(--shadow-lg); border-color: #c7d2fe; }
.schedule-card.completed { opacity: 0.55; }
.schedule-card.completed .card-title { text-decoration: line-through; }

/* Urgency stripe */
.urgency-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.urgency-dot.overdue   { background: var(--danger); box-shadow: 0 0 0 3px #fee2e2; }
.urgency-dot.today     { background: var(--warning); box-shadow: 0 0 0 3px #fef3c7; }
.urgency-dot.soon      { background: var(--primary); box-shadow: 0 0 0 3px #e0e7ff; }
.urgency-dot.normal    { background: #94a3b8; }
.urgency-dot.done      { background: var(--success); }

.card-body { min-width: 0; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-word;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.urgency-label {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.urgency-label.overdue { background: #fee2e2; color: #dc2626; }
.urgency-label.today   { background: #fef3c7; color: #d97706; }
.urgency-label.soon    { background: #e0e7ff; color: #4338ca; }

.card-memo {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all .15s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.complete-btn:hover { border-color: var(--success); background: #f0fdf4; }
.icon-btn.complete-btn.done { border-color: var(--success); background: #f0fdf4; color: var(--success); }
.icon-btn.edit-btn:hover { border-color: var(--primary); background: #eff6ff; }
.icon-btn.delete-btn:hover { border-color: var(--danger); background: #fef2f2; color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.hidden { display: none !important; }

/* Buttons */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--border); }

#schedule-form { padding: 20px 24px 24px; }

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.required { color: var(--danger); }

input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #e0e7ff; }
textarea { resize: vertical; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
  .schedule-card { grid-template-columns: auto 1fr; }
  .card-actions { flex-direction: row; grid-column: 1 / -1; }
}
