/* ===========================
   1. RESET & BASE
=========================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(180deg, #4F6FAE, #A8BCE6);
    color: #fff;
}

/* ===========================
   2. LAYOUT
=========================== */

.wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 24px 70px;
    min-height: 100vh;
}

/* ===========================
   3. HEADER
=========================== */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 28px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-org {
    font-size: 12px;
    opacity: 0.6;
}

.gear-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    text-decoration: none;
    color: #fff;
    font-size: 16px;
}

/* ===========================
   4. MENU
=========================== */

.main-menu {
    display: flex;
    gap: 18px;
    margin: 30px 0;
}

.menu-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 0;
    border-radius: 22px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    font-size: 16px;
    color: #fff;
    text-decoration: none;
}

/* ===========================
   5. CARD
=========================== */

.card {
    background: #ffffff;
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 40px;
    color: #2b2f36;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

/* ===========================
   6. BUTTONS
=========================== */

.btn {
    padding: 14px 24px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    min-width: 0;          /* importante */
}

.btn-primary {
    background: linear-gradient(180deg,#355c9d,#2f4f86);
    color: white;
}

.btn-light{
    background:rgba(255,255,255,0.85);
    border:none;
    color:#333;
}

/* ===========================
   7. FORMS
=========================== */

textarea {
    width: 100%;
    min-height: 110px;
    padding: 16px;
    border-radius: 18px;
    border: 2px solid #dbe3f1;
    font-size: 16px;
    resize: none;
}

.input-actions {
    display: flex;
    gap: 14px;
    margin-top: 18px;
}

/* ===========================
   8. HOME
=========================== */

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-top: 30px;
}

.thought-card {
    background: rgba(255,255,255,0.18);
    padding: 18px;
    border-radius: 18px;
    margin-top: 16px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.08);
}

.thought-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.thought-meta {
    font-size: 14px;
    opacity: 0.85;
}

/* ===========================
   9. RECAP
=========================== */

.recap-card {
    background: rgba(255,255,255,0.18);
    padding: 22px;
    border-radius: 20px;
    margin-bottom: 26px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.08);
}

.field-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
}

.field-content {
    font-size: 15px;
    line-height: 1.4;
}

.edit-icon {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
}

.edit-form {
    display: none;
    margin-top: 8px;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-top: 6px;
}

.card-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    flex-wrap:wrap;
}

.card-actions .btn {
    flex: 0 0 auto;               /* come recap */
}

.card-actions form {
    margin: 0;
}

.recap-card:hover {
    transform: translateY(-2px);
    transition: 0.2s ease;
}

.page-container {
    width: 100%;
}

/* ===========================
   SELECT - Reflecta Style
=========================== */

.edit-form select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 14px;
    border: 2px solid #dbe3f1;
    background: #ffffff;
    color: #2b2f36;
    appearance: none;
    cursor: pointer;
}

/* Effetto focus coerente con UI */
.edit-form select:focus {
    outline: none;
    border-color: #355c9d;
    box-shadow: 0 0 0 3px rgba(53,92,157,0.15);
}

.edit-form select option {
    font-size: 16px;
    padding: 8px;
}

/* =========================
   AUTH (guest pages)
========================= */

.auth-body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

