/* ============ PUFI ADMIN ============ */
:root{
  --yellow:#FFDD2D; --yellow-d:#FFCA0A; --yellow-soft:#FFFBEA;
  --ink:#1A1A1A; --graphite:#2B2B2B; --grey:#8A8F98; --grey-l:#A8ADB5;
  --bg:#F5F6F8; --bg-soft:#FAFBFC; --line:#E8EAED; --white:#fff;
  --ok:#22C55E; --danger:#EF4444; --blue:#3B82F6;
  --r-sm:10px; --r:14px; --r-lg:20px;
  --sh-card:0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --sh-pop:0 12px 40px rgba(16,24,40,.16);
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{font-family:Manrope,system-ui,sans-serif;background:var(--bg);color:var(--ink);
  font-size:14px;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{background:none;border:none;cursor:pointer}
.mono{font-family:'JetBrains Mono',monospace}
::selection{background:var(--yellow);color:var(--ink)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#D8DBE0;border-radius:8px;border:3px solid transparent;background-clip:content-box}

/* ---------- SHELL ---------- */
.shell{height:100dvh;display:flex;overflow:hidden}
.side{width:236px;flex:none;background:var(--white);border-right:1px solid var(--line);
  display:flex;flex-direction:column}
.side-h{height:64px;flex:none;display:flex;align-items:center;gap:10px;padding:0 18px;border-bottom:1px solid var(--line)}
.side-h .mk{width:32px;height:32px;object-fit:contain}
.logo{font-size:17px;font-weight:800;letter-spacing:-.03em}
.logo span{color:var(--grey)}

.nav{flex:1;padding:12px;display:flex;flex-direction:column;gap:3px;overflow-y:auto}
.nav a{display:flex;align-items:center;gap:12px;height:42px;padding:0 13px;border-radius:var(--r-sm);
  font-size:13.5px;font-weight:700;color:var(--graphite);transition:.14s}
.nav a:hover{background:var(--bg)}
.nav a.on{background:var(--yellow);color:var(--ink)}
.nav a svg{width:18px;height:18px;flex:none}
.nav .dot{margin-left:auto;background:var(--danger);color:#fff;font-size:11px;font-weight:800;
  min-width:20px;height:20px;border-radius:100px;display:grid;place-items:center;padding:0 6px}
.nav a.on .dot{background:var(--ink)}

.side-f{padding:12px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:8px}
.me{display:flex;align-items:center;gap:10px;padding:6px 4px}
.me .av{width:32px;height:32px;flex:none;border-radius:50%;background:var(--graphite);color:#fff;
  display:grid;place-items:center;font-size:12px;font-weight:800}
.me .mb{min-width:0;display:flex;flex-direction:column}
.me .mn{font-size:13px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.me .mr{font-size:11.5px;color:var(--grey)}
.wfull{width:100%}

.main{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden}
.topbar{height:64px;flex:none;background:var(--white);border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:14px;padding:0 24px}
.topbar h1{font-size:17px;font-weight:800;letter-spacing:-.02em}
.topbar .sub{font-size:12.5px;color:var(--grey);margin-top:1px}
.spacer{flex:1}
.scroll{flex:1;overflow-y:auto}
.page{padding:24px;max-width:1360px;margin:0 auto;width:100%}

@media(max-width:900px){
  .side{position:fixed;inset:0 auto 0 0;z-index:50;transform:translateX(-100%)}
  .page{padding:16px}
}

/* ---------- КНОПКИ ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 17px;
  border-radius:var(--r-sm);font-weight:700;font-size:14px;transition:.16s;white-space:nowrap}
.btn svg{width:16px;height:16px;flex:none}
.btn-y{background:var(--yellow);color:var(--ink)}
.btn-y:hover{background:var(--yellow-d)}
.btn-g{background:var(--white);color:var(--ink);border:1.5px solid var(--line)}
.btn-g:hover{border-color:#C9CDD4;background:var(--bg-soft)}
.btn-ghost{color:var(--graphite)}
.btn-ghost:hover{background:var(--bg)}
.btn-red{background:#FEF2F2;color:var(--danger)}
.btn-red:hover{background:#FEE2E2}
.btn-sm{height:34px;padding:0 12px;font-size:13px;border-radius:9px}
.btn:disabled{opacity:.5;pointer-events:none}

/* ---------- ФОРМЫ ---------- */
.label{display:block;font-size:13px;font-weight:700;margin-bottom:6px}
.hint{font-size:12.5px;color:var(--grey);margin-top:6px;line-height:1.55}
.input,.textarea,.select{width:100%;height:42px;padding:0 14px;background:var(--white);
  border:1.5px solid var(--line);border-radius:var(--r-sm);transition:.14s;font-weight:500}
.textarea{height:auto;padding:12px 14px;resize:vertical;min-height:96px;line-height:1.6}
.input:hover,.textarea:hover,.select:hover{border-color:#C9CDD4}
.input:focus,.textarea:focus,.select:focus{outline:none;border-color:var(--yellow-d);
  box-shadow:0 0 0 3px rgba(255,221,45,.25)}
.input::placeholder,.textarea::placeholder{color:var(--grey-l)}
.select{appearance:none;cursor:pointer;padding-right:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8F98' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 13px center;background-size:17px}
.field{margin-bottom:16px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.search{position:relative}
.search svg{position:absolute;left:13px;top:50%;transform:translateY(-50%);width:16px;height:16px;
  color:var(--grey);pointer-events:none}
.search .input{padding-left:38px;width:260px}

/* ---------- КАРТОЧКИ ---------- */
.card{background:var(--white);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--sh-card)}
.card-h{padding:16px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.card-h h3{font-size:15px;font-weight:800}
.card-h p{font-size:12.5px;color:var(--grey);margin-top:2px}
.card-b{padding:20px}
.card-f{padding:14px 20px;border-top:1px solid var(--line);background:var(--bg-soft);
  border-radius:0 0 var(--r) var(--r);display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* ---------- СТАТЫ ---------- */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px;margin-bottom:20px}
.stat{background:var(--white);border:1px solid var(--line);border-radius:var(--r);padding:17px;box-shadow:var(--sh-card)}
.stat .k{font-size:12px;font-weight:700;color:var(--grey)}
.stat .v{font-size:26px;font-weight:800;letter-spacing:-.03em;margin:7px 0 3px;font-family:'JetBrains Mono',monospace}
.stat .d{font-size:12px;font-weight:600;color:var(--grey)}
.stat .d.up{color:#15803D}

/* ---------- ТАБЛИЦЫ ---------- */
.tbl-wrap{overflow-x:auto}
.tbl{width:100%;border-collapse:collapse}
.tbl th{text-align:left;font-size:11.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;
  color:var(--grey);padding:11px 16px;border-bottom:1px solid var(--line);white-space:nowrap;background:var(--bg-soft)}
.tbl td{padding:13px 16px;border-bottom:1px solid var(--line);vertical-align:middle}
.tbl tbody tr{transition:.12s}
.tbl tbody tr:hover{background:var(--bg-soft)}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl a.row-link{font-weight:700}
.tbl a.row-link:hover{text-decoration:underline}

/* ---------- БЕЙДЖИ ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;height:23px;padding:0 9px;border-radius:100px;
  font-size:11.5px;font-weight:700;white-space:nowrap;background:var(--bg);color:var(--graphite)}
.badge b{width:6px;height:6px;border-radius:50%;background:currentColor}
.badge-ok{background:#F0FDF4;color:#15803D}
.badge-y{background:var(--yellow-soft);color:#946200}
.badge-red{background:#FEF2F2;color:#B91C1C}
.badge-blue{background:#EFF6FF;color:#1D4ED8}
.badge-grey{background:var(--bg);color:var(--grey)}

/* ---------- АЛЕРТЫ ---------- */
.alert{display:flex;gap:10px;padding:12px 15px;border-radius:var(--r-sm);font-size:13px;
  line-height:1.55;margin-bottom:18px;font-weight:600}
.alert svg{width:17px;height:17px;flex:none;margin-top:1px}
.alert-ok{background:#F0FDF4;color:#15803D}
.alert-err{background:#FEF2F2;color:#B91C1C}
.alert-info{background:var(--yellow-soft);color:#946200}

/* ---------- ПУСТО / ПАГИНАЦИЯ ---------- */
.empty{text-align:center;padding:48px 20px}
.empty h4{font-size:16px;font-weight:800;margin-bottom:6px}
.empty p{font-size:13.5px;color:var(--grey);max-width:380px;margin:0 auto;line-height:1.6}
.pag{display:flex;gap:6px;align-items:center;justify-content:center;margin-top:18px;flex-wrap:wrap}
.pag a,.pag span{min-width:36px;height:36px;padding:0 10px;display:inline-flex;align-items:center;
  justify-content:center;border-radius:9px;font-size:13px;font-weight:700;
  background:var(--white);border:1px solid var(--line);color:var(--graphite)}
.pag a:hover{border-color:#C9CDD4}
.pag .active span{background:var(--yellow);border-color:var(--yellow);color:var(--ink)}
.pag .disabled span{opacity:.4}

/* ---------- ЛОГИН ---------- */
.auth{min-height:100dvh;display:grid;place-items:center;padding:20px;background:var(--bg)}
.auth-box{width:100%;max-width:400px;background:var(--white);border:1px solid var(--line);
  border-radius:var(--r-lg);box-shadow:var(--sh-card);padding:32px}
.auth-box .mk{width:44px;height:44px;object-fit:contain;margin-bottom:16px}
.auth-box h1{font-size:22px;font-weight:800;letter-spacing:-.02em;margin-bottom:6px}
.auth-box p.lead{font-size:13.5px;color:var(--grey);line-height:1.6;margin-bottom:22px}

/* ---------- ПРОЧЕЕ ---------- */
.grid2{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
@media(max-width:1000px){.grid2,.grid3{grid-template-columns:1fr}}
.muted{color:var(--grey)}
.tiny{font-size:12.5px}
.bold{font-weight:700}
.stack{display:flex;flex-direction:column;gap:14px}
.sep{height:1px;background:var(--line);margin:18px 0}
.lrow{display:flex;align-items:center;gap:12px;padding:13px 20px;border-bottom:1px solid var(--line)}
.lrow:last-child{border-bottom:none}
.lrow:hover{background:var(--bg-soft)}
.lrow .lb{flex:1;min-width:0}
.lrow .lt{font-weight:700;font-size:13.5px}
.lrow .ld{font-size:12.5px;color:var(--grey);margin-top:2px}
.money{font-family:'JetBrains Mono',monospace;font-weight:700}
.money.plus{color:#15803D}
.money.minus{color:var(--ink)}
.bar{height:8px;background:var(--bg);border-radius:100px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--yellow-d);border-radius:100px}

/* график столбиками */
.chart{display:flex;align-items:flex-end;gap:6px;height:150px;padding-top:10px}
.chart .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;min-width:0}
.chart .col i{width:100%;background:var(--yellow);border-radius:5px 5px 0 0;min-height:3px;display:block}
.chart .col b{font-size:11px;font-weight:700;color:var(--grey);white-space:nowrap}
.chart .col em{font-size:11px;font-style:normal;font-weight:800;color:var(--ink)}

/* переписка тикета */
.msgs{display:flex;flex-direction:column;gap:12px}
.msg{max-width:76%;padding:12px 15px;border-radius:14px;font-size:13.5px;line-height:1.6}
.msg.client{background:var(--bg);border-bottom-left-radius:5px;align-self:flex-start}
.msg.support{background:var(--yellow);border-bottom-right-radius:5px;align-self:flex-end}
.msg.internal{background:#FFF7ED;border:1px dashed #FDBA74;align-self:flex-end;border-bottom-right-radius:5px}
.msg .who{font-size:10.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;
  color:var(--grey);margin-bottom:4px}
.msg.support .who{color:rgba(26,26,26,.55)}

/* профиль в шапке */
.who{display:flex;align-items:center;gap:9px;padding:5px 10px 5px 5px;border-radius:100px;
  transition:.14s;flex:none}
.who:hover{background:var(--bg)}
.who .av{width:32px;height:32px;flex:none;border-radius:50%;background:var(--graphite);color:#fff;
  display:grid;place-items:center;font-size:12px;font-weight:800}
.who .wb{display:flex;flex-direction:column;min-width:0}
.who .wn{font-size:13px;font-weight:700;white-space:nowrap}
.who .wr{font-size:11.5px;color:var(--grey);white-space:nowrap}
@media(max-width:760px){.who .wb{display:none}}

/* ---------- МОДАЛКИ ---------- */
.modal{position:fixed;inset:0;z-index:80;display:none;place-items:center;padding:20px}
.modal:target,.modal.open{display:grid}
.modal .scrim{position:absolute;inset:0;background:rgba(26,26,26,.45);backdrop-filter:blur(3px)}
.modal .box{position:relative;width:100%;max-width:460px;background:var(--white);
  border-radius:var(--r-lg);box-shadow:var(--sh-pop);max-height:88dvh;display:flex;flex-direction:column;
  animation:pop .18s ease-out}
@keyframes pop{from{opacity:0;transform:scale(.97) translateY(8px)}to{opacity:1;transform:none}}
.modal .card-h{border-radius:var(--r-lg) var(--r-lg) 0 0}
.modal .card-b{overflow-y:auto}
.modal .card-f{border-radius:0 0 var(--r-lg) var(--r-lg)}
.modal .x{width:32px;height:32px;display:grid;place-items:center;border-radius:9px;color:var(--grey)}
.modal .x:hover{background:var(--bg);color:var(--ink)}
.modal .x svg{width:18px;height:18px}

/* меню действий в строке таблицы */
.acts{display:flex;gap:4px;align-items:center;justify-content:flex-end}

/* вложения в переписке */
.atts{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.att{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:9px;
  background:rgba(255,255,255,.55);border:1px solid var(--line);transition:.14s;font-size:12.5px}
.msg.client .att{background:#fff}
.att:hover{border-color:#C9CDD4}
.att svg{width:15px;height:15px;flex:none;color:var(--grey)}
.att .an{flex:1;min-width:0;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.att .as{color:var(--grey);flex:none}

/* ---------- вкладки страницы ---------- */
.tabs-row{display:inline-flex;gap:4px;background:var(--white);border:1px solid var(--line);
  border-radius:12px;padding:4px;margin-bottom:20px;overflow-x:auto;max-width:100%}
.tabs-row a{padding:9px 16px;font-size:13.5px;font-weight:700;color:var(--grey);
  white-space:nowrap;border-radius:8px;transition:.16s}
.tabs-row a:hover{color:var(--ink);background:var(--bg)}
.tabs-row a.on{color:var(--ink);background:var(--yellow)}
