/* ===================== Кабинет юриста (по прототипу) ===================== */

.admin-shell { display: flex; min-height: 100vh; }
.admin-col { display: flex; flex-direction: column; flex: 1; min-width: 0; }

/* Мобильные топ-бар и нижняя навигация (показываются на узких экранах) */
.admin-topbar { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--brand); color: var(--on-brand); position: sticky; top: 0; z-index: 30; }
.admin-topbar__brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; color: var(--on-brand); }
.admin-topbar__logout { color: var(--on-brand); opacity: .85; display: flex; }
.admin-bottomnav { display: none; position: sticky; bottom: 0; z-index: 30; background: var(--brand); border-top: 1px solid rgba(255, 255, 255, .12); padding: 7px 4px; gap: 2px; }
.admin-bottomnav__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .7); border-radius: 10px; }
.admin-bottomnav__item.is-active { color: #fff; background: rgba(255, 255, 255, .14); }

/* SIDEBAR */
.sidebar {
  width: 248px; flex: none; background: var(--brand); color: var(--on-brand);
  display: flex; flex-direction: column; padding: 22px 16px; gap: 6px; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: var(--on-brand); }
.sidebar__brand-text { line-height: 1.15; }
.sidebar__brand-name { display: block; font-weight: 600; font-size: 15px; }
.sidebar__brand-sub { display: block; font-size: 11px; opacity: .6; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar__item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px;
  font-size: 14px; font-weight: 600; color: var(--on-brand); opacity: .78; transition: .15s;
}
.sidebar__item:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.sidebar__item.is-active { background: rgba(255, 255, 255, .15); opacity: 1; }
.sidebar__user { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 11px 10px; background: rgba(255, 255, 255, .08); border-radius: 12px; }
.sidebar__user-info { line-height: 1.2; min-width: 0; flex: 1; }
.sidebar__user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 11px; opacity: .6; }
.sidebar__logout { color: var(--on-brand); opacity: .7; display: flex; }
.sidebar__logout:hover { opacity: 1; }

