/* TFS Global CRM — Broadsheet. Source Serif 4 on paper white; cyan for
   action, magenta for caution, used small like spot colour. */

:root {
  --ink: #201e1d;
  --ink-2: #444141;
  --ink-3: #605d5d;
  --rule: #d7d3d3;
  --rule-2: #eae7e7;
  --paper: #f3f2f2;
  --card: #f8f4f4;
  --surface: #eae9e9;
  --accent: #0088b0;
  --accent-ink: #006786;
  --accent-deep: #004961;
  --accent-tint: #e9f8ff;
  --accent-tint-2: #cbeeff;
  --accent-2: #d6006c;
  --accent-2-ink: #aa0b56;
  --accent-2-tint: #fff1f4;
  --accent-2-tint-2: #ffdee6;
  --ok: #006786;
  --warn: #aa0b56;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --shadow: 0 1px 2px rgba(45,43,43,.10), 0 3px 10px rgba(45,43,43,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-tint-2); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--paper); color: var(--ink); padding: 32px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 24px 6px; }
.brand-mark { display: none; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.1; }
.brand-sub { font-size: 13px; color: var(--ink-3); }
.ist-clock { padding: 18px 24px 4px; }
.ist-clock .ist-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ist-clock .ist-time { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ist-clock .ist-date { font-size: 13px; color: var(--ink-3); }
.nav-group { padding: 18px 14px 0; }
.nav-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 4px; }
.nav-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 5px 10px; border-radius: 2px; color: var(--ink); font-size: 16px; }
.nav-item:hover { background: var(--accent-tint); color: var(--ink); text-decoration: none; }
.nav-item.on { color: var(--accent-ink); font-weight: 600; background: transparent; }
.nav-count { font-size: 12px; color: var(--accent-2-ink); font-variant-numeric: tabular-nums; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 32px 40px 8px 24px; background: var(--paper); position: sticky; top: 0; z-index: 20; }
.page-title { font-size: 36px; line-height: 1.1; }
.page-sub { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-deep); display: grid; place-items: center; font-size: 13px; letter-spacing: .04em; }
.who-name { font-size: 14px; font-weight: 600; }
.who-role { font-size: 12px; color: var(--ink-3); }
.content { padding: 24px 40px 64px 24px; max-width: 1320px; }

/* ---------------------------------------------------------------- pieces */
.card { background: var(--card); border: 0; border-radius: 4px; box-shadow: var(--shadow); }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 22px 6px;
}
.card-title { font-size: 21px; }
.card-note { font-size: 13px; color: var(--ink-3); }
.card-body { padding: 14px 22px 22px; }

.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.stat { background: transparent; border: 0; padding: 6px 0; }
.stat-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stat-value { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.tag {
  display: inline-block; font-size: 12.5px; letter-spacing: .01em;
  padding: 2px 9px; border-radius: 2px; border: 1px solid transparent; color: var(--ink-2); white-space: nowrap;
}
.tag-accent { background: var(--accent-tint); color: var(--accent-deep); }
.tag-accent-2 { background: var(--accent-2-tint); color: var(--accent-2-ink); }
.tag-neutral { background: var(--rule-2); color: var(--ink); }
.tag-outline { background: transparent; border-color: var(--rule); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--rule);
  white-space: nowrap; background: transparent;
}
td { padding: 12px 12px; border-bottom: 1px solid var(--rule-2); font-size: 14.5px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-tint); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; }
.table-wrap { overflow-x: auto; }
.empty { padding: 36px 22px; color: var(--ink-3); font-size: 15px; }

