:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #293548;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 10px;
}

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

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

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 { font-size: 1.5rem; font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* Form */
.add-form { display: flex; flex-direction: column; gap: 10px; }

.form-row { display: flex; gap: 10px; }
.form-row-sub { padding-left: 0; }
.form-row-bottom { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

input[type="text"], input[type="time"], textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.95rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus, input[type="time"]:focus, textarea:focus {
  border-color: var(--primary);
}
textarea { resize: vertical; font-family: inherit; }
input[type="time"] { width: auto; min-width: 110px; }

label { font-size: 0.875rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-icon { background: transparent; border: none; cursor: pointer; font-size: 1rem; padding: 4px 6px; border-radius: 6px; color: var(--text-muted); }
.btn-icon:hover { background: var(--surface2); color: var(--text); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.badge {
  background: var(--warning);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}
.badge:empty { display: none; }

/* Memo list */
.memo-list { display: flex; flex-direction: column; gap: 10px; }
.memo-list.hidden { display: none; }

.memo-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s;
}
.memo-item:hover { border-color: var(--primary); }
.memo-item.done { opacity: 0.55; }

.memo-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.8rem;
}
.memo-check:hover { border-color: var(--success); }
.memo-check.checked { background: var(--success); border-color: var(--success); color: #fff; }

.memo-body { flex: 1; min-width: 0; }
.memo-title { font-weight: 600; font-size: 0.95rem; word-break: break-word; }
.memo-title.done-text { text-decoration: line-through; }
.memo-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; word-break: break-word; white-space: pre-wrap; }
.memo-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.memo-meta span { display: flex; align-items: center; gap: 4px; }

.memo-actions { display: flex; gap: 4px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 0.95rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-box h2 { font-size: 1.1rem; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
