/* ══════════════════════════════════════════════════════════════════════════════
   ZELO CRM — Portale Cliente v3.0
   Pattern fedelmente tratti da bkfm-client-portal / bkfm-client-sidebar:
   300px sidebar sticky con backdrop-filter blur(16px),
   bkfm-cover con grid 2 colonne, bkfm-doc-row rounded cards,
   bkfm-sign-block per firma digitale, v79 unified area
══════════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --pm: #E2007A; --pm2: #C4006A;
    --ink: #202345; --muted: #72748a;
    --bg: #f7f8ff; --paper: #ffffff;
    --line: #e8e7f1; --soft: #f0eff8;
    --green: #1e9d64; --red: #c34242; --yellow: #a97805; --blue: #2979ff;
    --shadow: 0 18px 60px rgba(32,35,69,.07);
    --shadow-sm: 0 8px 28px rgba(32,35,69,.05);
    --r: 28px; --r-md: 18px; --r-sm: 14px; --pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.bkfm-app, .agio-portal-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    font-size: 14px; color: var(--ink);
    background: linear-gradient(135deg, #fff 0%, #f7f8ff 58%, #f0f1ff 100%);
    min-height: 100vh; line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* ── Login — bkfm-access-page ─────────────────────────────────────────────── */
.agio-portal-login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 8% -10%, rgba(88,82,159,.13), transparent 35%),
                radial-gradient(circle at 100% 8%, rgba(115,107,221,.10), transparent 34%),
                #f7f7fb;
    padding: 20px;
}
.agio-portal-login {
    background: var(--paper); border: 1px solid var(--line);
    border-radius: var(--r); padding: 42px 38px;
    box-shadow: var(--shadow); max-width: 420px; width: 100%;
    animation: bkfmFadeUp .36s ease both;
}
@keyframes bkfmFadeUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }
.agio-portal-login-logo { text-align: center; margin-bottom: 26px; }
.agio-portal-login-logo img { max-height: 52px; }
.agio-portal-login-logo h2 { font-size: 20px; font-weight: 900; color: var(--pm); letter-spacing: -.04em; }
.agio-portal-login h3 { font-size: 20px; font-weight: 900; letter-spacing: -.04em; text-align: center; margin-bottom: 6px; }
.agio-portal-login > p { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 24px; }
.agio-portal-login .login-username, .agio-portal-login .login-password { margin-bottom: 14px; }
.agio-portal-login label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.agio-portal-login input[type="text"], .agio-portal-login input[type="password"] {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    font-size: 14px; font-family: 'Inter', sans-serif;
    background: var(--paper); color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.agio-portal-login input:focus { outline: none; border-color: var(--pm); box-shadow: 0 0 0 3px rgba(226,0,122,.12); }
.agio-portal-login input[type="submit"] {
    width: 100%; background: linear-gradient(135deg, var(--pm), var(--pm2));
    color: #fff; border: none; padding: 14px;
    border-radius: var(--pill); font-size: 15px;
    font-weight: 900; font-family: 'Inter', sans-serif;
    cursor: pointer; margin-top: 8px;
    box-shadow: 0 15px 38px rgba(226,0,122,.24);
    transition: transform .2s, box-shadow .2s;
}
.agio-portal-login input[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 20px 48px rgba(226,0,122,.30); }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* ── App shell ─────────────────────────────────────────────────────────────── */
.agio-portal-wrap {
    /* bkfm-client-portal: 300px sidebar + 1fr content */
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

/* ── Sidebar — bkfm-client-sidebar ────────────────────────────────────────── */
.agio-portal-header {
    padding: 34px 26px;
    min-height: 100vh;
    background: rgba(255,255,255,.72);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
    display: flex; flex-direction: column;
}

.agio-portal-brand { margin-bottom: 28px; display: flex; flex-direction: column; gap: 6px; }
.agio-portal-logo  { height: 38px; object-fit: contain; object-position: left; }
.agio-portal-brand-name { font-size: 18px; font-weight: 900; color: var(--pm); letter-spacing: -.05em; }
.agio-portal-brand-sub  { font-size: 12px; color: var(--muted); }

/* Client profile mini — bkfm-client-profile */
.agio-portal-profile {
    display: grid; gap: 4px;
    padding: 14px 16px;
    background: var(--soft); border: 1px solid var(--line);
    border-radius: var(--r-sm); margin-bottom: 22px;
}
.agio-portal-profile strong { font-size: 14px; font-weight: 800; }
.agio-portal-profile span   { font-size: 12px; color: var(--muted); }

/* Nav — bkfm-menu-with-icons */
.agio-portal-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.agio-portal-nav-link {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--muted);
    font-weight: 700; font-size: 14px;
    padding: 12px 14px; border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: all .18s ease;
    position: relative;
}
.agio-portal-nav-link:hover { color: var(--ink); background: var(--soft); }
.agio-portal-nav-link.active {
    background: rgba(226,0,122,.08) !important;
    border-color: rgba(226,0,122,.18) !important;
    color: var(--pm) !important;
}
/* Icon box — bkfm-menu-icon */
.agio-nav-icon {
    width: 32px; height: 32px; min-width: 32px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: rgba(226,0,122,.10);
    color: var(--pm);
    transition: all .18s;
    flex-shrink: 0;
}
.agio-portal-nav-link:hover .agio-nav-icon { background: rgba(226,0,122,.15); }
.agio-portal-nav-link.active .agio-nav-icon { background: var(--pm); color: #fff; }
/* SVG in nav icons — bkfm-menu-icon svg */
.agio-nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Sidebar footer */
.agio-portal-user {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.agio-portal-user-name { font-size: 12px; color: var(--muted); font-weight: 600; }
.agio-portal-logout {
    font-size: 11px; font-weight: 800; color: var(--muted);
    text-decoration: none; padding: 6px 12px;
    background: var(--soft); border-radius: var(--pill);
    transition: .15s;
}
.agio-portal-logout:hover { background: rgba(195,66,66,.1); color: var(--red); }

/* ── Content — bkfm-client-content ────────────────────────────────────────── */
.agio-portal-content {
    padding: 42px;
    max-width: 1120px; width: 100%; margin: 0 auto;
}

/* Company banner */
.agio-portal-company-banner {
    background: var(--paper); border: 1px solid var(--line);
    border-left: 4px solid var(--pm);
    border-radius: var(--r-sm); padding: 12px 18px;
    margin-bottom: 24px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-sm);
}
.agio-portal-company-banner strong { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.agio-portal-company-banner span   { font-size: 12px; color: var(--muted); }

/* ── COVER HERO — bkfm-cover ───────────────────────────────────────────────── */
.agio-portal-cover {
    background: linear-gradient(135deg, #fff, #f7f6ff);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: var(--r);
    padding: 36px;
    display: grid; grid-template-columns: 1fr 280px; gap: 24px;
    margin-bottom: 22px;
    box-shadow: 0 18px 60px rgba(32,35,69,.06);
    animation: bkfmDashRise .46s ease both;
}
@keyframes bkfmDashRise { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }
.agio-portal-cover h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: -.06em; line-height: .95; margin: 0 0 14px; }
.agio-portal-cover p  { color: var(--muted); font-size: 15px; max-width: 500px; }
/* Cover meta box — bkfm-cover-meta */
.agio-portal-cover-meta {
    background: #fff; border: 1px solid var(--line);
    border-radius: 26px; padding: 20px;
    display: grid; grid-template-columns: 1fr; gap: 4px;
    align-self: start;
}
.agio-portal-cover-meta span   { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 900; margin-top: 10px; display: block; }
.agio-portal-cover-meta strong { font-size: 15px; font-weight: 700; }

/* ── UNIFIED CLIENT AREA v79 ───────────────────────────────────────────────── */
.agio-portal-unified {
    margin: 0 0 22px;
    padding: 22px;
    border: 1px solid rgba(226,0,122,.14);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(226,0,122,.07), rgba(32,35,69,.03));
    box-shadow: 0 18px 42px rgba(32,35,69,.06);
    animation: bkfmDashRise .46s ease .05s both;
}
.agio-portal-unified-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.agio-portal-unified-head span  { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--pm); font-weight: 800; }
.agio-portal-unified-head h3    { margin: 4px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.04em; }
.agio-portal-unified-head small { color: var(--muted); font-size: 12px; text-align: right; }
.agio-portal-unified-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}
.agio-portal-unified-grid > a,
.agio-portal-unified-grid > div {
    display: flex; flex-direction: column; gap: 4px;
    padding: 15px; border-radius: 18px;
    background: #fff; border: 1px solid rgba(32,35,69,.08);
    text-decoration: none; color: var(--ink); transition: .16s ease;
}
.agio-portal-unified-grid > a:hover { border-color: rgba(226,0,122,.25); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.agio-portal-unified-grid strong { font-size: 26px; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.agio-portal-unified-grid small  { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.agio-portal-unified-grid span   { font-size: 22px; margin-bottom: 2px; }

/* ── DOC LIST — bkfm-doc-list / bkfm-doc-row ──────────────────────────────── */
.agio-portal-doc-list { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 22px; }
.agio-portal-doc-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px; align-items: center;
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px 20px;
    margin: 8px 0;
    transition: .18s ease;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
.agio-portal-doc-row:hover { border-color: rgba(226,0,122,.3); transform: translateY(-1px); box-shadow: 0 18px 42px rgba(32,35,69,.08); color: var(--ink); }
.agio-portal-doc-row strong { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.agio-portal-doc-row small  { font-size: 11px; color: var(--muted); }

/* ── TABLES ─────────────────────────────────────────────────────────────────── */
.agio-portal-table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.agio-portal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.agio-portal-table thead th { padding: 12px 18px; text-align: left; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; border-bottom: 1px solid var(--line); background: rgba(247,247,251,.7); }
.agio-portal-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.agio-portal-table tbody tr:last-child td { border-bottom: none; }
.agio-portal-table tbody tr:hover td { background: var(--soft); }

/* ── PROJECTS GRID ──────────────────────────────────────────────────────────── */
.agio-portal-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
.agio-portal-project-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow-sm); transition: .18s ease; }
.agio-portal-project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.agio-portal-project-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.agio-portal-project-header strong { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.agio-portal-project-card p { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.agio-portal-progress { height: 6px; background: var(--soft); border-radius: 3px; margin-bottom: 8px; overflow: hidden; }
.agio-portal-progress-fill { height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.agio-portal-project-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ── SIGN BLOCK — bkfm-sign-block ──────────────────────────────────────────── */
.agio-portal-sign-wrap {
    background: linear-gradient(135deg, #fff, var(--soft));
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow);
    max-width: 820px; margin: 0 auto;
}
.agio-portal-sign-header {
    background: linear-gradient(135deg, var(--pm), var(--pm2));
    padding: 20px 28px;
    display: flex; justify-content: space-between; align-items: center;
}
.agio-portal-sign-header span { color: rgba(255,255,255,.8); font-size: 13px; font-weight: 600; }
.agio-portal-sign-body { padding: 28px; }
/* Signature notice — bkfm-signature-notice */
.agio-portal-sign-notice {
    margin: 0 0 18px;
    padding: 16px 18px;
    border: 1px solid rgba(226,0,122,.18);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(226,0,122,.08), rgba(32,35,69,.04));
    color: var(--ink); font-size: 14px; line-height: 1.55; font-weight: 600;
}
/* Doc content */
.agio-portal-sign-doc {
    border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 20px; max-height: 60vh; overflow-y: auto;
    margin-bottom: 24px; font-size: 13px; line-height: 1.8;
    background: #fff;
}
/* Signature meta grid — bkfm-signature-meta-grid */
.agio-portal-sign-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 16px; margin-bottom: 16px; }
.agio-portal-sign-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink); min-width: 0; }
.agio-portal-sign-form input {
    width: 100%; min-height: 50px; padding: 12px 16px;
    border: 1px solid var(--line); border-radius: 16px;
    font-size: 14px; font-family: 'Inter', sans-serif;
    transition: border-color .15s, box-shadow .15s;
}
.agio-portal-sign-form input:focus { outline: none; border-color: var(--pm); box-shadow: 0 0 0 3px rgba(226,0,122,.12); }
.agio-portal-sign-otp { display: flex; align-items: center; gap: 10px; }
.agio-portal-sign-otp input { width: 180px; letter-spacing: .3em; font-size: 22px; text-align: center; font-family: 'JetBrains Mono', monospace; }

/* ── SUPPORT ─────────────────────────────────────────────────────────────────── */
.agio-portal-support-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.agio-portal-support-form h3 { font-size: 16px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px; }
.agio-portal-field { margin-bottom: 14px; }
.agio-portal-field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.agio-portal-field input, .agio-portal-field textarea { width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; font-family: 'Inter', sans-serif; transition: border-color .15s, box-shadow .15s; }
.agio-portal-field input:focus, .agio-portal-field textarea:focus { outline: none; border-color: var(--pm); box-shadow: 0 0 0 3px rgba(226,0,122,.12); }
.agio-portal-field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

/* ── BADGES ─────────────────────────────────────────────────────────────────── */
.agio-portal-badge { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: var(--pill); font-size: 11px; font-weight: 700; }
.agio-portal-badge.ok     { background: rgba(30,157,100,.08); color: var(--green); }
.agio-portal-badge.warn   { background: rgba(169,120,5,.08);   color: var(--yellow); }
.agio-portal-badge.danger { background: rgba(195,66,66,.08);   color: var(--red); }
.agio-portal-badge.gray   { background: var(--soft);            color: var(--muted); }
.agio-portal-badge.blue   { background: rgba(41,121,255,.08);  color: var(--blue); }

/* ── BUTTONS ─────────────────────────────────────────────────────────────────── */
.agio-portal-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 11px 22px; border-radius: var(--pill);
    font-size: 14px; font-weight: 800; font-family: 'Inter', sans-serif;
    cursor: pointer; text-decoration: none;
    border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
    transition: all .2s ease;
}
.agio-portal-btn.primary { background: linear-gradient(135deg, var(--pm), var(--pm2)); color: #fff; border-color: var(--pm); box-shadow: 0 15px 38px rgba(226,0,122,.24); }
.agio-portal-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 20px 48px rgba(226,0,122,.30); }
.agio-portal-btn:hover:not(.primary) { border-color: rgba(226,0,122,.3); color: var(--pm); background: rgba(226,0,122,.04); }

