.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

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

.item-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
  animation: card-in 0.2s var(--ease);
}

.item-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: var(--shadow-md), 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
  transform: translateY(-2px);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-card.pinned {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow-sm);
}

.item-card.pinned:hover {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), var(--shadow-md);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}

.type-icon.note {
  background: var(--success-soft);
  color: var(--success);
}
.type-icon.url {
  background: color-mix(in srgb, #3b82f6 16%, transparent);
  color: #3b82f6;
}
:root[data-theme='dark'] .type-icon.url {
  color: #60a5fa;
}
.type-icon.password {
  background: var(--danger-soft);
  color: var(--danger);
}
.type-icon.file {
  background: var(--warning-soft);
  color: var(--accent);
}
.type-icon.identity {
  background: color-mix(in srgb, #8b5cf6 16%, transparent);
  color: #8b5cf6;
}
:root[data-theme='dark'] .type-icon.identity {
  color: #a78bfa;
}

.item-title {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.card-actions .icon-btn-round {
  width: 32px;
  height: 32px;
}

.card-actions .icon-btn-round .icon {
  width: 16px;
  height: 16px;
}

.card-actions .icon-btn-round.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.card-body {
  margin-top: 10px;
  margin-left: 39px;
  font-size: 14px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.note-content {
  white-space: pre-wrap;
}

.card-body a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.card-body a:hover {
  text-decoration: underline;
}

.url-row,
.password-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.password-row {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: var(--radius-sm);
}

.copy-btn:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

.copy-btn .icon {
  width: 14px;
  height: 14px;
}

.card-meta {
  margin-top: 12px;
  margin-left: 39px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.category-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.expiry-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  margin-top: 6px;
}

.expiry-badge.expiry-ok {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.expiry-badge.expiry-soon {
  background: var(--warning-soft);
  color: var(--accent);
}

.expiry-badge.expiry-expired {
  background: var(--danger-soft);
  color: var(--danger);
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-full);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.timestamp {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ---------- New/Edit modal (item-specific) ---------- */
.type-picker {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.type-fields {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.type-fields.active {
  display: flex;
}

.password-field-wrap input {
  padding-right: 40px;
}

/* ---------- File upload ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.dropzone .icon {
  width: 22px;
  height: 22px;
}

.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.current-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: 13px;
  margin-bottom: 4px;
}

.current-file .type-icon {
  width: 26px;
  height: 26px;
}

.current-file-name {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.current-file-size {
  color: var(--text-faint);
  font-size: 11.5px;
}

.current-file-meta {
  flex: 1;
  min-width: 0;
}

/* ---------- File item card body ---------- */
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.file-meta {
  min-width: 0;
}

.file-name {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.file-size {
  font-size: 12px;
  color: var(--text-faint);
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  margin-top: 2px;
}

.download-link:hover {
  text-decoration: underline;
}

.download-link .icon {
  width: 13px;
  height: 13px;
}
