:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #4f6ef7;
  --accent-hover: #6b85ff;
  --danger: #e05260;
  --danger-hover: #f06070;
  --success: #3ecf8e;
  --text: #e8eaf0;
  --text-muted: #8891aa;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon { font-size: 22px; }
.logo span { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.session-info { font-size: 13px; color: var(--text-muted); }

main { padding: 36px 24px; max-width: 1100px; margin: 0 auto; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; padding: 6px 13px; font-size: 13px; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-icon {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 14px;
}
.btn-icon:hover { color: var(--text); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 7px; letter-spacing: 0.03em; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 2px;
}
.toggle-pw:hover { color: var(--text); }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error { background: rgba(224,82,96,0.15); border: 1px solid rgba(224,82,96,0.4); color: #f08090; }
.alert-info { background: rgba(79,110,247,0.12); border: 1px solid rgba(79,110,247,0.3); color: #8aa0ff; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 60% 30%, rgba(79,110,247,0.07) 0%, transparent 60%), var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-card .logo { font-size: 22px; margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 36px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ── Dashboard ── */
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.count-badge {
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap input {
  padding-left: 38px;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}
.search-wrap form { display: flex; gap: 0; }
.search-wrap input { border-radius: 7px 0 0 7px; }
.search-wrap .btn { border-radius: 0 7px 7px 0; font-size: 13px; padding: 9px 14px; }

/* ── Credentials table ── */
.creds-table {
  width: 100%;
  border-collapse: collapse;
}
.creds-table thead tr {
  border-bottom: 1px solid var(--border);
}
.creds-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
}
.creds-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.creds-table tbody tr:hover { background: var(--surface2); }
.creds-table tbody tr:last-child td { border-bottom: none; }

.service-cell { display: flex; align-items: center; gap: 10px; }
.service-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.service-name { font-weight: 600; font-size: 15px; }
.notes-cell { color: var(--text-muted); font-size: 13px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-cell { color: var(--text-muted); font-size: 12px; }
.actions-cell { display: flex; gap: 6px; align-items: center; }

.pw-display {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pw-dots { font-size: 18px; letter-spacing: 3px; color: var(--text-muted); user-select: none; }
.pw-text { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ── Card variant ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 32px; }
.card-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* ── Change password page ── */
.form-page { max-width: 500px; }

/* ── Copy toast ── */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--success);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 18px; margin-bottom: 12px; }
.modal p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .creds-table .meta-cell, .creds-table .notes-cell { display: none; }
  .login-card { padding: 32px 24px; }
  main { padding: 24px 16px; }
}
