:root {
  --ink: #1c2321;
  --ink-soft: #5a6560;
  --paper: #f6f5f1;
  --panel: #ffffff;
  --line: #dcdad2;
  --accent: #2f5d50;
  --accent-hover: #24473d;
  --danger: #a3372c;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.hidden { display: none !important; }

/* ---------- AUTH SCREEN ---------- */
.screen.auth-screen-wrap {}

#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

.brand {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.tagline {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.auth-form { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 10px;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 4px 0 0;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 8px 0 0;
}

.btn-primary {
  margin-top: 16px;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  padding: 9px 14px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-danger {
  padding: 9px 14px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
}

.btn-icon {
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- VAULT SCREEN ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.whoami {
  font-size: 13px;
  color: var(--ink-soft);
}

.vault-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}

.vault-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

#search-input { flex: 1; }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 0;
  font-size: 14px;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-info { min-width: 0; }

.item-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-username {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.item-actions button {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  cursor: pointer;
}
.item-actions button:hover { border-color: var(--ink-soft); }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 35, 33, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px;
}

.modal-small { max-width: 340px; }

.modal h2 {
  margin: 0 0 16px;
  font-size: 17px;
}

#item-form { display: flex; flex-direction: column; }

.password-row {
  display: flex;
  gap: 8px;
}
.password-row input { flex: 1; min-width: 0; }

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

@media (max-width: 480px) {
  .item-card { flex-direction: column; align-items: stretch; }
  .item-actions { justify-content: flex-end; }
}
