/* Laser CNC Pro — тема оформления. Подключается ко всем страницам. */
:root {
  --paper: #ECEDE9;
  --panel: #F7F7F4;
  --ink: #14171A;
  --ink-2: #444A52;
  --ink-3: #747B84;
  --rule: #CDCFC9;
  --cut: #087A44;
  --cut-hover: #066637;
  --cut-tint: #DDF0E5;
  --grid: rgba(20, 23, 26, .055);
  --screen: #101215;
  --screen-line: #2A2F36;
  --font-body: 'Onest', 'Segoe UI', Arial, sans-serif;
  --font-display: 'Unbounded', 'Onest', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-body); }

body {
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:focus-visible { outline: 2px solid var(--cut); outline-offset: 2px; }

/* ---------- Шапка ---------- */
header {
  background: var(--paper);
  height: 60px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand span { font-family: inherit; }
.logo-icon {
  font-size: 0;
  width: 18px;
  height: 18px;
  background: var(--ink);
  clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%, 0 100%);
  position: relative;
}
.logo-icon::after {
  content: "";
  position: absolute;
  left: 5px; top: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--paper);
}
nav { display: flex; align-items: center; height: 100%; }
nav a {
  color: var(--ink-2);
  text-decoration: none;
  margin-left: 28px;
  font-size: .95rem;
  display: flex;
  align-items: center;
  height: 100%;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
nav a:hover { color: var(--ink); }
nav a.active { color: var(--ink); border-bottom-color: var(--cut); }

/* ---------- Главная ---------- */
.hero {
  padding: 88px max(24px, calc((100% - 1160px) / 2)) 80px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  column-gap: 64px;
  align-content: center;
  align-items: center;
}
.hero h1, .hero p, .hero .cta-button { grid-column: 1; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.025em;
  margin-bottom: 22px;
}
.hero p {
  color: var(--ink-2);
  font-size: 1.1rem;
  max-width: 46ch;
  margin-bottom: 34px;
}
.cta-button {
  justify-self: start;
  display: inline-block;
  background: var(--cut);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: 15px 28px;
  border-radius: 4px;
  font-size: 1rem;
  transition: background .15s;
}
.cta-button:hover { background: var(--cut-hover); }

.hero-part {
  grid-column: 2;
  grid-row: 1 / span 3;
  width: 100%;
  max-width: 520px;
  justify-self: end;
}
.hero-part svg { width: 100%; height: auto; display: block; overflow: visible; }
.plate { fill: rgba(20, 23, 26, .07); animation: fadein .8s 2.2s both; }
.cutline {
  fill: none;
  stroke: var(--cut);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  animation: trace 2.4s cubic-bezier(.55, 0, .3, 1) both;
}
.cutline.h1 { animation-delay: 1.1s; animation-duration: .7s; }
.cutline.h2 { animation-delay: 1.4s; animation-duration: .7s; }
.cutline.h3 { animation-delay: 1.7s; animation-duration: .7s; }
.cutline.sl { animation-delay: 1.9s; animation-duration: 1s; }
.dim { stroke: var(--ink-3); stroke-width: 1; fill: none; }
.dim-t { fill: var(--ink-2); font-size: 12px; font-weight: 500; }
@keyframes trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.features {
  max-width: 1160px;
  margin: 0 auto;
  padding: 72px 24px 32px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px;
}
.feature-card {
  background: none;
  border: 0;
  border-top: 2px solid var(--ink);
  border-radius: 0;
  padding: 20px 8px 0 0;
  text-align: left;
}
.feature-card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.feature-card p { color: var(--ink-2); font-size: .98rem; max-width: 40ch; }

footer {
  margin-top: auto;
  padding: 28px 24px;
  text-align: left;
  color: var(--ink-3);
  font-size: .85rem;
  border-top: 1px solid var(--rule);
}
footer p { max-width: 1160px; margin: 0 auto; }

/* ---------- Личный кабинет и Панель ---------- */
.container { max-width: 1100px; margin: 36px auto; padding: 0 24px; width: 100%; flex: 1; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}
.page-header h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-bottom: 32px;
}
.stat-card { padding: 18px 22px; text-align: left; border-right: 1px solid var(--rule); }
.stat-card:last-child { border-right: 0; }
.stat-card .label { font-size: .85rem; color: var(--ink-3); }
.stat-card .num { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--ink); margin-top: 2px; }
#active-count { color: #9A5B00 !important; }
#ready-count { color: var(--cut); }

