/* ═══════════════════════════════════════════════════════════════════════════
   IOCOS Client Portal — portal.css
   Struttura:
   1. Variabili CSS
   2. Override tema WordPress
   3. Layout shell (portal, shell, sidebar, main)
   4. Sidebar componenti (nav, footer, logout)
   5. Topbar
   6. Pagina di Login
   7. Componenti UI (stat, card, table, badge, button, form, ecc.)
   8. Responsive
═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Variabili ────────────────────────────────────────────────────────── */
:root {
  --p-bg:      #0b0f19;
  --p-surface: #111827;
  --p-surface2:#1c2436;
  --p-border:  #1e2d45;
  --p-accent:  #1a6ff4;
  --p-accent2: #0ea5e9;
  --p-green:   #10b981;
  --p-red:     #ef4444;
  --p-yellow:  #f59e0b;
  --p-orange:  #f97316;
  --p-text:    #e2e8f0;
  --p-muted:   #64748b;
  --p-muted2:  #94a3b8;
  --p-radius:  10px;
  --p-font:    'DM Sans', system-ui, sans-serif;
  --p-mono:    'DM Mono', monospace;
}

/* ── 2. Override tema WordPress ──────────────────────────────────────────── */
/* Nasconde l'header/footer del tema sulla pagina del portale */
body.iocos-portal-page .site-header,
body.iocos-portal-page header.site-header,
body.iocos-portal-page #masthead,
body.iocos-portal-page .site-footer,
body.iocos-portal-page footer.site-footer,
body.iocos-portal-page #colophon,
body.iocos-portal-page .admin-bar-visible .wpadminbar { display: none !important; }

/* Rimuove padding/max-width del content area */
body.iocos-portal-page,
body.iocos-portal-page #page,
body.iocos-portal-page #content,
body.iocos-portal-page #primary,
body.iocos-portal-page #main,
body.iocos-portal-page .site-main,
body.iocos-portal-page main,
body.iocos-portal-page .entry-content,
body.iocos-portal-page .wp-block-post-content,
body.iocos-portal-page .post-content,
body.iocos-portal-page article,
body.iocos-portal-page .page-content {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--p-bg) !important;
}

/* ── 3. Layout shell — app a viewport fisso ──────────────────────────────── */
/*
  La struttura è:
    body.iocos-portal-page → overflow: hidden  (non scorre la pagina)
    .iocos-portal          → height: 100vh, display: flex column
    .iocos-portal-shell    → flex: 1, min-height: 0, grid 220px + 1fr
    .iocos-sidebar         → min-height: 0, overflow-y: auto
    .iocos-main            → min-height: 0, overflow-y: auto  ← UNICA ZONA CHE SCORRE

  Il segreto è min-height: 0 su tutti i flex/grid child.
  Senza di esso il browser lascia che i figli crescano oltre il parent.
*/
body.iocos-portal-page {
  overflow: hidden;
  height: 100vh;
  background: var(--p-bg);
}

.iocos-portal * { box-sizing: border-box; margin: 0; padding: 0; }

.iocos-portal {
  font-family: var(--p-font);
  background: var(--p-bg);
  color: var(--p-text);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.iocos-portal-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 0;   /* FONDAMENTALE */
  overflow: hidden;
}

/* ── 4. Sidebar ──────────────────────────────────────────────────────────── */
.iocos-sidebar {
  background: var(--p-surface);
  border-right: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  min-height: 0;   /* non cresce oltre la shell */
  overflow-y: auto;
  overflow-x: hidden;
}

.iocos-sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--p-border);
  flex-shrink: 0;
}
.iocos-sidebar-logo .logo-text {
  font-size: 17px; font-weight: 700; letter-spacing: 3px; color: var(--p-accent);
}
.iocos-sidebar-logo .logo-sub {
  font-size: 10px; color: var(--p-muted); letter-spacing: 1px;
  text-transform: uppercase; margin-top: 2px;
}

