:root {
  --bg: #0b0d13;
  --card: #171a23;
  --card-hover: #1d2029;
  --field: #20232e;
  --text: #f3f4f8;
  --muted: #878ea1;
  --accent: #ff7a45;
  --accent-dark: #e35e2b;
  --danger: #ff5d5d;
  --border: #272b38;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

.screen { min-height: 100vh; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.card { width: 100%; max-width: 380px; }

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.brand-wordmark { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.brand-mark { color: var(--text); }
.brand-mark-alt { color: var(--accent); }

.brand-logo {
  border-radius: 22%;
  box-shadow: 0 8px 28px rgba(255, 122, 69, 0.25);
}
.brand-logo.lg { width: 84px; height: 84px; }
.brand-logo.sm { width: 28px; height: 28px; border-radius: 22%; box-shadow: none; }

.brand-sm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.brand-sm .brand-wordmark { font-size: 17px; font-weight: 800; }
.brand-sm .brand-mark-alt { color: var(--accent); }

.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.req { color: var(--accent); }

input, textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  margin-top: 10px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, opacity 0.15s;
}
input.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; letter-spacing: 0.5px; }
input:focus, textarea:focus { border-color: var(--accent); }
input:disabled { opacity: 0.4; }

.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.08s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:active { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,93,93,0.4); }

.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  max-width: 640px;
  margin: 0 auto;
}

.icon-btn {
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.icon-btn:active { background: var(--card-hover); }
.icon-btn.sm { width: 42px; height: 42px; font-size: 16px; }
.icon-btn.ghost-icon { background: transparent; border: none; font-size: 20px; color: var(--muted); }

.toolbar {
  display: flex;
  gap: 8px;
  padding: 6px 16px 10px;
  max-width: 640px;
  margin: 0 auto;
}
.toolbar input { margin-top: 0; }
.toolbar .btn { width: auto; white-space: nowrap; margin-top: 0; }

.entry-list {
  padding: 4px 16px 90px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
}

.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.entry-card:active { transform: scale(0.99); background: var(--card-hover); }

.entry-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}
.entry-avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 19px; }

.entry-info { min-width: 0; flex: 1; }
.entry-name {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-copy {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
  border-radius: 8px;
}
.quick-copy:active { background: var(--field); }

.chevron {
  color: var(--muted);
  font-size: 20px;
  flex-shrink: 0;
  opacity: 0.6;
}

.bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 16px 16px 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.dot { color: var(--muted); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.15s ease-out;
}
@media (min-width: 560px) { .modal-overlay { align-items: center; } }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.2s cubic-bezier(.2,.8,.3,1);
  border: 1px solid var(--border);
  border-bottom: none;
}
@media (min-width: 560px) {
  .modal { border-radius: 22px; border-bottom: 1px solid var(--border); }
}

.modal h2 { margin-top: 0; font-size: 19px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-top: 16px; font-weight: 600; }

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.label-row label { margin-top: 0; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.input-row { display: flex; gap: 6px; align-items: center; }
.input-row input { flex: 1; margin-top: 10px; }

.modal-actions { display: flex; gap: 8px; margin-top: 22px; }
.modal-actions .btn { width: auto; margin-top: 0; padding: 12px 18px; }
.spacer { flex: 1; }

/* View modal */
.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.view-title {
  font-size: 19px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--field);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
}
.detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 28px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.detail-value {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  overflow-wrap: break-word;
}
.detail-value.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; letter-spacing: 1px; }
.detail-value.empty { color: var(--muted); font-style: italic; font-size: 13px; letter-spacing: 0; }

.detail-actions { display: flex; gap: 2px; flex-shrink: 0; }
.detail-actions button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.detail-actions button:active { background: var(--card-hover); }

.detail-notes-wrap { margin-top: 14px; }
.detail-notes {
  margin-top: 6px;
  padding: 12px 14px;
  background: var(--field);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #272b38;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
