:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1c2433;
  --muted: #6b7689;
  --line: #e2e7f0;
  --brand: #2f5bd6;
  --brand-dark: #2347ad;
  --green: #1f9d57;
  --green-bg: #e3f6ec;
  --yellow: #c98a00;
  --yellow-bg: #fbf2da;
  --red: #d23b3b;
  --red-bg: #fbe4e4;
  --grey-bg: #eef1f6;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 6px 18px rgba(20, 30, 60, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--panel); padding: 12px 24px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 15px;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav button {
  background: none; border: none; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500;
}
.mainnav button:hover { background: var(--grey-bg); color: var(--ink); }
.mainnav button.active { background: var(--brand); color: #fff; }
.rolebox { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.rolebox label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rolebox select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-sub { color: var(--muted); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card .kpi { font-size: 28px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--grey-bg); }
.mono { font-family: "Consolas", "SF Mono", monospace; font-size: 12px; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-grey { background: var(--grey-bg); color: var(--muted); }
.b-blue { background: #e6edff; color: var(--brand-dark); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-yellow { background: var(--yellow-bg); color: var(--yellow); }
.b-red { background: var(--red-bg); color: var(--red); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.Green { background: var(--green); } .dot.Yellow { background: var(--yellow); } .dot.Red { background: var(--red); }

/* Buttons */
.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
.btn:hover { background: var(--grey-bg); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.field .hint { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,91,214,.12); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 18px; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark); padding: 0 6px; }

/* Stepper */
.stepper { display: flex; gap: 0; margin: 4px 0 22px; flex-wrap: wrap; }
.step { flex: 1; min-width: 120px; padding: 10px 12px; border-bottom: 3px solid var(--line); position: relative; }
.step .st-num { font-size: 11px; color: var(--muted); font-weight: 700; }
.step .st-name { font-size: 13px; font-weight: 600; }
.step.done { border-color: var(--green); }
.step.active { border-color: var(--brand); }
.step.done .st-num { color: var(--green); }
.step.active .st-num { color: var(--brand); }

/* Misc */
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.progress { height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; }
.heatbar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.heatbar .wk { width: 80px; font-size: 12px; color: var(--muted); }
.heatbar .bar { height: 16px; border-radius: 4px; background: var(--brand); }
.heatbar .val { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.audit-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-item .meta { color: var(--muted); font-size: 12px; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-row .tname { flex: 1; }
.task-row select { width: auto; }
.back { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; font-size: 13px; margin-bottom: 12px; font-weight: 600; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; opacity: 0; transition: all .3s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.callout { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.callout.info { background: #e6edff; color: var(--brand-dark); }
.callout.warn { background: var(--yellow-bg); color: var(--yellow); }
.sku-pick { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.sku-pick select { flex: 2; } .sku-pick input { flex: 1; }
.tier { font-weight: 700; }
.tier.A { color: var(--red); } .tier.B { color: var(--yellow); } .tier.C { color: var(--muted); }

/* Login */
.login-screen { position: fixed; inset: 0; background: linear-gradient(135deg, #eef2fb, #e3ecfa); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 420px; max-width: 92vw; box-shadow: var(--shadow); }
.login-users { display: flex; flex-direction: column; gap: 10px; }
.login-user { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.login-user:hover { border-color: var(--brand); background: #f7f9ff; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.lu-name { font-weight: 600; margin-bottom: 4px; }

/* Userbox */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.ub-info { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ub-name { font-weight: 600; font-size: 13px; }

/* Checkbox / radio fix (they were being stretched by the global input rule) */
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; box-shadow: none; flex: 0 0 auto; accent-color: var(--brand); }
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }
.check-row { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-bottom: 8px; cursor: pointer; }

/* Notification bell */
.bell { position: relative; background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 17px; display: grid; place-items: center; }
.bell:hover { background: var(--grey-bg); }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.bell .count.zero { display: none; }

/* Notification popup (simulated Teams / Outlook) */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,28,48,.45); display: flex; align-items: center; justify-content: center; z-index: 120; }
.notif-card { background: #fff; width: 460px; max-width: 94vw; border-radius: 14px; overflow: hidden; box-shadow: 0 18px 60px rgba(20,30,60,.35); }
.notif-tabs { display: flex; border-bottom: 1px solid var(--line); }
.notif-tabs button { flex: 1; padding: 10px; border: none; background: #fff; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.notif-tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }
.notif-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: #fff; }
.notif-head.teams { background: #4b53bc; }
.notif-head.outlook { background: #0f6cbd; }
.notif-head .ic { width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 700; }
.notif-head .ht { font-weight: 700; font-size: 14px; }
.notif-head .hs { font-size: 12px; opacity: .85; }
.notif-body { padding: 16px; }
.email-meta { font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.email-meta .ln { display: flex; gap: 6px; margin-bottom: 2px; }
.email-meta .k { color: var(--muted); width: 56px; }
.notif-msg { font-size: 14px; margin-bottom: 12px; }
.notif-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; }
.notif-item:hover { border-color: var(--brand); background: #f7f9ff; }
.notif-foot { background: var(--grey-bg); padding: 10px 16px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.notif-close { position: absolute; top: 10px; right: 12px; background: rgba(255,255,255,.25); border: none; color: #fff; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 15px; }
.notif-card { position: relative; }
.demo-pill { background: var(--yellow-bg); color: var(--yellow); padding: 2px 8px; border-radius: 999px; font-weight: 700; }

/* Auto-fill button */
.autofill-bar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
