:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #181c22;
  --text: #f4f6f8;
  --muted: #99a2ad;
  --line: #2a3038;
  --accent: #f56a2b;
  --accent-2: #ff8b52;
  --danger: #ff6b6b;
  --radius: 14px;
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  min-height: 100dvh;
}

.auth-art {
  position: relative;
  overflow: hidden;
  padding: 48px;
  background:
    linear-gradient(125deg, rgba(0,0,0,.18), rgba(0,0,0,.72)),
    url("/cover.png") center/cover;
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 55%, var(--bg));
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  font-weight: 800;
  letter-spacing: -.04em;
  font-size: 22px;
}
.brand span { color: var(--accent); }

.auth-copy {
  position: absolute;
  z-index: 1;
  left: 48px;
  bottom: 64px;
  max-width: 680px;
}
.auth-copy h1 { margin: 0 0 18px; font-size: clamp(48px, 6vw, 88px); line-height: .93; letter-spacing: -.065em; }
.auth-copy p { margin: 0; color: #d5dae0; font-size: 18px; line-height: 1.55; max-width: 52ch; }

.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(410px, 100%); }
.auth-card h2 { margin: 0 0 10px; font-size: 34px; letter-spacing: -.04em; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { color: #ccd2d9; font-size: 14px; font-weight: 650; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,106,43,.18); }
.field-help { color: var(--muted); font-size: 12px; }
.primary, .secondary, .danger {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 750;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease;
}
.primary { background: var(--accent); color: #16100d; }
.primary:hover { background: var(--accent-2); }
.secondary { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.danger { background: transparent; border-color: #663236; color: #ff9c9c; }
.primary:active, .secondary:active, .danger:active { transform: translateY(1px); }
.wide { width: 100%; }
.form-error { min-height: 22px; margin-top: 12px; color: #ff9c9c; font-size: 14px; }

.app-shell { max-width: 1400px; margin: 0 auto; padding: 0 32px 64px; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.topbar .brand { margin-right: auto; }
.user { color: var(--muted); font-size: 14px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 40px;
  align-items: end;
  padding: 62px 0 40px;
}
.hero h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); line-height: .96; letter-spacing: -.06em; max-width: 13ch; }
.hero-side { color: var(--muted); line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 30px 0 18px; }
.section-head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.companies { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.company-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.company-logo { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 12px; background: #fff; color: #111; font-weight: 850; overflow: hidden; }
.company-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.company-copy h3 { margin: 0 0 4px; font-size: 16px; }
.company-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.swatches { display: flex; align-self: start; }
.swatches i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--panel); margin-left: -4px; }
.company-edit { grid-column: 1 / -1; width: 100%; padding-block: 9px; }
.project {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  transition: border .16s ease, transform .16s ease;
}
.project:hover { border-color: #4b5563; transform: translateY(-2px); }
.project-preview {
  height: 112px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(245,106,43,.28), transparent 42%),
    repeating-linear-gradient(90deg, #151a20 0 22px, #11151a 22px 44px);
  border: 1px solid #272d35;
}
.project h3 { margin: 18px 0 5px; font-size: 17px; }
.project-meta { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; margin-top: 14px; padding: 5px 8px; border-radius: 999px; background: rgba(245,106,43,.13); color: #ffad85; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.empty {
  grid-column: 1 / -1;
  padding: 50px 24px;
  border: 1px dashed #343b45;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.loading { opacity: .7; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100% - 32px));
}
.dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-inner { padding: 24px; }
.dialog-wide { width: min(760px, calc(100% - 32px)); }
.dialog h2 { margin: 0 0 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: 1 / -1; }
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.color-grid span { display: grid; gap: 5px; color: var(--muted); text-align: center; }
.color-grid input { height: 44px; padding: 3px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 4px 9px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #0f1216; cursor: pointer; }
.choice input { grid-row: 1 / 3; width: auto; }
.choice span { color: var(--muted); font-size: 12px; line-height: 1.4; }

@media (max-width: 840px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { min-height: 100dvh; padding: 24px; }
  .app-shell { padding-inline: 18px; }
  .topbar .user { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 42px; }
  .hero h1 { font-size: 52px; }
  .form-grid, .choice-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .color-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