.iocos-nav { padding: 12px 0; flex: 1; }
.iocos-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 13.5px; font-weight: 500; color: var(--p-muted2);
  text-decoration: none; transition: background .12s, color .12s;
  border-left: 3px solid transparent;
}
.iocos-nav a:hover { background: var(--p-surface2); color: var(--p-text); }
.iocos-nav a.active {
  background: rgba(26,111,244,.1); color: var(--p-accent);
  border-left-color: var(--p-accent); font-weight: 600;
}
.iocos-nav a .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.iocos-nav .nav-badge {
  margin-left: auto; background: var(--p-red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
}

/* ── Sidebar footer: utente + logout ────────────────────────────────────── */
.iocos-sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--p-border);
  background: var(--p-surface);
  padding: 12px 14px;
}

/* Blocco utente */
.isf-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 12px;
  border-bottom: 1px solid var(--p-border);
  margin-bottom: 10px;
}
.isf-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--p-accent), var(--p-accent2));
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.isf-name {
  font-size: 13px; font-weight: 600; color: var(--p-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.isf-role {
  font-size: 10px; color: var(--p-muted);
  text-transform: uppercase; letter-spacing: .5px;
}

/* Link azioni (sito + logout) */
.isf-actions { display: flex; flex-direction: column; gap: 4px; }

.isf-action-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
  border: 1px solid transparent;
}

/* Link sito */
.isf-site-link { color: var(--p-muted2); }
.isf-site-link:hover { background: var(--p-surface2); color: var(--p-text); border-color: var(--p-border); }

/* Logout — sempre visibile, rosso tenue */
.isf-logout-link {
  color: #fca5a5;                        /* rosso chiaro sempre visibile */
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.2);
}
.isf-logout-link:hover {
  background: rgba(239,68,68,.18);
  color: #fff;
  border-color: rgba(239,68,68,.5);
}
.isf-action-link svg { flex-shrink: 0; }

/* ── 5. Main content ─────────────────────────────────────────────────────── */
.iocos-main {
  background: var(--p-bg);
  padding: 28px 32px;
  min-height: 0;   /* FONDAMENTALE */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--p-border) transparent;
}
.iocos-main::-webkit-scrollbar { width: 5px; }
.iocos-main::-webkit-scrollbar-track { background: transparent; }
.iocos-main::-webkit-scrollbar-thumb { background: var(--p-border); border-radius: 3px; }

/* ── Mobile header (visibile solo su mobile) ─────────────────────────────── */
.iocos-mobile-header {
  display: none; flex-shrink: 0;
  background: var(--p-surface); border-bottom: 1px solid var(--p-border);
  padding: 13px 20px; align-items: center; justify-content: space-between;
}
.iocos-hamburger {
  background: none; border: none; color: var(--p-text); font-size: 22px; cursor: pointer;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.iocos-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-shrink: 0;
}
.iocos-page-title { font-size: 22px; font-weight: 700; color: var(--p-text); }
.iocos-topbar-right { display: flex; align-items: center; gap: 14px; }
.iocos-user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 999px; padding: 6px 14px 6px 8px;
  font-size: 13px; color: var(--p-muted2);
}
.iocos-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--p-accent); color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.iocos-notif-btn {
  position: relative; background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
  color: var(--p-muted2); font-size: 16px; transition: color .15s, border-color .15s;
}
.iocos-notif-btn:hover { color: var(--p-text); border-color: var(--p-accent); }
.iocos-notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: var(--p-red);
  border-radius: 50%; border: 2px solid var(--p-surface);
}

/* ── Notifiche panel ─────────────────────────────────────────────────────── */
.iocos-notif-panel {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius); z-index: 1000; box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.iocos-notif-panel.open { display: block; }
.iocos-notif-header {
  padding: 14px 16px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--p-muted);
  border-bottom: 1px solid var(--p-border);
  display: flex; justify-content: space-between; align-items: center;
}
.iocos-notif-item { padding: 12px 16px; border-bottom: 1px solid var(--p-border); font-size: 13px; }
.iocos-notif-item:last-child { border-bottom: none; }
.iocos-notif-item.unread { background: rgba(26,111,244,.05); }
.iocos-notif-item .ni-title { font-weight: 600; color: var(--p-text); margin-bottom: 2px; }
.iocos-notif-item .ni-msg   { color: var(--p-muted2); font-size: 12px; }
.iocos-notif-item .ni-time  { color: var(--p-muted); font-size: 11px; margin-top: 4px; }
.iocos-notif-empty { padding: 24px; text-align: center; color: var(--p-muted); font-size: 13px; }

