/* Arena Rise CRM — shared styles.
   Everything uses CSS logical properties so a single stylesheet is correct in
   both RTL (Arabic) and LTR (English) without a second file. */

/* Arena Rise Design System tokens (assets/tokens/colors.css), mapped onto the
   variable names this stylesheet already uses everywhere. The teal is the
   brand's own (#45C3C2 primary / #1F8D8C strong), the neutrals are the brand's
   warm greys, and the status colours are the brand's semantic set. */
:root {
  --teal-50:  #EEFAFA;
  --teal-100: #D7F3F2;
  --teal-400: #45C3C2;
  --teal-500: #2FADAC;
  --teal-600: #1F8D8C;
  --teal-700: #166A69;

  --ink-900: #1D1D1B;
  --ink-700: #3B3A37;
  --ink-500: #7C7B76;
  --ink-400: #A5A49F;
  --ink-300: #CBCAC5;
  --ink-200: #E3E2DE;
  --ink-100: #F0F0ED;
  --ink-50:  #F7F7F5;

  --red-600:   #B0402F;
  --red-50:    #F8ECE9;
  --green-600: #3E8B63;
  --green-50:  #EAF4EE;
  --amber-600: #B98A31;
  --amber-50:  #FAF3E4;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgb(29 29 27 / 7%), 0 6px 18px -8px rgb(29 29 27 / 12%);
  --shadow-lg: 0 8px 32px -8px rgb(29 29 27 / 22%);

  --font: "Tajawal", "Segoe UI", Tahoma, "Noto Naskh Arabic", "Traditional Arabic", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over any layout rule below (.field uses
   display:flex, which would otherwise keep a hidden element on screen). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}

/* Latin text inside an RTL page (emails, phone numbers, file names). */
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }

a { color: var(--teal-700); }

/* ------------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: var(--ink-900);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* The mark ships in an on-black variant, so it sits on the dark bar directly —
   no white chip behind it. */
.topbar__logo { flex: none; }
.topbar__title { font-weight: 700; font-size: 16px; }
.topbar__sub { font-size: 12px; color: var(--ink-400); }
.topbar__actions { display: flex; gap: 8px; flex: none; }

/* ------------------------------------------------------------ global search */

.gsearch { position: relative; flex: 1 1 auto; max-width: 460px; min-width: 140px; }
.gsearch__input {
  width: 100%;
  background: rgb(255 255 255 / 10%);
  border: 1px solid rgb(255 255 255 / 22%);
  color: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  padding-inline-end: 42px; /* room for the go button */
  font-size: 13.5px;
}

/* The go button sits inside the pill, at its end — works in RTL and LTR. */
.gsearch__btn {
  position: absolute;
  inset-inline-end: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgb(255 255 255 / 14%);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.gsearch__btn:hover, .gsearch__btn:focus-visible { background: var(--teal-600); }
.gsearch__input::placeholder { color: rgb(255 255 255 / 55%); }
.gsearch__input:focus {
  outline: none;
  background: rgb(255 255 255 / 16%);
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgb(69 195 194 / 25%);
}
.gsearch__panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  min-width: 300px;
  background: #fff;
  color: var(--ink-900);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: min(420px, 70vh);
  overflow-y: auto;
  z-index: 40;
  padding: 6px;
}
.gsearch__group {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: .04em;
  padding: 8px 10px 4px;
}
.gsearch__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: start;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.gsearch__item.is-active, .gsearch__item:hover { background: var(--teal-50); }
.gsearch__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gsearch__title { font-weight: 600; font-size: 13.5px; }
.gsearch__sub { font-size: 12px; color: var(--ink-500); }
.gsearch__empty { padding: 14px; text-align: center; color: var(--ink-400); font-size: 13px; }

