/* Sadiba — admin panel */
body.admin { background: #F6F0F7; }
.a-shell { display: grid; grid-template-columns: 266px minmax(0, 1fr); min-height: 100vh; }

/* Sidebar */
.a-side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
  background: linear-gradient(185deg, #2C0B3D 0%, #3E0F55 55%, #4A1260 100%); color: #E9DDF0;
  padding: 18px 14px 16px; display: flex; flex-direction: column;
}
.a-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; color: #fff; }
.a-brand img, .a-brand svg { width: 42px; height: 42px; border-radius: 13px; flex: none; }
.a-brand b { display: block; font-size: 15.5px; line-height: 1.2; color: #fff; }
.a-brand small { color: #C7AFD5; font-size: 12px; }
.a-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #A68AB6; padding: 16px 12px 6px; }

/* Folding menu groups: the heading is a button, the links slide open below it */
.a-sec { margin-top: 4px; }
button.a-group {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; border: 0; background: none; cursor: pointer;
  font-family: inherit; text-align: left; padding: 11px 12px; border-radius: 12px; font-size: 12.5px; color: #C7AFD5;
  transition: background .15s ease, color .15s ease;
}
button.a-group:hover { background: rgba(255, 255, 255, .06); color: #fff; }
button.a-group:focus-visible { outline: 2px solid #FF7AC0; outline-offset: 1px; }
button.a-group > span:first-child { flex: 1; }
button.a-group .n { background: #FFD24A; color: #2A0B3A; font-size: 11px; font-weight: 700; letter-spacing: 0; border-radius: 99px; padding: 1px 8px; }
button.a-group .chev { width: 16px; height: 16px; flex: none; transition: transform .2s ease; }
.a-sec.is-open > button.a-group { color: #fff; }
.a-sec.is-open > button.a-group .chev { transform: rotate(180deg); }
.a-sec.is-open > button.a-group .n { display: none; } /* the count shows on the link itself once open */
.a-fold { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .22s ease, visibility 0s linear .22s; }
.a-fold > .a-nav { min-height: 0; overflow: hidden; }
.a-sec.is-open > .a-fold { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .22s ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .a-fold, button.a-group .chev { transition: none; } }
.a-nav { display: grid; gap: 2px; }
.a-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px;
  color: #E3D3EC; font-size: 14.5px; font-weight: 500;
}
.a-nav a .ico { opacity: .85; }
.a-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.a-nav a.is-active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(200, 20, 138, .35); }
.a-nav a.is-active .ico { opacity: 1; }
.a-nav .n { margin-left: auto; background: #FFD24A; color: #2A0B3A; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.a-me { margin-top: 18px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); display: flex; align-items: center; gap: 10px; }
.a-me b { display: block; font-size: 13.5px; color: #fff; line-height: 1.2; }
.a-me small { color: #C7AFD5; font-size: 12px; }
.a-me form { margin-left: auto; }
.a-me button { background: none; border: 0; color: #E3D3EC; cursor: pointer; padding: 6px; border-radius: 9px; }
.a-me button:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Main column */
.a-main { min-width: 0; display: flex; flex-direction: column; }
.a-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: rgba(246, 240, 247, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.a-top h1 { font-size: 20px; }
.a-top .crumb { font-size: 12.5px; color: var(--muted); }
.a-search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.a-search input { width: 100%; height: 42px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff; padding: 0 14px 0 40px; font-size: 14px; }
.a-search input:focus { outline: none; border-color: var(--m-500); box-shadow: 0 0 0 4px rgba(224, 24, 127, .1); }
.a-search .ico { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.a-content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.a-mobilebar, .a-tabbar, .a-scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Dashboard */
.a-hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 24px 26px; color: #fff; background: var(--grad);
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  box-shadow: 0 16px 36px rgba(170, 20, 130, .25);
}
.a-hero::after { content: ''; position: absolute; right: -80px; top: -120px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); }
.a-hero > * { position: relative; z-index: 1; }
.a-hero small { opacity: .88; font-size: 13.5px; }
.a-hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.a-hero .sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.a-hero .btn-white { background: #fff; color: var(--m-600); }
.a-hero .btn-white:hover { color: var(--m-700); }
.a-hero .btn-glass { background: rgba(255,255,255,.18); color: #fff; }
.a-hero .btn-glass:hover { background: rgba(255,255,255,.28); color: #fff; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { background: #fff; border-radius: 18px; padding: 16px 18px; border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; color: var(--ink); }
a.stat:hover { border-color: var(--m-200); color: var(--ink); }
.stat .si { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--m-50); color: var(--m-600); }
.stat .si.ok { background: var(--ok-bg); color: var(--ok); }
.stat .si.warn { background: var(--warn-bg); color: var(--warn); }
.stat .si.bad { background: var(--bad-bg); color: var(--bad); }
.stat .si.v { background: #F1E6FA; color: var(--v-600); }
.stat .si.info { background: var(--info-bg); color: var(--info); }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 23px; font-weight: 700; line-height: 1.2; }
.stat .delta { font-size: 12px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.grid-2e { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; text-align: center; }
.quick a:hover { border-color: var(--m-200); color: var(--ink); }
.quick small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.bars .col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bars .stack { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bars .stack span { width: 42%; max-width: 14px; border-radius: 5px 5px 2px 2px; min-height: 2px; }
.bars .in { background: linear-gradient(180deg, #2BC27A, #14A15A); }
.bars .out { background: linear-gradient(180deg, #F2268A, #9B1FA0); }
.bars .d { font-size: 11px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Lists & tables */
.panel { background: #fff; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; }
.panel-body { padding: 16px 18px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCF8FC; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FFF9FC; }
.tbl .r { text-align: right; }
.tbl .who { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.tbl .who b { white-space: nowrap; }
.tbl .who b { display: block; font-size: 14px; font-weight: 600; }
.tbl .who small { color: var(--muted); font-size: 12.5px; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.tbl tr.row-link { cursor: pointer; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #FFF9FC; color: var(--ink); }
.list-row .amt { text-align: right; flex: none; }
.list-row .amt b { display: block; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { flex: 1 1 150px; margin: 0; }
.filters .field + .field { margin-top: 0; }
.filters .input, .filters .select { min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.filters .btn { min-height: 42px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field + .field { margin-top: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.input-color { width: 100%; height: 48px; padding: 4px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff; }
.section-label { font-size: 13px; font-weight: 600; color: var(--m-600); text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 -4px; }

/* Request detail */
.req-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.req-amount { font-size: 30px; font-weight: 700; letter-spacing: -.4px; }
.proof { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #FAF6FA; }
.proof img { width: 100%; max-height: 420px; object-fit: contain; }
.payout-box { border-radius: 18px; padding: 18px; background: var(--grad-soft); border: 1px dashed var(--m-200); }
.payout-box .acc-no { font-size: 22px; font-weight: 700; letter-spacing: .4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--m-500); box-shadow: 0 0 0 4px var(--m-50); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: 2px; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--muted); font-size: 12px; }
.warn-list { margin: 0; padding-left: 18px; font-size: 13.5px; }

/* Renewal cards */
.renew { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.renew:last-child { border-bottom: 0; }
.days { min-width: 82px; text-align: center; padding: 8px 6px; border-radius: 14px; font-weight: 700; line-height: 1.1; }
.days small { display: block; font-size: 11.5px; font-weight: 500; }
.days.ok { background: var(--ok-bg); color: var(--ok); }
.days.soon { background: var(--warn-bg); color: var(--warn); }
.days.urgent, .days.expired { background: var(--bad-bg); color: var(--bad); }
.days.unknown { background: #F1ECF3; color: var(--muted); }

/* Auth */
.a-auth { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(900px 500px at 0% 0%, #F9C3E0 0%, transparent 60%), radial-gradient(800px 600px at 100% 100%, #DCC2F2 0%, transparent 60%), var(--bg); }
.a-auth-card { width: min(430px, 100%); background: #fff; border-radius: 28px; box-shadow: var(--shadow-lg); overflow: hidden; }
.a-auth-top { background: var(--grad); color: #fff; text-align: center; padding: 30px 24px 26px; }
.a-auth-top .lg { width: 78px; height: 78px; border-radius: 24px; margin: 0 auto 12px; padding: 4px; background: rgba(255,255,255,.22); }
.a-auth-top .lg svg, .a-auth-top .lg img { width: 100%; height: 100%; border-radius: 20px; }
.a-auth-top h1 { color: #fff; font-size: 22px; }
.a-auth-top p { opacity: .9; font-size: 14px; }
.a-auth-body { padding: 24px; }
.secure { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 16px; }

/* Print */
@media print {
  .a-side, .a-top, .a-mobilebar, .a-tabbar, .no-print, .filters { display: none !important; }
  .a-shell { display: block; }
  .a-content { padding: 0; }
  .panel { box-shadow: none; }
  body.admin { background: #fff; }
}

/* Tablet and phone */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .a-shell { display: block; }
  .a-side { position: fixed; inset: 0 auto 0 0; width: 286px; height: 100%; z-index: 70; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 40px rgba(40, 0, 50, .25); }
  body.drawer-open .a-side { transform: none; }
  .a-scrim { position: fixed; inset: 0; z-index: 65; background: rgba(38, 10, 46, .45); }
  body.drawer-open .a-scrim { display: block; }
  .a-top { display: none; }
  .a-mobilebar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
    padding: calc(env(safe-area-inset-top) + 12px) 14px 14px; background: var(--grad); color: #fff; border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 20px rgba(160, 20, 120, .2);
  }
  .a-mobilebar h1 { color: #fff; font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .a-mobilebar .mb-btn { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; border: 0; position: relative; cursor: pointer; }
  .a-mobilebar .mb-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #FFD24A; color: #2A0B3A; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
  .a-content { padding: 18px 18px 40px; margin: 0 auto; }
  .page-head h2 { font-size: 19px; }
  .a-hero { padding: 20px; border-radius: 20px; }
  .a-hero .big { font-size: 28px; }
  .grid-2e, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .a-content { padding: 16px 14px calc(100px + env(safe-area-inset-bottom)); }
  .a-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(110, 20, 110, .08);
  }
  .a-tabbar a, .a-tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #A592AC; font-size: 11.5px; font-weight: 500; background: none; border: 0; cursor: pointer; position: relative; padding: 4px 0; }
  .a-tabbar .is-active { color: var(--m-600); }
  .a-tabbar .n { position: absolute; top: -2px; left: 54%; background: var(--m-500); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 6px; }
}
@media (max-width: 720px) {
  .req-head { gap: 12px; }
  .req-head .avatar.lg { width: 52px; height: 52px; font-size: 18px; }
  .req-amount { font-size: 25px; }
  .stats { gap: 10px; }
  .stat { padding: 13px; gap: 10px; }
  .stat .si { width: 38px; height: 38px; border-radius: 12px; }
  .stat b { font-size: 19px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  .tbl.cards tr:last-child { border-bottom: 0; }
  .tbl.cards td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .tbl.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .tbl.cards td.who-cell { justify-content: flex-start; text-align: left; }
  .tbl.cards td.who-cell::before { display: none; }
  .tbl.cards .acts { justify-content: flex-end; }
  .tbl.cards tbody tr:hover td { background: none; }
  .bars { height: 140px; gap: 3px; }
  .bars .d { font-size: 9.5px; }
}