/* ── Alert inline ────────────────────────────────────────────────────────── */
.p-alert {
  padding: 11px 16px; border-radius: 7px; font-size: 13px; margin-bottom: 16px; display: none;
}
.p-alert.success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: #10b981; }
.p-alert.error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #ef4444; }


/* ══════════════════════════════════════════════════════════════════════════
   6. PAGINA DI LOGIN — Split layout: brand a sinistra, form a destra
   Il contenitore è separato dall'`.iocos-portal` per evitare conflitti.
   Usa position:fixed per coprire tutto lo schermo indipendentemente dal tema.
══════════════════════════════════════════════════════════════════════════ */

.iocos-login-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--p-bg);
  font-family: var(--p-font);
  color: var(--p-text);
}
.iocos-login-page * { box-sizing: border-box; margin: 0; padding: 0; }

/* Sfondo decorativo */
.ilp-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.ilp-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(26,111,244,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,111,244,.05) 1px, transparent 1px);
  background-size: 52px 52px;
}
.ilp-glow {
  position: absolute; border-radius: 50%;
  filter: blur(90px); pointer-events: none;
}
.ilp-glow--1 {
  width: 700px; height: 700px;
  background: rgba(26,111,244,.1);
  top: -200px; left: -150px;
}
.ilp-glow--2 {
  width: 500px; height: 500px;
  background: rgba(14,165,233,.07);
  bottom: -100px; right: 20%;
}

/* ── Colonna sinistra: brand ─────────────────────────────────────────────── */
.ilp-brand {
  position: relative; z-index: 1;
  flex: 0 0 52%;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 64px;
  border-right: 1px solid var(--p-border);
}
.ilp-brand-inner {
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 0;
}

/* Logo */
.ilp-logo {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; margin-bottom: 56px;
}
.ilp-logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--p-accent), var(--p-accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: #fff;
  box-shadow: 0 4px 20px rgba(26,111,244,.35);
  flex-shrink: 0;
}
.ilp-logo-name {
  font-size: 20px; font-weight: 800; letter-spacing: 4px; color: var(--p-text);
  text-transform: uppercase;
}

/* Titolo e descrizione */
.ilp-headline { margin-bottom: 40px; }
.ilp-headline h1 {
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -.5px; color: var(--p-text);
  margin-bottom: 16px;
}
.ilp-headline h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--p-accent), var(--p-accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ilp-headline p {
  font-size: 15px; color: var(--p-muted2); line-height: 1.7; max-width: 380px;
}

/* Feature list */
.ilp-features {
  list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 48px;
}
.ilp-features li {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; color: var(--p-muted2);
  padding: 11px 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--p-border);
  border-radius: 9px;
}
.ilp-feat-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--p-accent);
  box-shadow: 0 0 8px rgba(26,111,244,.6);
}

/* Link torna al sito */
.ilp-back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--p-muted2);
  text-decoration: none; transition: color .15s;
  padding-top: 20px; border-top: 1px solid var(--p-border);
}
.ilp-back-link svg { transition: transform .2s; }
.ilp-back-link:hover { color: var(--p-text); }
.ilp-back-link:hover svg { transform: translateX(-3px); }

/* ── Colonna destra: form ────────────────────────────────────────────────── */
.ilp-form-col {
  position: relative; z-index: 1;
  flex: 0 0 48%;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 52px;
  background: rgba(11,15,25,.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(30,45,69,.5);
}
.ilp-form-box { width: 100%; max-width: 380px; }

/* Header form */
.ilp-form-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: var(--p-accent); text-transform: uppercase;
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: rgba(26,111,244,.1);
  border: 1px solid rgba(26,111,244,.2); border-radius: 999px;
}
.ilp-form-head h2 {
  font-size: 28px; font-weight: 800; color: var(--p-text);
  margin-bottom: 8px; letter-spacing: -.3px;
}
.ilp-form-head p { font-size: 14px; color: var(--p-muted2); line-height: 1.5; margin-bottom: 32px; }

