/* ==========================================================
   Shortlink Panel
   ========================================================== */

:root{
  --bg:#eef2ff;
  --ink:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;
  --brand:#2563eb;
  --brand2:#7c3aed;
  --ok:#16a34a;
  --warn:#d97706;
  --bad:#dc2626;
  --sidebar:#111827;
  --radius:14px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:Inter,"Segoe UI",system-ui,-apple-system,Arial,sans-serif;
  background:var(--bg);
  color:var(--ink);
  font-size:14px;
  line-height:1.5;
}

a{color:var(--brand)}

code{
  background:#f1f5f9;
  padding:2px 6px;
  border-radius:6px;
  font-size:12px;
  word-break:break-all;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

h1{font-size:26px;margin:0 0 4px;font-weight:800}
h2{font-size:18px;margin:0 0 14px;font-weight:800}
h3{font-size:15px;margin:22px 0 10px;font-weight:800}
.muted{color:var(--muted);font-size:13px}
.mt{margin-top:18px}
.right{text-align:right}
.nowrap{white-space:nowrap}
.break{word-break:break-all;max-width:280px}
.plain{list-style:none;padding:0;margin:10px 0}

/* ---------------- ALERT ---------------- */
.alert{
  padding:12px 16px;
  border-radius:var(--radius);
  margin-bottom:16px;
  font-weight:600;
  font-size:13px;
  border:1px solid transparent;
}
.alert-ok   {background:#dcfce7;color:#166534;border-color:#bbf7d0}
.alert-warn {background:#fef3c7;color:#92400e;border-color:#fde68a}
.alert-err  {background:#fee2e2;color:#991b1b;border-color:#fecaca}

/* ---------------- LOGIN ---------------- */
.login-page{
  min-height:100vh;
  display:grid;
  grid-template-columns:1fr 1fr;
}
.login-hero{
  background:radial-gradient(circle at 20% 20%,#4338ca 0,#111827 38%,#020617 100%);
  color:#fff;
  padding:70px;
  display:flex;
  align-items:center;
}
.login-hero-inner{max-width:520px}
.login-hero .logo{font-size:54px;margin-bottom:18px}
.login-hero h1{font-size:44px;color:#fff;margin:0 0 16px;font-weight:900;letter-spacing:-1px}
.hero-desc{font-size:17px;line-height:1.7;color:#cbd5e1;margin-bottom:30px}
.hero-list{list-style:none;padding:0;margin:0}
.hero-list li{display:flex;gap:14px;align-items:center;margin:16px 0;color:#e5e7eb}
.hero-list span{
  width:34px;height:34px;flex:0 0 34px;
  border-radius:11px;background:rgba(99,102,241,.25);
  display:grid;place-items:center;color:#93c5fd;font-weight:900;
}

.login-formside{
  display:flex;align-items:center;justify-content:center;
  padding:40px;
  background:linear-gradient(180deg,#fff,#f8fafc);
}
.login-card{
  width:100%;max-width:410px;
  background:#fff;border:1px solid var(--line);
  border-radius:22px;padding:34px;
  box-shadow:0 26px 70px rgba(15,23,42,.12);
}
.login-card h2{text-align:center;font-size:26px;margin:0 0 6px}
.login-card .muted{text-align:center;margin-bottom:24px}

label{
  display:block;margin:16px 0 7px;
  font-size:12px;font-weight:800;color:#334155;
}
label small{font-weight:600;color:var(--muted)}

input[type=text],input[type=password],input[type=number],select,textarea{
  width:100%;height:46px;
  border:1px solid #cbd5e1;border-radius:11px;
  padding:0 13px;font-size:14px;font-family:inherit;
  background:#fff;color:var(--ink);
}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:#6366f1;
  box-shadow:0 0 0 4px rgba(99,102,241,.12);
}
select{cursor:pointer}

button,.btn{
  display:inline-block;
  border:0;border-radius:11px;
  padding:12px 18px;
  font-weight:800;font-size:13px;
  cursor:pointer;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
  color:#fff;text-decoration:none;
  font-family:inherit;
}
button:hover,.btn:hover{filter:brightness(1.08)}
.btn-ghost{background:#f1f5f9;color:#334155}
.btn-sm{padding:6px 11px;font-size:12px;border-radius:9px}
.foot{text-align:center;color:#94a3b8;font-size:12px;margin-top:22px}

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

.sidebar{
  width:236px;flex:0 0 236px;
  background:var(--sidebar);
  color:#cbd5e1;
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
}
.sidebar .brand{
  padding:20px 20px 18px;
  font-weight:900;font-size:16px;color:#fff;
  border-bottom:1px solid #1f2937;
}
.sidebar nav{flex:1;padding:12px 10px;overflow-y:auto}
.nav-link{
  display:flex;gap:11px;align-items:center;
  padding:11px 13px;margin-bottom:3px;
  border-radius:10px;
  color:#cbd5e1;text-decoration:none;
  font-size:13.5px;font-weight:600;
}
.nav-link:hover{background:#1f2937;color:#fff}
.nav-link.active{background:linear-gradient(135deg,var(--brand),var(--brand2));color:#fff}
.sidebar-foot{
  display:flex;gap:11px;align-items:center;
  padding:16px 18px;border-top:1px solid #1f2937;
}
.avatar{
  width:36px;height:36px;flex:0 0 36px;
  border-radius:50%;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
  display:grid;place-items:center;color:#fff;font-weight:900;
}
.uname{color:#fff;font-size:13px;font-weight:700}
.urole{color:#94a3b8;font-size:11px}

.content{flex:1;padding:28px;max-width:1400px;min-width:0}

/* ---------------- SECTION ---------------- */
.section{display:none;margin-bottom:34px}
.section.active{display:block}

/* ---------------- CARD STAT ---------------- */
.cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(165px,1fr));
  gap:14px;margin-bottom:22px;
}
.card-stat{
  background:#fff;border:1px solid var(--line);
  border-radius:16px;padding:17px;
}
.card-stat .k{
  font-size:11px;text-transform:uppercase;letter-spacing:.5px;
  color:var(--muted);font-weight:800;
}
.card-stat .v{font-size:28px;font-weight:900;margin-top:5px}
.card-stat .v small{font-size:15px;color:var(--muted);font-weight:700}
.card-stat .v.warnv{color:var(--warn)}

.panel{
  background:#fff;border:1px solid var(--line);
  border-radius:16px;padding:22px;margin-bottom:20px;
}
.panel-form{margin-bottom:20px}

.row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.row>div{flex:1;min-width:165px}
.row .row-btn{flex:0 0 auto}
.row label{margin-top:0}

/* ---------------- TABLE ---------------- */
.scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
th{
  text-align:left;color:var(--muted);
  font-size:10.5px;text-transform:uppercase;letter-spacing:.5px;
  padding:10px;border-bottom:1px solid var(--line);white-space:nowrap;
}
td{padding:10px;border-bottom:1px solid #f1f5f9;vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:#fafbff}
table.kv th{width:190px;text-transform:none;font-size:13px;color:var(--ink);font-weight:700}

.inline{display:inline-block;margin-right:4px}
.inline-form{display:inline-block;margin-bottom:14px}

/* ---------------- BADGE ---------------- */
.badge{
  display:inline-block;padding:3px 9px;
  border-radius:999px;font-size:11px;font-weight:800;white-space:nowrap;
}
.b-ok{background:#dcfce7;color:#166534}
.b-warn{background:#fef3c7;color:#92400e}
.b-bad{background:#fee2e2;color:#991b1b}
.b-mut{background:#f1f5f9;color:#475569}

.copy{cursor:pointer}
.copy:hover{background:#e0e7ff;color:#3730a3}

.pills{display:flex;gap:8px;flex-wrap:wrap}
.pill{
  background:#f1f5f9;border-radius:999px;
  padding:6px 13px;font-size:12px;
}
.pill strong{color:var(--brand)}

/* ---------------- CENTER PAGE (404, install) ---------------- */
.center-page{
  min-height:100vh;display:grid;place-items:center;padding:30px;
}
.card-page{
  width:100%;max-width:460px;background:#fff;
  border:1px solid var(--line);border-radius:22px;
  padding:32px;box-shadow:0 20px 60px rgba(15,23,42,.1);
  text-align:center;
}
.card-page form{text-align:left}
.card-page button{width:100%;margin-top:20px}
.card-page h3{text-align:left}

/* ---------------- TOAST ---------------- */
.toast{
  position:fixed;right:20px;bottom:20px;
  background:#111827;color:#fff;
  padding:12px 20px;border-radius:11px;
  font-weight:700;font-size:13px;
  opacity:0;pointer-events:none;transition:opacity .2s;
  z-index:99;max-width:340px;
}
.toast.show{opacity:1}

/* ---------------- RESPONSIF ---------------- */
@media (max-width:900px){
  .login-page{grid-template-columns:1fr}
  .login-hero{display:none}
  .app{flex-direction:column}
  .sidebar{
    width:100%;flex:none;height:auto;position:static;
    flex-direction:row;align-items:center;overflow-x:auto;
  }
  .sidebar nav{display:flex;gap:4px;padding:8px}
  .nav-link{white-space:nowrap;padding:8px 11px}
  .nav-link span{display:none}
  .sidebar-foot{border:0;padding:8px 14px}
  .content{padding:18px}
}
