/* ============================================================================
   CifraCloud — личный кабинет
   Наследует дизайн-систему лендинга (landing.css): переменные, кнопки,
   карточки, формы, модалку. Здесь — только то, чего нет на лендинге.
   ========================================================================== */

.app-body { background: var(--surface-2); }

.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }

/* ---------- Боковое меню ---------- */
.sidebar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
}
.side-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; }
.side-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.side-link {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link .ic { font-size: 14px; opacity: .8; }
.side-foot { display: none; }

/* ---------- Контент ---------- */
.main { padding: 20px 16px 56px; max-width: 1180px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 700;
}
.pill-k { color: var(--muted); font-weight: 500; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}

.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Карточки-показатели ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.stat .v.btc { color: var(--btc); }
.stat .v.ok { color: var(--ok); }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Панели ---------- */
.panel { padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16.5px; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.btn-xs { padding: 7px 12px; min-height: 34px; font-size: 13px; border-radius: 8px; }
.two-col { display: grid; gap: 16px; }

/* ---------- Контракты ---------- */
.contract {
  border: 1px solid var(--line); border-radius: var(--r); padding: 15px; margin-bottom: 10px; background: var(--surface);
}
.contract:last-child { margin-bottom: 0; }
.c-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.c-name { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 12px; }
.c-cell .k { font-size: 12px; color: var(--muted); }
.c-cell .v { font-size: 14.5px; font-weight: 700; margin-top: 2px; }
.c-cell .v.btc { color: var(--btc); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.c-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 7px; }

/* ---------- Таблица ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 460px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted-2); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
th.r, td.r { text-align: right; }
td.neg { color: var(--warn); }
td.pos { color: var(--ok); font-weight: 700; }

/* ---------- Список начислений (компактный) ---------- */
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.acc-row:last-child { border-bottom: none; }
.acc-row .d { color: var(--muted); }
.acc-row .n { font-weight: 700; color: var(--ok); }

/* ---------- Новый контракт ---------- */
.form-row { margin-bottom: 18px; }
.lbl { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hint a, .btn-link { color: var(--accent); font-weight: 600; cursor: pointer; }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row-inline .finput { flex: 1; margin-bottom: 0; }

.nc-summary {
  border-radius: var(--r); padding: 16px; background: linear-gradient(160deg, #fff, var(--accent-soft));
  border: 1px solid #D8E5F4;
}
.nc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nc-cell .k { font-size: 12px; color: var(--muted); }
.nc-cell .v { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.nc-cell .v.btc { color: var(--btc); }

/* ---------- Оплата ---------- */
.pay-summary { padding: 14px; border-radius: var(--r); background: var(--surface-2); margin-bottom: 16px; font-size: 14px; }
.pay-summary b { font-weight: 700; }
.tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  font-weight: 600; font-size: 13.5px; color: var(--muted); min-height: 40px;
}
.tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pay-body { display: none; }
.pay-body.active { display: block; }
.pay-grid { display: grid; gap: 16px; align-items: start; margin-top: 14px; }
.qr {
  width: 132px; height: 132px; border-radius: 10px; flex-shrink: 0;
  background: repeating-conic-gradient(var(--ink) 0% 25%, #fff 0% 50%) 50% / 11px 11px;
  border: 6px solid #fff; box-shadow: var(--shadow);
}
.addr-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.addr {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; font-size: 13px; word-break: break-all; font-weight: 600;
}
.req { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 12px; }
.req-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.req-row:last-child { border-bottom: none; }
.req-row span { color: var(--muted); }
.req-row b { text-align: right; }
.pay-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.pay-actions .btn { flex: 1; min-width: 160px; }

/* ---------- Выплаты ---------- */
.balance-box { padding: 16px; border-radius: var(--r); background: var(--btc-soft); border: 1px solid #F1DCC0; margin-bottom: 18px; }
.balance-box .k { font-size: 12.5px; color: var(--muted); }
.balance-box .v { font-size: 25px; font-weight: 800; color: var(--btc); letter-spacing: -.02em; margin-top: 4px; }
.balance-box .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.payout {
  padding: 12px 0; border-bottom: 1px solid var(--line-2);
}
.payout:last-child { border-bottom: none; }
.payout .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.payout .amt { font-weight: 800; font-size: 15px; }
.payout .tx { font-size: 11.5px; color: var(--muted-2); word-break: break-all; margin-top: 4px; }
.payout .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- KYC ---------- */
.kyc-steps { display: flex; margin: 16px 0 20px; }
.kyc-step { flex: 1; text-align: center; position: relative; }
.kyc-step .dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2);
  border: 2px solid var(--line); color: var(--muted); display: grid; place-items: center;
  margin: 0 auto 6px; font-weight: 700; font-size: 13px; position: relative; z-index: 1;
}
.kyc-step .l { font-size: 11.5px; color: var(--muted); }
.kyc-step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.kyc-step.active .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.kyc-step::after {
  content: ""; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--line);
}
.kyc-step:last-child::after { display: none; }

.upload {
  width: 100%; padding: 20px; border: 1px dashed var(--line); border-radius: var(--r);
  background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.upload.done { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); border-style: solid; }
.upload .ic { font-size: 17px; }

.status-box { padding: 18px; border-radius: var(--r); text-align: center; }
.status-box .ic { font-size: 28px; margin-bottom: 8px; }
.status-box.pending { background: var(--warn-soft); border: 1px solid #F2E3C4; color: var(--warn); }
.status-box.ok { background: var(--ok-soft); border: 1px solid #C8E6D6; color: var(--ok); }
.status-box b { display: block; margin-bottom: 4px; }
.status-box .sub { font-size: 13px; opacity: .85; }

/* ---------- Пустые состояния ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ic { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.empty p { font-size: 14px; margin-bottom: 14px; }

/* ---------- График ---------- */
.chart-svg { width: 100%; height: 150px; }
.chart-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted-2); margin-top: 5px; }

/* ============================================================================
   ДАТА-ЦЕНТР
   ========================================================================== */
.noc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.noc-tile {
  background: linear-gradient(180deg, #0E1626, #0B1120); border: 1px solid #1E2C47;
  border-radius: var(--r); padding: 15px 16px; color: #E2E8F0;
}
.noc-tile .k { color: #8AA0C2; font-size: 12px; }
.noc-tile .v { font-size: 22px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.noc-tile .v.acc { color: #60A5FA; } .noc-tile .v.ok { color: #34D399; }

.dc-cols { align-items: start; margin-bottom: 16px; }
.dc-side { margin-bottom: 0; }

.farm-scene {
  position: relative; width: 100%; height: 330px; border-radius: var(--r); overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #16233E 0%, #0B1120 55%, #070B15 100%);
  border: 1px solid #1E293B; box-shadow: inset 0 0 60px rgba(0,0,0,.55);
}
.farm-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 110%, rgba(30,78,140,.4), transparent 70%); }
.farm-floor {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%) perspective(900px) rotateX(48deg);
  transform-origin: center bottom; width: 128%; height: 66%;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px 18px; padding: 0 4%;
}
.rack { background: linear-gradient(180deg, #1B2942, #0E1626); border: 1px solid #24344F;
  border-radius: 5px; display: flex; flex-direction: column; gap: 4px; padding: 6px 5px; }
.rack .unit { height: 8px; border-radius: 2px; background: #16213A; border: 1px solid #20304C;
  display: flex; align-items: center; gap: 3px; padding: 0 3px; }
.rack .unit .dot { width: 3px; height: 3px; border-radius: 50%; background: #34D399;
  box-shadow: 0 0 4px #34D399; animation: ledblink 1.6s infinite; }
.rack .unit .bar { flex: 1; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #1E4E8C, #22D3EE); opacity: .7; }
.rack.warn .unit .dot { background: #FBBF24; box-shadow: 0 0 4px #FBBF24; }
.rack.off { opacity: .38; filter: grayscale(.6); }
.rack.off .unit .dot { background: #64748B; box-shadow: none; animation: none; }
@keyframes ledblink { 0%,100% { opacity: 1; } 45% { opacity: .25; } }

.farm-scan { position: absolute; inset: 0; pointer-events: none; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,.1) 50%, transparent);
  animation: scan 5s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform: translateX(-30%); } 50% { transform: translateX(220%); } }
.farm-particles span { position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(125,185,255,.7); box-shadow: 0 0 6px rgba(125,185,255,.8);
  animation: floatUp linear infinite; }
@keyframes floatUp { from { transform: translateY(0); opacity: 0; } 10%,90% { opacity: 1; }
  to { transform: translateY(-190px); opacity: 0; } }

.farm-top { position: absolute; top: 13px; left: 13px; right: 13px; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: rgba(220,38,38,.16); border: 1px solid rgba(248,113,113,.45); color: #FCA5A5;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.live-badge .rec { width: 7px; height: 7px; border-radius: 50%; background: #EF4444;
  box-shadow: 0 0 7px #EF4444; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }
.farm-cam { color: #94A3B8; font-size: 11px; text-align: right; background: rgba(7,11,21,.55);
  padding: 4px 9px; border-radius: 7px; }

.farm-hud { position: absolute; left: 13px; right: 13px; bottom: 13px; z-index: 3;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.farm-hud .m { background: rgba(10,16,30,.62); border: 1px solid rgba(30,78,140,.35);
  border-radius: 9px; padding: 9px 11px; }
.farm-hud .m .k { color: #8AA0C2; font-size: 10.5px; }
.farm-hud .m .v { color: #fff; font-size: 16px; font-weight: 800; margin-top: 2px;
  font-variant-numeric: tabular-nums; }
.farm-hud .m .v.acc { color: #60A5FA; } .farm-hud .m .v.ok { color: #34D399; }

.dark-panel { background: linear-gradient(180deg, #0E1626, #0A0F1C); border: 1px solid #1E2C47;
  border-radius: var(--r); padding: 18px; color: #E2E8F0; }
.dark-panel h3 { color: #fff; }

.rack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rack-cell { background: #0E1626; border: 1px solid #1E2C47; border-radius: 9px; padding: 10px 9px;
  position: relative; transition: transform .12s, box-shadow .12s; }
.rack-cell:hover { transform: translateY(-2px); border-color: #3B5FA6; }
.rack-cell .rid { display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; color: #8AA0C2; }
.rack-cell .st { width: 7px; height: 7px; border-radius: 50%; }
.rack-cell.online .st { background: #34D399; box-shadow: 0 0 6px #34D399; animation: ledblink 1.8s infinite; }
.rack-cell.warn .st { background: #FBBF24; box-shadow: 0 0 6px #FBBF24; }
.rack-cell.off .st { background: #64748B; }
.rack-cell .rh { font-size: 14px; font-weight: 800; color: #fff; margin-top: 6px;
  font-variant-numeric: tabular-nums; }
.rack-cell .rt { font-size: 10.5px; color: #8AA0C2; margin-top: 2px; }
.rack-cell.mine { border-color: var(--btc); box-shadow: 0 0 0 1px var(--btc); }
.rack-cell.mine::after { content: attr(data-you); position: absolute; top: 7px; right: 8px;
  font-size: 8.5px; font-weight: 800; color: var(--btc); letter-spacing: .05em; }

.event-log { font-family: ui-monospace, monospace; font-size: 12px; max-height: 300px; overflow: hidden; }
.event-log .ev { display: flex; gap: 9px; padding: 7px 0; border-bottom: 1px solid #16233A;
  animation: slideIn .3s ease; }
@keyframes slideIn { from { transform: translateX(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.event-log .ev .t { color: #5B6F92; flex-shrink: 0; }
.event-log .ev .msg { color: #CBD5E1; }
.event-log .ev .tag { margin-left: auto; font-size: 9.5px; padding: 1px 6px; border-radius: 5px; flex-shrink: 0; }
.event-log .ev .tag.ok { background: rgba(52,211,153,.15); color: #34D399; }
.event-log .ev .tag.info { background: rgba(96,165,250,.15); color: #60A5FA; }
.event-log .ev .tag.warn { background: rgba(251,191,36,.15); color: #FBBF24; }

/* ============================================================================
   ОНЧЕЙН-МЕТРИКИ
   ========================================================================== */
.flow { display: grid; gap: 10px; align-items: stretch; }
.flow-arrow { display: none; color: var(--muted-2); font-size: 20px; align-self: center; }
.flow-step { padding: 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); text-align: center; }
.flow-step.is-you { border-color: var(--btc); background: var(--btc-soft); }
.flow-step .fs-ic { font-size: 22px; margin-bottom: 7px; }
.flow-step .fs-name { font-weight: 700; font-size: 14.5px; }
.flow-step .fs-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.addr-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.addr-row .addr { flex: 1; min-width: 220px; }

.screening .scr-head { display: flex; gap: 12px; align-items: flex-start; }
.screening .scr-ic { font-size: 22px; }
.screening .scr-head b { display: block; margin-bottom: 5px; font-size: 15px; }

.octx { padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.octx:last-child { border-bottom: none; }
.octx .o-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.octx .o-amt { font-weight: 800; font-size: 15.5px; }
.octx .o-date { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.octx .o-hash { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.octx .o-hash code { flex: 1; min-width: 200px; font-size: 11.5px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 10px; word-break: break-all; }

/* ---------- Модалка ---------- */
.modal .close { position: absolute; top: 12px; right: 14px; font-size: 25px; color: var(--muted); line-height: 1; padding: 4px; background: none; border: none; cursor: pointer; }
.modal { position: relative; }
.modal .m-icon { font-size: 38px; text-align: center; margin-bottom: 10px; }
.modal h3 { text-align: center; margin-bottom: 8px; }
.modal .m-text { text-align: center; color: var(--ink-2); font-size: 14.5px; margin-bottom: 16px; }

/* ============================================================================
   Планшет и десктоп
   ========================================================================== */
@media (min-width: 760px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid.three { grid-template-columns: repeat(3, 1fr); }
  .noc-grid { grid-template-columns: repeat(5, 1fr); }
  .rack-grid { grid-template-columns: repeat(6, 1fr); }
  .farm-scene { height: 380px; }
  .dc-cols { grid-template-columns: 1.45fr 1fr; }
  .flow { grid-template-columns: 1fr auto 1fr auto 1fr; }
  .flow-arrow { display: block; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .c-grid { grid-template-columns: repeat(4, 1fr); }
  .nc-grid { grid-template-columns: repeat(4, 1fr); }
  .pay-grid { grid-template-columns: auto 1fr; }
  .main { padding: 26px 28px 60px; }
  .topbar h1 { font-size: 26px; }
}

@media (min-width: 1000px) {
  .app { grid-template-columns: 244px 1fr; }
  .sidebar {
    border-bottom: none; border-right: 1px solid var(--line);
    height: 100vh; position: sticky; top: 0; padding: 20px 14px;
  }
  .side-brand { padding: 4px 8px 16px; }
  .side-nav { flex-direction: column; overflow: visible; gap: 3px; }
  .side-link { font-size: 14.5px; padding: 10px 13px; }
  .side-foot {
    display: block; margin-top: auto; padding: 14px 10px 2px;
    border-top: 1px solid var(--line); font-size: 12px; color: var(--muted-2);
  }
  .side-foot > a { color: var(--accent); font-weight: 600; display: inline-block; margin-bottom: 10px; }
  .side-demo a { color: var(--accent); font-weight: 600; }
  .main { padding: 28px 36px 70px; }
}