/* WordPress login form override */
.ilp-form-box .login-username,
.ilp-form-box .login-password { margin-bottom: 16px; }
.ilp-form-box label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--p-muted); margin-bottom: 7px;
}
.ilp-form-box input[type="text"],
.ilp-form-box input[type="password"] {
  display: block; width: 100%; padding: 12px 16px;
  background: var(--p-surface2); border: 1px solid var(--p-border);
  border-radius: 8px; color: var(--p-text); font-size: 14.5px;
  font-family: var(--p-font); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ilp-form-box input[type="text"]:focus,
.ilp-form-box input[type="password"]:focus {
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px rgba(26,111,244,.15);
}
.ilp-form-box .login-remember { display: none; }
.ilp-form-box .login-submit { margin-top: 8px; }
.ilp-form-box input[type="submit"] {
  display: block; width: 100%; padding: 13px;
  background: var(--p-accent); border: none; border-radius: 8px;
  color: #fff; font-size: 15px; font-weight: 700;
  font-family: var(--p-font); cursor: pointer; letter-spacing: .2px;
  transition: opacity .15s, transform .1s;
}
.ilp-form-box input[type="submit"]:hover { opacity: .88; transform: translateY(-1px); }

/* Footer form */
.ilp-form-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--p-border);
  font-size: 12.5px;
}
.ilp-form-foot a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--p-muted2); text-decoration: none; transition: color .15s;
}
.ilp-form-foot a:hover { color: var(--p-accent); }