/* MAIN */
.admin__main { flex: 1; min-width: 0; overflow-x: hidden; padding: 34px clamp(18px, 4vw, 40px) 60px; }
.wrap { max-width: 1040px; margin: 0 auto; }
.wrap--wide { max-width: 1080px; }
.wrap--narrow { max-width: 680px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__title h1 { margin: 6px 0 0; font-size: 28px; font-weight: 600; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: clamp(18px, 3vw, 24px); margin-bottom: 18px; }
.card--flush { padding: 0; overflow: hidden; }
.card--center { text-align: center; max-width: 440px; margin: 60px auto; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card__head h2 { margin: 0; font-size: 16px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); }
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.kpi__value { font-size: 30px; font-weight: 700; font-family: var(--font-head); letter-spacing: -.5px; }
.kpi__sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi__sub--accent { color: var(--accent-2); font-weight: 600; }

/* Date range filter */
.rangebar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; }
.rangebar__label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.rangebar__presets { display: flex; gap: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 600; padding: 9px 15px; border-radius: 9px; transition: .15s; }
.chip-btn.is-active { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.rangebar__dates { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.rangebar__dates input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 13px; color: var(--ink); }

/* Tables */
.dtable { width: 100%; }
.dtable__head, .dtable__row { display: grid; gap: 0; align-items: center; }
.dtable__head { padding: 12px 22px; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.dtable__row { padding: 14px 22px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; transition: background .12s; }
.dtable__row:hover { background: var(--surface-2); }
.dtable__row:last-child { border-bottom: none; }
.cell-r { text-align: right; }
.client-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.client-cell__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-cell__date { font-size: 11px; color: var(--muted); }
.cell-soft { color: var(--ink-2); }
.empty-row { padding: 40px 22px; text-align: center; color: var(--muted); font-size: 14px; }

/* Generic table fallback */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table--click tbody tr { cursor: pointer; }
.table--click tbody tr:hover { background: var(--surface-2); }

/* Create offer */
.create-grid { display: grid; grid-template-columns: 1fr 372px; gap: 24px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tariff-rows { display: flex; flex-direction: column; gap: 11px; margin-bottom: 22px; }
.tariff-row { cursor: pointer; border: 2px solid var(--line); border-radius: 13px; padding: 15px 16px; background: var(--surface); transition: .15s; display: block; }
.tariff-row input { position: absolute; opacity: 0; pointer-events: none; }
.tariff-row__body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tariff-row__name { font-weight: 600; font-size: 15px; }
.tariff-row__desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tariff-row__price { font-weight: 700; font-size: 16px; white-space: nowrap; }
.tariff-row:has(input:checked) { border-color: var(--accent); background: var(--surface-2); box-shadow: 0 2px 10px rgba(31, 138, 76, .14); }
.tag-hit { font-size: 11px; font-weight: 600; color: var(--accent-2); background: var(--chip); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.create-foot { display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; flex-wrap: wrap; }

/* Live phone preview */
.pv-wrap { position: sticky; top: 20px; }
.pv-label { display: flex; align-items: center; gap: 7px; margin-bottom: 11px; }
.pv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; animation: qrPulse 1.6s infinite; }
.pv-phone { border-radius: 26px; background: #0c0e12; padding: 9px; box-shadow: 0 20px 50px rgba(10, 15, 30, .28); }
.pv-screen { background: var(--surface); border-radius: 19px; overflow: hidden; }
.pv-top { background: var(--brand); color: var(--on-brand); padding: 16px 18px; }
.pv-top__brand { font-size: 13px; font-weight: 600; opacity: .85; }
.pv-top__hello { font-size: 18px; font-weight: 600; margin-top: 12px; font-family: var(--font-head); line-height: 1.25; }
.pv-body { padding: 16px 18px; }
.pv-situation-label { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: #9a6b15; font-weight: 700; margin-bottom: 6px; }
.pv-situation { font-size: 13px; line-height: 1.5; color: #5a4a2a; margin-bottom: 16px; background: #fcf4e8; border: 1px solid #f0dcb6; border-left: 3px solid #e0a23c; border-radius: 10px; padding: 10px 12px; }
.pv-tariff { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.pv-tariff__name { font-size: 13px; font-weight: 600; }
.pv-tariff__price { font-size: 24px; font-weight: 700; font-family: var(--font-head); margin-top: 4px; }
.pv-pay { margin-top: 14px; background: var(--accent); color: var(--on-accent); text-align: center; padding: 13px; border-radius: 11px; font-weight: 600; font-size: 14px; }

/* Result */
.result-hero { text-align: center; margin-bottom: 26px; }
.result-check { width: 58px; height: 58px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; animation: pop .4s ease; }
.sharebox { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.sharebox__url { flex: 1; min-width: 240px; display: flex; align-items: center; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.share-row .btn { flex: 1; min-width: 150px; }
.co-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.co-card__id { display: flex; align-items: center; gap: 13px; }

/* History filters */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.search { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; }
.search input { width: 100%; padding: 11px 13px 11px 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.filters select { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; cursor: pointer; color: var(--ink); }

/* Stats */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 190px; padding-bottom: 26px; position: relative; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.bars__v { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.bars__bar { width: 100%; max-width: 46px; background: var(--brand); border-radius: 7px 7px 0 0; transition: height .5s ease; min-height: 2px; }
.bars__d { position: absolute; bottom: 0; font-size: 12px; color: var(--muted); }
.tstat { margin-bottom: 16px; }
.tstat__top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.tstat__bar { height: 9px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.tstat__fill { height: 100%; background: var(--accent); border-radius: 6px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv__v { font-size: 22px; font-weight: 700; font-family: var(--font-head); }

/* Detail deflist / docs */
.deflist { display: grid; gap: 10px; margin: 16px 0; }
.deflist div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.deflist dt { color: var(--muted); font-size: 14px; }
.deflist dd { margin: 0; font-weight: 600; text-align: right; }
.doclist { list-style: none; padding: 0; margin: 0 0 16px; }
.doclist li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.doc-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.doc-form .field__input { flex: 1; min-width: 180px; margin: 0; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(170deg, var(--brand-2), var(--brand)); }
.auth-card { background: var(--surface); border-radius: 18px; padding: clamp(28px, 5vw, 40px); width: 100%; max-width: 400px; box-shadow: 0 30px 70px rgba(10, 15, 30, .3); }
.auth-card__brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 4px; }
.auth-card__name { font-size: 20px; font-weight: 700; }
.auth-card__sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }

@media (max-width: 920px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .create-grid { grid-template-columns: 1fr; }
  .pv-wrap { position: static; max-width: 360px; margin: 0 auto; }
  .stats-2col { grid-template-columns: 1fr !important; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .admin-topbar { display: flex; }
  .admin-bottomnav { display: flex; }
  .admin__main { padding: 16px 14px 20px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .btn { justify-content: center; }
  .page-head__title h1 { font-size: 22px; }
  /* Таблицы → карточки: на телефоне строка читается как «метка: значение» — без обрезки и горизонтального скролла */
  .dtable__head { display: none; }
  .dtable__row { display: block; padding: 15px 16px; }
  .dtable__row > div { min-width: 0; }
  .dtable__row > .client-cell { margin-bottom: 11px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
  .dtable__row > [data-label] {
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    text-align: right; padding: 5px 0;
  }
  .dtable__row > [data-label]::before {
    content: attr(data-label); flex: none; text-align: left;
    color: var(--muted); font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: 0;
  }
  .dtable__row > .cell--wide { flex-direction: column; align-items: stretch; text-align: left; gap: 4px; }
  .dtable__row > .cell--wide::before { text-transform: uppercase; letter-spacing: .4px; font-size: 11px; }
  /* Фильтры/период переносятся аккуратно */
  .rangebar__dates { margin-left: 0; width: 100%; }
  .filters { gap: 10px; }
  .search { min-width: 100%; }
}
