/* PackMyFace cabinet — «Студия» design system (dark ink + lime accent).
   Tokens taken 1:1 from the design handoff. */
:root {
  --bg: #0C0D12;
  --surface: #15171E;
  --surface-2: #0F1016;
  --cell-a: #1B1E27;
  --cell-b: #232733;

  --lime: #C8F04B;
  --lime-hover: #D8FA66;
  --on-lime: #10130A;
  --lime-selected: #1D2410;
  --lime-bg: rgba(200, 240, 75, 0.1);
  --lime-ring: rgba(200, 240, 75, 0.14);

  --text: #EEF0F4;
  --text-2: rgba(238, 240, 244, 0.55);
  --text-3: rgba(238, 240, 244, 0.45);
  --text-disabled: rgba(238, 240, 244, 0.35);

  --border: rgba(255, 255, 255, 0.07);
  --border-input: rgba(255, 255, 255, 0.12);
  --border-outline: rgba(255, 255, 255, 0.2);

  --success: #8FE38F;
  --success-bg: rgba(60, 180, 110, 0.12);
  --warn: #F0CE8A;
  --warn-bg: rgba(255, 193, 70, 0.08);
  --warn-border: rgba(255, 193, 70, 0.3);
  --err-border: #FF6B6B;
  --err-text: #FF8A8A;
  --err-bg: rgba(255, 107, 107, 0.09);
  --btn-disabled: #23262F;

  --font-head: "Unbounded", system-ui, sans-serif;
  --font-body: "Onest", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; color: var(--text); margin: 0; }

/* ---- Auth screens (3a / 3b / 3c) — centered, no shell ---- */
.auth-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 960px; margin: 0 auto; padding: 26px 24px;
}
.logo { display: inline-flex; align-items: center; gap: 9px; font: 700 17px var(--font-head); color: var(--text); letter-spacing: 0.01em; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; display: block; border-radius: 8px; }

.lang { display: flex; gap: 6px; }
.lang a {
  padding: 5px 11px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer; font: 700 10.5px var(--font-body);
  background: transparent; color: var(--text-2); text-decoration: none;
}
.lang a:hover { text-decoration: none; color: var(--text); }
.lang a.active { background: var(--lime); color: var(--on-lime); border-color: var(--lime); }

.auth-wrap { max-width: 520px; margin: 24px auto 0; padding: 0 24px 64px; text-align: center; }
.auth-wrap.narrow { max-width: 440px; }

.decor { display: flex; gap: 14px; justify-content: center; margin-bottom: 30px; }
.decor .ph {
  width: 84px; height: 84px; border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.decor .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.decor .ph.mid {
  border: 1.5px solid var(--lime);
  box-shadow: 0 0 34px rgba(200, 240, 75, 0.25);
}
.decor .ph.l { transform: rotate(-5deg); }
.decor .ph.r { transform: rotate(5deg); }

.auth-title { font-size: 34px; line-height: 1.25; margin-bottom: 16px; }
.auth-title .grad { color: var(--lime); }
.auth-sub { font: 400 15.5px/1.6 var(--font-body); color: var(--text-2); margin: 0 0 30px; }

.form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field { display: flex; flex-direction: column; }
.field > label { font: 500 12.5px var(--font-body); color: var(--text-2); margin: 0 2px 7px; }
input, .input {
  width: 100%; padding: 15px 17px; border-radius: 12px;
  border: 1px solid var(--border-input); background: var(--surface);
  font: 400 14px var(--font-body); color: var(--text); outline: none;
  transition: border-color .15s;
}
input::placeholder { color: var(--text-3); }
input:focus { border-color: var(--lime); }
input.err { border: 1.5px solid var(--err-border); }
.field-err { font: 500 12px var(--font-body); color: var(--err-text); margin: 7px 2px 0; }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.link-muted { font: 500 12.5px var(--font-body); color: var(--text-2); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 20px; border-radius: 12px; border: none; cursor: pointer;
  font: 700 14.5px var(--font-body); text-decoration: none; transition: background .15s, transform .1s, box-shadow .2s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--lime); color: var(--on-lime); box-shadow: 0 14px 36px rgba(200, 240, 75, 0.2); }
