:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #252540;
  --accent: #4f8cff;
  --accent-hover: #6ba0ff;
  --text: #e0e0e0;
  --text-muted: #888;
  --danger: #ff4757;
  --danger-hover: #ff6b7a;
  --success: #2ed573;
  --border: #333;
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Screens */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Auth Cards (Login/Register) */
.auth-card {
  max-width: 400px;
  margin: auto;
  padding: 40px;
  background: var(--bg-card);
  border-radius: 12px;
  text-align: center;
}

.auth-card h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.auth-card p {
  margin-bottom: 20px;
}

.auth-card input {
  width: 100%;
  margin-bottom: 12px;
}

.auth-card button {
  width: 100%;
  margin-top: 8px;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px !important;
}

/* Inputs */
input, textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  border-color: var(--accent);
}

input[type="search"] {
  width: 100%;
}

textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

/* Buttons */
button {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  background: var(--bg-input);
  color: var(--text);
  transition: background 0.2s;
}

button:hover {
  background: #333;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(255, 71, 87, 0.15);
}

.btn-icon {
  background: none;
  padding: 6px 8px;
  font-size: 16px;
  border-radius: 4px;
}

.btn-icon:hover {
  background: var(--bg-input);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 22px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

/* Search */
.search-bar {
  padding: 16px 24px;
}

/* Password List */
#password-list {
  padding: 0 24px 24px;
}

.entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: background 0.2s;
}

.entry:hover {
  background: #222240;
}

.entry-info {
  flex: 1;
  min-width: 0;
}

.entry-site {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-username {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 12px;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

.modal label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 14px;
}

.modal label:first-of-type {
  margin-top: 0;
}

.modal input[type="text"],
.modal input[type="password"],
.modal textarea {
  width: 100%;
}

.password-field {
  display: flex;
  gap: 4px;
}

.password-field input {
  flex: 1;
  min-width: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Import */
input[type="file"] {
  margin: 12px 0;
}

#import-preview {
  padding: 8px 0;
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 200;
  background: var(--success);
  color: #000;
  transition: opacity 0.3s;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

/* Responsive */
@media (max-width: 600px) {
  .auth-card {
    margin: 20px;
    padding: 24px;
  }

  header {
    padding: 16px;
  }

  .search-bar {
    padding: 12px 16px;
  }

  #password-list {
    padding: 0 16px 16px;
  }

  .header-actions button {
    padding: 8px 12px;
    font-size: 13px;
  }
}
