/* SomaschiPass - stile. Sobrio, leggibile, adatto a chi non e' pratico. */
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #e8720c;      /* arancio */
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --ok: #1e874b;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--accent); letter-spacing: .3px; }
.spacer { flex: 1; }
.whoami { color: var(--muted); font-size: 14px; margin-right: 6px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 22px 18px 60px; }
.narrow { max-width: 440px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 18px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }
input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 16px; background: #fff; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 9px; cursor: pointer;
  padding: 11px 16px; font-size: 15px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(.96); }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f8f8f8; }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap-r { flex-wrap: wrap; }

/* Ricerca + lista voci */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.list { display: grid; gap: 10px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.item:hover { border-color: var(--accent); }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 13px; }
.item .grow { flex: 1; min-width: 0; }
.item .grow > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { color: var(--muted); text-align: center; padding: 30px; }

/* Modale */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 20; overflow: auto;
}
.modal { width: 100%; max-width: 520px; }
.modal.wide { max-width: 780px; }
.modal .card { overflow-x: auto; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .spacer { flex: 1; }

.pw-field { position: relative; }
.pw-field .reveal {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer; color: var(--muted);
  font-size: 13px; padding: 4px 6px;
}

.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: #3949ab; }
.badge.admin { background: #fff3e0; color: #b25a00; }
.badge.no { background: #fdecea; color: var(--danger); }
.badge.ok { background: #e7f6ee; color: var(--ok); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }

.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; padding: 10px 12px; border-radius: 9px; margin: 10px 0; }
.notice { background: #eef6ff; color: #14508a; border: 1px solid #cfe3fb; padding: 10px 12px; border-radius: 9px; margin: 10px 0; font-size: 14px; }
.loading { color: var(--muted); text-align: center; padding: 40px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 14px; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.gen-controls { display: grid; gap: 8px; margin: 10px 0; }
.gen-controls .row { justify-content: space-between; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.strength { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.strength > span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .whoami { width: 100%; order: 5; }
}
