:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --brand: #111827;
  --accent: #22c55e;
  --accent-2: #2563eb;
  --warning: #f59e0b;
  --danger: #ef4444;
  --line: #e5e7eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

img { max-width: 100%; display: block; }

.container {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.topbar {
  background: #0f172a;
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.topbar .inner {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.nav-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero {
  background: radial-gradient(circle at top left, #dbeafe, transparent 34%), linear-gradient(135deg, #111827, #1e293b);
  color: #fff;
  border-radius: 0 0 36px 36px;
  padding: 46px 0 58px;
}

.hero h1, h1, h2, h3 { letter-spacing: -0.04em; }
.hero h1 { font-size: clamp(2rem, 7vw, 4.4rem); line-height: 0.95; margin: 0 0 14px; }
.hero p { max-width: 720px; color: #d1d5db; font-size: 1.1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 22px;
}

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

input, textarea, select {
  width: 100%;
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  background: #fff;
  outline: none;
}

textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }

.btn, button {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  padding: 14px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
}

.btn.primary, button.primary { background: var(--accent-2); color: #fff; }
.btn.dark { background: #111827; color: #fff; }
.btn.success, button.success { background: var(--accent); color: #052e16; }
.btn.warning { background: var(--warning); color: #451a03; }
.btn.ghost { background: #eef2ff; color: #1e3a8a; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.full { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 900;
  font-size: .86rem;
  background: #eef2ff;
  color: #1e40af;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #f3f4f6; color: #374151; }

.order-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.order-title { font-size: 1.2rem; font-weight: 950; margin: 0; }
.muted { color: var(--muted); }
.money { font-weight: 950; font-size: 1.25rem; }

.progress-wrap { margin: 16px 0; }
.progress-track { background: #e5e7eb; height: 16px; border-radius: 999px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, #22c55e, #2563eb); height: 100%; border-radius: 999px; }
.stage-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
.stage-dot { padding: 10px; border-radius: 14px; background: #f3f4f6; text-align: center; font-size: .78rem; font-weight: 850; color: #6b7280; }
.stage-dot.active { background: #dcfce7; color: #166534; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.photo-card { overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: #fff; }
.photo-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.photo-card small { display: block; padding: 8px 10px; color: var(--muted); }

.stage-section { margin-top: 18px; }
.stage-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.searchbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.notice { padding: 14px 16px; border-radius: 16px; background: #ecfdf5; color: #166534; font-weight: 800; margin-bottom: 16px; }
.error { padding: 14px 16px; border-radius: 16px; background: #fef2f2; color: #991b1b; font-weight: 800; margin-bottom: 16px; }

.kpi { padding: 18px; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.kpi strong { display: block; font-size: 1.8rem; }

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

.client-code {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 1000;
  letter-spacing: .03em;
  margin: 8px 0;
}

@media (max-width: 760px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .order-card { grid-template-columns: 1fr; }
  .searchbar { grid-template-columns: 1fr; }
  .stage-list { grid-template-columns: repeat(2, 1fr); }
  .topbar .inner { align-items: flex-start; flex-direction: column; }
  .container { width: min(100% - 20px, 1180px); }
  .card { padding: 16px; }
}

@media print {
  .topbar, .nav-actions, .btn, button, form { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