/* ---------------------------------------------------------------- forms */
label.field { display: block; }
.field-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 15px; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-radius: 2px;
}
input[type=time], input[type=file] { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 2px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }
.field-err { color: var(--accent-2); font-size: 11.5px; margin-top: 4px; }
.field-hint { color: var(--ink-3); font-size: 11.5px; margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-family: var(--serif); font-size: 18px; font-weight: 600; padding: 0 0 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; font: inherit; font-size: 15px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 2px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #1186ac; border-color: #1186ac; color: #fff; }
.btn-accent:active { background: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--accent-ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--accent-tint); color: var(--accent-deep); }
.btn-danger { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger:hover { background: var(--accent-2-ink); border-color: var(--accent-2-ink); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-xs { padding: 3px 8px; font-size: 13px; }
.btn.on, .btn-ghost.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.flash {
  padding: 12px 18px; border-radius: 2px; border: 0; background: var(--accent-tint);
  color: var(--accent-deep); font-size: 15px; margin-bottom: 20px;
}
.flash.err { background: var(--accent-2-tint); color: var(--accent-2-ink); }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 10px 22px 16px;
}
.filters .field { min-width: 130px; }
.filters .grow { flex: 1 1 220px; }

.def { display: grid; grid-template-columns: 132px 1fr; gap: 8px 16px; font-size: 13px; }
.def dt { color: var(--ink-3); font-size: 13px; padding-top: 1px; }
.def dd { margin: 0; }

.thread { display: flex; flex-direction: column; gap: 12px; }
.note { border-left: 2px solid var(--rule); padding: 0 0 0 12px; }
.note-meta { font-size: 12.5px; color: var(--ink-3); }
.note-body { font-size: 15px; margin-top: 2px; }

.clock-state { font-family: var(--serif); font-weight: 600; font-size: 28px; }
.chart { width: 100%; height: auto; display: block; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.login-card { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Inline table editors — the three CRM-owned call fields */
.input-sm {
  width: 100%; min-width: 104px; padding: 4px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--rule); border-radius: 2px; background: #fff; color: var(--ink);
}
.input-sm:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.sync-flag { display: block; margin-top: 3px; }

/* The alert bell */
.bell {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--rule); display: grid; place-items: center;
  color: var(--ink-2); text-decoration: none; background: transparent;
}
.bell:hover { background: var(--accent-tint); color: var(--accent-deep); text-decoration: none; }
.bell-count {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--accent-2); color: #fff;
  font-size: 10.5px; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums;
}

/* Missed-call toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 330px; }
.toast {
  position: relative; background: var(--card); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-2); border-radius: 2px; box-shadow: var(--shadow);
  padding: 12px 30px 12px 14px;
}
.toast-title { font-family: var(--serif); font-size: 15px; }
.toast-body { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.toast-link { display: inline-block; margin-top: 6px; font-size: 12px; }
.toast-close {
  position: absolute; top: 6px; right: 8px; border: 0; background: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--ink-3);
}
.toast-close:hover { color: var(--ink); }
.toast-urgent {
  border-left-color: var(--accent-2); border-width: 2px;
  box-shadow: 0 0 0 3px rgba(214,0,108,.15), var(--shadow);
  animation: toast-pulse 1.1s ease-in-out infinite;
  padding: 14px 16px 40px 16px;
}
.toast-urgent .toast-title { font-size: 16px; font-weight: 700; }
.toast-urgent .toast-close {
  position: absolute; right: 10px; bottom: 10px; top: auto; left: auto;
  background: var(--accent-2); color: #fff; border-radius: 3px; font-size: 12px;
  padding: 6px 12px; font-family: inherit;
}
.toast-urgent .toast-close:hover { background: #a80057; color: #fff; }
@keyframes toast-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(214,0,108,.15), var(--shadow); }
  50% { box-shadow: 0 0 0 7px rgba(214,0,108,.28), var(--shadow); }
}
@media (max-width: 860px) {
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* Tablet */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g2[style] { grid-template-columns: minmax(0, 1fr) !important; }
  .shell { grid-template-columns: 196px 1fr; }
  .content, .topbar { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 18px 0 8px; }
  .ist-clock { display: none; }
  .side .nav-group { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px 0; }
  .side .nav-label { width: 100%; padding-bottom: 2px; }
  .side .nav-item { padding: 6px 10px; }
  .topbar { position: static; flex-wrap: wrap; }
  .page-title { font-size: 28px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field, .filters .grow { min-width: 0; width: 100%; }
  .filters .btn { width: 100%; justify-content: center; }
  .stat-value { font-size: 24px; }
  table { min-width: 620px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; }  /* stops iOS zooming on focus */
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .def { grid-template-columns: 1fr; gap: 2px 0; }
  .def dd { margin-bottom: 10px; }
}
@media print {
  .side, .topbar, .btn, .filters { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ------------------------------------------------- desks, case, chat, attendance */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--rule-2); padding: 3px; border-radius: 2px; margin-bottom: 22px; }