/* ── Responsive login ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .iocos-login-page { flex-direction: column; overflow-y: auto; }
  .ilp-brand { flex: none; padding: 36px 28px 28px; border-right: none; border-bottom: 1px solid var(--p-border); }
  .ilp-brand-inner { max-width: 100%; }
  .ilp-logo { margin-bottom: 28px; }
  .ilp-headline h1 { font-size: 28px; }
  .ilp-headline p { display: none; }
  .ilp-features { flex-direction: row; flex-wrap: wrap; }
  .ilp-features li { flex: 1 1 45%; font-size: 12px; padding: 8px 12px; }
  .ilp-back-link { padding-top: 16px; }
  .ilp-form-col { flex: none; padding: 36px 28px 48px; background: transparent; backdrop-filter: none; border-left: none; }
  .ilp-form-box { max-width: 460px; margin: 0 auto; width: 100%; }
}
@media (max-width: 480px) {
  .ilp-brand { padding: 24px 20px 20px; }
  .ilp-features { display: none; }
  .ilp-form-col { padding: 24px 20px 40px; }
  .ilp-form-head h2 { font-size: 24px; }
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.iocos-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.iocos-stat {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.iocos-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--p-accent);
}
.iocos-stat.green::before { background: var(--p-green); }
.iocos-stat.yellow::before { background: var(--p-yellow); }
.iocos-stat.red::before { background: var(--p-red); }
.iocos-stat .sv { font-size: 28px; font-weight: 700; line-height: 1; }
.iocos-stat .sl { font-size: 11px; color: var(--p-muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 5px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.iocos-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.iocos-card-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--p-muted2);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.iocos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.iocos-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--p-muted);
  border-bottom: 1px solid var(--p-border);
}
.iocos-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(30,45,69,.6);
  color: var(--p-text);
  vertical-align: middle;
}
.iocos-table tr:last-child td { border-bottom: none; }
.iocos-table tr:hover td { background: rgba(26,111,244,.04); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
}
.p-badge::before { content: '●'; font-size: 7px; }
.b-active   { background: rgba(16,185,129,.12); color: #10b981; }
.b-pending  { background: rgba(26,111,244,.12); color: #60a5fa; }
.b-paid     { background: rgba(16,185,129,.12); color: #10b981; }
.b-sent     { background: rgba(245,158,11,.12); color: #f59e0b; }
.b-overdue  { background: rgba(239,68,68,.12);  color: #ef4444; }
.b-draft    { background: rgba(100,116,139,.12); color: #94a3b8; }
.b-accepted { background: rgba(16,185,129,.12); color: #10b981; }
.b-declined { background: rgba(239,68,68,.12);  color: #ef4444; }
.b-cancelled{ background: rgba(100,116,139,.12); color: #94a3b8; }
.b-expired  { background: rgba(100,116,139,.12); color: #94a3b8; }
.b-open         { background: rgba(26,111,244,.12); color: #60a5fa; }
.b-in_progress  { background: rgba(245,158,11,.12); color: #f59e0b; }
.b-waiting_client{ background: rgba(249,115,22,.12); color: #f97316; }
.b-resolved     { background: rgba(16,185,129,.12); color: #10b981; }
.b-closed       { background: rgba(100,116,139,.12); color: #94a3b8; }
.b-suspended    { background: rgba(249,115,22,.12); color: #f97316; }
.b-low          { background: rgba(100,116,139,.12); color: #94a3b8; }
.b-medium       { background: rgba(26,111,244,.12); color: #60a5fa; }
.b-high         { background: rgba(245,158,11,.12); color: #f59e0b; }
.b-urgent       { background: rgba(239,68,68,.12); color: #ef4444; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.p-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: var(--p-font);
  transition: opacity .15s, transform .1s;
  line-height: 1;
}
.p-btn:hover { opacity: .85; transform: translateY(-1px); }
.p-btn-primary  { background: var(--p-accent); color: #fff; }
.p-btn-success  { background: var(--p-green);  color: #fff; }
.p-btn-danger   { background: var(--p-red);    color: #fff; }
.p-btn-ghost    { background: var(--p-surface2); color: var(--p-text); border: 1px solid var(--p-border); }
.p-btn-sm       { padding: 6px 12px; font-size: 12px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.p-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.p-field { display: flex; flex-direction: column; gap: 6px; }
.p-field.full { grid-column: 1/-1; }
.p-field label { font-size: 11px; font-weight: 600; color: var(--p-muted); text-transform: uppercase; letter-spacing: .5px; }
.p-field input,
.p-field select,
.p-field textarea {
  padding: 10px 13px;
  background: var(--p-surface2);
  border: 1px solid var(--p-border);
  border-radius: 7px;
  color: var(--p-text);
  font-family: var(--p-font);
  font-size: 13.5px;
  transition: border-color .15s;
}
.p-field input:focus,
.p-field select:focus,
.p-field textarea:focus {
  outline: none;
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px rgba(26,111,244,.15);
}
.p-field textarea { min-height: 90px; resize: vertical; }
.p-field select option { background: var(--p-surface2); }

/* ── Ticket thread ───────────────────────────────────────────────────────── */
.iocos-thread { display: flex; flex-direction: column; gap: 14px; }
.iocos-msg {
  padding: 14px 16px;
  border-radius: 8px;
  max-width: 88%;
}
.iocos-msg.client {
  background: var(--p-surface2);
  border: 1px solid var(--p-border);
  align-self: flex-start;
}
.iocos-msg.staff {
  background: rgba(26,111,244,.1);
  border: 1px solid rgba(26,111,244,.2);
  align-self: flex-end;
}
.iocos-msg .msg-meta { font-size: 11px; color: var(--p-muted); margin-bottom: 6px; }
.iocos-msg .msg-body { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; color: var(--p-text); }

