@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

* { margin:0; padding:0; box-sizing:border-box; font-family:'Poppins',sans-serif; }
html, body { height:100%; }

body{
  min-height:100vh;
  background: url('/assets/bg.jpg') center / cover no-repeat fixed,
              linear-gradient(135deg, #0a0a0a, #0a0a0a);
  display:flex;
  justify-content:center;
  align-items:center;
  color:#fff;
}

body.app-open { align-items:flex-start; }

.brand{
  position:fixed;
  top:12px;
  left:12px;
  color:#fff;
  font-weight:700;
  padding:5px 9px;
  border-radius:8px;
  background:rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.14);
  z-index:100;
  box-shadow:0 10px 28px rgba(0,0,0,.45);
  font-size:13px;
}

.wrapper{
  width:420px;
  background:transparent;
  border:0;
  backdrop-filter:none;
  color:#fff;
  border-radius:12px;
  padding:26px 34px;
  box-shadow:0 14px 40px rgba(0,0,0,.50);
}

.wrapper h1{
  font-size:32px;
  text-align:center;
}

.input-box{
  position:relative;
  width:100%;
  height:46px;
  margin:24px 0;
}

.input-box input{
  width:100%;
  height:100%;
  background:rgba(0,0,0,.22);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  outline:none;
  border:2px solid rgba(255,255,255,.75);
  border-radius:40px;
  color:#fff;
  font-size:15px;
  padding:18px 42px 18px 18px;
}

.input-box input::placeholder{
  color:#fff;
  opacity:.82;
}

.input-box i{
  position:absolute;
  right:18px;
  top:50%;
  transform:translateY(-50%);
  font-size:18px;
}

.btn{
  width:100%;
  height:40px;
  border-radius:32px;
  border:none;
  background:#fff;
  color:#333;
  font-weight:600;
  cursor:pointer;
  font-size:14px;
  box-shadow:0 8px 22px rgba(0,0,0,.45);
}

.btn.small{
  padding:5px 9px;
  font-size:12px;
  height:auto;
}

.btn.ghost{
  background:transparent;
  color:#fff;
  border:1px solid rgba(255,255,255,.35);
}

.btn.danger{
  background:#e74c3c;
  color:#fff;
  border:none;
}

.btn.pill{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.35);
  background:transparent;
  color:#fff;
  width:auto;
  height:auto;
}

.app{
  width:min(1560px, 99vw);
  margin-top:54px;
  margin-bottom:14px;
}

.appbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
}

.app-title{
  font-weight:700;
  opacity:.95;
  font-size:14px;
}

.tabs{
  display:flex;
  gap:6px;
  margin:6px 0 10px;
  flex-wrap:wrap;
}

.tabs button{
  padding:6px 10px;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.32);
  background:rgba(0,0,0,.16);
  color:#fff;
  cursor:pointer;
  white-space:nowrap;
  box-shadow:0 7px 18px rgba(0,0,0,.36);
  font-size:12px;
}

.tabs button.active{
  border-color:#fff;
  background:rgba(255,255,255,.12);
}

.panel{
  background:rgba(0,0,0,.28);
  border-radius:12px;
  padding:9px;
  box-shadow:0 14px 38px rgba(0,0,0,.46);
}

.panel h2{
  font-size:18px;
  margin-bottom:7px;
}

.controls .row{
  display:grid;
  grid-template-columns:2.0fr 1.6fr 1.6fr 1.8fr auto;
  gap:6px;
  margin-bottom:7px;
}

.controls input{
  padding:7px 9px;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.32);
  background:rgba(0,0,0,.22);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  color:#fff;
  font-size:12px;
}

.inline{
  display:inline-flex;
  align-items:center;
  gap:5px;
  opacity:.85;
}

.grid{
  display:grid;
  gap:6px;
}

.grid.grid-4{
  grid-template-columns:repeat(4, minmax(0,1fr));
}