/* ── FOOTER ─────────────────────────────────────────────────────────────────── */
.agio-portal-footer { text-align: center; padding: 16px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: auto; }

/* ── ALERT — bkfm-alert ─────────────────────────────────────────────────────── */
.agio-portal-alert { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: rgba(169,120,5,.06); border: 1px solid rgba(169,120,5,.2); border-radius: var(--r-sm); margin-bottom: 10px; font-size: 14px; }
.agio-portal-notice { padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; border: 1px solid transparent; }
.agio-portal-notice.error { background: rgba(195,66,66,.06); border-color: rgba(195,66,66,.2); color: #7a1a1a; }
.agio-portal-notice.ok    { background: rgba(30,157,100,.06); border-color: rgba(30,157,100,.2); color: #0f5c3a; }
.agio-portal-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.agio-portal-link  { color: var(--pm); text-decoration: none; font-weight: 600; }
.agio-portal-link:hover { text-decoration: underline; }
.agio-portal-title { font-size: 20px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 18px; }
.agio-portal-section { margin-bottom: 28px; }
.agio-portal-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — bkfm mobile overrides
══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .agio-portal-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .agio-portal-header { min-height: auto; height: auto; position: static; padding: 18px 20px; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
    .agio-portal-brand  { margin: 0; flex-direction: row; align-items: center; }
    .agio-portal-nav    { flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; }
    .agio-portal-nav-link { padding: 8px 12px; font-size: 12px; white-space: nowrap; }
    .agio-portal-nav-link span:not(.agio-nav-icon) { display: none; }
    .agio-portal-user   { margin-top: 0; padding-top: 0; border-top: none; }
    .agio-portal-content { padding: 20px 16px 40px; }
    .agio-portal-cover  { grid-template-columns: 1fr; }
    .agio-portal-unified-grid { grid-template-columns: repeat(3,1fr); }
    .agio-portal-projects { grid-template-columns: 1fr; }
    .agio-portal-sign-form { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .agio-portal-unified-grid { grid-template-columns: repeat(2,1fr); }
}