/* ── Notifications panel ─────────────────────────────────────────────────── */
.iocos-notif-panel {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  width: 320px;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  z-index: 1000;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.iocos-notif-panel.open { display: block; }
.iocos-notif-header {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--p-muted);
  border-bottom: 1px solid var(--p-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.iocos-notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--p-border);
  font-size: 13px;
}
.iocos-notif-item:last-child { border-bottom: none; }
.iocos-notif-item.unread { background: rgba(26,111,244,.05); }
.iocos-notif-item .ni-title { font-weight: 600; color: var(--p-text); margin-bottom: 2px; }
.iocos-notif-item .ni-msg   { color: var(--p-muted2); font-size: 12px; }
.iocos-notif-item .ni-time  { color: var(--p-muted); font-size: 11px; margin-top: 4px; }
.iocos-notif-empty { padding: 24px; text-align: center; color: var(--p-muted); font-size: 13px; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.p-alert {
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.p-alert.success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: #10b981; }
.p-alert.error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: #ef4444; }

/* ── Service cards grid ─────────────────────────────────────────────────── */
.iocos-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.iocos-service-card {
  background: var(--p-surface2);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 18px 20px;
  position: relative;
}
.iocos-service-card .sc-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--p-accent);
  margin-bottom: 8px;
}
.iocos-service-card .sc-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.iocos-service-card .sc-desc { font-size: 12px; color: var(--p-muted2); margin-bottom: 12px; line-height: 1.5; }
.iocos-service-card .sc-footer { display: flex; align-items: center; justify-content: space-between; }
.iocos-service-card .sc-price { font-size: 16px; font-weight: 700; color: var(--p-text); }
.iocos-service-card .sc-cycle { font-size: 11px; color: var(--p-muted); }
.iocos-service-card .sc-renewal { font-size: 11px; color: var(--p-muted); margin-top: 6px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.p-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--p-border); }
.p-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--p-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.p-tab.active { color: var(--p-accent); border-color: var(--p-accent); }
.p-tab-content { display: none; }
.p-tab-content.active { display: block; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.iocos-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--p-muted);
}
.iocos-empty .empty-icon { font-size: 40px; margin-bottom: 12px; }
.iocos-empty p { font-size: 14px; }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.p-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive portale (mobile) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  body.iocos-portal-page { overflow: auto; height: auto; }
  .iocos-portal { height: auto; min-height: 100svh; overflow: visible; }
  .iocos-portal-shell {
    grid-template-columns: 1fr;
    flex: none; min-height: auto; overflow: visible;
  }
  .iocos-main {
    min-height: calc(100vh - 52px);
    overflow-y: visible; padding: 20px 16px;
  }
  .iocos-sidebar {
    display: none; position: fixed; inset: 0;
    width: 260px; height: 100%; z-index: 999; overflow-y: auto;
  }
  .iocos-sidebar.open { display: flex; }
  .iocos-mobile-header { display: flex; }
  .iocos-stats-grid { grid-template-columns: 1fr 1fr; }
  .p-form-grid { grid-template-columns: 1fr; }
}

/* ── Password reset — elementi UI ────────────────────────────────────────── */

/* Bottone primario generico usato nelle schermate password */
.ilp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  background: var(--p-accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--p-font);
  cursor: pointer;
  text-decoration: none;
  letter-spacing: .2px;
  transition: opacity .15s, transform .1s;
  box-sizing: border-box;
}
.ilp-btn:hover { opacity: .88; transform: translateY(-1px); color: #fff; }

/* Box di conferma email / successo */
.ilp-sent-box {
  text-align: center;
  padding: 8px 0;
}
.ilp-sent-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(26,111,244,.1);
  border: 2px solid rgba(26,111,244,.2);
  color: var(--p-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.ilp-sent-box h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--p-text);
  margin-bottom: 12px;
}
.ilp-sent-box p {
  font-size: 14px;
  color: var(--p-muted2);
  line-height: 1.6;
}

/* Box errore inline */
.ilp-error-box {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.25);
  color: #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 20px;
}


/* ── Brand Kit ───────────────────────────────────────────────────────────── */
.bk-color { width:38px;height:38px;padding:0;border:none;background:none;cursor:pointer;border-radius:6px;flex-shrink:0; }
.bk-swatch { width:28px;height:28px;border-radius:50%;border:2px solid rgba(255,255,255,.15);flex-shrink:0;transition:background .15s; }