@media (max-width: 640px) {
  .gsearch { order: 3; flex-basis: 100%; max-width: none; }
  .topbar { flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ layout */

.container { max-width: 1180px; margin: 0 auto; padding: 22px; }

.panel {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.panel h2 { font-size: 16px; }

.hint { color: var(--ink-500); font-size: 13px; margin: 4px 0 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { min-width: 0; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--ink-500); font-weight: 600; }
.field--grow { flex: 1 1 190px; }

/* ------------------------------------------------------------------ inputs */

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-900);
  padding: 9px 11px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  background: #fff;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgb(69 195 194 / 22%);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--ink-100);
  color: var(--ink-400);
  cursor: not-allowed;
  border-color: var(--ink-200);
}

input[type="date"], input[type="number"] { direction: ltr; text-align: start; }
input[type="file"] { padding: 7px; background: var(--ink-50); }
select[multiple] { min-height: 118px; }

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--teal-600);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: var(--teal-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--sm { padding: 5px 12px; font-size: 13px; }
.btn--block { width: 100%; }

.btn--ghost { background: transparent; border-color: rgb(255 255 255 / 28%); color: inherit; }
.btn--ghost:hover:not(:disabled) { background: rgb(255 255 255 / 12%); }

.panel .btn--ghost { border-color: var(--ink-200); color: var(--ink-700); }
.panel .btn--ghost:hover:not(:disabled) { background: var(--ink-100); }

.btn--danger { background: var(--red-600); }
.btn--danger:hover:not(:disabled) { background: #8F3325; }

.btn--muted { background: var(--ink-500); }
.btn--muted:hover:not(:disabled) { background: var(--ink-700); }

/* -------------------------------------------------------------- hero panel */

.hero {
  background: linear-gradient(135deg, #1D1D1B 0%, #0F4948 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.hero__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero__greeting { font-size: 21px; font-weight: 700; margin: 0; }
.hero__motivation { margin: 6px 0 0; color: #B0E7E6; font-size: 14px; max-width: 62ch; }
.hero__clock { font-size: 13px; color: var(--ink-400); font-variant-numeric: tabular-nums; direction: ltr; flex: none; }

.hero__bar {
  margin-top: 18px;
  background: rgb(255 255 255 / 14%);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.hero__fill {
  height: 100%;
  background: linear-gradient(90deg, #87DAD9, #45C3C2);
  border-radius: 999px;
  transition: width .4s ease;
  min-width: 2px;
}
.hero__progress { margin: 9px 0 0; font-size: 13.5px; color: var(--ink-300); }
.hero__progress b { color: #fff; font-variant-numeric: tabular-nums; }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 14%);
}
.hero__stat .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero__stat .l { font-size: 11.5px; color: var(--ink-400); margin-top: 1px; }
.hero__stat .v.good { color: #87DAD9; }
.hero__stat .v.warn { color: #E0B865; }

@media (max-width: 640px) {
  .hero { padding: 18px; }
  .hero__greeting { font-size: 18px; }
}

/* ------------------------------------------------------------------- cards */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 18px; }

.card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: 15px 17px;
  box-shadow: var(--shadow);
}
.card__value { font-size: 26px; font-weight: 800; color: var(--teal-600); font-variant-numeric: tabular-nums; }
.card__label { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.card--muted .card__value { color: var(--ink-700); }
.card--warn  .card__value { color: var(--amber-600); }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--ink-200); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; background: #fff; }

th, td {
  padding: 9px 12px;
  text-align: start;
  border-bottom: 1px solid var(--ink-200);
  font-size: 13.5px;
  vertical-align: middle;
}
th { background: var(--ink-100); font-weight: 700; font-size: 12.5px; color: var(--ink-700); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--ink-50); }

td.empty { text-align: center; color: var(--ink-400); padding: 26px; }
td .select, td select { min-width: 132px; font-size: 13px; padding: 5px 8px; }
/* Buttons wrap onto a second line rather than pushing the last one off the
   edge of the table. A user row can carry four actions — resend, reset,
   disable, delete — and "delete" sliding out of view under a scrollbar is how
   a row ends up looking broken.
   Wrapping is done with white-space, not flex: a flex `td` stops behaving as a
   table cell and the column widths collapse. */
td.actions { white-space: normal; }
td.actions .btn, td.actions .linkbtn { margin-inline-end: 5px; margin-block-end: 4px; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--ink-100);
  color: var(--ink-700);
  white-space: nowrap;
}
.badge--ok      { background: var(--green-50); color: var(--green-600); }
.badge--warn    { background: var(--amber-50); color: var(--amber-600); }
.badge--danger  { background: var(--red-50);   color: var(--red-600); }
.badge--teal    { background: var(--teal-50);  color: var(--teal-700); }

/* ---------------------------------------------------------------- progress */

.goal-title { margin-top: 20px; margin-bottom: 8px; }

.progress { background: var(--ink-200); border-radius: 999px; height: 22px; overflow: hidden; }
.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-600));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .35s ease;
  min-width: 2px;
}

/* Simple column chart for the 7-day trend. */
.spark { display: flex; align-items: flex-end; justify-content: center; gap: 7px; height: 108px; padding-top: 8px; }
/* Cap the width so a single day does not stretch into one giant block. */
.spark__col { flex: 1 1 0; max-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.spark__bar { width: 100%; background: var(--teal-500); border-radius: 5px 5px 0 0; min-height: 3px; transition: height .3s; }
.spark__bar--empty { background: var(--ink-200); }
.spark__val { font-size: 11px; font-weight: 700; color: var(--ink-700); font-variant-numeric: tabular-nums; }
.spark__day { font-size: 10px; color: var(--ink-400); direction: ltr; }

/* ------------------------------------------------------------------ notice */

.notice { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; margin: 10px 0; border: 1px solid; }
.notice--ok    { background: var(--green-50); border-color: #bbf7d0; color: #166534; }
.notice--error { background: var(--red-50);   border-color: #fecaca; color: #991b1b; }
.notice--warn  { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.notice--info  { background: var(--teal-50);  border-color: var(--teal-100); color: var(--teal-700); }

.code-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  background: #fff;
  border: 1px dashed var(--ink-300);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
.code-line code {
  flex: 1;
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 12.5px;
  word-break: break-all;
  font-family: Consolas, "Courier New", monospace;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 50%;
  transform: translate(50%, 16px);
  background: var(--ink-900);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  max-width: min(90vw, 520px);
  text-align: center;
}
:dir(ltr) .toast { transform: translate(-50%, 16px); }
.toast.is-visible { opacity: 1; transform: translate(50%, 0); }
:dir(ltr) .toast.is-visible { transform: translate(-50%, 0); }
.toast--error { background: var(--red-600); }
.toast--ok    { background: var(--green-600); }

/* ---------------------------------------------------------------- worklist */

.worklist__tools { align-items: flex-end; margin-bottom: 14px; }
.worklist__count { font-size: 13px; color: var(--ink-500); font-variant-numeric: tabular-nums; }

/* Segmented toggle: one tap to switch between "what's left" and everything. */
.seg { display: inline-flex; border: 1px solid var(--ink-200); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg__btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
  white-space: nowrap;
}
.seg__btn:hover { background: var(--ink-100); }
.seg__btn.is-active { background: var(--ink-900); color: #fff; }

.worklist { display: flex; flex-direction: column; gap: 12px; }

/* A card per call rather than a table row: 150 contacts a day means the note
   field and the action buttons need real room, which a row cannot give. */
.callcard {
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(200px, 1fr) minmax(240px, 1.3fr);
  gap: 14px 20px;
  align-items: start;
  transition: border-color .15s, box-shadow .15s;
}
.callcard:hover { border-color: var(--ink-300); }
.callcard.is-done { background: var(--ink-50); border-color: var(--ink-200); }
.callcard.is-active { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgb(20 184 166 / 15%); }

.callcard__who { min-width: 0; }
.callcard__name { font-size: 15.5px; font-weight: 700; }
.callcard__role { font-size: 13px; color: var(--ink-500); }
.callcard__co { font-size: 13.5px; color: var(--ink-700); font-weight: 600; margin-top: 3px; }
.callcard__city { font-size: 12.5px; color: var(--ink-400); }

.callcard__contact { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.callcard__line { display: flex; align-items: center; gap: 7px; font-size: 13.5px; min-width: 0; }
.callcard__line .val { direction: ltr; unicode-bidi: isolate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.callcard__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

.linkbtn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: #fff;
  color: var(--ink-700);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.linkbtn:hover { background: var(--ink-100); }
.linkbtn--call { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }
.linkbtn--call:hover { background: var(--teal-700); }

.callcard__work { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.callcard__work label { font-size: 11.5px; font-weight: 600; color: var(--ink-500); display: block; margin-bottom: 3px; }
.callcard__note textarea {
  min-height: 76px;
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.55;
}
.note-state { font-size: 11.5px; color: var(--green-600); min-height: 15px; }

@media (max-width: 900px) {
  .callcard { grid-template-columns: 1fr; }
}

/* Real job titles run long — "Eng. Inam Ul Haq Khan, CSP®, ASP®, Lead Auditor
   ISO/IMS/HSEQ" is one contact — so the name column is capped rather than
   allowed to push the outcome dropdown and the action button off the table. */
.review td:nth-child(2) { max-width: 22ch; }
.review td:nth-child(1) { max-width: 20ch; }
.review select { min-width: 11ch; }

/* The refresh button carries its own spinner rather than covering the page:
   the point of refreshing in place is that you keep looking at your data. */
.btn--refresh { position: relative; }
.btn--refresh.is-busy { color: transparent; }
.btn--refresh.is-busy::after {
  content: '';
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  width: 14px;
  height: 14px;
  margin-block-start: -7px;
  margin-inline-start: -7px;
  border: 2px solid currentcolor;
  border-block-start-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn--refresh.is-busy::after { animation-duration: 2s; }
}

/* A switched-off call outcome still has to be readable — it is history for
   every call that carries it — but it must not look like a live choice. */
tr.is-muted { background: var(--ink-50); }
tr.is-muted td:not(.actions) { opacity: .6; }

/* Two badges that answer different questions — is the account live, and how
   far the invitation got — stacked rather than run together on one line. */
.stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* Checkbox and its label on one baseline, inside a filter row. */
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.check input { width: 16px; height: 16px; }

/* -------------------------------------------------------------- companies */

/* The employee's worklist and the admin's company tab are the same list, so
   they share the spacing rather than each inventing their own. */
.companies { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.company {
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.company:hover { border-color: var(--ink-300); }
.company.is-open { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgb(20 184 166 / 12%); }
.company.is-done { background: var(--ink-50); }

/* The whole header is the toggle: a small caret is a poor target on a phone. */
.company__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.company__head:hover { background: var(--ink-50); }

.company__caret {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-400);
  transition: transform .18s;
}
.company.is-open .company__caret { transform: rotate(90deg); color: var(--teal-600); }
:dir(rtl) .company__caret { transform: scaleX(-1); }
:dir(rtl) .company.is-open .company__caret { transform: scaleX(-1) rotate(90deg); }

.company__main { flex: 1; min-width: 0; }
.company__name { font-size: 15.5px; font-weight: 700; }
.company__meta { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.company__side { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.company__progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.company__body { border-top: 1px solid var(--ink-200); padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.company__body[hidden] { display: none; }

.person {
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(190px, 1fr) minmax(220px, 1.2fr);
  gap: 12px 18px;
  align-items: start;
  background: #fff;
}
.person.is-done { background: var(--ink-50); }
.person__name { font-size: 14.5px; font-weight: 700; }
.person__role { font-size: 12.5px; color: var(--ink-500); }

/* A company name that opens the firm's record. Underlined only on hover, so
   tables stay calm while still signalling the name is a door, not just text. */
.company-link { color: var(--teal-700); text-decoration: none; cursor: pointer; }
.company-link:hover, .company-link:focus-visible { text-decoration: underline; }

.timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.timeline__row { display: flex; gap: 10px; font-size: 12.5px; align-items: baseline; }
.timeline__when { color: var(--ink-400); font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; }
.timeline__what { color: var(--ink-700); }
.timeline__who { color: var(--ink-400); }
.timeline__note {
  color: var(--ink-700);
  margin-top: 4px;
  background: var(--amber-50);
  border-inline-start: 3px solid var(--amber-600);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
}
.timeline__note b { color: var(--amber-600); font-weight: 700; }
.timeline__phone { color: var(--ink-500); font-size: 12px; margin-inline-start: 8px; }

/* The at-a-glance strip on top of a company's record. */
.company-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 10px 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.company-summary__item { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.company-summary__label { color: var(--ink-500); font-size: 11.5px; font-weight: 600; }
.company-summary__note {
  flex-basis: 100%;
  background: var(--amber-50);
  border-inline-start: 3px solid var(--amber-600);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--ink-700);
}
.company-summary__note b { color: var(--amber-600); }
.company-summary__notemeta { color: var(--ink-400); font-size: 11px; }

.backlog-note { font-size: 12px; margin-top: 2px; max-width: 46ch; }

.access-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.access-url code {
  background: var(--ink-100);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  user-select: all;
}

/* Long imported notes stay readable inside tables: clamped to two lines with
   the full text on hover, instead of one note stretching the whole row. */
td.note-cell {
  max-width: 30ch;
  font-size: 12.5px;
  color: var(--ink-700);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* A fixed-width tag keeps the four kinds of entry in one readable column
   instead of letting each line start wherever its label happens to end. */
.timeline__tag {
  flex: 0 0 auto;
  min-width: 68px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  background: var(--ink-100);
  color: var(--ink-600);
}
.timeline__row--call    .timeline__tag { background: #D7F3F2; color: #166A69; }
.timeline__row--status  .timeline__tag { background: #B0E7E6; color: #0F4948; }
.timeline__row--removed .timeline__tag { background: #F8ECE9; color: #B0402F; }
.timeline__row--note    .timeline__tag { background: var(--amber-50); color: var(--amber-600); }

@media (max-width: 900px) {
  .person { grid-template-columns: 1fr; }
  .company__head { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- messages */

.threads { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; align-items: start; }
.threads > * { min-width: 0; }

.thread-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; }
.thread-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: start;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}
.thread-item:hover { background: var(--ink-50); }
.thread-item.is-active { border-color: var(--teal-500); background: var(--teal-50); }
.thread-item__body { flex: 1; min-width: 0; }
.thread-item__name { display: block; font-weight: 600; font-size: 14px; }
.thread-item__last {
  display: block;
  font-size: 12px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column-reverse keeps the newest message pinned to the bottom without any
   scroll maths, which is what people expect from a conversation. */
.chat {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  min-height: 180px;
}
.chat__empty { margin: auto; color: var(--ink-400); font-size: 13px; }

.bubble { max-width: min(78%, 560px); padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.bubble__meta { display: block; font-size: 11px; margin-top: 4px; opacity: .75; }
.bubble__about { display: block; font-size: 11.5px; margin-bottom: 4px; opacity: .8; font-weight: 600; }
.bubble--mine { align-self: flex-end; background: var(--teal-600); color: #fff; border-end-end-radius: 4px; }
.bubble--theirs { align-self: flex-start; background: #fff; border: 1px solid var(--ink-200); border-end-start-radius: 4px; }
.bubble--unread { box-shadow: 0 0 0 2px var(--teal-500); }

.composer { display: flex; gap: 9px; margin-top: 12px; align-items: flex-end; }
.composer textarea { resize: vertical; min-height: 46px; max-height: 180px; }
.composer .btn { flex: none; }

.tab__badge {
  display: inline-block;
  min-width: 19px;
  padding: 0 6px;
  margin-inline-start: 6px;
  border-radius: 999px;
  background: var(--red-600);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
}

@media (max-width: 720px) {
  .threads { grid-template-columns: 1fr; }
  .thread-list { max-height: 220px; }
}

/* ------------------------------------------------------------------- modal */

.modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow-lg);
  max-width: min(94vw, 440px);
  width: 100%;
  color: var(--ink-900);
  background: #fff;
}
.modal::backdrop { background: rgb(15 23 42 / 45%); }
.modal__form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal__form h3 { font-size: 17px; }
.modal__form .hint { margin: 0; }
.modal__actions { display: flex; gap: 9px; margin-top: 4px; }
.modal__actions .btn { flex: 1; }

/* -------------------------------------------------------------- event bits */

.event-add {
  background: none;
  border: none;
  padding: 2px 0;
  margin-top: 4px;
  font: inherit;
  font-size: 12px;
  color: var(--teal-700);
  text-decoration: underline;
  cursor: pointer;
}
.event-add:hover { color: var(--teal-600); }

/* ------------------------------------------------------------------- pager */

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 12px; }
.pager__label { font-size: 13px; color: var(--ink-500); }

/* -------------------------------------------------------------- auth pages */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -10%, #D7F3F2 0%, transparent 60%),
    var(--ink-50);
}

.auth__card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 30px;
}

.auth__logo { display: block; width: 76px; height: 76px; margin: 0 auto 14px; }
/* The brand lockup, built live from the mark and Tajawal instead of a raster:
   heavy uppercase wordmark with wide tracking, tagline in micro caps — the
   treatment the design system's Logo component defines. */
.auth__brand { margin-bottom: 6px; }
.auth__wordmark {
  text-align: center;
  font-weight: 900;
  font-size: 23px;
  letter-spacing: .14em;
  color: var(--ink-900);
}
.auth__slogan {
  text-align: center;
  font-size: 10.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-top: 4px;
}
/* The full lockup reads far better than the emblem alone at this size: the
   emblem is mostly ring, so its monogram shrinks to nothing on a sign-in card. */
.auth__lockup { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 18px; }
.auth__title { text-align: center; font-size: 20px; }
.auth__tagline { text-align: center; color: var(--ink-500); font-size: 13px; margin: 5px 0 24px; }
.auth__card .field { margin-bottom: 14px; }
.auth__hint { margin-top: 16px; margin-bottom: 0; }
.auth__foot { text-align: center; margin-top: 18px; }
.auth__lang { background: none; border: none; color: var(--teal-700); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 17px;
  border: 1px solid var(--ink-200);
  background: #fff;
  color: var(--ink-700);
  border-radius: 999px;
  cursor: pointer;
}
.tab:hover { background: var(--ink-100); }
.tab.is-active { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }

.tabpane[hidden] { display: none; }

/* ------------------------------------------------------------------ misc */

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
/* Grid and flex children default to min-width:auto, so a wide table refuses to
   shrink and pushes the whole page sideways instead of scrolling inside its own
   .table-wrap. This is what keeps the layout inside the viewport. */
.split > *, .cards > *, .panel { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--ink-500); font-size: 13px; }
.inline-check { width: auto; margin-inline-end: 4px; vertical-align: middle; }
.kv { display: flex; gap: 8px; font-size: 13px; color: var(--ink-500); }
.kv b { color: var(--ink-900); }
.contact-name { font-weight: 600; }
.target-input { width: 88px; padding: 5px 8px; font-size: 13px; }
.role-select { width: 116px; padding: 5px 8px; font-size: 13px; }
.role-self { margin-inline-start: 6px; }
.event-heading { font-size: 14px; margin: 18px 0 8px; color: var(--teal-700); }
.right { margin-inline-start: auto; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ touch / phone */

@media (max-width: 640px) {
  .container { padding: 14px; }
  .panel { padding: 15px; }
  .topbar { padding: 10px 14px; }
  .topbar__sub { display: none; }
}

/* iOS zooms the whole page in whenever a focused field is smaller than 16px,
   and the employee has to pinch back out after every single entry. Sizing the
   fields at 16px on touch devices is the only way to stop it. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }

  /* Comfortable targets for a thumb. */
  .btn, .linkbtn, .seg__btn, .tab, input, select, .thread-item { min-height: 44px; }
  .btn--sm, .linkbtn { min-height: 38px; padding-block: 8px; }
  /* Text-style buttons need the height too — they are real actions, not labels. */
  .auth__lang, .event-add { min-height: 38px; padding-block: 8px; }
  .inline-check { width: 20px; height: 20px; }
}

/* Keep content clear of the notch and the home indicator when the app is
   installed to the home screen and runs full-screen. */
@supports (padding: env(safe-area-inset-left)) {
  .topbar {
    padding-inline-start: max(14px, env(safe-area-inset-left));
    padding-inline-end: max(14px, env(safe-area-inset-right));
    padding-block-start: max(10px, env(safe-area-inset-top));
  }
  .container {
    padding-inline-start: max(14px, env(safe-area-inset-left));
    padding-inline-end: max(14px, env(safe-area-inset-right));
    padding-block-end: max(22px, env(safe-area-inset-bottom));
  }
}

@media print {
  .topbar, .subnav, .btn, .tabs, .pager { display: none !important; }
  .panel { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* --------------------------------------------------------- employee subnav */
/* The page bar under the topbar: sticky right beneath it, so the pages stay
   one click away however far down the daily list the employee has scrolled. */

.subnav {
  position: sticky;
  top: 58px;
  z-index: 19;
  background: #fff;
  border-bottom: 1px solid var(--ink-200);
  box-shadow: 0 2px 8px -6px rgb(29 29 27 / 25%);
}
.subnav__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 7px 22px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.subnav__link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-700);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.subnav__link:hover { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-700); }
.subnav__link.is-active { background: var(--ink-900); color: #fff; }
.subnav__badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-700);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.subnav__link.is-active .subnav__badge { background: rgb(255 255 255 / 18%); color: #fff; }
.subnav__link[data-page="backlog"] .subnav__badge { background: var(--amber-50); color: var(--amber-600); }
.subnav__link[data-page="backlog"].is-active .subnav__badge { background: rgb(255 255 255 / 18%); color: #fff; }

@media (max-width: 640px) {
  /* The topbar wraps to two rows on phones, so the bar sits lower. */
  .subnav { top: auto; position: static; }
  .subnav__inner { padding: 7px 14px; }
}

/* --------------------------------------------------------- employee pages */

/* A card that is also a link to its list. */
a.card, .card--link { text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.card:hover, .card--link:hover { border-color: var(--teal-400); transform: translateY(-1px); }
.card--link .card__label::after { content: " ↗"; color: var(--teal-500); font-size: 11px; }

/* Overview: three columns (all time / month / week), each a compact stat row. */
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.overview__col {
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.overview__title { font-size: 12px; font-weight: 700; color: var(--ink-500); letter-spacing: .03em; margin-bottom: 8px; }
.overview__range { display: inline-block; font-weight: 500; color: var(--ink-400); margin-inline-start: 10px; }
.overview__row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; border-top: 1px dashed var(--ink-200); font-size: 13.5px; }
.overview__row:first-of-type { border-top: none; }
.overview__row b { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--teal-700); }

/* Page header strip on the sub-pages: title + big count + filters. */
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pagehead h1 { font-size: 21px; }
.pagehead__count { font-size: 30px; font-weight: 800; color: var(--teal-600); font-variant-numeric: tabular-nums; line-height: 1; }
.pagehead__sub { font-size: 12.5px; color: var(--ink-500); }

/* Date group heading inside the backlog table. */
tr.group th { background: var(--ink-100); color: var(--ink-700); font-size: 12.5px; text-align: start; padding: 6px 12px; }
td .row-note { font-size: 12px; color: var(--ink-500); margin-top: 2px; white-space: pre-wrap; max-width: 360px; }
table.review td:first-child, table.review th:first-child { min-width: 220px; }
td .row-meta { font-size: 11.5px; color: var(--ink-400); margin-top: 2px; }
tr.is-done td { opacity: .55; }

/* ------------------------------------------------------ callbacks & due */

.callback-field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.callback-field > label { font-size: 12px; color: var(--ink-500); font-weight: 600; }
.callback-input { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--ink-300); border-radius: var(--radius-sm); }

.panel--due { border-color: var(--amber-600); box-shadow: 0 0 0 3px var(--amber-50); }
.due { display: flex; flex-direction: column; gap: 6px; }
.due__title { font-size: 12.5px; font-weight: 700; color: var(--ink-500); margin: 8px 0 2px; }
.due__title--overdue { color: var(--red-600); }
.due__row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: #fff;
}
.due__row--overdue { border-color: var(--red-50); background: #FFFBFA; }
.due__row--upcoming { opacity: .8; }
.due__when { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-500); }
.due__when b { font-size: 17px; color: var(--ink-900); }
.due__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.due__actions select { max-width: 200px; }
@media (max-width: 720px) {
  .due__row { grid-template-columns: 1fr; }
  .due__actions { justify-content: flex-start; }
}

/* ------------------------------------------------------------------ goals */

.goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.goal { border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.goal--behind { border-color: var(--amber-50); background: #FFFDF8; }
.goal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.goal__title { font-weight: 700; font-size: 15px; }
.goal__range { font-size: 12px; color: var(--ink-400); }
.goal__bar { height: 8px; border-radius: 999px; background: var(--ink-100); overflow: hidden; margin: 10px 0 6px; }
.goal__fill { height: 100%; background: linear-gradient(90deg, var(--teal-600), var(--teal-400)); border-radius: 999px; transition: width .4s; }
.goal--behind .goal__fill { background: linear-gradient(90deg, var(--amber-600), #E2B45A); }
.goal__line { font-size: 13.5px; color: var(--ink-700); }
.goal__stats { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.goal__stats > div { display: flex; flex-direction: column; }
.goal__stats b { font-size: 19px; color: var(--teal-700); font-variant-numeric: tabular-nums; }
.goal__stats span { font-size: 11.5px; color: var(--ink-500); }

/* -------------------------------------------------------- message buttons */

.msgbtns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.msgbtns__pick { font: inherit; font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--ink-300); border-radius: var(--radius-sm); max-width: 140px; }
.linkbtn--wa { background: #E7F8EF; color: #1E7B4F; border-color: #BFE8D0; }
.linkbtn--wa:hover { background: #D4F2E2; }
.linkbtn:disabled { opacity: .45; cursor: not-allowed; }
table .msgbtns { margin-top: 0; }
table .msgbtns .badge { display: block; margin-top: 4px; }

/* ---------------------------------------------------------- login: PIN */

.auth__pinwho { margin: 0 0 12px; color: var(--ink-700); }
.auth__pin { font-size: 24px; letter-spacing: .5em; text-align: center; }
#use-password { display: block; margin: 12px auto 0; }

/* ------------------------------------------------------ admin: templates */

.tpl { border: 1px solid var(--ink-200); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.tpl__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tpl__langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.tpl textarea { width: 100%; min-height: 150px; font: inherit; font-size: 13.5px; }
.tpl input { width: 100%; }

/* --------------------------------------------------------- admin: digest */

.digest { display: flex; flex-direction: column; gap: 10px; }
.digest__totals { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.digest__totals b { font-size: 20px; color: var(--teal-700); }
.digest__emp { border: 1px solid var(--ink-200); border-radius: var(--radius-sm); padding: 10px 12px; background: #fff; }
.digest__emp--noshift { border-color: var(--red-50); background: #FFFBFA; }
.digest__leads { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; }
.digest__leads li { margin: 2px 0; }

/* ----------------------------------------------------- upload: overlap */

.overlap { border: 1px solid var(--amber-600); background: var(--amber-50); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 12px; }
.overlap__title { font-weight: 700; color: var(--amber-600); margin-bottom: 4px; }
.email-cell { font-size: 12.5px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------- inline note cell */

.note-cell { min-width: 220px; max-width: 340px; vertical-align: top; }
.note-view {
  display: block;
  width: 100%;
  text-align: start;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-700);
  background: var(--ink-50);
  border: 1px dashed var(--ink-300);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
  transition: border-color .15s, background .15s;
}
.note-view:hover, .note-view:focus-visible { border-color: var(--teal-500); background: var(--teal-50); outline: none; }
.note-view--empty { color: var(--ink-400); font-style: italic; }
.note-meta { font-size: 11px; color: var(--ink-400); margin-top: 3px; }
.note-box {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--teal-500);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 3px rgb(69 195 194 / 22%);
  resize: vertical;
  min-height: 72px;
}
.note-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-500); }
.note-counter { margin-inline-start: auto; }
.note-hint { flex-basis: 100%; color: var(--ink-400); font-size: 11px; }
.note-state { color: var(--teal-700); font-weight: 600; }

/* ----------------------------------------------------- admin: view as */

.viewas {
  position: sticky;
  top: 0;
  z-index: 21;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 22px;
  background: var(--amber-50);
  color: var(--amber-600);
  border-bottom: 2px solid var(--amber-600);
  font-size: 13.5px;
}
.viewas__text { color: var(--ink-700); }
.viewas__text b { color: var(--amber-600); }
/* Read-only: the controls that would change the employee's data are shown
   but inert, so the screen still reads exactly as theirs does. */
.is-viewas #clock-btn,
.is-viewas .worklist select,
.is-viewas .worklist textarea,
.is-viewas .worklist .event-add,
.is-viewas .worklist .msgbtns,
.is-viewas table select,
.is-viewas .note-cell,
.is-viewas .callback-input,
.is-viewas .due__actions .btn,
.is-viewas .composer,
.is-viewas #pin-settings,
.is-viewas .actions .btn {
  pointer-events: none;
  opacity: .55;
}