.btn-primary:hover { background: var(--lime-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled, .btn[disabled] { background: var(--btn-disabled); color: var(--text-disabled); box-shadow: none; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-outline); }
.btn-outline:hover { border-color: var(--lime); color: var(--lime); }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 14px; font-size: 12.5px; }

.trust { font: 400 12px var(--font-body); color: var(--text-3); margin-top: 16px; }
.below-form { font: 400 13px var(--font-body); color: var(--text-2); margin-top: 14px; }
.below-form a { font-weight: 600; }

/* ---- Banners / alerts ---- */
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn);
  border-radius: 12px; padding: 13px 16px; font: 500 13px var(--font-body); margin-bottom: 20px; text-align: left;
}
.alert {
  background: var(--err-bg); border: 1px solid rgba(255, 107, 107, 0.35); color: var(--err-text);
  border-radius: 12px; padding: 12px 15px; font: 500 13px var(--font-body); margin-bottom: 16px; text-align: left;
}
.btn-link { background: none; border: none; color: var(--lime); cursor: pointer; font: 600 13px var(--font-body); padding: 0; text-decoration: underline; }

/* ---- Result card (3c) ---- */
.result-card {
  max-width: 460px; margin: 40px auto 0; padding: 36px 30px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; text-align: center;
}
.result-ico {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}
.result-ico.ok { color: var(--lime); border: 1.5px solid var(--lime); background: rgba(200, 240, 75, 0.12); }
.result-ico.bad { color: var(--err-border); border: 1.5px solid var(--err-border); background: var(--err-bg); }

/* ---- App shell (sidebar + content) ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 24px 18px; display: flex; flex-direction: column;
}
.sidebar .logo { margin: 0 6px 26px; font-size: 15px; }
.sidebar .logo-mark { width: 26px; height: 26px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; font: 500 13.5px var(--font-body);
  color: rgba(238, 240, 244, 0.6); text-decoration: none;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.nav a.active { background: var(--lime-bg); color: var(--lime); font-weight: 600; }
.nav a .ni { width: 18px; text-align: center; font-size: 15px; }
.side-user {
  margin-top: auto; padding-top: 16px; display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 10px; background: var(--lime); color: var(--on-lime);
  display: flex; align-items: center; justify-content: center; font: 700 14px var(--font-body); flex-shrink: 0;
}
.side-user .nm { font: 500 12.5px var(--font-body); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 20px 36px; border-bottom: 1px solid var(--border);
}
.content { padding: 32px 36px 60px; max-width: 940px; width: 100%; }

/* Mobile tab bar */
.tabbar { display: none; }
.mobile-head { display: none; }

@media (max-width: 820px) {
  .sidebar { display: none; }
  .topbar { display: none; }
  .content { padding: 20px 16px 90px; }
  .mobile-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border);
  }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface-2); border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 0 12px; font: 500 10.5px var(--font-body); color: var(--text-2); text-decoration: none;
  }
  .tabbar a .ni { font-size: 18px; }
  .tabbar a.active { color: var(--lime); }
}

/* ---- Dashboard (3d) ---- */
.hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px 28px; margin-bottom: 22px;
}
.hero-card h1 { font-size: 26px; margin-bottom: 10px; }
.hero-card p { font: 400 14px/1.55 var(--font-body); color: var(--text-2); margin: 0 0 22px; max-width: 460px; }
.section-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sec-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px;
  transition: border-color .15s; text-decoration: none; display: block;
}
.sec-card:hover { border-color: rgba(200, 240, 75, 0.4); text-decoration: none; }
.sec-card h3 { font: 600 14.5px var(--font-body); font-family: var(--font-body); color: var(--text); margin-bottom: 8px; }
.sec-card p { font: 400 12.5px/1.5 var(--font-body); color: var(--text-3); margin: 0; }
.mini-previews { display: flex; gap: 6px; margin-top: 12px; }
.mini-previews img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }

@media (max-width: 640px) { .section-grid { grid-template-columns: 1fr; } }

