:root {
  --navy: #142352; --navy-2: #1c2f66; --navy-text: #c9d3ee;
  --bg: #f4f6fa; --card: #ffffff; --line: #e3e7ef; --line-2: #eef1f6;
  --text: #1a2233; --muted: #6b7489; --faint: #98a0b3;
  --accent: #f97316; --accent-dark: #c2570c; --accent-soft: #fff1e6;
  --blue: #2350c8; --blue-soft: #e8eefc; --green: #15803d; --green-soft: #e7f6ec;
  --red: #b42318; --red-soft: #fdecea; --amber: #a15c07; --amber-soft: #fdf3e2;
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }

.shell { display: flex; min-height: 100vh; }
.side { width: 200px; background: var(--navy); color: var(--navy-text); padding: 18px 0; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 0 18px 18px; display: flex; gap: 8px; align-items: center; }
.brand b { color: var(--accent); }
.side a { display: block; color: var(--navy-text); padding: 9px 18px; font-size: 13.5px; border-left: 3px solid transparent; }
.side a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.side a.on { background: var(--navy-2); color: #fff; border-left-color: var(--accent); }
.side .foot { margin-top: auto; padding: 12px 18px; font-size: 12px; color: #8f9cc4; }
.side .foot button { background: none; border: 0; color: #c9d3ee; padding: 0; cursor: pointer; text-decoration: underline; }
.main { flex: 1; min-width: 0; padding: 18px 24px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 12.5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.explain { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: #c7cede; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--blue); padding: 2px 4px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c8d5f7; border-color: var(--blue); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.chk { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--text); font-size: 12.5px; }
.chk input { width: auto; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; font-size: 13px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8f9fc; }
tr.worked td { opacity: .5; }
.tablewrap { overflow-x: auto; }

.prio { display: inline-block; min-width: 38px; text-align: center; font-weight: 700; font-size: 12.5px; padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-dark); }
.prio.mid { background: var(--amber-soft); color: var(--amber); }
.prio.low { background: var(--line-2); color: var(--muted); }
.why { color: var(--muted); font-size: 11.5px; margin-top: 4px; max-width: 240px; line-height: 1.35; }
.name { font-weight: 600; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; }
.pill.we { background: var(--blue-soft); color: var(--blue); }
.pill.they { background: var(--green-soft); color: var(--green); }
.pill.contacted, .pill.logged { background: var(--line-2); color: var(--muted); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.touch { font-size: 12px; line-height: 1.35; margin-bottom: 5px; }
.touch .when { font-weight: 600; display: block; }
.muted { color: var(--muted); }
.due { color: var(--red); font-weight: 600; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12.5px; }

.cust { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.tile { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.tile .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tile .v { font-weight: 700; font-size: 15px; margin-top: 3px; }
.tile.wide { grid-column: span 2; }
.scores { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.scores b { color: var(--text); }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 10px; flex-wrap: wrap; }
.subtab { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.subtab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.stack > * + * { margin-top: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.phone-big { font-size: 17px; font-weight: 700; white-space: nowrap; }
.callrow .btn { white-space: nowrap; flex-shrink: 0; }
.callrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.callrow:last-child { border-bottom: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }
.login { max-width: 360px; margin: 12vh auto; }
.login .brand { color: var(--navy); padding: 0 0 14px; font-size: 20px; }
.banner { background: var(--amber-soft); color: var(--amber); border: 1px solid #f3d9ab; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 8px; align-items: center; }
  .side .brand { padding: 4px 10px; }
  .side a { padding: 6px 10px; border-left: 0; }
  .side .foot { margin: 0 0 0 auto; padding: 6px 10px; }
  .main { padding: 14px 16px 40px; }
  .cust, .grid2 { grid-template-columns: 1fr; }
}

.kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kpi { font-size: 22px; }
.kpitable th.num, .kpitable td.num { text-align: right; white-space: nowrap; }
.kpitable th .sortby { font: inherit; text-transform: inherit; letter-spacing: inherit; color: var(--muted); padding: 0; }
.kpitable th .sortby.on { color: var(--text); }
.meter { width: 90px; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.charttip { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.08); white-space: nowrap; }
