* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f7f7f8;
  color: #1a1a1a;
  margin: 0;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

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

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

.row {
  display: flex;
  gap: 8px;
}

.row > * {
  flex: 1;
  min-width: 0;
}

input, select, button {
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d0d0d5;
}

button {
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover {
  background: #333;
}

.link-btn {
  background: none;
  border: none;
  color: #888;
  padding: 4px;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.save-form {
  margin-bottom: 12px;
}

.save-feedback {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  font-weight: 600;
}

.save-feedback.success {
  background: #d7f5df;
  color: #146c2e;
}

.save-feedback.error {
  background: #fbdada;
  color: #9c1c1c;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters a {
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: #ececef;
}

.filters a.active {
  background: #1a1a1a;
  color: #fff;
}

ul.links {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.links li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e5e8;
}

ul.links:not([data-layout="look-02"]) li a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a1a1a;
}

.group-tag {
  font-size: 0.75rem;
  color: #888;
  background: #ececef;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

ul.links[data-layout="look-02"] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ul.links[data-layout="look-02"] .link-item {
  display: block;
  background: #fff;
  border: 1px solid #e5e5e8;
  border-radius: 12px;
  padding: 14px 16px;
}

.link-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.link-title {
  flex: 1;
  min-width: 0;
  color: #1a1a1a;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
}

.external-btn {
  flex-shrink: 0;
  color: #888;
  padding: 2px;
  line-height: 0;
}

.external-btn:hover {
  color: #1a1a1a;
}

.link-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.link-domain {
  font-size: 0.8rem;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e5e8;
}

.link-actions .edit-btn,
.link-actions form.inline {
  flex: 1;
}

.link-actions .edit-btn,
.link-actions button[type="submit"] {
  width: 100%;
  background: none;
  color: #444;
  border: 1px solid #d0d0d5;
  padding: 8px;
  font-size: 0.9rem;
}

.link-actions .edit-btn:hover,
.link-actions button[type="submit"]:hover {
  background: #f2f2f4;
}

form.inline {
  display: inline;
}

.muted {
  color: #888;
  font-size: 0.9rem;
}

ul.flashes {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

ul.flashes li {
  background: #fff3cd;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

dialog#edit-dialog {
  border: none;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
}

dialog#edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog#edit-dialog h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}

.type-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: #888;
  background: #ececef;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.detail h1 {
  margin: 8px 0 0;
}

.detail-url {
  display: block;
  word-break: break-all;
  color: #666;
  font-size: 0.85rem;
  margin: 8px 0 16px;
}

.detail-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.status-pill {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #ececef;
  color: #666;
}

.status-pill.status-done { background: #d7f5df; color: #146c2e; }
.status-pill.status-partial { background: #fff3cd; color: #8a6416; }
.status-pill.status-error { background: #fbdada; color: #9c1c1c; }
.status-pill.status-pending { background: #dce8fb; color: #1a4d8f; }

.content-section {
  border: 1px solid #e5e5e8;
  border-radius: 8px;
  margin-top: 16px;
  overflow: hidden;
}

.content-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  background: #f2f2f4;
}

.content-section summary::-webkit-details-marker {
  display: none;
}

.content-section .chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-right: 2px;
}

.content-section[open] .chevron {
  transform: rotate(-135deg);
}

.content-section-body {
  position: relative;
  padding: 12px;
}

.copy-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #d0d0d5;
  border-radius: 6px;
  color: #666;
  cursor: pointer;
  z-index: 1;
}

.copy-btn:hover {
  background: #f2f2f4;
  color: #1a1a1a;
}

.copy-btn.copied {
  color: #146c2e;
  border-color: #146c2e;
  font-weight: 700;
}

.content-box {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid #e5e5e8;
  border-radius: 8px;
  padding: 12px 44px 12px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  max-height: 480px;
  overflow-y: auto;
}
