:root {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --bg-elev2: #263449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dark: #0284c7;
  --danger: #f87171;
  --danger-dark: #7f1d1d;
  --border: #334155;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior: none;
}

.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  animation: fadein .18s ease-out;
}

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

.brand {
  text-align: center;
  margin: 12vh 0 32px;
}
.brand-icon { font-size: 56px; }
.brand h1 { margin: 8px 0 4px; font-size: 26px; letter-spacing: 0.5px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }

.stack { display: flex; flex-direction: column; gap: 14px; }

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input[type="text"], input[type="password"], input[type="email"], input[type="url"], textarea {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  width: 100%;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  width: 100%;
  outline: none;
  appearance: none;
}

input[type="file"] {
  color: var(--muted);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
}
input[type="file"]::file-selector-button {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 10px;
  font-family: inherit;
  font-size: 13.5px;
}

.input-with-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-with-actions input { flex: 1; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn.primary { background: var(--accent); color: #04212f; }
.btn.primary:active { background: var(--accent-dark); }
.btn.ghost { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); }
.btn.text { background: transparent; color: var(--accent); font-weight: 500; }
.btn.danger { background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.35); }

.hint {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.topbar h2 { flex: 1; margin: 0; font-size: 19px; }

.icon-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
}

.search-wrap { margin-bottom: 14px; }

.entry-list { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.entry-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.entry-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-dark);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.entry-info { flex: 1; min-width: 0; }
.entry-info .title { font-size: 15.5px; font-weight: 600; }
.entry-info .subtitle { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-copy-btn {
  background: var(--bg-elev2);
  border: none;
  color: var(--accent);
  border-radius: 8px;
  width: 36px; height: 36px;
  font-size: 15px;
}

.empty-state { text-align: center; margin-top: 20vh; }

.fab {
  position: fixed;
  right: 22px;
  bottom: calc(28px + env(safe-area-inset-bottom));
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #04212f;
  font-size: 28px;
  border: none;
  box-shadow: 0 6px 18px rgba(56,189,248,0.4);
  cursor: pointer;
}

.row-actions { display: flex; gap: 10px; margin-top: 8px; }
.row-actions .btn { width: auto; flex: 1; }

.settings-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.settings-card h3 { margin: 0 0 10px; font-size: 15px; }
.settings-card .btn { margin-top: 10px; }

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ---- elenco pagine (schermata principale) ---- */

.list-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 8px 2px 0;
}

.page-card .entry-avatar { background: var(--bg-elev2); }

.entry-chevron {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
