:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1a1d21;
  --muted: #5c6570;
  --line: #e3e6ea;
  --accent: #1f4e79;
  --accent-hover: #163a5c;
  --ok: #1b7f4e;
  --warn: #b45309;
  --danger: #b42318;
  --info: #175cd3;
  --radius: 8px;
  --sidebar: 240px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: #111827;
  color: #e5e7eb;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar a { color: #d1d5db; text-decoration: none; }
.sidebar a:hover { color: #fff; text-decoration: none; }
.sidebar-brand {
  padding: 20px 18px 16px;
  font-weight: 650;
  letter-spacing: .02em;
  border-bottom: 1px solid #1f2937;
  color: #fff;
}
.sidebar-brand small { display: block; font-weight: 400; color: #9ca3af; font-size: 12px; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
}
.sidebar nav a.active { background: #1f2937; color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.content { padding: 24px; max-width: 1200px; }

.page-title { margin: 0 0 16px; font-size: 22px; font-weight: 650; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f8fafc; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%;
  max-width: 480px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
textarea { min-height: 80px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 720px; }

.flash { padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.flash-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.flash-success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-muted { background: #f2f4f7; color: #344054; }
.badge-ok { background: #ecfdf3; color: #067647; }
.badge-warn { background: #fffaeb; color: #b54708; }
.badge-danger { background: #fef3f2; color: #b42318; }
.badge-info { background: #eff8ff; color: #175cd3; }
.badge-primary { background: #eef4ff; color: #3538cd; }
.badge-teal { background: #f0fdfa; color: #0f766e; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.muted { color: var(--muted); }

.public-hero { padding: 64px 24px 40px; max-width: 880px; margin: 0 auto; }
.public-hero h1 { font-size: 36px; margin: 0 0 12px; }
.public-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 24px 0; }
.step { background: #fff; border: 1px solid var(--line); padding: 14px; border-radius: 8px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.catalog-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.catalog-card img { width: 100%; height: 180px; object-fit: contain; background: #f8fafc; display: block; }
.catalog-card .body { padding: 12px; }

.print-editor { position: relative; max-width: 520px; user-select: none; }
.print-editor img { width: 100%; display: block; }
.print-box {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(31, 78, 121, .12);
  cursor: move;
}
.print-box .handle {
  position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px;
  background: var(--accent); cursor: nwse-resize;
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); margin-left: 8px; }
.dpi-ok { color: var(--ok); }
.dpi-low { color: var(--warn); }
.dpi-critical { color: var(--danger); }

@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
