:root {
  --accent: #0f9d8c;
  --accent-dark: #0c7f72;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2328;
  --text-muted: #6b7280;
  --placeholder: #9ca3af;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px;
}

.page {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #dff3f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.card h1 {
  font-size: 20px;
  margin: 0 0 8px;
}
.card .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
label .optional {
  font-weight: 400;
  color: var(--text-muted);
}

.field { margin-bottom: 20px; }

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input[type="text"]::placeholder,
textarea::placeholder { color: var(--placeholder); }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  background: #fff;
}

.input-prefix {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-prefix span {
  color: var(--text-muted);
  font-size: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled {
  background: #b7ded8;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f9fafb; }
.btn-small {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}
.btn-icon {
  width: auto;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-muted);
}
.btn-icon:hover { background: #f3f4f6; }
.btn-danger-text {
  color: #d92d20;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 14px;
}
.checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Group header */
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.group-header h1 {
  font-size: 20px;
  margin: 0;
}
.group-header .subtitle-inline {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.recent-list-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fafb;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.recent-list-item:hover {
  background: #fff;
  border-color: var(--accent);
}
.recent-list-item.active {
  border-color: var(--accent);
  background: #fff;
}

.recent-list-item .recent-list-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 10px;
  font-family: inherit;
}
.recent-list-item .recent-list-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.recent-list-item .recent-list-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-list-item .recent-list-pin {
  flex: none;
  font-size: 12px;
}
.recent-list-item .recent-list-current {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}
.recent-list-item .recent-list-members {
  width: 100%;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-list-menu {
  position: relative;
  flex: none;
}
.recent-list-kebab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
}
.recent-list-kebab:hover {
  background: #f0f0f0;
  color: var(--text);
}
.recent-list-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 10;
  overflow: hidden;
}
.recent-list-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.recent-list-dropdown-item:hover {
  background: #f9fafb;
}
.recent-list-dropdown-item-danger {
  color: #d92d20;
}
.recent-list-dropdown-item-danger:hover {
  background: #fef2f2;
}

/* Sidebar */
.sidebar-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 20px);
  left: 20px;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.sidebar-toggle:hover { background: #f9fafb; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.4);
  z-index: 60;
}

.sidebar-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 320px;
  max-width: 85vw;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 70;
  padding: 24px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.sidebar-panel.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sidebar-header h2 {
  font-size: 18px;
  margin: 0;
}

.sidebar-new-link {
  display: block;
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 16px;
}
.sidebar-new-link:hover {
  border-color: var(--accent);
  background: #f9fafb;
}

.sidebar-lists {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 8px;
}

.share-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-row input {
  flex: 1;
  font-size: 13px;
  padding: 10px 12px;
  color: var(--text-muted);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-top: 4px;
}
.tab {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Add item form */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.add-form .row {
  display: flex;
  gap: 8px;
}
.add-form .row select {
  flex: none;
  width: 130px;
}
.add-form .row input {
  flex: 1;
}

/* Items list */
.items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.item.done { opacity: 0.55; }
.item-check {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
}
.item-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  word-break: break-word;
}
.item.done .item-title { text-decoration: line-through; }
.item-notes {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 6px;
  word-break: break-word;
}
.item-notes a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}
.item-notes a:hover {
  color: var(--accent-dark);
}
.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-read { background: #eef2ff; color: #4338ca; }
.badge-watch { background: #fef2f2; color: #b91c1c; }
.badge-listen { background: #f0fdf4; color: #15803d; }
.badge-visit { background: #fffbeb; color: #b45309; }
.badge-eat { background: #fdf2f8; color: #be185d; }
.badge-other { background: #f3f4f6; color: #374151; }

.item-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2328;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.modal h2 {
  font-size: 17px;
  margin: 0 0 8px;
}
.modal p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
}
.modal-actions {
  display: flex;
  gap: 8px;
}
.modal-actions .btn { width: auto; flex: 1; }

.hidden { display: none !important; }

.brand {
  text-align: center;
  margin-bottom: 8px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  body { padding: calc(env(safe-area-inset-top, 0px) + 76px) 12px 24px; }
  .card { padding: 22px; }
  .add-form .row { flex-wrap: wrap; }
  .add-form .row select { width: 100%; }
}