.stack{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.stack label{
  font-size:12px;
  opacity:.9;
}

.row{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}

.muted{ opacity:.75; }
.center{ text-align:center; }

.mono{
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.table-wrap{
  overflow:auto;
  max-height:calc(100vh - 205px);
  -ms-overflow-style:none;
  scrollbar-width:none;
}

.table-wrap::-webkit-scrollbar{
  width:0;
  height:0;
}

table.list{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

table.list th,
table.list td{
  padding:6px 7px;
  border-bottom:1px solid rgba(255,255,255,.16);
  vertical-align:top;
  font-size:12px;
}

table.list th{
  font-size:12px;
  font-weight:700;
  opacity:.9;
}

table.list input,
table.list select{
  width:100%;
  padding:5px 7px;
  border-radius:7px;
  border:1px solid rgba(255,255,255,.32);
  background:rgba(0,0,0,.22);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  color:#fff;
  min-height:29px;
  font-size:12px;
}

table.list select option{
  background:#111;
  color:#fff;
}

table.list input[type="checkbox"]{
  width:auto;
  height:auto;
  transform:translateY(1px);
}

td.right{
  text-align:right;
  white-space:nowrap;
}

.hidden{ display:none !important; }

.chip{
  display:inline-flex;
  align-items:center;
  padding:2px 7px;
  border-radius:999px;
  font-size:11px;
  line-height:1.4;
}

.chip.ok{ background:rgba(46,204,113,.25); border:1px solid rgba(46,204,113,.5); }
.chip.expired{ background:rgba(231,76,60,.25); border:1px solid rgba(231,76,60,.5); }
.chip.online{ background:rgba(46,204,113,.25); border:1px solid rgba(46,204,113,.6); }
.chip.offline{ background:rgba(231,76,60,.25); border:1px solid rgba(231,76,60,.65); }

/* Toast */
#toast-root{
  position:fixed;
  right:14px;
  bottom:14px;
  display:flex;
  flex-direction:column-reverse;
  gap:8px;
  z-index:1000;
  pointer-events:none;
}

.toast{
  min-width:250px;
  max-width:390px;
  border-radius:10px;
  padding:9px 11px;
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  border:1px solid rgba(255,255,255,.15);
  box-shadow:0 14px 34px rgba(0,0,0,.48);
  display:flex;
  align-items:flex-start;
  gap:8px;
  pointer-events:auto;
  animation:toast-in .22s ease-out forwards, toast-life linear forwards;
}

.toast .icon{
  font-size:17px;
  line-height:1;
  margin-top:2px;
}

.toast .body{ flex:1; }

.toast .title{
  font-weight:700;
  margin-bottom:1px;
  font-size:13px;
}

.toast .msg{
  opacity:.9;
  font-size:12px;
}

.toast .close{
  border:none;
  background:transparent;
  color:#fff;
  opacity:.75;
  cursor:pointer;
  font-size:16px;
}

.toast.success{ border-color:rgba(46,204,113,.55); color:#2ecc71; }
.toast.info{ border-color:rgba(52,152,219,.55); color:#3498db; }
.toast.error{ border-color:rgba(231,76,60,.55); color:#e74c3c; }

@keyframes toast-in{
  from{ transform:translateY(10px); opacity:0; }
  to{ transform:translateY(0); opacity:1; }
}

.toast::after{
  content:"";
  display:block;
  height:2px;
  margin-top:6px;
  border-radius:3px;
  background:currentColor;
  opacity:.55;
  width:100%;
  transform-origin:left;
  animation:life-shrink var(--life, 3800ms) linear forwards;
}

@keyframes life-shrink{
  from{ transform:scaleX(1); }
  to{ transform:scaleX(0); }
}

@keyframes toast-life{ from{} to{} }

/* Modal */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1001;
  animation:fade-in .15s ease-out forwards;
}

@keyframes fade-in{
  from{opacity:0}
  to{opacity:1}
}

.modal{
  width:min(500px, 92vw);
  background:rgba(10,10,10,.88);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.15);
  border-radius:13px;
  box-shadow:0 18px 50px rgba(0,0,0,.50);
  padding:14px;
}

.modal h3{
  margin-bottom:5px;
  font-size:17px;
}

.modal p{
  opacity:.9;
  margin-bottom:11px;
  font-size:13px;
}

.modal .actions{
  display:flex;
  justify-content:flex-end;
  gap:6px;
}

.modal .btn{
  width:auto;
  border-radius:9px;
  height:auto;
  padding:8px 12px;
}

.modal .btn.ghost{ border-color:rgba(255,255,255,.35); }
.modal .btn.danger{ background:#e74c3c; }

/* Actions */
.actions{
  display:inline-flex;
  gap:5px;
  flex-wrap:nowrap;
  align-items:center;
}

.actions .action{
  height:29px;
  min-width:29px;
  padding:0 7px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.20);
  background:rgba(255,255,255,.07);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  font-size:12px;
  line-height:1;
  cursor:pointer;
  white-space:nowrap;
  box-shadow:0 8px 18px rgba(0,0,0,.38);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  transition:transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.actions .action:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.12);
  border-color:rgba(255,255,255,.34);
}

.actions .action:active{
  transform:translateY(0);
  background:rgba(255,255,255,.16);
}

.actions .action:disabled{
  opacity:.5;
  cursor:not-allowed;
  transform:none;
}

.actions .badge{
  width:17px;
  height:17px;
  border-radius:50%;
  display:inline-grid;
  place-items:center;
  font-size:10px;
  line-height:1;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.22);
}

.actions .label{
  font-size:11px;
}

.actions .action--primary{
  border-color:rgba(46,204,113,.55);
  background:rgba(46,204,113,.16);
}

.actions .action--primary .badge{
  background:rgba(46,204,113,.25);
  border-color:rgba(46,204,113,.55);
}

.actions .action--muted{
  border-color:rgba(255,255,255,.28);
  background:rgba(255,255,255,.10);
}

.actions .action--muted .badge{
  background:rgba(255,255,255,.18);
  border-color:rgba(255,255,255,.35);
}

.actions .action--safe{
  border-color:rgba(52,152,219,.55);
  background:rgba(52,152,219,.18);
}

.actions .action--safe .badge{
  background:rgba(52,152,219,.25);
  border-color:rgba(52,152,219,.55);
}

.actions .action--danger{
  border-color:rgba(231,76,60,.6);
  background:rgba(231,76,60,.18);
}

.actions .action--danger .badge{
  background:rgba(231,76,60,.26);
  border-color:rgba(231,76,60,.6);
}

/* Clients Panel */
#clientsPanel{
  padding:8px;
}

