:root{--bg:#f3f5f9;--card:#fff;--text:#172033;--muted:#667085;--line:#e6eaf0;--primary:#2657ff;--danger:#d92d20;--success:#079455;--warning:#b54708;--shadow:0 18px 55px rgba(16,24,40,.08);--radius:18px}*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}a{color:inherit}.app-shell{display:flex;min-height:100vh}.sidebar{width:280px;background:#0b1220;color:white;padding:24px;position:fixed;inset:0 auto 0 0}.brand{display:flex;gap:12px;align-items:center;margin-bottom:28px}.brand-mark{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;background:linear-gradient(135deg,#4870ff,#12b76a);font-weight:800}.brand small{display:block;color:#a5b4fc;margin-top:2px}.sidebar nav{display:grid;gap:8px}.sidebar nav a{text-decoration:none;color:#d9e2ff;padding:12px 14px;border-radius:12px}.sidebar nav a:hover{background:rgba(255,255,255,.09)}.main{margin-left:280px;width:calc(100% - 280px);padding:28px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.topbar h1{margin:0;font-size:28px}.topbar p{margin:6px 0 0;color:var(--muted)}.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;margin-bottom:18px}.grid{display:grid;gap:18px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.grid.four{grid-template-columns:repeat(4,minmax(0,1fr))}.stat{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px}.stat strong{display:block;font-size:30px}.stat span{color:var(--muted)}.alert{border-radius:14px;padding:13px 15px;margin-bottom:14px;border:1px solid}.alert.success{background:#ecfdf3;border-color:#abefc6;color:#067647}.alert.danger{background:#fef3f2;border-color:#fecdca;color:#b42318}.alert.warning{background:#fffaeb;border-color:#fedf89;color:#93370d}.alert.info{background:#eff8ff;border-color:#b2ddff;color:#175cd3}.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:12px;padding:10px 14px;text-decoration:none;cursor:pointer;font-weight:700;background:#eef2ff;color:#263b7c}.btn.primary{background:var(--primary);color:#fff}.btn.success{background:var(--success);color:#fff}.btn.danger{background:var(--danger);color:#fff}.btn.ghost{background:#f2f4f7;color:#344054}.btn.small{padding:7px 10px;font-size:13px}form label{display:block;margin:12px 0 6px;font-weight:700}input,select,textarea{width:100%;border:1px solid #d0d5dd;border-radius:12px;padding:11px 12px;font:inherit;background:#fff;color:var(--text)}textarea{min-height:90px;resize:vertical}.form-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:16px}table{width:100%;border-collapse:collapse;background:#fff}th,td{padding:13px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}th{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);background:#f8fafc}tr:last-child td{border-bottom:0}.badge{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800}.badge.ok{background:#ecfdf3;color:#067647}.badge.bad{background:#fef3f2;color:#b42318}.badge.wait{background:#fffaeb;color:#93370d}.actions{display:flex;gap:8px;flex-wrap:wrap}.inline-form{display:inline}.inline-form input{width:auto;display:inline-block;max-width:120px;padding:7px 10px}.muted{color:var(--muted)}code{background:#eef2f6;border-radius:8px;padding:2px 6px}.auth-body{display:grid;place-items:center;min-height:100vh;background:radial-gradient(circle at top,#dfe7ff,transparent 38%),var(--bg)}.auth-card{width:min(440px,92vw);background:#fff;border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:26px}.auth-card.wide{width:min(640px,92vw)}.auth-card h1{margin-top:0}.mini{font-size:12px;color:var(--muted)}@media (max-width:900px){.sidebar{position:static;width:100%;border-radius:0}.app-shell{display:block}.main{margin-left:0;width:100%;padding:18px}.grid.two,.grid.three,.grid.four,.form-row{grid-template-columns:1fr}.topbar h1{font-size:23px}}
.table-wrap{overflow:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--line);border-radius:16px}table{width:100%;border-collapse:collapse;background:#fff}th,td{padding:13px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}th{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);background:#f8fafc}tr:last-child td{border-bottom:0}.badge{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800}.badge.ok{background:#ecfdf3;color:#067647}.badge.bad{background:#fef3f2;color:#b42318}.badge.wait{background:#fffaeb;color:#93370d}.actions{display:flex;gap:8px;flex-wrap:wrap}.inline-form{display:inline}.inline-form input{width:auto;display:inline-block;max-width:120px;padding:7px 10px}.muted{color:var(--muted)}code{background:#eef2f6;border-radius:8px;padding:2px 6px}.auth-body{display:grid;place-items:center;min-height:100vh;background:radial-gradient(circle at top,#dfe7ff,transparent 38%),var(--bg)}.auth-card{width:min(440px,92vw);background:#fff;border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:26px}.auth-card.wide{width:min(640px,92vw)}.auth-card h1{margin-top:0}.mini{font-size:12px;color:var(--muted)}@media (max-width:900px){.sidebar{position:static;width:100%;border-radius:0}.app-shell{display:block}.main{margin-left:0;width:100%;padding:18px}.grid.two,.grid.three,.grid.four,.form-row{grid-template-columns:1fr}.topbar h1{font-size:23px}}
.user-table{min-width:0;font-size:13px}
.user-table th,.user-table td{white-space:nowrap;vertical-align:middle;padding:9px 8px}
.user-table .cell-stack{display:flex;align-items:center;gap:6px;flex-wrap:nowrap}
.user-table .actions{display:flex;align-items:center;gap:6px;flex-wrap:nowrap}
.user-table .row-form{display:inline-flex;align-items:center;gap:6px;flex-wrap:nowrap;margin:0}
.user-table .row-form input,
.user-table .row-form select{width:auto;min-width:100px;max-width:170px;padding:6px 8px}
.user-table .row-form input[type="file"]{min-width:180px;max-width:230px}
.user-table .mini{display:inline}
.user-table .password-cell{padding-right:12px}
.customer-password{display:inline-block;max-width:150px;margin-right:5px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.password-toggle{position:relative;width:30px;height:30px;min-width:30px;padding:0!important;border-radius:9px}
.password-toggle svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.password-toggle.is-visible::after{content:"";position:absolute;width:20px;height:2px;border-radius:2px;background:currentColor;transform:rotate(-45deg)}
.icon-action{width:36px;height:36px;min-width:36px;padding:0!important}
.icon-action svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.reseller-table .password-cell{width:1%;white-space:nowrap}
.reseller-table th:nth-child(-n+6),.reseller-table td:nth-child(-n+6){width:1%;white-space:nowrap}
.reseller-table .reseller-name,.reseller-table .reseller-email,.reseller-table .reseller-username{display:block;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mobile-reseller-info{display:none}.reseller-info-dialog{width:min(440px,94vw)}.reseller-info-value{display:block;font-size:28px}.reseller-info-grid{text-align:center}
.plan-mobile-name,.plan-mobile-edit,.plan-mobile-status,.plan-delete-icon{display:none}.plan-edit-dialog{width:min(520px,94vw)}
.user-table-wrap{scrollbar-gutter:stable both-edges}
input[type="checkbox"],input[type="radio"]{width:auto;padding:0;border:0;accent-color:var(--primary);margin:0;vertical-align:middle}
.choice-group{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:8px}
.choice{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600;line-height:1.2;cursor:pointer}
.checkbox-row{display:inline-flex;align-items:center;gap:8px;margin-top:10px}
input:focus-visible,select:focus-visible,textarea:focus-visible,button:focus-visible,.btn:focus-visible{outline:2px solid rgba(38,87,255,.45);outline-offset:1px}
.mt-14{margin-top:14px}
.mt-12{margin-top:12px}
.mb-12{margin-bottom:12px}
.maxw-340{max-width:340px}
.self-end{align-self:end}
.is-hidden{display:none}
.actions .inline-form input[name="note"],
.actions .inline-form input[placeholder="nota"]{display:none !important}
.pager{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:10px}
.pager-links{display:flex;gap:8px;flex-wrap:wrap}
.user-mobile-line{display:inline-flex;align-items:center;gap:6px;min-width:0}
.mobile-quick-actions{display:none}
@media (max-width:1200px){.user-table{min-width:0}}
@media (max-width:900px){.user-table{min-width:0}.user-table .row-form{flex-wrap:wrap;gap:5px}.user-table .row-form input,.user-table .row-form select{max-width:140px}.user-table th,.user-table td{padding:8px 7px}}

@media (max-width:700px){
    .vpn-template-picker-head{align-items:flex-start;flex-direction:column}.vpn-template-checks{grid-template-columns:1fr}
    .card{padding:12px;border-radius:16px}
    .row-form.mb-12{display:grid;grid-template-columns:1fr auto;gap:8px}
    .row-form.mb-12 input{grid-column:1 / -1;max-width:none}
    .user-table-wrap{overflow:visible;border:0;border-radius:0}
    .user-table{display:block;min-width:0;background:transparent;font-size:14px}
    .user-table thead{display:none}
    .user-table tbody{display:block}
    .user-table tr[data-user-row="1"]{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px;position:relative;margin:0 0 8px;padding:13px 40px 13px 14px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 8px 24px rgba(16,24,40,.05);cursor:pointer}
    .user-table tr[data-user-row="1"]::after{content:"\25BE";position:absolute;right:14px;top:14px;color:var(--muted);font-size:20px;line-height:1;transition:transform .15s ease}
    .user-table tr[data-user-row="1"].mobile-open::after{transform:rotate(180deg)}
    .user-table tr[data-user-row="1"] td{display:none;padding:0;border:0;white-space:normal;background:transparent}
    .user-table tr[data-user-row="1"] .user-cell,.user-table tr[data-user-row="1"] .expiry-cell{display:block}
    .user-table .user-cell{min-width:0}
    .user-table .id-cell,.user-table .user-cell,.user-table .password-cell,.user-table .owner-cell,.user-table .notes-cell,.user-table .expiry-cell,.user-table .status-cell{width:auto}
    .user-mobile-line{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap}
    .user-table .user-cell strong{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;text-decoration:underline;font-size:15px;vertical-align:middle}
    .user-table .user-cell .badge{display:inline-flex;margin:0;padding:4px 7px;font-size:11px;vertical-align:middle}
    .mobile-quick-actions{display:flex;gap:6px;margin:0}
    .mobile-quick-actions form{display:inline-flex;margin:0}
    .btn.tiny{padding:5px 8px;border-radius:9px;font-size:11px;line-height:1}
    .btn.tiny.danger{min-width:26px}
    .user-table .expiry-cell{text-align:right;color:var(--success);font-weight:800;white-space:nowrap}
    .user-table .expiry-cell form{display:none}
    .user-table .mobile-expiry-text{display:inline}
    .user-table tr.mobile-open .expiry-cell{text-align:left;color:var(--text);font-weight:400;white-space:normal}
    .user-table tr.mobile-open .expiry-cell form{display:flex}
    .user-table tr.mobile-open .mobile-expiry-text{display:none}
    .user-table tr.mobile-open td:not(.id-cell):not(.user-cell):not(.expiry-cell){display:grid;grid-column:1 / -1;grid-template-columns:96px minmax(0,1fr);align-items:start;gap:10px;padding-top:8px;border-top:1px solid #eef1f5}
    .user-table tr.mobile-open td:not(.id-cell):not(.user-cell):not(.expiry-cell)::before{content:attr(data-label);color:var(--muted);font-weight:800;font-size:12px}
    .user-table tr.mobile-open td:not([data-label])::before{content:"Dettagli"}
    .user-table tr.mobile-open .actions-cell{display:block}
    .user-table tr.mobile-open .actions-cell::before{display:block;margin-bottom:8px}
    .user-table .cell-stack,.user-table .actions,.user-table .row-form{display:flex;flex-wrap:wrap;gap:7px}
    .user-table .row-form input,.user-table .row-form select,.user-table .row-form input[type="file"]{width:100%;min-width:0;max-width:none}
    .user-table .btn.small{padding:8px 10px}
    .user-table .mini{white-space:normal;word-break:break-word}
    .pager{padding:0 2px}
}

.presence{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 8px;font-size:12px;font-weight:800;background:#f2f4f7;color:#344054;line-height:1}
.presence span{width:8px;height:8px;border-radius:999px;background:#98a2b3;box-shadow:0 0 0 3px rgba(152,162,179,.16)}
.presence.ok{background:#ecfdf3;color:#067647}
.presence.ok span{background:#12b76a;box-shadow:0 0 0 3px rgba(18,183,106,.18)}
.presence.bad{background:#fef3f2;color:#b42318}
.presence.bad span{background:#f04438;box-shadow:0 0 0 3px rgba(240,68,56,.16)}
.user-cell .presence{font-size:0;padding:4px;background:transparent}
.user-cell .presence span{width:10px;height:10px}
.btn.icon-delete{min-width:31px;width:31px;padding-left:0;padding-right:0;font-weight:900}
.user-table .id-cell,.user-table .user-cell,.user-table .password-cell,.user-table .owner-cell,.user-table .notes-cell,.user-table .expiry-cell,.user-table .status-cell{width:1%;min-width:0}
.user-table .user-cell strong{display:inline-block;max-width:170px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.user-table .owner-text{display:inline-block;max-width:150px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.truncate{display:inline-block;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
.compact-details{position:relative;display:inline-block}
.compact-details summary{list-style:none;display:inline-flex;align-items:center;border:1px solid #d0d5dd;border-radius:9px;padding:6px 9px;background:#fff;color:#344054;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
.compact-details summary::-webkit-details-marker{display:none}
.compact-details[open] summary{background:#eef2ff;color:#263b7c}
.compact-details[open]{z-index:20}
.compact-details[open] .row-form{position:absolute;right:0;top:calc(100% + 6px);display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:360px;max-width:520px;padding:10px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 42px rgba(16,24,40,.16)}
.compact-details[open] .row-form + .row-form{top:calc(100% + 58px)}
.note-text{font-weight:800;color:var(--text)}
.user-table .notes-cell{width:1%;min-width:0}.user-table .notes-cell .note-text{max-width:160px}.user-table .expiry-cell{width:1%}
.notes-details[open] .row-form{left:0;right:auto;min-width:300px}
.notes-details[open] .row-form input[name="notes"]{min-width:190px;max-width:240px}
.template-details[open] .row-form,.file-details[open] .row-form{left:0;right:auto}
.template-details[open] .row-form select{min-width:190px;max-width:260px}
.edit-dialog{width:min(760px,94vw);border:0;border-radius:20px;padding:0;box-shadow:0 24px 80px rgba(16,24,40,.24);color:var(--text)}
.edit-dialog::backdrop{background:rgba(15,23,42,.55);backdrop-filter:blur(2px)}
.user-edit-dialog{max-height:90vh;overflow:hidden}
.user-edit-dialog .dialog-grid{max-height:calc(90vh - 65px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 20px;border-bottom:1px solid var(--line)}
.dialog-head h3{margin:0;font-size:20px}
.dialog-body{padding:18px 20px 20px}
.dialog-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:18px 20px 20px}
.dialog-grid section{border:1px solid var(--line);border-radius:14px;padding:14px;background:#f8fafc}
.dialog-grid h4{margin:0 0 10px;font-size:15px}
.stack-form{display:grid;gap:9px}
.stack-form input,.stack-form select{width:100%;max-width:none}
.stack-form .btn{width:max-content}
.expiry-btn{border:0;background:transparent;color:var(--success);font:inherit;font-weight:900;text-decoration:underline;cursor:pointer;padding:0}
.expiry-dialog{width:min(620px,94vw)}
.expiry-form{display:grid;gap:18px;padding:22px}
.expiry-form label{text-align:center;text-transform:uppercase;color:var(--muted);letter-spacing:.04em;margin:0;font-size:13px}
.expiry-date-input{font-size:18px;font-weight:800;padding:16px;border-radius:14px;background:#f8fafc}
.quick-expiry{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px;padding-top:4px}
.page-actions{display:flex;justify-content:flex-end;gap:10px;margin:0 0 14px}
.create-user-dialog{width:min(860px,94vw)}
.create-user-dialog .form-row{grid-template-columns:repeat(2,minmax(0,1fr))}
.create-section-title{margin:0 0 14px;font-size:15px}
.create-info{margin:0 0 18px;padding:12px 14px;border-radius:12px;background:#f0f9f5;color:#475467;font-size:14px}
.create-expiry-field{grid-column:1 / -1}
.create-quick-expiry{justify-content:flex-start;margin-top:10px}
.no-expiry-badge{position:relative;user-select:none}
.no-expiry-badge input{position:absolute;opacity:0;pointer-events:none}
.no-expiry-badge:has(input:checked){background:#ecfdf3;color:#067647;box-shadow:inset 0 0 0 1px #abefc6}
.create-dialog-actions{position:sticky;bottom:-20px;display:flex;justify-content:flex-end;gap:10px;margin:18px -20px -20px;padding:16px 20px;background:#f8fafc;border-top:1px solid var(--line);border-radius:0 0 20px 20px}
.vpn-template-picker{margin-top:12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#f8fafc}
.vpn-template-picker[hidden]{display:none}
.vpn-template-picker-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.vpn-template-picker-head>div:first-child{display:grid;gap:2px}.vpn-template-picker-head span{font-size:12px;color:var(--muted)}
.vpn-template-picker-head>div:last-child{display:flex;gap:6px;flex-wrap:wrap}
.vpn-template-checks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:230px;overflow:auto}
.vpn-template-choice{display:flex!important;align-items:center;gap:9px;margin:0!important;padding:10px 11px;border:1px solid var(--line);border-radius:11px;background:#fff;cursor:pointer}
.vpn-template-choice input{width:auto;flex:0 0 auto;margin:0}.vpn-template-choice span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vpn-template-choice:has(input:checked){border-color:#9db4ff;background:#eef3ff;color:#1d3fbf}
.primary-vpn-label{display:none;margin-left:auto;padding:3px 6px;border-radius:999px;background:#dbe6ff;color:#1d3fbf;font-size:10px}
.vpn-template-choice.is-primary .primary-vpn-label{display:inline-flex}
.vpn-assigned-list{display:grid;gap:6px;margin-bottom:12px}
.vpn-assigned-row{display:flex;align-items:center;gap:8px;min-width:0;margin:0;padding:8px 9px;border:1px solid var(--line);border-radius:10px;background:#fff}
.vpn-assigned-row span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:700}
.vpn-assigned-row small{margin-left:auto;padding:3px 7px;border-radius:999px;background:#eaf0ff;color:#2657ff;font-size:10px;font-weight:800}
.vpn-assigned-row.is-primary{border-color:#bfd0ff;background:#f5f7ff}
.vpn-remove-x{display:grid;place-items:center;width:24px;height:24px;min-width:24px;padding:0;border:0;border-radius:7px;background:#d92d20;color:#fff;font:800 18px/1 Arial,sans-serif;cursor:pointer}
.vpn-remove-x:hover{background:#b42318}
.vpn-edit-picker{margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
.vpn-edit-picker .vpn-template-picker-head{align-items:flex-start;margin-bottom:8px}
.vpn-edit-picker .vpn-template-checks{grid-template-columns:1fr;max-height:190px}
.vpn-edit-picker .vpn-template-choice{padding:8px 9px}
.vpn-primary-template-form{margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
.vpn-primary-template-form label{margin:0;font-size:12px;color:var(--muted)}
.template-visibility-box{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#f8fafc}
.template-reseller-list{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px;margin-top:8px}
.template-reseller-list .checkbox-row{display:inline-flex;width:max-content;max-width:100%;margin:0;padding:6px 9px;border:1px solid var(--line);border-radius:999px;background:#fff;line-height:1.15;white-space:nowrap}
.template-reseller-list input[type="checkbox"]{transform:scale(.92)}
.password-input-wrap{position:relative}.password-input-wrap input{padding-right:46px}.credential-password-toggle{position:absolute;top:50%;right:7px;display:grid;place-items:center;width:34px;height:34px;padding:0;transform:translateY(-50%);border:0;border-radius:9px;background:transparent;color:#667085;cursor:pointer}.credential-password-toggle:hover{background:#f2f4f7;color:#172033}.credential-password-toggle svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.credential-password-toggle.is-visible::after{content:"";position:absolute;width:22px;height:2px;border-radius:2px;background:currentColor;transform:rotate(-45deg)}
.template-action-icon{width:36px;height:36px;min-width:36px;padding:0!important}.template-action-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.template-table th:nth-child(-n+7),.template-table td:nth-child(-n+7){width:1%;white-space:nowrap}.template-name-text,.template-file-text,.template-access-names{display:inline-block;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.template-name-text{max-width:160px}.mobile-template-info{display:none}.template-info-dialog{width:min(560px,94vw)}.template-info-grid p{margin:0;overflow-wrap:anywhere}
.template-download-link{color:inherit;font-weight:800;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}.template-download-link:hover{color:var(--primary)}
.visibility-access-button{border:0;font-family:inherit;cursor:pointer}.visibility-access-button:hover{text-decoration:underline}.template-access-dialog{width:min(480px,94vw);white-space:normal}.template-access-list{display:grid;gap:8px;margin:14px 0 0;padding:0;list-style:none}.template-access-list li{padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#f8fafc;overflow-wrap:anywhere}
.user-action-icon{width:42px;height:38px;min-width:42px;padding:0!important}.user-action-icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media (max-width:700px){
    .plans-table .plan-detail-column,.plans-table .plan-desktop-field,.plans-table .plan-desktop-save{display:none}
    .plans-table th,.plans-table td{padding:10px 8px;vertical-align:middle}
    .plans-table th:first-child,.plans-table td:first-child{width:100%}
    .plans-table .plan-mobile-name{display:block;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .plans-table .plan-desktop-status{display:none}
    .plans-table .plan-mobile-status{display:inline-flex;white-space:nowrap}
    .plans-table .plan-status-column{width:1%;white-space:nowrap;text-align:center}
    .plans-table .plan-actions{display:flex;align-items:center;gap:6px;flex-wrap:nowrap;white-space:nowrap}
    .plans-table .plan-mobile-edit{display:inline-flex;width:36px;height:36px;min-width:36px}
    .plans-table .plan-delete{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;min-width:36px;padding:0}
    .plans-table .plan-delete-text{display:none}
    .plans-table .plan-delete-icon{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}
    .plan-edit-dialog .dialog-body{padding:14px}
    .template-table .template-id-column,.template-table .template-file-column,.template-table .template-size-column,.template-table .template-credentials-column,.template-table .template-date-column{display:none}
    .template-table th,.template-table td{padding:10px 6px}
    .template-table .template-visibility-cell .template-access-names{display:none}
    .template-table .template-row-actions{display:flex;align-items:center;gap:5px;flex-wrap:nowrap}
    .template-table .template-action-icon{width:34px;height:34px;min-width:34px}
    .template-table .mobile-template-info{display:inline-flex;font-size:18px;font-weight:900;font-family:Georgia,serif}
    .template-info-dialog .dialog-grid{grid-template-columns:1fr}
    .reseller-table .reseller-name-column,.reseller-table .reseller-password-column,.reseller-table .reseller-credits-column,.reseller-table .reseller-clients-column{display:none}
    .reseller-table{table-layout:auto}
    .reseller-table th,.reseller-table td{padding:10px 6px}
    .reseller-table .actions{display:flex;align-items:center;gap:5px;flex-wrap:nowrap}
    .reseller-table .icon-action{width:34px;height:34px;min-width:34px}
    .reseller-table .mobile-reseller-info{display:inline-flex;font-size:18px;font-weight:900;font-family:Georgia,serif}
    .reseller-table .reseller-status-badge{display:inline-block;width:12px;height:12px;padding:0;border-radius:999px;font-size:0;vertical-align:middle}
    .reseller-table .reseller-status-badge.ok{background:#12b76a}.reseller-table .reseller-status-badge.bad{background:#f04438}
    .reseller-info-dialog .dialog-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .user-table .id-cell,.user-table .user-cell,.user-table .password-cell,.user-table .owner-cell,.user-table .notes-cell,.user-table .expiry-cell,.user-table .status-cell{width:auto;min-width:0}
    .user-table tr[data-user-row="1"] .user-cell{display:block;grid-column:1;grid-row:1;min-width:0}
    .user-table tr[data-user-row="1"] .expiry-cell,.user-table tr[data-user-row="1"].mobile-open .expiry-cell{display:block;grid-column:2;grid-row:1;align-self:center;text-align:right;white-space:nowrap}
    .user-table tr[data-user-row="1"] .notes-cell,.user-table tr[data-user-row="1"].mobile-open .notes-cell{display:block;grid-column:1 / -1;grid-row:2;min-width:0;padding-top:6px;border-top:1px solid #eef1f5;white-space:nowrap}
    .user-table tr[data-user-row="1"] .notes-cell::before{display:none!important}
    .user-table .notes-cell .note-text{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:var(--muted)}
    .mobile-quick-actions .user-action-icon{width:30px;height:28px;min-width:30px;padding:0!important}
    .mobile-quick-actions .user-action-icon svg{width:17px;height:17px}
}
@media (max-width:700px){
    .user-table .user-cell .presence{margin:0;padding:4px;font-size:0}
    .user-table .user-cell .presence span{width:9px;height:9px}
    .compact-details{display:block;width:100%}
    .compact-details summary{width:max-content}
    .compact-details[open] .row-form{position:static;min-width:0;max-width:none;width:100%;box-shadow:none;margin-top:7px}
    .notes-details[open] .row-form input[name="notes"]{min-width:0;max-width:none}
    .dialog-grid{grid-template-columns:1fr;padding:14px}
    .dialog-body{padding:14px}
    .dialog-head{padding:14px}
    .page-actions{justify-content:stretch}
    .page-actions .btn{width:100%}
    .create-user-dialog .form-row{grid-template-columns:1fr}
    .create-user-dialog{width:calc(100vw - 28px);max-height:86vh;border-radius:18px}
    .create-user-dialog .dialog-head h3{font-size:20px}
    .create-user-dialog .dialog-head .btn{width:34px;height:34px;padding:0;font-size:0;border-radius:999px}
    .create-user-dialog .dialog-head .btn::before{content:"×";font-size:22px;line-height:1}
    .create-user-dialog form label{text-transform:uppercase;letter-spacing:.04em;color:#667085;font-size:12px;margin-top:14px}
    .create-user-dialog input,.create-user-dialog select{min-height:48px;border-radius:12px;font-size:16px}
    .create-info{font-size:13px;background:#eef8f2}
    .create-quick-expiry{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
    .create-quick-expiry .btn{border-radius:999px}
    .create-dialog-actions{bottom:-14px;margin:18px -14px -14px;padding:14px;background:#f8fafc}
    .create-dialog-actions .btn{flex:1}
    .template-reseller-list{gap:6px}
    .template-reseller-list .checkbox-row{max-width:100%;white-space:normal}
}

@media (max-width:700px){
    .create-user-dialog{width:min(560px,calc(100vw - 32px));max-height:82vh;margin:auto;border-radius:18px;overflow:hidden}
    .create-user-dialog .dialog-head{min-height:58px;padding:14px 22px;background:#fff}
    .create-user-dialog .dialog-head h3{font-size:18px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
    .create-user-dialog .dialog-head .btn{width:34px;height:34px;padding:0;font-size:0;border-radius:999px}
    .create-user-dialog .dialog-head .btn::before{content:"x";font-size:20px;line-height:1}
    .create-user-dialog .dialog-body{max-height:calc(82vh - 58px);overflow:auto;padding:18px 22px 0}
    .create-user-dialog .form-row{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
    .create-user-dialog form label{text-transform:uppercase;letter-spacing:.04em;color:#667085;font-size:11px;margin:10px 0 6px}
    .create-user-dialog input,.create-user-dialog select{min-height:46px;border-radius:11px;font-size:15px;padding:10px 12px}
    .create-expiry-field{grid-column:1 / -1}
    .create-quick-expiry{display:flex;flex-wrap:wrap;justify-content:flex-start;gap:8px;margin-top:9px}
    .create-quick-expiry .btn{border-radius:999px;min-height:34px;padding:7px 12px;font-size:12px;line-height:1.1}
    .no-expiry-badge{max-width:150px;text-align:center}
    .create-dialog-actions{bottom:0;margin:16px -22px 0;padding:12px 22px;background:#f8fafc}
    .create-dialog-actions .btn{flex:1}
}

@media (max-width:420px){
    .create-user-dialog{width:calc(100vw - 24px);max-height:84vh}
    .create-user-dialog .dialog-head{padding:12px 16px}
    .create-user-dialog .dialog-body{max-height:calc(84vh - 58px);padding:14px 16px 0}
    .create-user-dialog .form-row{grid-template-columns:1fr;gap:8px}
    .create-quick-expiry{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
    .create-quick-expiry .btn{width:100%;padding-left:6px;padding-right:6px}
    .no-expiry-badge{max-width:none}
    .create-dialog-actions{margin-left:-16px;margin-right:-16px;padding:12px 16px}
}

.mobile-header,.mobile-sidebar-backdrop{display:none}
.desktop-credits{display:flex;align-items:center;gap:14px;padding:10px 14px;border:1px solid #abefc6;border-radius:14px;background:#ecfdf3;color:#067647;box-shadow:0 10px 28px rgba(18,183,106,.12)}
.desktop-credits span{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.desktop-credits strong{font-size:24px;line-height:1}
@media (max-width:900px){
    body.mobile-menu-open{overflow:hidden}
    .mobile-header{position:sticky;top:0;z-index:70;display:flex;align-items:center;gap:14px;height:64px;padding:10px 14px;background:#fff;border-bottom:1px solid var(--line);box-shadow:0 4px 18px rgba(16,24,40,.08)}
    .mobile-menu-btn{display:inline-flex;flex-direction:column;justify-content:center;gap:4px;width:42px;height:42px;border:0;border-radius:10px;background:#f2f4f7;padding:0 11px;cursor:pointer}
    .mobile-menu-btn span{display:block;width:20px;height:2px;border-radius:999px;background:#1d2939}
    .mobile-brand{display:grid;gap:0;min-width:0;line-height:1.05}
    .mobile-brand strong{display:block;max-width:170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}
    .mobile-brand small{font-size:11px;font-weight:900;color:var(--success);letter-spacing:.04em}
    .mobile-header-meta{margin-left:auto;display:flex;align-items:center;gap:14px}
    .mobile-credits{display:inline-flex;align-items:center;gap:5px;color:var(--success);font-weight:900;font-size:15px;line-height:1}
    .mobile-credits::before{content:"";display:inline-block;width:15px;height:15px;border-radius:999px;background:linear-gradient(135deg,#12b76a,#079455);box-shadow:0 0 0 3px rgba(18,183,106,.12)}
    .mobile-theme-dot{width:24px;height:24px;padding:0;border-radius:999px;background:linear-gradient(90deg,#1d2939 0 50%,#fff 50% 100%);border:2px solid #1d2939;cursor:pointer;transition:transform .18s ease,background .18s ease,border-color .18s ease}
    .mobile-sidebar-backdrop{position:fixed;inset:64px 0 0 0;z-index:75;background:rgba(15,23,42,.55);border:0;padding:0;opacity:0;pointer-events:none;transition:opacity .18s ease}
    body.mobile-menu-open .mobile-sidebar-backdrop{display:block;opacity:1;pointer-events:auto}
    .sidebar{position:fixed;inset:64px auto 0 0;z-index:80;width:min(330px,82vw);padding:0;background:#fff;color:var(--text);box-shadow:18px 0 45px rgba(16,24,40,.18);transform:translateX(-105%);transition:transform .2s ease;overflow:auto}
    body.mobile-menu-open .sidebar{transform:translateX(0)}
    .sidebar .brand{display:none}
    .sidebar nav{display:grid;gap:0;padding:14px 0}
    .sidebar nav a{display:flex;align-items:center;min-height:54px;padding:0 28px;border-radius:0;color:#344054;font-size:18px;font-weight:650}
    .sidebar nav a:hover{background:#f2f4f7}
    .sidebar nav a[href*="users.php"]{background:#dff8ec;color:#067647}
    .sidebar nav a[href*="logout.php"]{color:#c01048}
    .app-shell{display:block}
    .main{margin-left:0;width:100%;padding:14px}
    .topbar{display:none}
}

html[data-theme="dark"]{color-scheme:dark;--bg:#0f172a;--card:#111827;--text:#e5edf8;--muted:#94a3b8;--line:#334155;--primary:#4770ff;--shadow:0 18px 55px rgba(0,0,0,.28)}
html[data-theme="dark"] body{background:var(--bg);color:var(--text)}
html[data-theme="dark"] .card,html[data-theme="dark"] .stat,html[data-theme="dark"] table,html[data-theme="dark"] .auth-card,html[data-theme="dark"] .edit-dialog{background:var(--card);color:var(--text)}
html[data-theme="dark"] th{background:#1e293b;color:#aebdd0}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{border-color:#475569;background:#0f172a;color:var(--text)}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#718096}
html[data-theme="dark"] .btn.ghost,html[data-theme="dark"] .password-toggle,html[data-theme="dark"] .credential-password-toggle:hover{background:#263449;color:#dbe6f5}
html[data-theme="dark"] .template-visibility-box,html[data-theme="dark"] .dialog-grid section,html[data-theme="dark"] .template-access-list li,html[data-theme="dark"] .vpn-template-picker{border-color:var(--line);background:#1a2536}
html[data-theme="dark"] .vpn-template-choice{border-color:var(--line);background:#111827;color:var(--text)}
html[data-theme="dark"] .vpn-template-choice:has(input:checked){border-color:#5578ff;background:#172554;color:#dbe6ff}
html[data-theme="dark"] .vpn-assigned-row{border-color:var(--line);background:#111827;color:var(--text)}
html[data-theme="dark"] .vpn-assigned-row.is-primary{border-color:#3b5ccc;background:#172554}
html[data-theme="dark"] .expiry-date-input,html[data-theme="dark"] .create-dialog-actions,html[data-theme="dark"] .create-user-dialog .dialog-head,html[data-theme="dark"] .create-info{border-color:var(--line);background:#1a2536;color:var(--text)}
html[data-theme="dark"] .template-reseller-list .checkbox-row,html[data-theme="dark"] .compact-details summary,html[data-theme="dark"] .compact-details[open] .row-form{border-color:var(--line);background:#111827;color:var(--text)}
html[data-theme="dark"] .dialog-head{border-color:var(--line);background:#111827}
html[data-theme="dark"] .badge.ok{background:#123b32;color:#6ee7b7}
html[data-theme="dark"] .badge.wait{background:#453817;color:#fcd47d}
html[data-theme="dark"] .badge.bad{background:#4a2025;color:#fda4af}
html[data-theme="dark"] .alert.success{background:#123b32;border-color:#236c56;color:#a7f3d0}
html[data-theme="dark"] .alert.danger{background:#4a2025;border-color:#7f3038;color:#fecdd3}
html[data-theme="dark"] .alert.warning{background:#453817;border-color:#765f25;color:#fde68a}
html[data-theme="dark"] .alert.info{background:#172f4d;border-color:#285985;color:#bfdbfe}
html[data-theme="dark"] .desktop-credits{border-color:#236c56;background:#123b32;color:#6ee7b7}
html[data-theme="dark"] code,html[data-theme="dark"] .presence{background:#263449;color:#dbe6f5}
html[data-theme="dark"] .mobile-theme-dot{background:linear-gradient(90deg,#e5edf8 0 50%,#111827 50% 100%);border-color:#e5edf8;transform:rotate(180deg)}
@media (max-width:900px){
    html[data-theme="dark"] .mobile-header{border-color:var(--line);background:#111827}
    html[data-theme="dark"] .mobile-menu-btn{background:#263449}
    html[data-theme="dark"] .mobile-menu-btn span{background:#e5edf8}
    html[data-theme="dark"] .sidebar{background:#111827;color:var(--text)}
    html[data-theme="dark"] .sidebar nav a{color:#dbe6f5}
    html[data-theme="dark"] .sidebar nav a:hover{background:#1e293b}
    html[data-theme="dark"] .sidebar nav a[href*="users.php"]{background:#123b32;color:#6ee7b7}
}
@media (max-width:700px){
    html[data-theme="dark"] .user-table tr[data-user-row="1"]{border-color:var(--line);background:#111827;box-shadow:0 8px 24px rgba(0,0,0,.2)}
    html[data-theme="dark"] .user-table tr[data-user-row="1"] .notes-cell,html[data-theme="dark"] .user-table tr.mobile-open td{border-color:var(--line)}
}