/* ---- Create pack (3e) ---- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; margin-bottom: 8px; }
.page-head p { font: 400 13.5px/1.55 var(--font-body); color: var(--text-2); margin: 0; }
.kicker { font: 700 11px var(--font-body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--lime); margin: 0 0 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin-bottom: 18px; }

.slots-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.slots { display: flex; gap: 12px; flex-wrap: wrap; }
.slot {
  width: 82px; height: 82px; border-radius: 12px; position: relative; cursor: pointer;
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font: 500 11px var(--font-body); text-align: center;
  background: rgba(255, 255, 255, 0.02);
}
.slot.faint { border-color: rgba(255, 255, 255, 0.12); }
.slot.filled { border: 1.5px solid var(--lime); overflow: visible; cursor: default; }
.slot.filled img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; display: block; }
.slot .badge {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--lime); color: var(--on-lime); font: 700 11px var(--font-body);
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.slot .rm {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: #FF6B6B; color: #fff; font: 700 12px var(--font-body); border: 2px solid var(--bg);
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.slot.filled:hover .rm { display: flex; }
.slot.filled:hover .badge { display: none; }
.slots-side { display: flex; flex-direction: column; gap: 8px; }
.count-pill {
  align-self: flex-start; padding: 6px 12px; border-radius: 999px;
  background: var(--lime-bg); color: var(--lime); font: 600 12.5px var(--font-body);
}
.slots-hint { font: 400 12.5px/1.4 var(--font-body); color: var(--text-2); max-width: 260px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-top: 4px; }
.tcard { cursor: pointer; }
.tcard input { position: absolute; opacity: 0; pointer-events: none; }
.tcard-in {
  display: block; height: 100%; padding: 14px;
  background: rgba(0, 0, 0, 0.22); border: 1.5px solid var(--border); border-radius: 14px;
  transition: border-color .15s, background .15s, transform .1s;
}
.tcard-in:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.tcard input:checked + .tcard-in { background: var(--lime-selected); border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-ring); }
.mini3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 66px; height: 66px; margin-bottom: 10px; }
.mini3 span { border-radius: 3px; background: repeating-linear-gradient(45deg, var(--cell-a) 0 5px, var(--cell-b) 5px 10px); }
.mini3 span.on { background: var(--lime); }
.tname { display: block; font: 600 13px var(--font-body); color: var(--text); }
.tdesc { display: block; font: 400 10.5px/1.35 var(--font-body); color: var(--text-3); margin-top: 3px; }

.create-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-hint { font: 400 12.5px var(--font-body); color: var(--text-3); }
.bundle-total { font: 700 15px var(--font-body); color: var(--lime); margin-top: 4px; }
.saved-note { font: 500 12.5px var(--font-body); color: var(--success); margin-top: 8px; }

@media (max-width: 640px) {
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .create-footer .btn { width: 100%; }
}

/* ---- Pack: preview (3f) ---- */
.pack-2col { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }
.preview-box {
  width: 340px; height: 340px; border-radius: 22px; overflow: hidden;
  border: 1.5px solid var(--lime); box-shadow: 0 0 60px rgba(200, 240, 75, 0.18);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
}
.preview-box img { width: 100%; height: 100%; object-fit: cover; }
.preview-box.plain { border: 1px solid var(--border); box-shadow: none; }
.preview-box .loading { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-2); font: 400 13px var(--font-body); padding: 20px; text-align: center; }
.pack-info h1 { font-size: 26px; margin-bottom: 10px; }
.pack-info .sub { font: 400 14px/1.55 var(--font-body); color: var(--text-2); margin: 0 0 18px; }
.pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
  background: var(--lime-bg); color: var(--lime); font: 600 12.5px var(--font-body);
}
.pack-btns { display: flex; flex-direction: column; gap: 12px; max-width: 320px; }
.err-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px; }