#clientsPanel h2{
  margin-bottom:6px;
}

#clientsPanel .grid{
  gap:5px !important;
  margin-bottom:5px !important;
}

#clientsPanel .row{
  gap:5px !important;
  margin-bottom:5px !important;
}

#clientsPanel .stack{
  gap:2px;
}

#clientsPanel .stack label{
  font-size:11px;
}

#clientsPanel input,
#clientsPanel select{
  padding:5px 7px !important;
  min-height:27px !important;
  font-size:12px !important;
}

#clientsPanel .table-wrap{
  max-height:calc(100vh - 226px);
}

/* Clients table compact: works for Admin and Leaders */
#clientsPanel table.list{
  table-layout:fixed !important;
}

#clientsPanel table.list th,
#clientsPanel table.list td{
  padding:3px 4px !important;
  vertical-align:middle !important;
  font-size:11px !important;
  line-height:1.1 !important;
}

/* UUID */
#clientsPanel table.list th:nth-child(1),
#clientsPanel table.list td:nth-child(1){
  width:22% !important;
}

/* Team / Label / Note / Group */
#clientsPanel table.list th:nth-child(2),
#clientsPanel table.list td:nth-child(2){
  width:7% !important;
}

#clientsPanel table.list th:nth-child(3),
#clientsPanel table.list td:nth-child(3){
  width:9% !important;
}

#clientsPanel table.list th:nth-child(4),
#clientsPanel table.list td:nth-child(4){
  width:9% !important;
}

#clientsPanel table.list th:nth-child(5),
#clientsPanel table.list td:nth-child(5){
  width:8% !important;
}

/* Expires */
#clientsPanel table.list th:nth-child(6),
#clientsPanel table.list td:nth-child(6){
  width:12% !important;
}

