/* ============================================================
   credentials.cloud — foglio di stile principale
   ============================================================ */

/* ---------- Reset di base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ink);
	background: var(--bg);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
input, button, textarea, select { font: inherit; }

/* ---------- Variabili tema ---------- */
:root {
	--bg:          #eef2f8;
	--surface:     #ffffff;
	--ink:         #1b2433;
	--ink-soft:    #5b6679;
	--ink-faint:   #97a1b3;
	--brand:       #2563eb;
	--brand-dark:  #1d4ed8;
	--brand-deep:  #0b1f3a;
	--accent:      #06b6d4;
	--danger:      #e11d48;
	--danger-dark: #be123c;
	--line:        #e2e8f2;
	--ring:        rgba(37, 99, 235, .28);
	--shadow-sm:   0 1px 2px rgba(16, 30, 60, .06), 0 2px 8px rgba(16, 30, 60, .05);
	--shadow-md:   0 6px 22px rgba(16, 30, 60, .10);
	--shadow-lg:   0 18px 50px rgba(16, 30, 60, .22);
	--radius:      14px;
	--radius-sm:   10px;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.site-main { flex: 1 0 auto; width: 100%; }

/* ---------- Header / nav ---------- */
.site-header {
	position: sticky; top: 0; z-index: 30;
	background: rgba(255, 255, 255, .82);
	backdrop-filter: saturate(160%) blur(10px);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
	border-bottom: 1px solid var(--line);
}
.site-header__inner {
	display: flex; align-items: center; justify-content: space-between;
	min-height: 62px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }
.brand__mark {
	display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
	color: #fff; background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
	box-shadow: var(--shadow-sm);
}
.brand__text { color: var(--brand-deep); }
.brand__dot { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
	padding: 8px 12px; border-radius: 9px; font-size: .94rem; font-weight: 500; color: var(--ink-soft);
	transition: background .15s, color .15s;
}
.site-nav a:hover { background: #f1f5fb; color: var(--ink); }
.site-nav__logout { color: var(--danger) !important; }
.site-nav__logout:hover { background: #fde8ec !important; }

/* ---------- Bottoni ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
	font-size: .95rem; font-weight: 600; cursor: pointer; white-space: nowrap;
	transition: transform .04s, background .15s, box-shadow .15s, border-color .15s, color .15s;
	-webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #f6f8fc; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-dark); }
.btn--lg { padding: 13px 24px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn__plus { font-size: 1.15em; line-height: 1; margin-top: -1px; }
.link-btn {
	align-self: flex-start; margin-top: 8px; padding: 0; border: 0; background: none;
	color: var(--brand); font-size: .86rem; font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Home: hero ---------- */
.hero { position: relative; overflow: hidden; color: #fff; text-align: center; }
.hero::before {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background: radial-gradient(1200px 500px at 50% -120px, #2a4d8f 0%, transparent 70%),
	            linear-gradient(160deg, var(--brand-deep) 0%, #143b72 55%, #0e2c57 100%);
}
.hero__inner { padding: 76px 20px 88px; max-width: 760px; }
.hero__badge {
	display: inline-block; padding: 5px 14px; margin-bottom: 22px; border-radius: 999px;
	font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
	color: #cfe1ff; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .18);
}
.hero__title { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.02em; font-weight: 800; }
.hero__subtitle { margin: 20px auto 0; max-width: 560px; font-size: clamp(1rem, 2.4vw, 1.18rem); color: #c7d6ee; }
.hero__actions { margin-top: 34px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .btn--ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .28); }
.hero .btn--ghost:hover { background: rgba(255, 255, 255, .16); }

/* ---------- Home: features ---------- */
.features { padding: 64px 0 72px; }
.features__grid { display: grid; gap: 22px; grid-template-columns: repeat(3, 1fr); }
.feature-card {
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 28px 24px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-card__icon {
	display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; border-radius: 13px;
	color: var(--brand); background: linear-gradient(135deg, #e8f0ff, #e3fbff);
}
.feature-card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.feature-card p { color: var(--ink-soft); font-size: .96rem; }

/* ---------- Autenticazione (login) ---------- */
.auth { display: flex; align-items: center; justify-content: center; padding: 56px 20px; min-height: calc(100vh - 62px - 132px); }
.auth__card {
	width: 100%; max-width: 410px; background: var(--surface);
	border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
	padding: 34px 30px;
}
.auth__head { text-align: center; margin-bottom: 24px; }
.auth__icon {
	display: inline-grid; place-items: center; width: 58px; height: 58px; margin-bottom: 14px; border-radius: 16px;
	color: #fff; background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); box-shadow: var(--shadow-md);
}
.auth__title { font-size: 1.5rem; letter-spacing: -.01em; }
.auth__subtitle { color: var(--ink-soft); margin-top: 6px; font-size: .96rem; }
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__error {
	margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem;
	color: var(--danger-dark); background: #fdecef; border: 1px solid #f7c9d3;
}
.auth__foot { text-align: center; margin-top: 22px; color: var(--ink-faint); font-size: .82rem; }

/* ---------- Campi form ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea {
	width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: #fbfcfe; color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 56px; }
.field input:focus, .field textarea:focus {
	outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--ring);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-faint); }
.field--row { flex-direction: row; align-items: center; }
.req { color: var(--danger); }

.field__password { position: relative; display: flex; }
.field__password input { padding-right: 46px; }
.field__toggle {
	position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
	width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; cursor: pointer;
	display: grid; place-items: center; opacity: .55; transition: opacity .15s, background .15s;
}
.field__toggle:hover { opacity: 1; background: #eef2f8; }
.field__toggle.is-on { opacity: 1; color: var(--brand); }
.eye { font-size: 1.05rem; line-height: 1; }

/* Input "segreti" senza type=password: mascherati via CSS, così il browser non li
   tratta da credenziali (niente popup "salvare la password?" né autofill) */
.input-mask { -webkit-text-security: disc; }

.checkbox { display: inline-flex; align-items: center; gap: 9px; font-size: .92rem; color: var(--ink-soft); cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }

/* ---------- Pagina credenziali ---------- */
.creds { padding: 34px 20px 56px; }
.creds__toolbar {
	display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
	flex-wrap: wrap; margin-bottom: 24px;
}
.creds__heading h1 { font-size: 1.7rem; letter-spacing: -.01em; }
.creds__count { color: var(--ink-soft); font-size: .92rem; margin-top: 2px; }
.creds__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search { position: relative; display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; color: var(--ink-faint); pointer-events: none; display: grid; }
.search input {
	width: 250px; max-width: 60vw; padding: 10px 14px 10px 38px;
	border: 1px solid var(--line); border-radius: 999px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }

.creds__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* Card credenziale */
.cred-card {
	display: flex; flex-direction: column; gap: 12px; background: var(--surface);
	border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cred-card:hover { box-shadow: var(--shadow-md); border-color: #d4ddec; }
.cred-card__top { display: flex; align-items: center; gap: 12px; }
.cred-card__avatar {
	flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
	color: #fff; font-weight: 700; font-size: 1.05rem; background: linear-gradient(135deg, var(--brand), var(--accent));
	text-transform: uppercase;
}
.cred-card__title { min-width: 0; }
.cred-card__title h3 { font-size: 1.04rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cred-card__title a { color: var(--brand); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cred-card__title a:hover { text-decoration: underline; }

.cred-card__fields { display: flex; flex-direction: column; gap: 9px; }
.cred-card__empty { color: var(--ink-faint); font-size: .9rem; font-style: italic; }
.cred-row { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.cred-row__label {
	flex: 0 0 auto; max-width: 96px; color: var(--ink-faint); font-size: .76rem;
	text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cred-row__value {
	flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
}
.cred-row__value.is-mask { letter-spacing: .12em; }
.cred-row__link { font-family: inherit; color: var(--brand); }
.cred-row__link:hover { text-decoration: underline; }
.creds__noresult { color: var(--ink-soft); padding: 24px 4px; }
.icon-btn {
	flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
	border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-soft);
	transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: #f1f5fb; color: var(--brand); border-color: #d4ddec; }
.icon-btn.is-copied { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }

.cred-card__notes { font-size: .88rem; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 10px; }
.cred-card__actions { display: flex; gap: 8px; margin-top: 2px; }
.cred-card__actions .btn { flex: 1; padding: 8px 12px; font-size: .88rem; }

/* Card passphrase: prima cella della griglia, stesse dimensioni delle altre card */
.cred-card--vault { border-style: dashed; border-color: #c9d6ea; }
.cred-card--vault:hover { border-color: var(--brand); }
.cred-card--vault .cred-card__avatar { background: linear-gradient(135deg, var(--accent), var(--brand)); }
.cred-card__hint { color: var(--ink-soft); font-size: .88rem; }
.cred-card--vault form { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.cred-card--vault .field__password input { width: 100%; padding: 11px 46px 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcfe; color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s; }
.cred-card--vault .field__password input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--ring); }
.cred-card--vault .field__password input::placeholder { color: var(--ink-faint); }

/* Stato vuoto */
.creds__empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.creds__empty-icon {
	display: inline-grid; place-items: center; width: 86px; height: 86px; margin-bottom: 18px;
	border-radius: 24px; color: var(--brand); background: linear-gradient(135deg, #e8f0ff, #e3fbff);
}
.creds__empty h2 { font-size: 1.25rem; color: var(--ink); margin-bottom: 6px; }
.creds__empty p { margin-bottom: 20px; }

/* ---------- Modali ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11, 31, 58, .55); backdrop-filter: blur(2px); }
.modal__dialog {
	position: relative; width: 100%; max-width: 480px; margin: 7vh auto 0; max-height: 86vh; overflow: auto;
	background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
	animation: modalIn .18s ease-out;
}
.modal--sm .modal__dialog { max-width: 400px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal__title { font-size: 1.2rem; }
.modal__close { border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--ink-faint); cursor: pointer; padding: 0 4px; }
.modal__close:hover { color: var(--ink); }
.modal__body { padding: 16px 22px 22px; display: flex; flex-direction: column; gap: 15px; }
.modal__text { color: var(--ink-soft); }
.modal__footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.modal__footer .btn { min-width: 104px; }

/* ---------- Editor: blocco campi dinamici ---------- */
.fields-block { display: flex; flex-direction: column; gap: 10px; }
.fields-block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fields-block__title { font-size: .9rem; font-weight: 700; color: var(--ink); }
.fields-block__hint { font-size: .8rem; color: var(--ink-faint); }
.fields-list { display: flex; flex-direction: column; gap: 10px; }

.ff { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcfe; padding: 10px; }
.ff__head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ff__label {
	flex: 1 1 auto; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
	background: #fff; font-size: .85rem; font-weight: 600; color: var(--ink-soft);
}
.ff__label:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); color: var(--ink); }

.ff__icon {
	flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
	border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-soft);
	transition: background .15s, color .15s, border-color .15s;
}
.ff__icon:hover { background: #f1f5fb; color: var(--brand); border-color: #d4ddec; }
.ff__remove:hover { color: var(--danger); border-color: #f3c6d0; background: #fdecef; }
.ff.is-secret .ff__lock { color: var(--brand); border-color: #c9d8f5; background: #eef3ff; }

.ff__valwrap { position: relative; display: flex; }
.ff__value {
	width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
	color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem;
}
.ff__value:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.ff__valwrap .ff__icon { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; background: none; }
.ff__valwrap .ff__icon:hover { background: #eef2f8; }
.ff__reveal { right: 36px; }
.ff__reveal.is-on { color: var(--brand); }
.ff__gen { right: 6px; }
.ff:not(.is-secret) .ff__reveal, .ff:not(.is-secret) .ff__gen { display: none; }
.ff.is-secret .ff__value { padding-right: 70px; }

/* ---------- Footer ---------- */
.site-footer { flex-shrink: 0; background: var(--brand-deep); color: #c7d6ee; }
.site-footer__inner { padding: 26px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer__copy { font-weight: 600; color: #e8f0ff; font-size: .92rem; }
.site-footer__note { font-size: .88rem; color: #91a6c8; }

/* ---------- Toast ---------- */
.toast {
	position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
	background: #0f2647; color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .92rem; font-weight: 500;
	box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
	.features__grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
}
@media (max-width: 620px) {
	.site-nav a { padding: 8px 9px; font-size: .88rem; }
	.brand__text { font-size: 1.02rem; }
	.hero__inner { padding: 58px 18px 64px; }
	.hero__actions .btn { width: 100%; }
	.creds__toolbar { align-items: stretch; }
	.creds__tools { width: 100%; }
	.search { flex: 1; }
	.search input { width: 100%; max-width: none; }
	.creds__grid { grid-template-columns: 1fr; }
	.auth__card { padding: 28px 22px; box-shadow: var(--shadow-md); }
	.modal__dialog { margin: 0; position: absolute; bottom: 0; left: 0; right: 0; max-width: none;
		border-radius: 18px 18px 0 0; max-height: 92vh; animation: sheetIn .22s ease-out; }
	@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
}
@media (max-width: 380px) {
	.cred-row { flex-wrap: wrap; }
	.cred-row__label { flex: 1 0 100%; max-width: none; }
}
