/* Trade-Worth CRM — white / grey / orange theme */
:root {
  --orange:        #f6841f;
  --orange-dark:   #d96e10;
  --orange-soft:   #fff1e3;
  --white:         #ffffff;
  --grey-50:       #f7f8fa;
  --grey-100:      #eef0f3;
  --grey-200:      #e2e5ea;
  --grey-300:      #cbd0d8;
  --grey-500:      #7c848f;
  --grey-700:      #454b54;
  --grey-900:      #1f2329;
  --shadow:        0 1px 3px rgba(31,35,41,.08), 0 1px 2px rgba(31,35,41,.06);
  --radius:        10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--grey-50);
  color: var(--grey-900);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- top nav ---------- */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: 0 20px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav .brand {
  font-weight: 800;
  font-size: 17px;
  margin-right: 20px;
  letter-spacing: -.3px;
  white-space: nowrap;
}
.nav .brand .rig { color: var(--orange); }
.nav a {
  color: var(--grey-700);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
}
.nav a:hover { background: var(--grey-100); }
.nav a.active { color: var(--orange-dark); background: var(--orange-soft); }

/* Grouped dropdown navigation */
.nav .navgroup { position: relative; }
.nav .navtrigger {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--grey-700); background: none; border: none; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: inherit; font-family: inherit;
}
.nav .navtrigger:hover { background: var(--grey-100); }
.nav .navtrigger.active { color: var(--orange-dark); background: var(--orange-soft); }
.nav .navtrigger .caret { font-size: 10px; opacity: .6; }
.nav .navmenu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px;
  background: var(--white); border: 1px solid var(--grey-200); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10); padding: 6px; display: none; flex-direction: column; gap: 2px; z-index: 20;
}
.nav .navgroup:hover .navmenu, .nav .navgroup:focus-within .navmenu { display: flex; }
.nav .navmenu a { padding: 8px 12px; border-radius: 7px; white-space: nowrap; }

.nav .spacer { flex: 1; }
.nav .who { color: var(--grey-500); font-size: 13px; margin-right: 12px; }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.4px; }
.sub { color: var(--grey-500); margin: 0 0 20px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--grey-500); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.card .value { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -1px; }
.card .value.accent { color: var(--orange); }

/* ---------- panels ---------- */
.panel {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel h2 { font-size: 15px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--grey-200); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--grey-100); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--grey-500); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--grey-50); cursor: default; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.grey { background: var(--grey-100); color: var(--grey-700); }
.badge.orange { background: var(--orange-soft); color: var(--orange-dark); }
.badge.green { background: #e6f6ec; color: #1a7f43; }
.badge.blue { background: #e8f0fe; color: #1a5fb4; }
.badge.red { background: #fdeaea; color: #c0392b; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: 8px; padding: 9px 16px; border: 1px solid transparent;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost { background: var(--white); color: var(--grey-700); border-color: var(--grey-300); }
.btn-ghost:hover { background: var(--grey-100); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-danger { background: #fff; color: #c0392b; border-color: #f0c4c0; }
.btn-danger:hover { background: #fdeaea; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--grey-700); }
input, select, textarea {
  width: 100%; font: inherit; padding: 9px 11px;
  border: 1px solid var(--grey-300); border-radius: 8px; background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px 18px; }
.form-actions { padding: 0 18px 16px; }

/* ---------- two column ---------- */
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--grey-100); border-radius: var(--radius); padding: 12px; }
.col h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--grey-700); display: flex; justify-content: space-between; }
.col h3 .count { color: var(--grey-500); }
.pcard { background: var(--white); border: 1px solid var(--grey-200); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.pcard .t { font-weight: 700; }
.pcard .c { color: var(--grey-500); font-size: 13px; margin: 2px 0 8px; }
.pcard .row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.muted { color: var(--grey-500); }
.empty { padding: 26px 18px; text-align: center; color: var(--grey-500); }
.right { text-align: right; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }
.list-item { padding: 12px 18px; border-bottom: 1px solid var(--grey-100); cursor: pointer; }
.list-item:hover { background: var(--grey-50); }
.list-item.sel { background: var(--orange-soft); box-shadow: inset 3px 0 0 var(--orange); }
.list-item .n { font-weight: 700; }
.list-item .m { color: var(--grey-500); font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 600; }
.flash.err { background: #fdeaea; color: #c0392b; }
