/* ─── DESIGN TOKENS (синхронизировано с mockup-2.html) ─────── */
:root {
  --bg:              #000;
  --surface:         #0d0d0d;
  --surface-2:       #161616;
  --surface-3:       #1f1f1f;
  --border:          rgba(255,255,255,0.08);
  --border-hover:    rgba(255,255,255,0.18);
  --border-focus:    rgba(255,107,53,0.5);
  --molten:          #FF6B35;
  --molten-dim:      #cc5528;
  --molten-glow:     rgba(255,107,53,0.18);
  --text:            #ffffff;
  --text-2:          rgba(255,255,255,0.65);
  --text-3:          rgba(255,255,255,0.4);
  --text-4:          rgba(255,255,255,0.25);

  /* Status colors */
  --st-economy:      #5DA4DF;
  --st-review:       #E8C87A;
  --st-ready:        #6FCF97;
  --st-production:   #FF6B35;

  /* Spacing 8px grid */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px; --s8: 64px;

  /* Type */
  --t-xs:   13px;
  --t-sm:   14px;
  --t-base: 15px;
  --t-lg:   17px;
  --t-xl:   22px;
  --t-2xl:  32px;
  --t-3xl:  44px;

  /* Motion */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 160ms;
  --dur-base: 260ms;
  --dur-slow: 420ms;

  --radius:    10px;
  --radius-lg: 18px;
  --radius-sm: 6px;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--molten); color: #000; }

/* ─── HEADER ─── */
.app-header {
  position: sticky;
  top: 0; z-index: 50;
  height: 60px;
  display: flex; align-items: center;
  padding: 0 var(--s4);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.brand-mark {
  width: 26px; height: 26px;
  background: var(--molten);
  border-radius: 6px;
  position: relative;
}
.brand-mark::before, .brand-mark::after {
  content: '';
  position: absolute; left: 5px; right: 5px;
  height: 2px; background: #000;
  border-radius: 1px;
}
.brand-mark::before { top: 9px; }
.brand-mark::after  { top: 15px; }

.app-nav {
  display: flex; gap: var(--s3);
}
.app-nav a {
  font-size: var(--t-sm);
  color: var(--text-2);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--dur-base), border-color var(--dur-base);
}
.app-nav a:hover, .app-nav a.active {
  color: var(--text);
  border-bottom-color: var(--molten);
}

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: var(--t-xs);
  background: var(--surface);
}
.user-avatar {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--molten), var(--molten-dim));
  color: #000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { color: var(--text); font-weight: 500; }
.user-role { color: var(--text-3); font-size: 11px; letter-spacing: 0.04em; }
.btn-logout {
  margin-left: 8px;
  color: var(--text-3);
  font-size: 11px;
  padding: 0 4px;
  transition: color var(--dur-base);
}
.btn-logout:hover { color: var(--molten); }

/* ─── PAGE WRAP ─── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s5) var(--s4);
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
  margin-bottom: var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: var(--t-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.page-title small {
  display: block;
  font-size: var(--t-sm);
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-size: var(--t-sm);
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background var(--dur-base), border-color var(--dur-base), transform var(--dur-fast);
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-hover); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--molten);
  border-color: var(--molten);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover { background: #ff7d4d; border-color: #ff7d4d; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ff8585; }
.btn-danger:hover { background: rgba(255,80,80,0.08); border-color: rgba(255,80,80,0.4); }

/* ─── FORM CONTROLS ─── */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--t-sm);
  transition: border-color var(--dur-base), background var(--dur-base);
  outline: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--border-focus);
  background-color: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.08);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 36px;
}
.select::-ms-expand { display: none; }

/* ─── TOOLBAR (search + filters) ─── */
.toolbar {
  display: flex; gap: var(--s2);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 0; }
.search-wrap {
  position: relative;
  flex: 1; min-width: 240px;
}
.search-wrap .input { padding-left: 38px; }
.search-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-3);
}

/* ─── PROJECT CARDS ─── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s2);
}
.project-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s3);
  transition: border-color var(--dur-base), transform var(--dur-base), background var(--dur-base);
  cursor: pointer;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--st-color, var(--molten));
  opacity: 0.4;
  transition: opacity var(--dur-base);
}
.project-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.project-card:hover::before { opacity: 1; }
.project-card[data-status="economy"]    { --st-color: var(--st-economy); }
.project-card[data-status="review"]     { --st-color: var(--st-review); }
.project-card[data-status="ready"]      { --st-color: var(--st-ready); }
.project-card[data-status="production"] { --st-color: var(--st-production); }

.pc-row1 {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.pc-title {
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.pc-edit {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text-3);
  transition: background var(--dur-base), color var(--dur-base);
}
.pc-edit:hover { color: var(--molten); background: rgba(255,107,53,0.1); }

.pc-customer {
  font-size: var(--t-sm);
  color: var(--text-2);
  margin-bottom: var(--s2);
}
.pc-manager {
  font-size: var(--t-xs);
  color: var(--text-3);
  margin-bottom: var(--s2);
}
.pc-manager strong { color: var(--text-2); font-weight: 500; }

.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--st-color, var(--text-2));
  border: 1px solid var(--border);
}
.status-chip::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--st-color, var(--text-3));
}

.pc-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}
.pc-id {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ─── EMPTY STATE ─── */
.empty {
  text-align: center;
  padding: var(--s8) var(--s4);
  color: var(--text-3);
}
.empty h3 {
  font-size: var(--t-lg);
  color: var(--text-2);
  margin-bottom: var(--s2);
  font-weight: 500;
}

/* ─── MODAL ─── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: var(--s3);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s3);
}
.modal-title {
  font-size: var(--t-xl);
  font-weight: 700;
}
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text-3);
  transition: background var(--dur-base), color var(--dur-base);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: var(--s3); }
.modal-foot {
  display: flex; gap: var(--s2); justify-content: flex-end;
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
}

/* ─── LOGIN ─── */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s4);
  background:
    radial-gradient(ellipse 600px 400px at 30% 30%, rgba(255,107,53,0.08), transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 70%, rgba(93,164,223,0.06), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: var(--s4);
}
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-brand .brand-mark::before { top: 14px; left: 8px; right: 8px; height: 3px; }
.login-brand .brand-mark::after  { top: 23px; left: 8px; right: 8px; height: 3px; }
.login-brand-text {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.login-brand-text small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.05em;
  margin-top: 3px;
}
.login-title {
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--s4);
}
.login-form { display: flex; flex-direction: column; gap: var(--s3); }
.login-error {
  display: none;
  padding: 12px 14px;
  background: rgba(255,80,80,0.08);
  border: 1px solid rgba(255,80,80,0.3);
  border-radius: var(--radius);
  color: #ff8585;
  font-size: var(--t-sm);
}
.login-error.show { display: block; }
.login-hint {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.55;
}
.login-hint code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--molten);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .app-header { padding: 0 var(--s2); }
  .app-nav { gap: var(--s2); }
  .app-nav a { font-size: 13px; }
  .user-pill .user-meta { display: none; }
  .page { padding: var(--s3) var(--s2); }
  .page-title { font-size: var(--t-2xl); }
  .toolbar { flex-direction: column; }
  .toolbar .input, .toolbar .select { width: 100%; }
  .projects-grid { grid-template-columns: 1fr; }
}
