/* ════════════════════════════════════════════════════════════════
   Кабинет (агент/админ): оболочка, навигация, таблицы, выплаты.
   Светлая «IT-tech» тема. Дополняет site.css.
   ════════════════════════════════════════════════════════════════ */

/* экран входа */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-soft); }
.auth-screen::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 40% at 80% 0%, rgba(124,58,237,.10), transparent 60%),
    radial-gradient(40% 40% at 10% 100%, rgba(192,38,211,.08), transparent 60%);
}
.auth-screen .form-card { position: relative; z-index: 1; }

/* оболочка */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: block; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.3px; padding: 6px 12px 20px; color: var(--text); text-decoration: none; }
.sidebar .brand:hover { color: var(--text); }
.sidebar .brand span { color: var(--brand); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: var(--muted); cursor: pointer; font-size: 15px; font-weight: 500; user-select: none;
  border: 1px solid transparent; transition: .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { color: var(--brand); background: var(--brand-tint); border-color: #e6dbfb; font-weight: 600; }
.nav-item.active .ic { color: var(--brand); }
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; opacity: .85; }
.sidebar .spacer { flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-soft); }
.topbar {
  height: 66px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; gap: 16px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.topbar #viewTitle { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -.3px; }
.topbar .who { color: var(--muted); font-size: 14px; }
.topbar .who b { color: var(--text); font-weight: 600; }
.content { padding: 32px 28px; max-width: 1180px; width: 100%; }
.content h1 { font-family: var(--display); font-size: 28px; margin: 0 0 6px; font-weight: 700; letter-spacing: -.6px; }
.content .page-sub { color: var(--muted); margin: 0 0 28px; font-size: 15px; }

/* карточки статистики */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 960px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--sh-sm); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.stat::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.stat .label { color: var(--muted); font-size: 13px; margin-bottom: 10px; font-weight: 500; }
.stat .value { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -1px; }
.stat .value.money { color: var(--brand); }
.stat .value.money::after { content: ' ₽'; font-size: 15px; color: var(--muted); font-weight: 600; }

/* фильтры */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: end; }
.filters .f { display: flex; flex-direction: column; gap: 5px; }
.filters label { font-size: 12px; color: var(--muted); font-weight: 500; }
.filters select, .filters input { background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px; font-family: inherit; transition: .15s; }
.filters select:focus, .filters input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* таблицы */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--sh-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; background: var(--bg-soft); }
tr:last-child td { border-bottom: none; }
tbody tr.click { cursor: pointer; transition: background .12s; }
tbody tr.click:hover { background: var(--brand-tint); }
.empty { padding: 52px; text-align: center; color: var(--muted); }

/* бейджи */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.muted { background: var(--panel-2); color: var(--muted); }
.pay-none    { background: #eef0f4; color: var(--muted); }
.pay-accrued { background: #fdf2dc; color: #b45309; }
.pay-paid    { background: #e7f7f0; color: #047857; }

/* реф-ссылка */
.reflink-box { display: flex; gap: 10px; }
.reflink-box input { flex: 1; font-size: 15px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text); font-family: var(--mono); }

/* документы */
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.doc-row .meta { color: var(--faint); font-size: 13px; margin-top: 3px; }

/* таймлайн */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 20px 24px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); }
.timeline .t-time { color: var(--faint); font-size: 12px; }
.timeline .t-body { margin-top: 3px; font-size: 14px; }

/* секции настроек */
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; max-width: 560px; box-shadow: var(--sh-sm); }
.settings-card h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* слайд-панель деталей */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(13,15,22,.4); backdrop-filter: blur(3px); z-index: 70; display: none; }
.drawer-backdrop.open { display: block; animation: fade .2s; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 94vw; z-index: 71;
  background: var(--bg-soft); border-left: 1px solid var(--line); padding: 28px; overflow: auto;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.3,.8,.3,1); box-shadow: -30px 0 60px -20px rgba(13,15,22,.18);
}
.drawer.open { transform: translateX(0); }
.drawer h2 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.drawer .x { float: right; cursor: pointer; color: var(--muted); font-size: 26px; line-height: 1; background: none; border: none; transition: color .15s; }
.drawer .x:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 18px 0; font-size: 14px; }
.kv .k { color: var(--muted); }
.drawer .settings-card { max-width: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; height: auto; position: sticky; top: 0; z-index: 8; gap: 6px; }
  .sidebar .brand { width: 100%; padding-bottom: 10px; }
  .sidebar .spacer { display: none; }
  .nav-item { padding: 9px 12px; font-size: 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 22px 18px; }
}
