:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #3b82f6;
  --blue-d: #2563eb;
  --teal: #0d9488;
  --green: #22c55e;
  --orange: #f97316;
  --red: #ef4444;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --sidebar: 250px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, Poppins, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--blue-d); text-decoration: none; }
a:hover { text-decoration: underline; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.03em; margin: 0 10px 6px; }
.brand span { color: var(--blue); }
.brand-sub { color: var(--muted); font-size: 12px; margin: 0 10px 22px; }
.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  margin-bottom: 4px;
  text-decoration: none;
}
.nav a:hover, .nav a.active { background: #eff6ff; color: var(--blue-d); }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.user { color: var(--muted); font-size: 14px; }
.user b { color: var(--text); }
.content { padding: 28px; }
.page-title { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.lede { color: var(--muted); margin: 0 0 22px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px 20px;
}
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 36px; font-weight: 700; letter-spacing: -0.04em; margin: 6px 0 10px; }
.bar { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; }
tbody tr:hover { background: #f8fbff; }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.pill-pending, .pill-inquiry, .pill-waiting { background: #dbeafe; color: #1d4ed8; }
.pill-offer, .pill-offer_sent { background: #ccfbf1; color: #0f766e; }
.pill-won, .pill-approved, .pill-completed, .pill-active { background: #dcfce7; color: #166534; }
.pill-lost, .pill-rejected, .pill-delayed { background: #fee2e2; color: #b91c1c; }
.pill-production, .pill-install, .pill-design, .pill-rough_measure, .pill-detail_measure { background: #ffedd5; color: #c2410c; }
.tl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tl-green { background: #dcfce7; color: #166534; }
.tl-orange { background: #ffedd5; color: #c2410c; }
.tl-red { background: #fee2e2; color: #b91c1c; }
.tl-gray { background: #f1f5f9; color: #64748b; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tl-green .dot { background: var(--green); }
.tl-orange .dot { background: var(--orange); }
.tl-red .dot { background: var(--red); }
.tl-gray .dot { background: #94a3b8; }
.btn {
  display: inline-block;
  background: var(--blue);
  color: #fff !important;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  font-size: 14px;
}
.btn:hover { background: var(--blue-d); }
.btn-ghost { background: #fff; color: var(--text) !important; border: 1px solid var(--line); }
.btn-danger { background: #ef4444; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
form.grid, .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 90px; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash-ok { background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #b91c1c; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #eff6ff, #f4f7fb);
}
.login-card { width: 420px; max-width: 92vw; }
.muted { color: var(--muted); font-size: 13px; }
.pipeline { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.pipeline span {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
}
.pipeline span.on { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.filters a { margin-right: 8px; font-size: 13px; }
.warn { color: var(--red); }
.sop h2 { margin-top: 28px; }
.sop ol { line-height: 1.6; }
@media (max-width: 960px) {
  .app { display: block; }
  .sidebar { position: relative; height: auto; width: auto; }
  .kpis, form.grid, .grid { grid-template-columns: 1fr; }
}
