:root{
  --page:#f3f6f4;
  --panel:#ffffff;
  --panel2:#f8faf7;
  --ink:#17231b;
  --muted:#708075;
  --line:#dfe7df;
  --rail:#17231b;
  --rail2:#203228;
  --brand:#2f8f83;
  --brand2:#ef5d3d;
  --warn:#d6a229;
  --danger:#c93f36;
  --shadow:0 16px 34px rgba(23,35,27,.10);
  --shadow2:0 8px 18px rgba(23,35,27,.08);
  --radius:8px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Cairo", Tahoma, Arial, sans-serif;
  color:var(--ink);
  background:
    linear-gradient(90deg, rgba(47,143,131,.08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #f6f8f5 0%, var(--page) 100%);
  background-size:44px 44px, auto;
}

.sidebar{
  position:fixed;
  right:14px;
  top:14px;
  width:270px;
  height:calc(100vh - 28px);
  padding:12px;
  border-radius:var(--radius);
  background:linear-gradient(180deg, var(--rail2) 0%, var(--rail) 100%);
  color:#fff;
  box-shadow:var(--shadow);
  overflow:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 8px 14px;
  border-bottom:1px solid rgba(255,255,255,.12);
  margin-bottom:10px;
}

.logo{
  width:44px;
  height:44px;
  border-radius:var(--radius);
  display:grid;
  place-items:center;
  background:#f7f9f4;
  color:var(--rail);
  font-weight:900;
  letter-spacing:0;
}

.brand h3{margin:0;font-size:16px}
.brand small{display:block;color:rgba(255,255,255,.74);margin-top:2px;line-height:1.45}

.sidebar a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  color:#edf3ee;
  text-decoration:none;
  padding:10px 12px;
  border-radius:var(--radius);
  margin:6px 0;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.045);
  transition:background .12s ease, border-color .12s ease, color .12s ease;
}

.sidebar a:hover{background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.14)}
.sidebar a.active{background:var(--brand2);border-color:rgba(255,255,255,.22);color:#fff}
.sidebar a.logout{background:#3a211e;border-color:rgba(239,93,61,.34);color:#fff}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  color:#fff;
  font-size:12px;
  line-height:1;
}

.content{
  margin-right:308px;
  padding:18px 18px 28px;
  display:flex;
  justify-content:center;
}

.container{width:100%;max-width:1080px}

.topbar{
  position:sticky;
  top:14px;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px;
  margin-bottom:14px;
  border-radius:var(--radius);
  background:rgba(255,255,255,.92);
  border:1px solid var(--line);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow2);
}

.topbar-title{min-width:0}
.topbar-h{font-size:14px;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-s{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-actions{display:flex;align-items:center;gap:10px}

.balance-chip{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:205px;
  padding:8px 10px;
  border-radius:var(--radius);
  background:#fff;
  border:1px solid #cfe1d9;
  box-shadow:0 10px 20px rgba(47,143,131,.12);
}
.balance-chip .ico{
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  border-radius:var(--radius);
  color:#fff;
  font-weight:900;
  background:var(--brand);
}
.balance-chip .label{
  display:block;
  color:var(--muted);
  font-size:11px;
  line-height:1.1;
}
.balance-chip .value{
  display:block;
  color:var(--ink);
  font-size:14px;
  font-weight:900;
  line-height:1.35;
  white-space:nowrap;
}

.icon-btn{
  border:1px solid var(--line);
  background:#fff;
  color:var(--ink);
  border-radius:var(--radius);
  padding:8px 10px;
  cursor:pointer;
  box-shadow:0 6px 12px rgba(23,35,27,.06);
}

.ghost-btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.8);
  color:var(--ink);
  border-radius:var(--radius);
  padding:8px 12px;
  cursor:pointer;
  font-weight:800;
  font-size:12px;
}

.profile-menu{position:relative}
.profile-btn{
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:var(--radius);
  padding:8px 10px;
  cursor:pointer;
  box-shadow:0 6px 14px rgba(23,35,27,.06);
}
.profile-avatar{
  width:36px;
  height:36px;
  border-radius:var(--radius);
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
  background:var(--brand2);
}
.profile-meta{display:block;text-align:right;line-height:1.2;min-width:0}
.profile-meta .name{display:block;font-size:12px;font-weight:900;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-meta .sub{display:block;font-size:11px;color:var(--muted);max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-btn .chev{opacity:.7}

.profile-dd{
  position:absolute;
  top:calc(100% + 10px);
  right:0;
  min-width:260px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:10px;
  display:none;
}
.profile-dd.open{display:block}
.profile-row{
  padding:8px 10px;
  border-radius:var(--radius);
  background:var(--panel2);
  border:1px dashed #cfe1d9;
  font-size:12px;
}
.profile-actions a{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px;
  margin-top:8px;
  border-radius:var(--radius);
  border:1px solid var(--line);
  text-decoration:none;
  color:var(--ink);
  background:#fff;
}
.profile-actions a.danger{border-color:#f0c0ba;background:#fff4f1;color:#9d3028}

.card{
  background:rgba(255,255,255,.96);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow2);
  padding:16px;
  margin-bottom:14px;
}

.title{margin:0;font-size:18px;font-weight:900}
.sub{color:var(--muted);font-size:13px;margin-top:6px;line-height:1.85}
.center{text-align:center;line-height:1.9}

input,select,textarea{
  width:100%;
  padding:12px;
  border:1px solid #cedbd0;
  border-radius:var(--radius);
  outline:none;
  background:#fff;
  color:var(--ink);
  font-size:14px;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(47,143,131,.14);
}

.btn, button.btn, a.btn{
  width:100%;
  margin-top:12px;
  padding:12px;
  border:0;
  border-radius:var(--radius);
  cursor:pointer;
  font-weight:900;
  color:#fff;
  background:var(--brand2);
  box-shadow:0 12px 20px rgba(239,93,61,.16);
  text-align:center;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn:hover{filter:brightness(1.02)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.ghost-link{background:var(--rail);box-shadow:none}

.note{
  background:#fff7df;
  border:1px solid #efd58d;
  padding:12px;
  border-radius:var(--radius);
  text-align:center;
  font-weight:900;
  color:#7d5a10;
  line-height:1.8;
}

table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  background:#fff;
  border-radius:var(--radius);
  overflow:hidden;
}
th,td{border-bottom:1px solid var(--line);padding:10px;text-align:right;vertical-align:top}
th{background:#eef3ef;font-weight:900;color:var(--ink)}
tr:hover td{background:#fbfdfb}

.ok{color:#197a48}
.bad{color:#a8322a}

.perm-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.perm-grid label{display:flex;align-items:center;gap:6px;font-size:13px;white-space:nowrap}

@media (max-width: 980px){
  .content{margin-right:0;padding:12px}
  .container{max-width:980px}
  .sidebar{
    right:10px;
    top:10px;
    height:calc(100vh - 20px);
    transform:translateX(110%);
    transition:transform .18s ease;
    width:min(92vw, 320px);
    z-index:100;
  }
  body.sidebar-open .sidebar{transform:translateX(0)}
  .topbar{top:10px}
}

@media (max-width: 600px){
  .card{padding:12px}
  table{display:block;overflow-x:auto;white-space:nowrap}
  .profile-meta .name,.profile-meta .sub{max-width:140px}
  .ghost-btn{display:none}
  .balance-chip{min-width:0}
}

@media (prefers-reduced-motion: reduce){
  *{scroll-behavior:auto !important;transition:none !important;animation:none !important}
}
