* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: #f8fafc;
  color: #1e293b;
}

.hidden { display: none !important; }

/* Login */
.login-card {
  max-width: 380px;
  margin: 15vh auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  text-align: center;
}

.login-card h1 { color: #4f46e5; margin-bottom: .25rem; }
.login-card p { color: #64748b; margin-bottom: 1.5rem; }

.login-card input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: .75rem;
  outline: none;
  transition: border-color .2s;
}

.login-card input:focus { border-color: #4f46e5; }

.login-card button {
  width: 100%;
  padding: .75rem;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: .5rem;
}

.login-card button:hover { background: #4338ca; }
.error { color: #dc2626; font-size: .875rem; }

/* Header */
header {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 { font-size: 1.25rem; color: #4f46e5; margin: 0; }

.header-actions { display: flex; gap: .5rem; }

/* Buttons */
.btn-primary {
  padding: .5rem 1rem;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .875rem;
  cursor: pointer;
}
.btn-primary:hover { background: #4338ca; }

.btn-secondary {
  padding: .5rem 1rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .875rem;
  cursor: pointer;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
  padding: .5rem 1rem;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: .875rem;
  cursor: pointer;
}
.btn-danger:hover { background: #fee2e2; }

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem;
}

.project-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  transition: box-shadow .2s;
}

.project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }

.project-card h3 {
  margin: 0 0 .5rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.project-card .meta {
  font-size: .8rem;
  color: #64748b;
  margin-bottom: .75rem;
}

.project-card .meta span { margin-right: 1rem; }

.project-card .url {
  font-size: .8rem;
  background: #f8fafc;
  padding: .5rem .75rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  word-break: break-all;
  margin-bottom: .75rem;
}

.project-card .url a { color: #4f46e5; text-decoration: none; }
.project-card .url a:hover { text-decoration: underline; }

.project-card .actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 600;
}

.badge-key { background: #fef3c7; color: #92400e; }
.badge-public { background: #d1fae5; color: #065f46; }
.badge-expired { background: #fee2e2; color: #991b1b; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 { margin-top: 0; }

.modal-content label {
  display: block;
  font-size: .875rem;
  color: #475569;
  margin-bottom: .75rem;
  font-weight: 500;
}

.modal-content input[type="text"],
.modal-content input[type="file"],
.modal-content input[type="datetime-local"],
.modal-content select {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .875rem;
  margin-top: .25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.5rem;
}

.progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-fill {
  height: 100%;
  background: #4f46e5;
  width: 0%;
  transition: width .3s;
}

#no-projects {
  text-align: center;
  color: #64748b;
  padding: 4rem 2rem;
  font-size: 1.1rem;
}

/* Language toggle */
.lang-toggle {
  padding: .4rem .7rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: .75rem;
  cursor: pointer;
  font-weight: 600;
}
.lang-toggle:hover { background: #e2e8f0; }

.lang-switch-login {
  text-align: right;
  margin-bottom: .5rem;
}
.lang-switch-login button {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .75rem;
  cursor: pointer;
}

/* Header link styled as button */
.header-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Block button */
.btn-block { width: 100%; margin-top: .5rem; }

/* Backup section */
.backup-section { margin: 1rem 0; }
.backup-section hr { border: none; border-top: 1px solid #e2e8f0; margin: 1.5rem 0; }

/* Modal input for password */
.modal-content input[type="password"] {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .875rem;
  margin-top: .25rem;
}

/* Responsive */
@media (max-width: 640px) {
  .projects-grid { grid-template-columns: 1fr; padding: 1rem; }
  header { padding: 1rem; }
  .header-actions { flex-wrap: wrap; }
  .modal-content { padding: 1.5rem; }
}
