/* CLAUDE: design system SSL Manager */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #047857; --success-soft: #ecfdf5; --success-border: #a7f3d0;
    --warning: #b45309; --warning-soft: #fffbeb; --warning-border: #fde68a;
    --danger: #b91c1c;  --danger-soft: #fef2f2;  --danger-border: #fecaca;
    --info: #1d4ed8;    --info-soft: #eff6ff;    --info-border: #bfdbfe;
    --sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
    --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; word-break: break-all; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 14px; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 4px 12px rgba(99, 102, 241, .4); }
.brand-text { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 8px 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 500; transition: background .15s, color .15s; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: rgba(99, 102, 241, .18); color: #fff; }
.nav-item.active svg { color: #a5b4fc; opacity: 1; }
.sidebar-footer { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; }
.sidebar-footer .env-dot { display: inline-block; margin-right: 6px; }
.env-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }

.main { flex: 1; margin-left: 248px; min-width: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px 32px 0; }
.page-header h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.page-subtitle { margin: 4px 0 0; color: var(--muted); }
.page-subtitle:empty { display: none; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 32px 48px; }

/* ---------- Card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-title { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; }
.card-flush { overflow: hidden; }
.count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--border-strong); }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.kpi-hint { color: var(--muted); font-size: 12px; }
.kpi.k-total::before { background: var(--primary); }
.kpi.k-danger::before { background: #ef4444; } .kpi.k-danger .kpi-value { color: var(--danger); }
.kpi.k-warning::before { background: #f59e0b; } .kpi.k-warning .kpi-value { color: var(--warning); }
.kpi.k-info::before { background: #3b82f6; }
.kpi.k-muted::before { background: #9ca3af; }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.table, table.res { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, table.res th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td, table.res td { padding: 12px 14px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.table tr:last-child td, table.res tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td, table.res tr:hover td { background: #fafbff; }
.table td.num, table.res td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td.actions { white-space: nowrap; text-align: right; width: 1%; }
.table td.actions .btn + .btn { margin-left: 4px; }
.table td.actions .btn-sm { padding: 5px 9px; }
.col-check { font-size: 13px; color: var(--text-2); max-width: 220px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12.5px; }
tr.inactive td { opacity: .55; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- Bottoni (input type=submit compresi) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; font-size: 14px; font-weight: 500; line-height: 20px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; box-shadow: var(--shadow); text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .25); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: #f3f4f6; }
.btn-sm { font-size: 13px; padding: 5px 10px; line-height: 18px; }
.btn[disabled], .btn.aspNetDisabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.field > label, .field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
input[type=text], input[type=password], input[type=email], select, textarea, .input { width: 100%; font-family: inherit; font-size: 14px; color: var(--text); padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
input[type=text][readonly], textarea[readonly] { background: var(--surface-2); }
textarea { font-family: var(--mono); font-size: 12px; line-height: 1.45; }
.input-group { display: flex; gap: 8px; }
.input-group > input[type=text], .input-group > select { flex: 1; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check label { cursor: pointer; }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters input[type=text] { width: 260px; }
.search { position: relative; }
.search input[type=text] { padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ---------- Avvisi ---------- */
/* Testo normale (non flex: con flex ogni pezzo di testo, <b> e <code> diventava una colonna); barra colorata assoluta */
.msg { position: relative; display: block; padding: 12px 16px 12px 26px; margin: 0 0 20px; border-radius: 10px; border: 1px solid var(--border);
       background: var(--surface); box-shadow: var(--shadow); line-height: 1.6; overflow-wrap: anywhere; }
.msg::before { content: ""; position: absolute; left: 11px; top: 11px; bottom: 11px; width: 4px; border-radius: 4px; background: var(--muted); }
.msg code { background: rgba(255, 255, 255, .6); }
.msg.success { background: var(--success-soft); border-color: var(--success-border); color: #065f46; } .msg.success::before { background: #10b981; }
.msg.warn { background: var(--warning-soft); border-color: var(--warning-border); color: #92400e; } .msg.warn::before { background: #f59e0b; }
.msg.error { background: var(--danger-soft); border-color: var(--danger-border); color: #991b1b; } .msg.error::before { background: #ef4444; }
.msg.info, .renew-info { background: var(--info-soft); border-color: var(--info-border); color: #1e3a8a; } .msg.info::before { background: #3b82f6; }
.renew-info { display: block; padding: 12px 16px; margin: 0 0 20px; border-radius: 10px; border: 1px solid var(--info-border); }

/* ---------- Badge e stati ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.badge.ToPurchase, .badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge.ToValidate, .badge.warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge.Validating, .badge.success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge.neutral { background: #f3f4f6; color: var(--muted); }

/* Scadenze */
.exp-date { font-weight: 600; font-variant-numeric: tabular-nums; }
.exp-expired .exp-date, .exp-soon .exp-date { color: var(--danger); }
.exp-near .exp-date { color: var(--warning); }
.exp-none .exp-date { color: var(--muted); font-weight: 500; }

.ok { color: var(--success); } .ko { color: var(--muted); } .err { color: var(--danger); }
.text-muted, .hint { color: var(--muted); font-size: 12.5px; }
.stack > * + * { margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .sidebar { position: static; width: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; overflow-x: auto; }
    .brand { padding: 0; }
    .nav { flex-direction: row; }
    .nav-section, .brand-text { display: none; }
    .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; }
    .sidebar-footer .sidebar-user { margin: 0; }
    .sidebar-footer .sidebar-user > span, .sidebar-footer > div > div:first-child { display: none; }
    .app { flex-direction: column; }
    .main { margin-left: 0; }
    .page-header { padding: 20px 16px 0; }
    .content { padding: 16px 16px 32px; }
    .form-grid .span-2 { grid-column: auto; }
}

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
              background: radial-gradient(1200px 600px at 20% -10%, #e0e7ff 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
              box-shadow: var(--shadow-md); padding: 28px; }
.login-card h1 { font-size: 20px; margin: 20px 0 4px; letter-spacing: -.01em; }
.login-card .text-muted { margin: 0 0 20px; }
.login-card .field { margin-bottom: 16px; }
.login-card .msg { margin-bottom: 16px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; }
.btn-block { width: 100%; }

/* Logout nella sidebar */
.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.sidebar-user .btn-logout { background: transparent; border: 1px solid rgba(255,255,255,.14); color: #cbd5e1; border-radius: 6px;
                            padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.sidebar-user .btn-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
pre.code-block { margin: 0; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
                 font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; max-width: 520px; }
.btn-danger { color: var(--danger); border-color: var(--danger-border); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.card-footer .btn-left { margin-right: auto; }
.form-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.cell-main a.domain-link { color: var(--text); text-decoration: none; }
.cell-main a.domain-link:hover { color: var(--primary); text-decoration: underline; }
/* Colonna Dominio: nome + badge (DNS/FTP, giorni, tipologia) sulla stessa riga, a capo se serve */
.domain-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.domain-line a.domain-link { margin-right: 2px; }