.auth-shell{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background: linear-gradient(180deg, #4F6FAE 0%, #5f7fbf 35%, #A8BCE6 100%);
}

.auth-card{
  width: min(520px, 100%);
  background:#fff;
  border-radius:22px;
  padding:28px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.auth-title{
  margin:0 0 8px 0;
  font-size:28px;
  font-weight:800;
  color:#1f2937;
}

.auth-subtitle{
  margin:0 0 14px 0;
  color:#6b7280;
  line-height:1.35;
}

.auth-form{ margin-top:14px; }

.auth-label{
  display:block;
  margin:14px 0 6px 0;
  font-size:13px;
  color:#6b7280;
  font-weight:600;
}

.auth-input{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid #d7deea;
  font-size:16px;
  outline:none;
}

.auth-input:focus{
  border-color:#2F4F86;
  box-shadow:0 0 0 4px rgba(47,79,134,0.15);
}

.auth-primary{
  margin-top:18px;
  width:100%;
  padding:14px 18px;
  border-radius:16px;
  border:none;
  background: linear-gradient(180deg, #355c9d, #2f4f86);
  color:#fff;
  font-weight:800;
  font-size:16px;
  cursor:pointer;
}

.auth-links{
  margin-top:16px;
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  font-size:14px;
}

.auth-links a{
  color:#2F4F86;
  text-decoration:none;
  font-weight:700;
}

.auth-links a:hover{ text-decoration:underline; }

.auth-alert{
  background:#fde8e8;
  border:1px solid #f8b4b4;
  color:#b91c1c;
  padding:12px 14px;
  border-radius:14px;
  margin-top:12px;
}

.auth-divider{
  height:1px;
  background:#e5e7eb;
  margin:18px 0 6px 0;
}

/* =========================
   ADMIN
========================= */

.page-title{
  font-size:28px;
  font-weight:800;
  margin:16px 0;
  color:#fff;
}

.admin-actions{
  display:flex;
  justify-content:flex-end;
  margin-bottom:12px;
}

.admin-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px;
}

.admin-table th{
  text-align:left;
  font-size:12px;
  color:#6b7280;
  font-weight:800;
  padding:0 12px;
}

.admin-table td{
  background:#f7f9fd;
  padding:12px;
  border-top:1px solid #e5e7eb;
  border-bottom:1px solid #e5e7eb;
}

.admin-table tr td:first-child{
  border-left:1px solid #e5e7eb;
  border-radius:12px 0 0 12px;
}

.admin-table tr td:last-child{
  border-right:1px solid #e5e7eb;
  border-radius:0 12px 12px 0;
}

.admin-table .right{
  text-align:right;
  white-space:nowrap;
}

.inline{ display:inline-block; margin-left:8px; }

.toast-success{
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.35);
  color:#fff;
  padding:10px 12px;
  border-radius:14px;
  margin: 10px 0 16px 0;
}

.page-logout{
  margin-top:40px;
  text-align:center;
}

.logout-link{
  background:none;
  border:none;
  color:rgba(255,255,255,0.8);
  font-weight:700;
  cursor:pointer;
}

.logout-link:hover{
  text-decoration:underline;
}

.page-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin:20px 0;
}

.btn-link-clean {
    background: none;
    border: none;
    color: white;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}


.page-header .btn {
    flex: 0 0 auto;
}

.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-weight: 600;
}

