:root {
  --bg: #0d0f13;
  --panel: #151820;
  --panel-soft: #1b1f29;
  --panel-raised: #20242e;
  --line: #2b303d;
  --line-gold: rgba(199, 164, 93, 0.42);
  --gold: #c7a45d;
  --gold-light: #e0c685;
  --text: #f5f3ee;
  --muted: #a9afbd;
  --muted-dark: #747b8b;
  --success: #76c99d;
  --danger: #e18383;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(199, 164, 93, 0.09), transparent 30%),
    radial-gradient(circle at 90% 100%, rgba(91, 101, 128, 0.1), transparent 34%),
    var(--bg);
  font-family: Inter, Manrope, "Segoe UI", Arial, sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
code { color: var(--gold-light); }

.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-lockup h1 { margin: 4px 0 0; font-size: 22px; line-height: 1.1; }
.brand-lockup.compact h1 { font-size: 20px; }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line-gold);
  border-radius: 15px;
  color: var(--gold-light);
  background: linear-gradient(145deg, rgba(199, 164, 93, 0.18), rgba(199, 164, 93, 0.04));
  font-size: 20px;
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.brand-kicker, .eyebrow {
  margin: 0;
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .18em;
  text-transform: uppercase;
}

/* Панель управления */
.admin-body { min-height: 100vh; }
.admin-container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.admin-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(43,48,61,.8);
  background: rgba(13,15,19,.82);
  backdrop-filter: blur(18px);
}
.header-inner { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 20px; }
.admin-main { padding: 34px 0 64px; }
.admin-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.admin-hero h2 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
.metric-card {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21,24,32,.78);
}
.metric-card strong { color: var(--gold-light); font-size: 32px; line-height: 1; }
.metric-card span { color: var(--muted); font-size: 13px; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(21,24,32,.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading { padding: 24px 26px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .section-heading h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.025em; }
.step-badge, .status-badge {
  padding: 7px 10px;
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(199,164,93,.07);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.project-form { position: relative; padding: 26px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.field-label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.text-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: #11141a;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.text-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(199,164,93,.11); }
.text-input::placeholder { color: #656c7a; }
.upload-list { display: grid; gap: 10px; }
.upload-field {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px dashed #39404f;
  border-radius: 15px;
  background: rgba(17,20,26,.68);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.upload-field:hover, .upload-field.has-file { border-color: var(--line-gold); background: rgba(199,164,93,.045); transform: translateY(-1px); }
.upload-field input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-number { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: var(--gold-light); background: rgba(199,164,93,.1); font-size: 12px; font-weight: 750; }
.upload-copy { min-width: 0; }
.upload-copy strong, .upload-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-copy strong { font-size: 14px; }
.upload-copy small { margin-top: 6px; color: var(--muted-dark); font-size: 12px; }
.upload-field.has-file .upload-copy small { color: var(--success); }
.upload-action { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; }
.form-footer p { max-width: 520px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.primary-button, .secondary-button, .ghost-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.primary-button { padding: 0 18px; border: 1px solid var(--gold); color: #18140c; background: linear-gradient(135deg, var(--gold-light), var(--gold)); font-weight: 750; box-shadow: 0 10px 26px rgba(199,164,93,.16); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.secondary-button, .ghost-button { padding: 0 13px; border: 1px solid var(--line); color: var(--muted); background: var(--panel-soft); font-size: 12px; }
.secondary-button:hover, .ghost-button:hover { border-color: var(--line-gold); color: var(--text); }
.ghost-button { background: transparent; }
.processing-state {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px;
  background: rgba(15,18,24,.94);
  text-align: left;
  backdrop-filter: blur(12px);
}
.processing-state[hidden] { display: none; }
.processing-state strong, .processing-state small { display: block; }
.processing-state small { margin-top: 5px; color: var(--muted); }
.spinner { width: 24px; height: 24px; flex: 0 0 auto; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 760ms linear infinite; }
.projects-section { margin-top: 38px; }
.section-heading { margin-bottom: 15px; }
.section-heading > span { color: var(--muted); font-size: 13px; }
.project-list { display: grid; gap: 12px; }
.project-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(21,24,32,.82); }
.project-card.is-new { border-color: var(--line-gold); box-shadow: 0 0 0 3px rgba(199,164,93,.07); }
.project-main { display: flex; align-items: center; gap: 14px; }
.project-icon { display: grid; flex: 0 0 auto; width: 48px; height: 48px; place-items: center; border: 1px solid var(--line-gold); border-radius: 14px; color: var(--gold-light); background: rgba(199,164,93,.08); font-size: 12px; font-weight: 800; }
.project-copy { min-width: 0; flex: 1; }
.project-topline { display: flex; align-items: center; gap: 10px; }
.project-topline h3 { min-width: 0; margin: 0; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.project-copy > p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; color: var(--muted-dark); font-size: 11px; }
.project-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 15px; }
.project-url { min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: #8990a0; background: #11141a; font-size: 12px; }
.empty-state { padding: 46px 20px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 12px 0 5px; color: var(--text); }
.empty-state p { margin: 0; }
.empty-icon { color: var(--gold); font-size: 30px; }
.notice { margin-bottom: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.notice.success { border-color: rgba(118,201,157,.32); color: #a8dfc0; background: rgba(118,201,157,.07); }
.notice.error { border-color: rgba(225,131,131,.35); color: #f1aaaa; background: rgba(225,131,131,.08); }
.notice.warning { border-color: var(--line-gold); color: var(--gold-light); background: rgba(199,164,93,.06); }

/* Авторизация */
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: rgba(21,24,32,.92); box-shadow: var(--shadow); }
.login-copy { margin: 24px 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-form { display: grid; }
.login-form .primary-button { width: 100%; margin-top: 14px; }
.demo-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* Клиентский 3D-просмотр */
.viewer-body { min-height: 100vh; }
.viewer-page { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; }
.viewer-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.viewer-topbar h1 { max-width: 700px; overflow: hidden; font-size: clamp(20px,2.3vw,28px); text-overflow: ellipsis; white-space: nowrap; }
.client-name { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.viewer-status { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(21,24,32,.78); font-size: 12px; font-weight: 650; }
.viewer-card { overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: rgba(21,24,32,.88); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: rgba(19,22,29,.92); }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.control-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--panel-soft); cursor: pointer; transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease; }
.control-button:hover { border-color: var(--line-gold); color: var(--text); transform: translateY(-1px); }
.control-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.control-button[aria-pressed="true"] { border-color: var(--gold); color: #17140d; background: linear-gradient(135deg,var(--gold-light),var(--gold)); box-shadow: 0 8px 24px rgba(199,164,93,.18); }
.control-button.icon-only { width: 42px; padding: 0; font-size: 18px; }
.viewer-stage { position: relative; height: clamp(560px,65vw,760px); min-height: 480px; background: radial-gradient(circle at 54% 42%,#313641 0%,#1b1f28 42%,#11141a 78%),var(--panel); }
.viewer-stage::after { position: absolute; right: 0; bottom: 0; left: 0; height: 34%; background: linear-gradient(to top,rgba(8,10,13,.44),transparent); content: ""; pointer-events: none; }
.viewer-canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; }
.loading { position: absolute; z-index: 6; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); background: rgba(15,18,24,.84); transition: opacity 220ms ease,visibility 220ms ease; pointer-events: none; }
.loading.is-hidden { visibility: hidden; opacity: 0; }
.viewer-message { position: absolute; z-index: 3; left: 50%; bottom: 92px; max-width: calc(100% - 28px); transform: translateX(-50%); padding: 9px 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; color: #c7cbd4; background: rgba(13,15,19,.72); font-size: 12px; text-align: center; white-space: nowrap; backdrop-filter: blur(12px); pointer-events: none; }
.animation-panel { position: absolute; z-index: 4; right: 16px; bottom: 15px; left: 16px; display: grid; grid-template-columns: auto minmax(120px,1fr) 42px; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid rgba(199,164,93,.26); border-radius: 16px; background: rgba(13,15,19,.84); box-shadow: 0 12px 34px rgba(0,0,0,.3); backdrop-filter: blur(16px); }
.animation-action { display: flex; align-items: center; gap: 10px; }
.animation-label { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.animation-button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line-gold); border-radius: 10px; color: var(--text); background: rgba(199,164,93,.08); cursor: pointer; }
.animation-button:hover { border-color: var(--gold); background: rgba(199,164,93,.15); }
.animation-slider { width: 100%; height: 22px; margin: 0; accent-color: var(--gold); cursor: ew-resize; }
.animation-value { color: var(--gold-light); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.viewer-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-top: 1px solid var(--line); color: var(--muted); background: rgba(19,22,29,.94); font-size: 12px; }
.footer-accent { color: var(--gold-light); }
.viewer-card:fullscreen { border: 0; border-radius: 0; background: var(--bg); }
.viewer-card:fullscreen .viewer-stage { height: calc(100vh - 72px); }
.viewer-card:fullscreen .viewer-footer { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .admin-container { width: min(100% - 20px,760px); }
  .admin-main { padding-top: 24px; }
  .admin-hero { align-items: stretch; flex-direction: column; }
  .metric-card { min-width: 0; }
  .two-columns { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .viewer-page { width: min(100% - 20px,760px); padding-top: 16px; }
  .viewer-status { display: none; }
  .viewer-card { border-radius: 20px; }
  .viewer-toolbar { align-items: stretch; flex-direction: column; }
  .viewer-toolbar .toolbar-group:first-child { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .toolbar-group.secondary .control-button:first-child { flex: 1 1 auto; }
  .control-button { min-width: 0; padding: 0 10px; font-size: 13px; }
  .viewer-stage { height: min(67vh,620px); min-height: 440px; }
  .viewer-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (max-width: 560px) {
  .header-inner { min-height: 68px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-lockup.compact h1 { font-size: 17px; }
  .admin-main { padding-bottom: 42px; }
  .admin-hero h2 { font-size: 32px; }
  .panel { border-right: 0; border-left: 0; border-radius: 0; }
  .admin-grid { margin-right: -10px; margin-left: -10px; }
  .panel-heading, .project-form { padding: 18px 14px; }
  .upload-field { grid-template-columns: 38px minmax(0,1fr); }
  .upload-number { width: 36px; height: 36px; }
  .upload-action { display: none; }
  .project-card { padding: 14px; }
  .project-link-row { grid-template-columns: 1fr 1fr; }
  .project-url { grid-column: 1 / -1; min-height: 38px; }
  .project-meta span:nth-child(3) { display: none; }
  .login-card { padding: 22px; }
  .viewer-page { width: 100%; padding: 0; }
  .viewer-topbar { padding: 15px 14px 0; }
  .viewer-card { border-right: 0; border-left: 0; border-radius: 0; }
  .viewer-toolbar { padding: 10px; }
  .viewer-stage { height: 66vh; min-height: 430px; }
  .viewer-message { bottom: 108px; white-space: normal; }
  .animation-panel { right: 10px; bottom: 10px; left: 10px; grid-template-columns: 1fr 38px; gap: 7px 10px; padding: 9px 10px; }
  .animation-action { justify-content: space-between; }
  .animation-slider { grid-column: 1 / -1; grid-row: 2; }
  .animation-label { font-size: 10px; }
  .animation-button { min-height: 30px; padding: 0 9px; font-size: 12px; }
}