.seg a { padding: 6px 14px; border-radius: 2px; color: var(--ink); font-size: 15px; white-space: nowrap; }
.seg a:hover { background: var(--accent-tint); text-decoration: none; }
.seg a.on { background: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 14px; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; font-size: 15px; background: #fff; white-space: nowrap; }
.chip span:hover { background: var(--accent-tint); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-find { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; max-width: 560px; margin-bottom: 26px; }
.case-find .field { flex: 1 1 260px; }
.case-find input { font-size: 22px; text-transform: uppercase; }
.lede { font-size: 17px; color: var(--ink-2); max-width: 62ch; margin: 0 0 24px; text-wrap: pretty; }
.big-num { font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1; }
.big-num.cyan { color: var(--accent-ink); }
.big-num.magenta { color: var(--accent-2-ink); }
.board-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; margin: 0 0 26px; }
.board-stats .lbl { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 820px; }
.cal .wd { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 4px 6px; }
.cal .day { min-height: 62px; padding: 6px 8px; border-radius: 2px; display: flex; flex-direction: column; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.cal .day b { font-weight: 400; font-variant-numeric: tabular-nums; }
.cal .d-present { background: var(--accent-tint); color: var(--accent-deep); }
.cal .d-late { background: var(--accent-2-tint); color: var(--accent-2-ink); }
.cal .d-half { background: var(--rule-2); color: var(--ink); }
.cal .d-short, .cal .d-absent { background: var(--accent-2-tint-2); color: #4b1528; }
.cal .d-leave { outline: 1px dashed var(--ink-3); outline-offset: -1px; color: var(--ink-2); }
.cal .d-today { box-shadow: inset 0 0 0 2px var(--accent); }
.chat { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 28px; align-items: start; }
.chat-list { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.chat-list a { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 2px; color: var(--ink); }
.chat-list a:hover { background: var(--accent-tint); text-decoration: none; }
.chat-list a.on { background: var(--accent-tint); }
.chat-list .who-col { min-width: 0; }
.chat-list .nm { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .last { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .unread { font-size: 12px; color: #fff; background: var(--accent-2); border-radius: 9px; padding: 0 7px; line-height: 18px; }
.chat-thread { display: flex; flex-direction: column; gap: 14px; height: 56vh; overflow-y: auto; padding-right: 8px; }
.msg { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.msg.mine { align-items: flex-end; }
.msg .meta { font-size: 12px; color: var(--ink-3); }
.msg .bubble { max-width: 72%; padding: 10px 14px; border-radius: 4px; background: var(--surface); font-size: 15px; display: flex; flex-direction: column; gap: 4px; white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: var(--accent-tint); }
.msg .bubble a { font-size: 13.5px; }
.chat-compose { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.chat-compose input[name=body] { flex: 1 1 260px; width: auto; }
.chat-compose input[name=caseId] { width: 120px; text-transform: uppercase; }
.chat-compose label.attach { cursor: pointer; }
.chat-compose label.attach input { display: none; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; }
  .chat-list { max-height: 30vh; }
  .cal .day { min-height: 48px; }
}
