
:root{
  --bg:#0b1220;
  --card:#0f1a2e;
  --card2:#0e1730;
  --text:#e7eefc;
  --muted:#a8b3cc;
  --line:rgba(255,255,255,.10);
  --brand:#7c3aed;
  --ok:#22c55e;
  --warn:#f59e0b;
  --danger:#ef4444;
  --shadow:0 18px 40px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(124,58,237,.35), transparent 60%),
              radial-gradient(900px 500px at 90% 10%, rgba(34,197,94,.20), transparent 60%),
              var(--bg);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background:rgba(10,16,30,.70);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:40px;height:40px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background: linear-gradient(135deg, rgba(124,58,237,1), rgba(34,197,94,1));
  font-weight:800;
}
.brand-name{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px; color:var(--muted); margin-top:2px}

.top-actions{display:flex; gap:10px; align-items:center}
.pill{
  font-size:12px; color:var(--muted);
  padding:8px 10px; border:1px solid var(--line);
  border-radius:999px; background:rgba(255,255,255,.04);
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; padding:0 12px;
  border-radius:12px; border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  font-weight:600; font-size:13px;
}
.btn:hover{transform:translateY(-1px)}
.btn.ghost{background:transparent}
.btn.danger{border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.10)}

.layout{display:flex; min-height:calc(100vh - 70px)}
.sidebar{
  width:260px; padding:16px;
  border-right:1px solid var(--line);
  background:rgba(15,26,46,.45);
}
.nav-item{
  display:block; padding:12px 12px;
  border-radius:12px;
  border:1px solid transparent;
  color:var(--text);
}
.nav-item:hover{
  background:rgba(255,255,255,.05);
  border-color:rgba(255,255,255,.10);
}
.nav-sep{height:14px}
.nav-title{font-size:12px; color:var(--muted); padding:0 10px 8px}
.nav-foot{font-size:12px; color:var(--muted); padding:18px 10px 0}

.content{flex:1; padding:22px}
.card{
  max-width:980px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius:18px;
  padding:18px;
}
.grid{display:grid; gap:14px}
.grid.two{grid-template-columns:1fr 1fr}
@media (max-width: 900px){
  .layout{flex-direction:column}
  .sidebar{width:auto; border-right:none; border-bottom:1px solid var(--line)}
  .grid.two{grid-template-columns:1fr}
}

.h1{font-size:22px; font-weight:900; margin:0 0 6px}
.sub{color:var(--muted); font-size:13px; margin:0 0 14px}

.form{
  display:grid; gap:10px;
}
.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.25);
  color:var(--text);
  outline:none;
}
.input:focus{border-color:rgba(124,58,237,.65); box-shadow:0 0 0 4px rgba(124,58,237,.20)}
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.btn.primary{
  background: linear-gradient(135deg, rgba(124,58,237,1), rgba(99,102,241,1));
  border-color:rgba(124,58,237,.45);
}
.msg{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--muted);
}
.msg.err{border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.10); color:#ffd1d1}
.msg.ok{border-color:rgba(34,197,94,.35); background:rgba(34,197,94,.10); color:#d6ffe7}

.table{width:100%; border-collapse:separate; border-spacing:0 10px}
.table th{font-size:12px; color:var(--muted); text-align:left; padding:0 10px}
.table td{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  padding:10px;
}
.table td:first-child{border-radius:12px 0 0 12px}
.table td:last-child{border-radius:0 12px 12px 0}
.badge{font-size:12px; padding:4px 8px; border-radius:999px; border:1px solid var(--line); color:var(--muted)}
.badge.admin{border-color:rgba(124,58,237,.45); color:#e9ddff}
.badge.staff{border-color:rgba(34,197,94,.35); color:#d6ffe7}


/* ===== Mobile Sidebar (Off-canvas) ===== */
.nav-toggle{
  display:none;
  width:40px;height:40px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:900;
  font-size:20px;
  cursor:pointer;
}

.nav-backdrop{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:9;
}

/* มือถือ */
@media (max-width: 900px){
  .nav-toggle{display:inline-flex;align-items:center;justify-content:center}

  .layout{flex-direction:row; min-height:auto;} /* ไม่ให้ดันยาวแปลกๆ */

  /* Sidebar ลอยทับ ไม่โชว์เต็มหน้า */
  .sidebar{
        position:fixed;
    top:70px;
    left:0;
    height:calc(100vh - 70px);
    width:280px;
    max-width:88vw;
    z-index:10;

    /* 🔴 เปลี่ยนตรงนี้ */
    background:#0b1220;          /* สีทึบ */
    backdrop-filter:none;        /* ปิด blur */
    border-right:1px solid var(--line);

    transform:translateX(-105%);
    transition:transform .18s ease;
  }

  /* เนื้อหาเต็มจอ */
  .content{padding:16px}

  /* ตอนเปิดเมนู */
  body.nav-open .sidebar{transform:translateX(0)}
  body.nav-open .nav-backdrop{display:block}
}
/* ===== Sidebar solid mode (mobile) ===== */
@media (max-width: 900px){
  .sidebar .nav-item{
    background:transparent;
  }

  .sidebar .card{
    background:#0f1a2e;
    border:1px solid var(--line);
    box-shadow:none;
  }
}
.nav-backdrop{
  background:rgba(0,0,0,.65); /* จาก .55 → .65 */
  backdrop-filter:none;
}
@media (max-width: 900px){
  .topbar{
    background:#0b1220;
    backdrop-filter:none;
  }
}

@media (max-width: 768px){
  .input{
    font-size:16px !important;
  }
}
html{ -webkit-text-size-adjust: 100%; }
/* ??? iPhone ??? (???? >=16px) */
@media (max-width: 768px){
  .cu-search input,
  .cu-field input,
  .cu-field textarea,
  .cu-field select{
    font-size:16px !important;
  }
}
@media (max-width: 768px){
  .note-page .cu-search input{ font-size:16px !important; }
}
@font-face{
  font-family:"THSarabunNew";
  src:url("../fonts/THSarabunNew.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
}
@font-face{
  font-family:"THSarabunNew";
  src:url("../fonts/THSarabunNew-Bold.ttf") format("truetype");
  font-weight:700;
  font-style:normal;
}
@font-face{
  font-family:"THSarabunNew";
  src:url("../fonts/THSarabunNew-Italic.ttf") format("truetype");
  font-weight:400;
  font-style:italic;
}
@font-face{
  font-family:"THSarabunNew";
  src:url("../fonts/THSarabunNew-BoldItalic.ttf") format("truetype");
  font-weight:700;
  font-style:italic;
}

/* ??????????????? */
html, body, button, input, select, textarea{
  font-family:"THSarabunNew", sans-serif !important;
}

