/* ============================================================================
   DASHBOARD STYLE — Auto Hosting
   ============================================================================ */
:root{
  --blue:#2563eb;--blue-dark:#1d4ed8;--bg:#f5f7fb;
  --text:#172033;--muted:#778197;--border:#e7ebf2;
  --white:#fff;--green:#15803d;--amber:#b45309;--red:#dc2626;
}
*{box-sizing:border-box}
body{margin:0;font:14px/1.5 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}
button,input,select,textarea{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
a{text-decoration:none;color:inherit}
button{cursor:pointer}

/* SCROLLBAR CUSTOM */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* LAYOUT */
.sidebar{position:fixed;inset:0 auto 0 0;width:250px;background:#fff;border-right:1px solid var(--border);padding:24px 16px;display:flex;flex-direction:column;z-index:100;transition:transform 0.3s ease}
.brand{display:flex;gap:12px;align-items:center;padding:0 10px 30px}
.brand-icon{height:38px;width:38px;display:grid;place-items:center;border-radius:10px;background:#172554;color:#fff;font-weight:900;font-size:18px}
.brand strong{display:block;font-size:15px}
.brand small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.section-label{font-size:10px;font-weight:800;color:#a0a8b7;letter-spacing:1px;padding:10px 12px}
.nav{display:flex;gap:12px;align-items:center;padding:10px 12px;margin:2px 0;border-radius:8px;color:var(--muted);font-weight:500;transition:0.2s}
.nav .ico{width:20px;text-align:center;font-size:16px}
.nav:hover{background:var(--bg);color:var(--text)}
.nav.active{background:#eff6ff;color:var(--blue);font-weight:700}
.side-bottom{margin-top:auto;border-top:1px solid var(--border);padding-top:15px}
.profile{display:flex;align-items:center;gap:10px;padding:8px}
.avatar{width:38px;height:38px;border-radius:50%;background:#dbeafe;color:#1d4ed8;display:grid;place-items:center;font-weight:800}
.profile strong{display:block;font-size:12px}
.profile small{display:block;color:var(--muted);font-size:11px}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(15,23,42,0.4);z-index:90;backdrop-filter:blur(2px)}
.sidebar-overlay.show{display:block}

/* TOPBAR */
.topbar{height:70px;background:var(--white);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:50}
.topbar-left{display:flex;align-items:center;gap:16px}
.toggle-btn{display:none;font-size:20px;background:transparent;border:none;color:var(--text);padding:8px;cursor:pointer;border-radius:8px}
.toggle-btn:hover{background:var(--bg)}
.search-box{display:flex;align-items:center;gap:8px;background:var(--bg);padding:10px 16px;border-radius:8px;width:280px;border:1px solid transparent;transition:0.2s}
.search-box:focus-within{background:#fff;border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}
.search-box i{color:var(--muted);font-size:14px}
.search-box input{border:none;background:transparent;outline:none;font-size:13px;width:100%;color:var(--text)}
.topbar-right{display:flex;align-items:center;gap:16px}
.icon-btn{position:relative;width:38px;height:38px;border-radius:50%;border:1px solid var(--border);background:#fff;color:var(--muted);display:grid;place-items:center;cursor:pointer;transition:0.2s}
.icon-btn:hover{background:var(--bg);color:var(--blue)}
.badge-dot{position:absolute;top:2px;right:2px;width:9px;height:9px;background:var(--red);border-radius:50%;border:2px solid #fff}
.user-profile{display:flex;align-items:center;gap:10px;padding-left:16px;border-left:1px solid var(--border);cursor:pointer}
.user-profile .avatar{width:36px;height:36px;font-size:14px}
.user-info{display:flex;flex-direction:column;line-height:1.2}
.user-name{font-weight:700;font-size:13px}
.user-role{font-size:11px;color:var(--muted)}

.main{margin-left:250px;min-height:100vh;display:flex;flex-direction:column}
.content{padding:30px;max-width:1400px;margin:0 auto;width:100%;flex:1}

/* HEADINGS & BUTTONS */
.heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}
.heading h1{font-size:24px;margin:0 0 6px;letter-spacing:-0.5px}
.heading .sub{margin:0;color:var(--muted);font-size:13px}
.btn{border:1px solid var(--border);background:var(--white);color:var(--text);border-radius:8px;padding:10px 16px;font-weight:600;font-size:13px;display:inline-flex;align-items:center;justify-content:center;gap:8px;transition:0.2s;cursor:pointer}
.btn:hover{background:var(--bg)}
.btn.primary{background:var(--blue);border-color:var(--blue);color:var(--white)}
.btn.primary:hover{background:var(--blue-dark)}
.btn.danger{color:var(--red);border-color:#fecaca;background:#fef2f2}
.btn.danger:hover{background:var(--red);color:#fff;border-color:var(--red)}
.btn.small{font-size:12px;padding:6px 12px}
.btn:disabled{opacity:0.6;cursor:not-allowed}

/* STATS & PANELS */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px}
.stat{background:var(--white);border:1px solid var(--border);border-radius:12px;padding:20px}
.stat label{font-size:12px;color:var(--muted);font-weight:500}
.stat strong{display:block;font-size:28px;margin:8px 0 4px;letter-spacing:-0.5px}
.stat small{font-size:11px;color:var(--muted)}
.panel{background:var(--white);border:1px solid var(--border);border-radius:12px;margin-bottom:24px;overflow:hidden}
.panel-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid var(--border)}
.panel-head h2{font-size:15px;margin:0;font-weight:700}
.panel-head p{font-size:12px;color:var(--muted);margin:4px 0 0}
.panel-body{padding:20px}
.grid2{display:grid;grid-template-columns:repeat(2,1fr);gap:20px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}

/* TABLES */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;white-space:nowrap}
th{background:#f8fafc;color:var(--muted);font-size:11px;text-align:left;font-weight:700;text-transform:uppercase;letter-spacing:0.5px;padding:14px 20px;border-bottom:1px solid var(--border)}
td{padding:14px 20px;border-bottom:1px solid var(--border);font-size:13px;vertical-align:middle}
tbody tr:last-child td{border-bottom:none}
tbody tr:hover{background:#f8fafc}
.site-name{display:flex;align-items:center;gap:12px}
.site-icon{width:36px;height:36px;border-radius:8px;background:#eff6ff;color:var(--blue);display:grid;place-items:center;font-weight:700}
.site-name strong{display:block;font-size:13px}
.site-name small{display:block;font-size:11px;color:var(--muted);margin-top:2px}
.row-actions{display:flex;gap:6px}
.icon-btn-sm{width:32px;height:32px;border-radius:6px;border:1px solid var(--border);background:#fff;color:var(--muted);display:grid;place-items:center;cursor:pointer;transition:0.2s}
.icon-btn-sm:hover{background:#eff6ff;color:var(--blue);border-color:#bfdbfe}
.status{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:100px;font-size:11px;font-weight:700}
.status::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.status.live{background:#f0fdf4;color:var(--green)}
.status.pending{background:#fffbeb;color:var(--amber)}
.status.error{background:#fef2f2;color:var(--red)}

/* FORMS & EDITOR */
.field-label{display:block;font-size:12px;font-weight:700;margin:0 0 8px}
.field{width:100%;border:1px solid var(--border);padding:10px 14px;border-radius:8px;outline:none;background:#fff;color:var(--text);font-size:13px;transition:0.2s}
.field:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}
.editor-layout{display:grid;grid-template-columns:1fr 1fr;min-height:450px;background:#0f172a}
.editor-panel{display:flex;flex-direction:column;min-width:0}
.editor-panel + .editor-panel{border-left:1px solid #1e293b}
.editor-panel-head{padding:10px 16px;background:#1e293b;color:#cbd5e1;font-size:12px;font-weight:600;display:flex;justify-content:space-between;border-bottom:1px solid #0f172a}
.editor-panel-head span{color:#64748b}
#cwHtmlEditor{flex:1;width:100%;min-height:400px;padding:16px;border:none;outline:none;resize:vertical;background:transparent;color:#e2e8f0;font-family:'JetBrains Mono',Consolas,monospace;font-size:13px;line-height:1.6}
#preview{flex:1;width:100%;min-height:400px;border:none;background:#fff}
.dropzone{border:2px dashed #cbd5e1;border-radius:12px;padding:40px 20px;text-align:center;background:#f8fafc;cursor:pointer;transition:0.2s}
.dropzone:hover, .dropzone.is-dragover{background:#eff6ff;border-color:var(--blue)}
.dropzone-icon{font-size:32px;color:var(--blue);margin-bottom:12px}
.cw-method{border:2px solid var(--border);border-radius:12px;padding:24px;text-align:center;cursor:pointer;transition:0.2s;background:#fff}
.cw-method:hover{border-color:#93c5fd;background:#f8fafc}
.cw-method.is-active{border-color:var(--blue);background:#eff6ff}
.notice{display:flex;gap:12px;padding:16px;background:#f8fafc;border:1px solid var(--border);border-radius:10px;margin-top:16px}
.notice strong{font-size:13px;display:block;margin-bottom:2px}
.notice p{font-size:12px;color:var(--muted);margin:0}
.pill{display:inline-block;background:#eff6ff;color:var(--blue);padding:4px 10px;border-radius:6px;font-size:11px;font-weight:700}
.empty{padding:40px 20px;text-align:center;color:var(--muted);font-size:13px}
.empty strong{display:block;color:var(--text);font-size:15px;margin-bottom:6px}
.footer{text-align:center;padding:24px 0;font-size:12px;color:#94a3b8;margin-top:auto}
.hidden{display:none!important}

/* MODAL & POPUP */
.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(15,23,42,0.5);z-index:999;align-items:center;justify-content:center;padding:20px;backdrop-filter:blur(4px)}
.modal-backdrop.show{display:flex}
.modal{background:#fff;border-radius:16px;width:100%;max-width:480px;padding:24px;box-shadow:0 20px 40px rgba(0,0,0,0.2);animation:modalIn 0.3s ease}
@keyframes modalIn{from{transform:scale(0.95);opacity:0}to{transform:scale(1);opacity:1}}
.modal.wide{max-width:720px}
.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.modal h2{font-size:18px;margin:0}
.modal .close{border:none;background:none;font-size:20px;color:var(--muted);cursor:pointer}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}
.status-popup{text-align:center;padding:10px 0}
.status-icon{width:80px;height:80px;border-radius:50%;display:grid;place-items:center;margin:0 auto 20px;font-size:36px;color:white}
.status-icon.success{background:#22c55e;box-shadow:0 0 0 10px #dcfce7}
.status-icon.failed{background:#ef4444;box-shadow:0 0 0 10px #fee2e2}
.status-popup h3{font-size:22px;margin-bottom:8px}
.status-popup p{color:var(--muted);margin-bottom:20px;font-size:13px}
.status-url{background:#f1f5f9;padding:12px;border-radius:8px;font-family:monospace;word-break:break-all;color:var(--blue);font-weight:600;font-size:13px}

/* RESPONSIVE */
@media(max-width:1024px){
  .grid2{grid-template-columns:1fr}.grid3{grid-template-columns:repeat(2,1fr)}
  .stats{grid-template-columns:repeat(2,1fr)}
  .editor-layout{grid-template-columns:1fr}
  .editor-panel + .editor-panel{border-left:none;border-top:1px solid #1e293b}
}
@media(max-width:768px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.show{transform:translateX(0);box-shadow:20px 0 40px rgba(0,0,0,0.1)}
  .main{margin-left:0}
  .topbar{padding:0 16px;height:60px}
  .toggle-btn{display:block}
  .search-box{display:none}.user-info{display:none}
  .content{padding:20px 16px}
  .heading{flex-direction:column;align-items:flex-start;gap:12px}
  .heading .btn{width:100%}
  .stats{grid-template-columns:1fr}.grid2,.grid3{grid-template-columns:1fr}
  .panel-head{flex-direction:column;align-items:flex-start;gap:10px}
  .panel-head .btn,.panel-head .field{width:100%}
}