:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #1f2933;
  --muted: #64748b;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}

* { box-sizing: border-box; }

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

header.topbar {
  background: #111827;
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

header.topbar .brand { font-weight: 700; font-size: 1.05rem; }

header.topbar nav a {
  color: #cbd5e1;
  text-decoration: none;
  margin-right: 1rem;
  font-size: 0.92rem;
}

header.topbar nav a:hover, header.topbar nav a.active { color: white; }

header.topbar .topbar-user {
  margin-left: auto;
  color: #cbd5e1;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.link-button {
  background: none;
  border: none;
  color: #cbd5e1;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.88rem;
  padding: 0;
}
.link-button:hover { color: white; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; margin-top: 1.75rem; }
.subtitle { color: var(--muted); margin-top: 0; margin-bottom: 1rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; }
tr:hover td { background: #fafbfc; }

a { color: var(--accent); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.received { background: #e0e7ff; color: #3730a3; }
.badge.in_process { background: #fef3c7; color: #92400e; }
.badge.pending_qc { background: #fee2e2; color: #991b1b; }
.badge.released { background: #dcfce7; color: #166534; }
.badge.rejected { background: #f3f4f6; color: #374151; }
.badge.pass { background: #dcfce7; color: #166534; }
.badge.fail { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.low { background: #fee2e2; color: #991b1b; }
.badge.ok { background: #dcfce7; color: #166534; }

.empty { color: var(--muted); font-style: italic; }

form.stacked label { display: block; margin-bottom: 0.9rem; font-size: 0.9rem; }
form.stacked label span { display: block; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.82rem; }
form.stacked input, form.stacked select, form.stacked textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
}

button, .button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { opacity: 0.9; }
.button.secondary { background: #e5e7eb; color: var(--text); }

.actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  border-left: 2px solid var(--border);
  padding: 0.5rem 0 0.5rem 1rem;
  margin-bottom: 0.5rem;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.7rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline .meta { color: var(--muted); font-size: 0.82rem; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 0.3rem 1rem; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
