:root {
  --bg: #0b0b14;
  --bg-alt: #12121e;
  --surface: #171727;
  --border: #26263a;
  --text: #e8e8f0;
  --text-muted: #9797ad;
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --accent-text: #ffffff;
  --radius: 14px;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.narrow {
  max-width: 720px;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 16px;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }

p {
  color: var(--text-muted);
  margin: 0 0 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 11, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
}

.nav-admin-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  opacity: 0.7;
}

.nav-admin-link:hover {
  opacity: 1;
  color: var(--text);
}

.btn-nav {
  background: var(--accent);
  color: var(--accent-text) !important;
  padding: 8px 18px;
  border-radius: 999px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* Hero */
.hero {
  padding: 100px 0 80px;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.15), transparent 40%);
}

.hero-inner {
  text-align: center;
  max-width: 760px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-text {
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
  border: 1px solid transparent;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}

/* Sections */
.section {
  padding: 72px 0;
}

.page-header {
  padding: 64px 0 24px;
  border-bottom: 1px solid var(--border);
}

.cta-section {
  text-align: center;
  border-top: 1px solid var(--border);
}

.cta-inner {
  max-width: 560px;
}

/* Grid & cards */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card-icon {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.values {
  margin-top: 40px;
}

.project-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* Forms */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-form label {
  font-weight: 600;
  margin-top: 12px;
}

.contact-form input,
.contact-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form button {
  margin-top: 20px;
  align-self: flex-start;
  cursor: pointer;
}

.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-weight: 500;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Admin */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.message-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: auto;
}

/* Markdown-rendered descriptions (products, projects, offers, contracts) */
.markdown-content {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.markdown-content > *:first-child {
  margin-top: 0;
}

.markdown-content > *:last-child {
  margin-bottom: 0;
}

.markdown-content p {
  margin: 0 0 10px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  color: var(--text);
  font-size: 1rem;
  margin: 14px 0 6px;
}

.markdown-content strong {
  color: var(--text);
  font-weight: 700;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.markdown-content li {
  margin-bottom: 4px;
}

.markdown-content a {
  color: var(--accent);
  text-decoration: underline;
}

/* Products & Order */
.product-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 16px;
  background: var(--bg-alt);
}

.product-price {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
  margin-top: 8px;
}

.product-grid {
  margin-bottom: 48px;
}

.product-select {
  cursor: pointer;
  display: block;
  position: relative;
  border-color: var(--border);
  transition: border-color 0.15s, background 0.15s;
}

.product-select input[type="checkbox"] {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.product-select:has(input:checked) {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
}

.order-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-details label {
  font-weight: 600;
  margin-top: 12px;
}

.order-details input,
.order-details textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.order-details button {
  margin-top: 20px;
  align-self: flex-start;
  cursor: pointer;
}

.order-items-list {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--text-muted);
}

.status-form {
  margin-top: 8px;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.record-actions .status-form {
  margin-top: 0;
}

.employee-form-card {
  max-width: 480px;
  margin-bottom: 32px;
}

.employee-list {
  gap: 12px;
}

.employee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.employee-row form {
  margin: 0;
}

.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.role-owner {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent);
}

.role-employee {
  background: rgba(150, 150, 170, 0.15);
  color: var(--text-muted);
}

.status-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
}

/* Admin */
.admin-subnav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-subnav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.admin-subnav a:hover {
  color: var(--text);
}

.admin-logout {
  margin-left: auto;
  color: #f87171 !important;
}

.admin-link {
  display: block;
  transition: border-color 0.15s;
}

.admin-link:hover {
  border-color: var(--accent);
}

.product-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.product-admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.product-admin-actions form {
  margin: 0;
}

.btn-danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.product-image-preview {
  margin-top: 12px;
  max-width: 240px;
}

/* Image crop modal */
.crop-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.crop-modal.open {
  display: flex;
}

.crop-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 560px;
}

.crop-modal-image-wrap {
  max-height: 60vh;
  overflow: hidden;
}

.crop-modal-image {
  display: block;
  max-width: 100%;
}

.crop-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.image-preview {
  display: none;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 12px;
  background: var(--bg-alt);
}

/* Gallery */
.gallery-heading {
  margin-top: 40px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-item form {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}

.gallery-item button {
  background: rgba(11, 11, 20, 0.75);
  color: #f87171;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.gallery-add-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.project-image-wrap {
  position: relative;
}

.gallery-trigger {
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 10px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.1rem;
}

.lightbox-close {
  top: 24px;
  right: 24px;
}

.lightbox-prev {
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
}

/* Login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.15), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.12), transparent 40%),
    var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 380px;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-title {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form label {
  font-weight: 600;
  margin-top: 12px;
}

.login-form input {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form button {
  margin-top: 20px;
  cursor: pointer;
}

.login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-back:hover {
  color: var(--text);
}

/* Legal pages */
.legal-text h2 {
  margin-top: 32px;
}

.legal-note {
  margin-top: 32px;
  padding: 14px 18px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 760px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }

  .site-nav.open {
    display: flex;
  }
}