/* WC / NF / AL */
#clientsPanel table.list th:nth-child(7),
#clientsPanel table.list td:nth-child(7),
#clientsPanel table.list th:nth-child(8),
#clientsPanel table.list td:nth-child(8),
#clientsPanel table.list th:nth-child(9),
#clientsPanel table.list td:nth-child(9){
  width:4% !important;
}

/* Disabled */
#clientsPanel table.list th:nth-child(10),
#clientsPanel table.list td:nth-child(10){
  width:6% !important;
}

/* Actions */
#clientsPanel table.list th:nth-child(11),
#clientsPanel table.list td:nth-child(11){
  width:19% !important;
}

#clientsPanel table.list input,
#clientsPanel table.list select{
  padding:3px 5px !important;
  min-height:24px !important;
  height:24px !important;
  font-size:11px !important;
  border-radius:6px !important;
}

#clientsPanel table.list input[type="checkbox"]{
  width:auto !important;
  height:auto !important;
  min-height:auto !important;
  transform:scale(.9) !important;
}

#clientsPanel .actions{
  gap:4px !important;
}

#clientsPanel .actions .action{
  height:25px !important;
  min-width:25px !important;
  padding:0 5px !important;
  font-size:11px !important;
  border-radius:7px !important;
}

#clientsPanel .actions .badge{
  width:15px !important;
  height:15px !important;
  font-size:9px !important;
}

/* UUID / text */
.uuid-cell .uuid-wrap{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}

.uuid-cell .uuid-text{
  display:inline-block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-variant-ligatures:none;
}

table.list td input[placeholder="label"],
table.list td input[placeholder="note"]{
  font-size:12px;
}

/* Extension Users Panel */
#extUsersPanel{
  padding:9px;
}

#extUsersPanel h2{
  margin-bottom:7px;
}

#extUsersPanel .grid{
  gap:5px !important;
  margin-bottom:5px !important;
}

#extUsersPanel .stack{
  gap:2px;
}

#extUsersPanel .stack label{
  font-size:11px;
}

#extUsersPanel input,
#extUsersPanel select{
  padding:5px 7px !important;
  min-height:28px !important;
  font-size:12px !important;
}

#extUsersPanel .row{
  gap:5px !important;
  margin-bottom:5px !important;
}

#extUsersPanel .table-wrap{
  max-height:calc(100vh - 230px);
}

#extUsersPanel table.list th,
#extUsersPanel table.list td{
  padding:5px 6px !important;
  vertical-align:top;
  font-size:12px;
}

#extUsersPanel table.list th:nth-child(1){ width:9%; }
#extUsersPanel table.list th:nth-child(2){ width:7%; }
#extUsersPanel table.list th:nth-child(3){ width:8%; }
#extUsersPanel table.list th:nth-child(4){ width:8%; }
#extUsersPanel table.list th:nth-child(5){ width:10%; }
#extUsersPanel table.list th:nth-child(6){ width:24%; }
#extUsersPanel table.list th:nth-child(7){ width:18%; }
#extUsersPanel table.list th:nth-child(8){ width:5%; }
#extUsersPanel table.list th:nth-child(9){ width:16%; }

#extUsersPanel .actions{
  gap:4px;
}

#extUsersPanel .actions .action{
  height:27px;
  min-width:27px;
  padding:0 6px;
  border-radius:8px;
  gap:4px;
  font-size:11px;
}

#extUsersPanel .actions .badge{
  width:16px;
  height:16px;
  font-size:10px;
}

#extUsersPanel .ext-pass-card,
#extUsersPanel .ext-browser-card{
  padding:4px 5px;
  margin:3px 0;
  border-radius:7px;
  font-size:11px;
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.10);
}

#extUsersPanel .mono,
#clientsPanel .mono{
  font-size:11px;
}

/* Small screens */
@media (max-width: 980px){
  .grid.grid-4{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }

  .app{
    width:99vw;
    margin-top:50px;
  }

  .actions .label{
    display:none;
  }

  .actions .action{
    padding:0 6px;
  }
}

@media (max-width: 640px){
  .grid.grid-4{
    grid-template-columns:1fr;
  }

  .wrapper{
    width:92vw;
    padding:24px;
  }

  .appbar{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
  }
}