.orders-list { display: flex; flex-direction: column; gap: 14px; }
.order-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 4px solid #C98A1B;
  border-radius: 4px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.order-card.status-cutting-card { border-left-color: #0B5FA5; }
.order-card.status-ready-card { border-left-color: var(--cut); }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.order-id { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-right: 10px; }
.order-date { font-size: .85rem; color: var(--ink-3); }

.status-badge { padding: 4px 12px; border-radius: 3px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.status-processing { background: #FBEBCB; color: #7A4800; }
.status-cutting { background: #D9E9F8; color: #0B4F8A; }
.status-ready { background: var(--cut-tint); color: var(--cut); }

.order-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 20px;
  font-size: .92rem;
  color: var(--ink);
}
.order-details b { display: block; font-size: .78rem; font-weight: 500; color: var(--ink-3); }

.empty-state {
  text-align: left;
  padding: 40px 28px;
  background: var(--panel);
  border: 1px dashed #A9ACA4;
  border-radius: 4px;
  color: var(--ink-2);
}
.empty-state a { color: var(--cut); font-weight: 600; text-decoration: none; display: inline-block; margin-top: 12px; }
.empty-state a:hover { text-decoration: underline; }

/* Таблица заказов оператора станка */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}
.admin-table th { background: #ecefe9; font-weight: 600; color: var(--ink); }
.status-select {
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #B9BCB5;
  border-radius: 4px;
  font-size: 0.85rem;
}
.btn-download {
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  display: inline-block;
}

/* ---------- Заказ и 3D ---------- */
body:has(.workspace) { height: 100vh; overflow: hidden; }
.workspace { display: flex; flex: 1; height: calc(100vh - 60px); position: relative; }

.order-sidebar {
  width: 380px;
  background: var(--panel);
  border-right: 1px solid var(--rule);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  z-index: 5;
}
.order-sidebar h2 {
  font-size: .95rem;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: .85rem; color: var(--ink-2); }
input[type="file"], select, input[type="number"], input[type="text"], input[type="email"], input[type="password"] {
  background: #fff;
  border: 1px solid #B9BCB5;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 4px;
  font-size: .92rem;
}
input[type="file"]::file-selector-button {
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 3px;
  padding: 5px 12px;
  margin-right: 10px;
  cursor: pointer;
}
input:focus, select:focus { outline: 2px solid var(--cut); outline-offset: 1px; border-color: var(--cut); }

.delivery-options { display: flex; gap: 10px; margin-top: 4px; }
.radio-label {
  flex: 1;
  background: #fff;
  border: 1px solid #B9BCB5;
  color: var(--ink);
  padding: 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.radio-label input { accent-color: var(--cut); }
.radio-label:hover { border-color: var(--cut); }
.radio-label:has(input:checked) { border-color: var(--cut); background: var(--cut-tint); font-weight: 600; }

.submit-btn {
  background: var(--cut);
  color: #fff;
  border: 0;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s;
}
.submit-btn:hover { background: var(--cut-hover); }
#status-msg { font-size: .85rem; color: var(--ink-3); text-align: left; }

#viewer-3d { flex: 1; width: 100%; height: 100%; background: var(--screen); position: relative; }
.camera-toggles {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  background: rgba(16, 18, 21, .88);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--screen-line);
  z-index: 10;
}
.cam-btn { background: transparent; color: #A9AFB8; border: 0; padding: 8px 14px; border-radius: 4px; cursor: pointer; font-size: .85rem; font-weight: 500; }
.cam-btn:hover { color: #fff; }
.cam-btn.active-view { background: #2A2F36; color: #00D26A; }
.viewport-controls-info {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(16, 18, 21, .88);
  border: 1px solid var(--screen-line);
  padding: 7px 12px;
  border-radius: 4px;
  font-size: .8rem;
  color: #A9AFB8;
  pointer-events: none;
}

/* ---------- Модальное окно авторизации ---------- */
.auth-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(16, 18, 21, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.auth-backdrop.active { display: flex; }
.auth-modal {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  width: 100%;
  max-width: 400px;
  padding: 28px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  position: relative;
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 1.3rem;
  cursor: pointer;
}
.auth-close:hover { color: var(--ink); }
.auth-tabs { display: flex; border-bottom: 2px solid var(--rule); margin-bottom: 20px; }
.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab-btn.active { color: var(--ink); border-bottom-color: var(--cut); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-error {
  background: #fde8e8;
  color: #b3261e;
  border: 1px solid #f8b4b4;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  display: none;
}

@media (max-width: 860px) {
  header { padding: 0 16px; }
  nav a { margin-left: 16px; font-size: .85rem; }
  .hero { grid-template-columns: 1fr; padding-top: 56px; padding-bottom: 56px; }
  .hero-part { grid-column: 1; margin-top: 40px; }
  body:has(.workspace) { height: auto; overflow: auto; }
  .workspace { flex-direction: column; height: auto; }
  .order-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--rule); }
  #viewer-3d { flex: none; height: 65vh; }
}