.alert-success {
    background: rgba(46, 204, 113, 0.18);
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.alert-error {
    background: rgba(231, 76, 60, 0.18);
    border: 1px solid rgba(231, 76, 60, 0.4);
}

/* CARD */
.card {
    background: #ffffff;
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 40px;
    color: #2b2f36;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

/* HEADER UTENTE */

.user-name-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-name {
    font-size: 22px;   /* prima era 26 */
    font-weight: 700;
    color: #2f2f2f;
}

.user-email {
    font-size: 16px;
    color: #555;
}

/* BADGE */

.status-active {
    background: #32c36c;
    color: white;
}

.status-inactive {
    background: #e14b4b;
    color: white;
}

/* BOTTONI ALLINEATI */
.btn-secondary,
.btn-secondary-light {
    height: 44px;   /* altezza uniforme */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
}

.user-status {
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
}

.status-inactive {
    background: #e14b4b;
    color: white;
}

.recap-card:first-of-type {
    margin-top: 10px;
}

.recap-card {
    margin-top: 12px;
}



.new-user-btn {
    flex: 0;
    width: auto;
    padding: 14px 28px;
    border-radius: 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;          /* una sola riga */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.new-user-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.18);
    transition: 0.2s ease;
}

.badge { font-size: .7rem; padding: 2px 6px; border-radius: 4px; margin-right: 6px; }
.badge-mail { background: #e0f2ff; color: #0369a1; }
.badge-wa   { background: #dcfce7; color: #166534; }
.badge-ui   { background: #f3f4f6; color: #374151; }

.modal-backdrop{
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

.modal-card{
    width: min(520px, 92vw);
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.modal-card label{
    display: flex !important;
}

.modal-title{ font-weight: 700; margin-bottom: 10px; }

.modal-body{ font-size: 0.95rem; }

.modal-check{
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 0.95rem;
    color: #1f2937; /* grigio scuro leggibile */
}
.modal-hint{ margin-top: 10px; font-size: .85rem; opacity: .8; }

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

.card-actions.vertical {
    flex-direction: column;
    gap: 10px;
}

/* Container verticale */
.settings-actions{
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Bottone settings */
.settings-btn{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 18px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all .2s ease;
    text-decoration: none;
    border: none;
}

.settings-btn,
.settings-btn *{
    text-decoration: none !important;
}

/* Variante chiara */
.settings-btn.light{
    background: #e5e7eb;
    color: #1f2937;
}

/* Variante primaria */
.settings-btn.primary{
    background: linear-gradient(135deg, #3b5b8a, #2f4a78);
    color: white;
}

/* Hover */
.settings-btn:hover{
    transform: translateY(-2px);
    opacity: .95;
}

/* Icona */
.settings-btn .icon{
    font-size: 1.4rem;
}

/* =========================
   FORM GRID
========================= */

.form-grid{
    display:flex;
    flex-direction:column;
    gap:16px;
    margin-top:18px;
}

.form-row{
    display:flex;
    flex-direction:column;
}

.form-row label{
    font-size:13px;
    font-weight:600;
    margin-bottom:6px;
    color:#6b7280;
}

.form-row input,
.form-row select{
    padding:12px 14px;
    border-radius:14px;
    border:1px solid #d7deea;
    font-size:15px;
}

.checkbox-row{
    grid-column: span 2;
}

.full-btn{
    width:100%;
    margin-top:10px;
}

.resp-contact {
    font-size: 12px;
    opacity: 0.7;
}

.resp-list button {
    width: 100%;
    text-align: left;

    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);

    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 6px;

    color: white;
    font-size: 14px;

    transition: all 0.2s ease;
}

.resp-list button:hover {
    background: rgba(255,255,255,0.25);
}

.resp-pill {

    width: 100%;
    text-align: left;

    background: rgba(255,255,255,0.12);
    border: none;

    border-radius: 14px;

    padding: 10px 14px;
    margin-top: 6px;

    color: white;
    font-size: 14px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    cursor: pointer;

    transition: all 0.15s ease;
}

.resp-pill:hover {

    background: rgba(255,255,255,0.22);

}


.btn-later{
    background:rgba(255,255,255,0.25);
    border:none;
    color:white;
}

.btn-later:hover {

    background: rgba(255,255,255,0.25);

}

.card-actions {
    margin-top: 14px;
}

.action-primary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.action-danger {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    opacity: 0.8;
}

.card-actions {
    margin-top: 14px;
}

.action-primary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.action-danger {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    opacity: 0.8;
}

.recap-actions{
    margin-top:16px;
}

.recap-primary{
    display:flex;
    gap:12px;
    margin-bottom:12px;
}

.recap-danger{
    display:flex;
    gap:12px;
}

.recap-primary form,
.recap-danger form{
    flex:1;
}

.recap-actions button{
    width:100%;
    height:46px;
    border-radius:12px;
    font-size:16px;
    font-weight:600;
    display:flex;
    align-items:center;
    justify-content:center;
}

.responsibility-search{
    width:100%;
    margin-top:8px;
    padding:10px;
    border-radius:10px;
    border:none;
    background:rgba(255,255,255,0.25);
    color:white;
}

.toast{
position:fixed;
bottom:30px;
left:50%;
transform:translateX(-50%);
background:#2f4f7f;
color:white;
padding:10px 18px;
border-radius:20px;
opacity:0;
transition:all .3s;
}

.toast.show{
opacity:1;
}

.suggested-resp{
margin-top:12px;
}
