:root{
  --bg:#f2f5ef;
  --panel:#fbfcf8;
  --line:#d9e3d8;
  --text:#1a3025;
  --muted:#66786d;
  --green:#1f7a50;
  --green-soft:#e3f3ea;
  --yellow:#c98b08;
  --yellow-soft:#fff5d9;
  --gray:#7b8490;
  --gray-soft:#eef1f4;
  --danger:#b42318;
  --danger-soft:#fff0ef;
  --ok:#166534;
  --ok-soft:#edf8f1;
  --shadow:0 24px 54px rgba(19,35,27,.10);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:"Segoe UI",Tahoma,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top left, rgba(225,238,228,.92), transparent 30%),
    linear-gradient(180deg, #f8faf6 0%, var(--bg) 40%, #edf2eb 100%);
}
a{color:inherit}
button,input,select{font:inherit}
.app{
  width:min(1480px,100%);
  margin:0 auto;
  padding:22px;
}
.hero{
  position:relative;
  overflow:hidden;
  border:1px solid rgba(203,215,204,.95);
  border-radius:34px;
  padding:28px;
  background:linear-gradient(135deg, rgba(255,255,255,.94), rgba(241,248,243,.96));
  box-shadow:var(--shadow);
}
.hero::after{
  content:"";
  position:absolute;
  right:-60px;
  top:-56px;
  width:220px;
  height:220px;
  border-radius:999px;
  background:radial-gradient(circle at center, rgba(135,180,150,.24), rgba(135,180,150,0));
}
.hero-top{
  position:relative;
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.eyebrow{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:#e6f2eb;
  color:var(--green);
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.title{
  margin:14px 0 0;
  font-size:46px;
  line-height:1;
  letter-spacing:-.04em;
}
.sub{
  margin:14px 0 0;
  max-width:760px;
  color:var(--muted);
  font-size:15px;
  line-height:1.7;
}
.hero-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.btn{
  height:42px;
  padding:0 16px;
  border:1px solid rgba(195,210,199,.95);
  border-radius:14px;
  background:#fff;
  color:var(--text);
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:.18s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn.primary{
  background:var(--green);
  border-color:var(--green);
  color:#fff;
}
.btn.danger{
  background:#fff5f4;
  border-color:#efc8c5;
  color:var(--danger);
}
.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-top:18px;
}
.stat{
  padding:18px 20px;
  border-radius:22px;
  border:1px solid rgba(206,218,209,.95);
  background:rgba(255,255,255,.78);
}
.stat-label{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.stat-value{
  margin-top:10px;
  font-size:34px;
  font-weight:900;
  letter-spacing:-.04em;
}
.stat-meta{
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
}
.guard,.msg{
  margin-top:16px;
  padding:14px 16px;
  border-radius:18px;
  display:none;
}
.guard{
  border:1px solid #efc8c5;
  background:#fff4f2;
  color:#8f2d25;
}
.msg.ok{
  display:block;
  border:1px solid #bbe3c8;
  background:var(--ok-soft);
  color:var(--ok);
}
.msg.err{
  display:block;
  border:1px solid #efc8c5;
  background:var(--danger-soft);
  color:var(--danger);
}
.toolbar-grid{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}
.surface{
  margin-top:18px;
  border:1px solid rgba(206,218,209,.95);
  border-radius:28px;
  background:rgba(251,252,248,.94);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.toolbar-grid .surface{margin-top:0}
.surface-head{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:flex-start;
  padding:22px 24px 0;
  flex-wrap:wrap;
}
.surface-title{
  margin:0;
  font-size:24px;
  letter-spacing:-.03em;
}
.surface-sub{
  margin:8px 0 0;
  color:var(--muted);
  font-size:13px;
  line-height:1.6;
}
.surface-body{
  padding:20px 24px 24px;
}
.stack{display:grid;gap:18px}
.field-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.field-grid.compact{margin-top:12px}
.field{display:grid;gap:6px}
.field label{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
}
.input,.select{
  width:100%;
  min-height:46px;
  padding:0 14px;
  border:1px solid rgba(197,211,200,.95);
  border-radius:14px;
  background:#fff;
  color:var(--text);
  outline:none;
}
.input:focus,.select:focus{
  border-color:rgba(31,122,80,.48);
  box-shadow:0 0 0 4px rgba(31,122,80,.10);
}
.checkline{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:46px;
  padding:0 14px;
  border:1px solid rgba(197,211,200,.95);
  border-radius:14px;
  background:#fff;
  font-size:13px;
}
.checkline input{margin:0}
.fileline{
  justify-content:center;
  position:relative;
  overflow:hidden;
}
.fileline input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}
.tiny{
  margin-top:10px;
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
}
.page-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
}
.page-card{
  padding:16px;
  border-radius:22px;
  border:1px solid rgba(211,222,214,.95);
  background:#fff;
}
.page-card h3{
  margin:0;
  font-size:18px;
}
.page-card p{
  margin:8px 0 0;
  color:var(--muted);
  font-size:12px;
}
.bubble-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  margin-top:14px;
  padding-left:8px;
}
.bubble{
  width:42px;
  height:42px;
  margin-left:-8px;
  border-radius:999px;
  overflow:hidden;
  border:2px solid #fff;
  box-shadow:0 8px 14px rgba(15,23,42,.12);
  background:#dfeae2;
}
.bubble:first-child{margin-left:0}
.bubble img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.bubble.more{
  display:grid;
  place-items:center;
  background:#eef4ef;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.user-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
  gap:16px;
}
.role-groups{
  display:grid;
  gap:18px;
}
.role-group{
  border:1px solid rgba(210,221,214,.95);
  border-radius:26px;
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(246,250,246,.96));
  padding:18px;
}
.role-group-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:14px;
}
.role-chip{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  background:#e8f4ec;
  color:var(--green);
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.role-meta{
  margin:8px 0 0;
  color:var(--muted);
  font-size:13px;
}
.role-user-grid{
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
}
.user-card{
  border:none;
  padding:0;
  text-align:left;
  border-radius:28px;
  overflow:hidden;
  cursor:pointer;
  box-shadow:0 18px 32px rgba(17,24,39,.08);
  transition:transform .18s ease, box-shadow .18s ease;
}
.user-card:hover{
  transform:translateY(-3px);
  box-shadow:0 24px 42px rgba(17,24,39,.14);
}
.user-card.active{
  background:linear-gradient(180deg, #f0fbf4, var(--green-soft));
  border:1px solid rgba(91,165,119,.42);
}
.user-card.idle{
  background:linear-gradient(180deg, #fffaf0, var(--yellow-soft));
  border:1px solid rgba(230,183,77,.48);
}
.user-card.offline{
  background:linear-gradient(180deg, #fafbfc, var(--gray-soft));
  border:1px solid rgba(197,204,214,.78);
}
.user-card.disabled{
  background:linear-gradient(180deg, #fff6f5, #f7efee);
  border:1px solid rgba(221,196,193,.9);
}
.user-card figure{
  margin:0;
}
.user-thumb{
  aspect-ratio:1/1;
  background:#dfe9e2;
}
.user-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.user-card.offline .user-thumb img{
  filter:saturate(.2) contrast(.92);
}
.user-card.disabled .user-thumb img{
  filter:saturate(.18) contrast(.94);
}
.user-body{
  display:grid;
  gap:5px;
  padding:14px 14px 16px;
}
.user-name{
  display:block;
  font-size:14px;
  font-weight:800;
  line-height:1.45;
}
.user-handle,
.user-position{
  display:block;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}
.user-state{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  margin-top:4px;
  padding:0 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
}
.user-state.active{
  background:var(--green-soft);
  color:var(--green);
}
.user-state.idle{
  background:var(--yellow-soft);
  color:var(--yellow);
}
.user-state.offline{
  background:var(--gray-soft);
  color:var(--gray);
}
.user-state.disabled{
  background:var(--danger-soft);
  color:var(--danger);
}
.table-shell{
  overflow:auto;
  border:1px solid rgba(210,221,214,.95);
  border-radius:20px;
  background:#fff;
}
.perm-table{
  width:100%;
  min-width:980px;
  border-collapse:collapse;
}
.perm-table th,.perm-table td{
  padding:12px 14px;
  border-bottom:1px solid rgba(231,237,233,.96);
  text-align:left;
  vertical-align:top;
}
.perm-table th{
  background:#f6faf6;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  position:sticky;
  top:0;
  z-index:1;
}
.perm-table .key{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-size:11px;
}
.center{text-align:center}
.section-note{margin:0 0 10px}
.empty{
  padding:18px;
  border-radius:18px;
  border:1px dashed rgba(206,218,209,.95);
  background:#fff;
  color:var(--muted);
  text-align:center;
  font-size:13px;
}
.modal{
  position:fixed;
  inset:0;
  z-index:10020;
}
.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(13,20,17,.56);
  backdrop-filter:blur(4px);
}
.modal-card{
  position:relative;
  width:min(1080px, calc(100vw - 24px));
  margin:32px auto;
  max-height:calc(100vh - 64px);
  overflow:auto;
  border-radius:30px;
  border:1px solid rgba(209,220,213,.95);
  background:#fcfdfb;
  box-shadow:0 36px 70px rgba(8,15,12,.25);
}
.modal-close{
  position:absolute;
  right:14px;
  top:14px;
  width:42px;
  height:42px;
  border:none;
  border-radius:999px;
  background:#f1f4f2;
  color:var(--text);
  font-weight:800;
  cursor:pointer;
}
.modal-body{
  display:grid;
  grid-template-columns:300px minmax(0,1fr);
  gap:22px;
  padding:28px;
}
.modal-preview{
  display:grid;
  gap:14px;
  align-content:start;
}
.modal-avatar{
  aspect-ratio:1/1;
  border-radius:30px;
  overflow:hidden;
  background:#dfe9e2;
  border:1px solid rgba(197,211,200,.95);
}
.modal-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.upload-box{
  position:relative;
  overflow:hidden;
  border:1px dashed rgba(135,180,150,.95);
  border-radius:18px;
  background:#eef7f1;
  color:var(--green);
  padding:14px;
  text-align:center;
  font-size:13px;
  font-weight:700;
}
.upload-box input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}
.status-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  padding:0 14px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
}
.status-badge.active{
  background:var(--green-soft);
  color:var(--green);
}
.status-badge.idle{
  background:var(--yellow-soft);
  color:var(--yellow);
}
.status-badge.offline{
  background:var(--gray-soft);
  color:var(--gray);
}
.modal-danger{
  width:100%;
}
.modal-content{
  display:grid;
  gap:18px;
  align-content:start;
}
.modal-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.modal-title{
  margin:0;
  font-size:30px;
  letter-spacing:-.04em;
}
.modal-subtitle{
  margin:8px 0 0;
  color:var(--muted);
  font-size:14px;
}
.meta-box{
  min-height:46px;
  display:grid;
  align-content:center;
  padding:0 14px;
  border:1px solid rgba(197,211,200,.95);
  border-radius:14px;
  background:#fff;
}
.meta-box strong{
  font-size:12px;
  color:var(--muted);
}
.meta-box span{
  margin-top:4px;
  font-size:13px;
}
.mini-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.mini-card{
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(212,223,216,.95);
  background:#fff;
}
.mini-card strong{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}
.mini-card span{
  display:block;
  font-size:13px;
  line-height:1.5;
}
@media (max-width:1180px){
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .toolbar-grid{grid-template-columns:1fr}
  .modal-body{grid-template-columns:1fr}
}
@media (max-width:820px){
  .app{padding:12px}
  .hero{padding:16px;border-radius:26px}
  .hero-top{display:grid;gap:12px}
  .title{font-size:30px}
  .sub{font-size:13px;line-height:1.5}
  .hero-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%}
  .hero-actions .btn{width:100%;min-height:40px;padding:0 12px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .stat{padding:12px;border-radius:18px}
  .stat strong{font-size:22px}
  .toolbar-grid{gap:12px}
  .surface{margin-top:12px;border-radius:22px}
  .surface-head{display:grid;gap:6px;padding:14px 14px 10px}
  .surface-title{font-size:19px}
  .surface-sub{margin-top:2px;font-size:12px;line-height:1.45}
  .surface-body{padding:14px}
  .field-grid{grid-template-columns:1fr;gap:10px}
  .role-groups{gap:12px}
  .role-group{padding:12px;border-radius:20px}
  .role-group-head{gap:8px;margin-bottom:10px}
  .role-chip{min-height:30px;padding:0 10px;font-size:11px}
  .role-meta{font-size:12px}
  .role-user-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .user-card{border-radius:20px}
  .user-thumb{aspect-ratio:4/3;border-radius:20px}
  .user-body{padding:10px;gap:4px}
  .user-name{font-size:13px;line-height:1.35}
  .user-handle,.user-position{font-size:11px;line-height:1.35}
  .user-state{min-height:24px;padding:0 8px;font-size:10px}
  .table-shell{border-radius:16px}
  .perm-table{min-width:720px}
  .perm-table th,.perm-table td{padding:9px 10px;font-size:12px}
  .mini-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .mini-card{padding:10px;border-radius:14px}
  .modal-card{margin:10px auto;max-height:calc(100vh - 20px);border-radius:24px}
  .modal-body{padding:14px;gap:14px}
  .modal-title{font-size:24px}
  .modal-subtitle{font-size:12px}
}