/* ---- Pack: paid full pack (3h) ---- */
.paid-head h1 { font-size: 26px; margin-bottom: 6px; }
.paid-head .sub { font: 400 14px var(--font-body); color: var(--text-2); margin: 0 0 22px; }
.full-grid { display: grid; grid-template-columns: repeat(3, 150px); gap: 14px; margin-bottom: 24px; }
.full-cell { width: 150px; }
.full-cell .img {
  width: 150px; height: 150px; border-radius: 14px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.full-cell .img img { width: 100%; height: 100%; object-fit: cover; }
.full-cell.pending .img { border: 1.5px dashed rgba(255, 255, 255, 0.18); }
.full-cell .lbl { font: 500 11px var(--font-body); color: var(--text-3); margin-top: 7px; text-align: center; text-transform: capitalize; }
.spinner-sm { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--lime); animation: spin .9s linear infinite; }
.paid-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Awaiting payment (3g) ---- */
.center-screen {
  min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center;
}
.center-screen h1 { font-size: 22px; }
.center-screen p { font: 400 13.5px var(--font-body); color: var(--text-2); margin: 0; max-width: 340px; }

@media (max-width: 720px) {
  .pack-2col { grid-template-columns: 1fr; }
  .preview-box, .preview-box img { width: 100%; height: auto; aspect-ratio: 1; }
  .full-grid { grid-template-columns: repeat(2, 1fr); }
  .full-cell, .full-cell .img { width: 100%; }
  .full-cell .img { height: auto; aspect-ratio: 1; }
  .pack-btns { max-width: none; }
}

/* ---- Section pages (3i/3j/3k/3l) ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.list-head h1 { font-size: 24px; }

.row-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px; text-decoration: none;
}
.row-card:hover { border-color: var(--border-strong); text-decoration: none; }
.row-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; border: 1px solid var(--border); }
.row-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 22px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font: 600 14.5px var(--font-body); color: var(--text); }
.row-meta { font: 400 12.5px var(--font-body); color: var(--text-3); margin-top: 3px; }
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font: 600 11.5px var(--font-body); white-space: nowrap; }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: rgba(255, 193, 70, 0.1); color: var(--warn); }
.badge-mut { background: rgba(255, 255, 255, 0.05); color: var(--text-2); }

.empty-state { text-align: center; padding: 50px 20px; }
.empty-box {
  width: 84px; height: 84px; border-radius: 16px; margin: 0 auto 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 30px;
}
.empty-state h3 { font: 600 16px var(--font-body); color: var(--text); margin-bottom: 6px; }
.empty-state p { font: 400 13px var(--font-body); color: var(--text-2); margin: 0 0 20px; }

/* Profile */
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.field-row:last-child { border-bottom: none; }
.field-row .lab { font: 500 13px var(--font-body); color: var(--text-2); }
.field-row .val { font: 500 13.5px var(--font-body); color: var(--text); }
.panel-title { font: 700 15px var(--font-head); margin-bottom: 14px; }
.segment { display: inline-flex; background: rgba(0,0,0,.25); border: 1px solid var(--border-input); border-radius: 10px; padding: 3px; gap: 3px; }
.segment button { padding: 7px 16px; border-radius: 8px; border: none; background: transparent; color: var(--text-2); font: 600 12.5px var(--font-body); cursor: pointer; }
.segment button.active { background: var(--lime); color: var(--on-lime); }
.danger-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.link-danger { background: none; border: none; color: var(--err-text); font: 500 13px var(--font-body); cursor: pointer; }

/* Invite */
.ref-field { display: flex; gap: 10px; margin: 16px 0 22px; }
.ref-input { flex: 1; font: 500 13px var(--font-mono); color: var(--lime); background: rgba(0,0,0,.28); border: 1px solid var(--border-input); border-radius: 12px; padding: 14px 16px; overflow: hidden; text-overflow: ellipsis; }
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.counter .n { font: 700 26px var(--font-head); color: var(--text); }
.counter .c { font: 400 12.5px var(--font-body); color: var(--text-3); margin-top: 4px; }
.dashed-note { border: 1.5px dashed rgba(255,255,255,.14); border-radius: 14px; padding: 18px; text-align: center; font: 400 12.5px var(--font-body); color: var(--text-2); }

@media (max-width: 640px) {
  .ref-field { flex-direction: column; }
  .counters { grid-template-columns: 1fr; }
}

/* ---- Spinner ---- */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--lime);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .auth-title { font-size: 26px; }
  .decor .ph { width: 68px; height: 68px; }
}
