/* ================= Shared UI components (cards, tables, pills, pager) + admin back office ================= */
.admin-body { background: #f3f6fb; display: block; min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.ico { flex: none; vertical-align: -0.2em; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* ----- Sidebar ----- */
.admin-side {
  width: 264px; flex: none; background: linear-gradient(180deg, #0b2545 0%, #0f2f57 100%); color: #c9d6ea;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.admin-side__brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; text-decoration: none; }
.admin-side__brand b { display: block; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.admin-side__brand small { color: #f3a77e; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.admin-side__brand .brand-mark { color: #fff; }
.admin-nav { padding: 4px 12px 16px; flex: 1; }
.admin-nav__group { margin: 18px 10px 6px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #7f93b3; }
.admin-nav__link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9d6ea; text-decoration: none;
  font-weight: 600; font-size: .92rem; background: none; border: 0; text-align: start; transition: background .15s, color .15s;
}
.admin-nav__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav__link.is-active { background: rgba(232,116,59,.16); color: #fff; box-shadow: inset 3px 0 0 #e8743b; }
[dir="rtl"] .admin-nav__link.is-active { box-shadow: inset -3px 0 0 #e8743b; }
.admin-nav__link.is-active .ico { color: #f3a77e; }
.admin-nav__badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e8743b; color: #fff; font-size: .75rem; font-weight: 800; display: inline-grid; place-items: center; }
.admin-side__foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.admin-side__foot form { margin: 0; }

/* ----- Top bar ----- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 14px 28px;
  background: rgba(243,246,251,.9); backdrop-filter: blur(10px); border-bottom: 1px solid #e3e9f2;
}
.admin-top__menu { display: none; border: 0; background: #fff; border-radius: 10px; width: 42px; height: 42px; place-items: center; color: #0b2545; box-shadow: 0 1px 2px rgba(11,37,69,.08); }
.admin-top__title { min-width: 0; }
.admin-top__title h1 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; color: #0f1d33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-top__crumb { font-size: .75rem; font-weight: 700; color: #8a97ad; text-transform: uppercase; letter-spacing: .1em; }
.admin-top__search { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #dde5ef; border-radius: 12px; padding: 0 12px; height: 42px; width: min(340px, 40vw); color: #8a97ad; }
.admin-top__search:focus-within { border-color: #e8743b; box-shadow: 0 0 0 3px rgba(232,116,59,.15); }
.admin-top__search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; font-size: .92rem; color: #0f1d33; }
.admin-top__chip { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid #dde5ef; background: #fff; color: #13315c; font-weight: 600; font-size: .9rem; }
.admin-top__user { display: inline-flex; align-items: center; gap: 8px; color: #3b4a63; font-weight: 600; font-size: .9rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-top__avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; background: #0b2545; color: #fff; font-weight: 800; flex: none; }
.admin-flag { margin: 14px 28px 0; padding: 9px 14px; border-radius: 10px; background: #fff4d6; color: #6b4e00; font-size: .85rem; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.admin-flag--error { background: #fde2e1; color: #8a1c17; }
.admin-content { padding: 24px 28px 48px; }
.admin-content > .container, .admin-content .container { max-width: none; padding: 0; margin-top: 0 !important; }
.admin-content .page-title { display: none; } /* the top bar shows the title */
.admin-backdrop { display: none; }

@media (max-width: 991.98px) {
  .admin-side { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  [dir="rtl"] .admin-side { transform: translateX(100%); }
  .admin-menu-open .admin-side { transform: none; }
  .admin-menu-open .admin-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,37,69,.45); z-index: 35; }
  .admin-top__menu { display: inline-grid; }
  .admin-top { padding: 12px 16px; gap: 10px; }
  .admin-top__search { width: auto; flex: 1; }
  .admin-top__title { display: none; }
  .admin-content { padding: 18px 16px 40px; }
  .admin-flag { margin: 12px 16px 0; }
}

/* ----- Cards, KPIs ----- */
.acard { background: #fff; border: 1px solid #e3e9f2; border-radius: 16px; padding: 20px; box-shadow: 0 1px 2px rgba(11,37,69,.04), 0 8px 24px rgba(11,37,69,.04); }
.acard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 14px; }
.acard__head h2 { font-size: 1rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; color: #0f1d33; }
.acard__head h2 .ico { color: #e8743b; }
.acard__link { font-size: .85rem; font-weight: 700; text-decoration: none; color: #13315c; display: inline-flex; align-items: center; gap: 2px; }
.acard__link:hover { color: #e8743b; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1199.98px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { position: relative; background: #fff; border: 1px solid #e3e9f2; border-radius: 16px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 8px 24px rgba(11,37,69,.04); overflow: hidden; }
.kpi__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; }
.kpi__icon--navy { background: #e8eef7; color: #0b2545; }
.kpi__icon--sky { background: #e3f0fd; color: #1d6fc2; }
.kpi__icon--green { background: #e6f6ee; color: #15803d; }
.kpi__icon--accent { background: #fdeee5; color: #c95e29; }
.kpi__label { font-size: .8rem; font-weight: 700; color: #5d6b82; text-transform: uppercase; letter-spacing: .06em; }
.kpi__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: #0f1d33; line-height: 1.15; }
.kpi__value--money { font-size: 1.45rem; }
.kpi__sub { font-size: .85rem; color: #5d6b82; }

/* ----- Tables ----- */
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.dtable th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #8a97ad; padding: 0 12px 10px; border-bottom: 1px solid #e3e9f2; white-space: nowrap; text-align: start; }
.dtable th.text-end { text-align: end; }
.dtable td { padding: 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; color: #0f1d33; }
.dtable tbody tr:hover td { background: #f8fafd; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable__ref { font-weight: 800; text-decoration: none; color: #13315c; letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }
.dtable__ref:hover { color: #e8743b; }
.dtable__sub { font-size: .78rem; color: #8a97ad; margin-top: 2px; }
.dtable__type { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #eef4fb; color: #13315c; margin-inline-end: 6px; vertical-align: middle; }

/* ----- Pills ----- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.pill--ok { background: #e6f6ee; color: #166534; }
.pill--wait { background: #fff4d6; color: #8a5a00; }
.pill--bad { background: #fdecec; color: #b42318; }
.pill--info { background: #e3f0fd; color: #1d6fc2; }
.pill--muted { background: #f1f3f6; color: #5d6b82; }

/* ----- Filter bar ----- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filter-bar .form-select { width: auto; min-width: 150px; height: 44px; border-radius: 12px; border-color: #dde5ef; }
.filter-bar .btn { height: 44px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; }
.filter-bar__search { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid #dde5ef; border-radius: 12px; background: #fff; color: #8a97ad; margin: 0; }
.filter-bar__search:focus-within { border-color: #e8743b; box-shadow: 0 0 0 3px rgba(232,116,59,.15); }
.filter-bar__search input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; color: #0f1d33; }

/* ----- Pager ----- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #eef2f7; }
.pager__info { font-size: .85rem; color: #5d6b82; }
.pager__links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager__btn { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid #dde5ef; background: #fff; color: #13315c; font-weight: 700; font-size: .88rem; text-decoration: none; }
.pager__btn:hover { border-color: #e8743b; color: #e8743b; }
.pager__btn.is-active { background: #0b2545; border-color: #0b2545; color: #fff; }
.pager__btn.is-disabled { opacity: .4; pointer-events: none; }
.pager__gap { color: #8a97ad; padding: 0 2px; }

/* ----- Lists ----- */
.empty { text-align: center; padding: 28px 12px; color: #8a97ad; }
.empty p { margin: 8px 0 0; font-weight: 600; }
.empty--ok { color: #15803d; padding: 8px 12px 18px; }
.todo-list, .mini-list, .bars { list-style: none; padding: 0; margin: 0; }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; text-decoration: none; color: #0f1d33; }
.todo:hover { background: #f6f9fd; }
.todo__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #f1f3f6; color: #5d6b82; flex: none; }
.todo--hot .todo__icon { background: #fdeee5; color: #c95e29; }
.todo__text { display: flex; flex-direction: column; min-width: 0; }
.todo__text small { color: #8a97ad; font-size: .78rem; }
.todo__count { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; color: #8a97ad; }
.todo--hot .todo__count { color: #c95e29; }
.mini-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef2f7; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #eef4fb; color: #13315c; flex: none; }
.mini-list__main { display: flex; flex-direction: column; min-width: 0; }
.mini-list__main small { color: #8a97ad; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list__main a { text-decoration: none; color: #13315c; }
.mini-list__end { margin-inline-start: auto; font-weight: 800; }
.bars li a { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 10px; padding: 6px 0; text-decoration: none; color: #3b4a63; font-size: .86rem; font-weight: 600; }
.bars__track { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bars__fill { display: block; height: 100%; border-radius: 99px; background: #8a97ad; }
.bars__fill--ok { background: #22a35a; } .bars__fill--wait { background: #f0b429; } .bars__fill--bad { background: #e5484d; }
.bars__n { text-align: end; font-weight: 800; color: #0f1d33; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; margin: 0; font-size: .92rem; }
.kv dt { color: #5d6b82; font-weight: 600; }
.kv dd { margin: 0; color: #0f1d33; }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }

/* Older admin pages inside the new shell */
.admin-content .panel { border-radius: 16px; border-color: #e3e9f2; box-shadow: 0 8px 24px rgba(11,37,69,.04); }
.admin-content .staff-card { border-radius: 16px; }
.admin-content .agency-stat { border-radius: 16px; }
.agency-cell { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.agency-cell__logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #13315c, #1d4e89); color: #fff; font-weight: 800; flex: none; }
.agency-cell:hover b { color: #e8743b; }
