/* GTI Tasks. The base (tokens, login, forms, buttons, topbar, modals, mobile
   nav) is taken from gti-purchase's app.css so the modules look like one
   family. Work-specific pieces are at the bottom. */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand blues — pulled from GTI logo */
  --blue:          #1a5ca8;
  --blue-dark:     #144a8c;
  --blue-mid:      #2a6fbf;
  --blue-light:    #e8f0fb;
  --blue-pale:     #f0f5fd;

  /* Status colors */
  --green:         #2e7d32;
  --green-light:   #e8f5e9;
  --yellow:        #f59f00;
  --yellow-light:  #fff8e1;
  --orange:        #e65c00;
  --orange-light:  #fff3e0;
  --red:           #c62828;
  --red-light:     #ffebee;

  /* Neutrals */
  --bg:            #F0F2F5;   /* page background */
  --surface:       #ffffff;   /* cards, panels, tables */
  --border:        #D0D7E2;
  --gray-light:    #F0F2F5;
  --text:          #1C2B3A;   /* dark navy */
  --muted:         #5A6A7E;
  --white:         #ffffff;

  --topbar-h:      72px;
  --shadow:        0 1px 4px rgba(26,44,80,.10), 0 2px 8px rgba(26,44,80,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-container {
  max-width: 380px;
  margin: 80px auto;
  background: var(--surface);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(26,44,80,.14);
  border: 1px solid var(--border);
}
.login-container form { display: flex; flex-direction: column; gap: 16px; }

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 80px; width: auto; }
.login-module {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}
.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.5;
}
.login-link {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  font-weight: 500;
}
.login-link:hover { text-decoration: underline; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 16px;            /* 16px stops iOS zooming into the field */
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,92,168,.13);
}
input[readonly], input.readonly-input { background: var(--gray-light); color: var(--muted); }

.form-error {
  color: var(--red);
  font-size: 14px;
  min-height: 18px;
}
.form-msg { font-size: 14px; color: var(--green); line-height: 1.5; }
.field-hint { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--blue); color: var(--white); }
.btn-primary:hover  { background: var(--blue-dark); box-shadow: 0 2px 8px rgba(26,92,168,.3); }
.btn-outline  { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover  { background: var(--blue-light); }
.btn-danger   { background: var(--red);  color: var(--white); }
.btn-danger:hover   { background: #a31f1f; }
.btn-sm       { padding: 7px 15px; font-size: 14px; }
.btn-full     { width: 100%; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 3px solid var(--blue);
  color: var(--text);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(26,44,80,.12);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { height: 52px; width: auto; display: block; }
.topbar-module {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: .8px;
  text-transform: uppercase;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.topbar-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 9px 17px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.nav-btn:hover  { background: var(--blue-light); color: var(--blue); }
.nav-btn.active { background: var(--blue); color: var(--white); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-greeting { font-size: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }

/* ── Views ────────────────────────────────────────────────────────────────── */
.view { padding: 20px; max-width: 1200px; margin: 0 auto; }
.view.hidden { display: none; }
.view-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.view-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-toolbar h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.toolbar-search { max-width: 260px; }

.admin-list { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.admin-list-item:last-child { border-bottom: none; }
.admin-list-item .item-name { font-weight: 600; }
.admin-list-item .item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.admin-list-item .item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.admin-list-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.inactive-badge { font-size: 11px; color: var(--muted); background: var(--gray-light); padding: 2px 8px; border-radius: 10px; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-sm { max-width: 340px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Badges (work) ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-timeclock { background: var(--blue-light);   color: var(--blue); }
.badge-local     { background: var(--orange-light); color: var(--orange); }
.badge-admin      { background: var(--blue);        color: var(--white); }
.badge-supervisor { background: var(--blue-mid);    color: var(--white); }
.badge-user       { background: var(--gray-light);  color: var(--muted); border: 1px solid var(--border); }
.badge-warn      { background: var(--yellow-light); color: #8a5a00; }

/* ── Filter chips (work) ──────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.chip:hover  { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* ── Sync card (admin) ────────────────────────────────────────────────────── */
.sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}
.sync-card.sync-bad { border-left-color: var(--red); }
.sync-card .sync-when { font-weight: 600; }
.sync-card .sync-detail { font-size: 13px; color: var(--muted); margin-top: 3px; }
.sync-problems { margin: 8px 0 0 18px; font-size: 13px; color: var(--red); }

/* ── User form (admin) ────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.managed-note {
  background: var(--blue-pale);
  border: 1px solid var(--blue-light);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.managed-note strong { color: var(--text); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.fieldset-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

/* ── Status + priority (work) ─────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.st-queued     { background: var(--blue-light);   color: var(--blue); }
.st-progress   { background: var(--yellow-light); color: #8a5a00; }
.st-issue      { background: var(--red-light);    color: var(--red); }
.st-complete   { background: var(--green-light);  color: var(--green); }
.st-cancelled  { background: var(--gray-light);   color: var(--muted); border: 1px solid var(--border); }

.prio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.prio-3    { background: var(--red);        color: var(--white); }
.prio-2    { background: var(--orange-light); color: var(--orange); }
.prio-1    { background: var(--gray-light); color: var(--muted); border: 1px solid var(--border); }
.prio-none { background: var(--yellow-light); color: #8a5a00; border: 1px dashed var(--yellow); }

.due { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.due-overdue  { color: var(--red); }
.due-today    { color: var(--orange); }
.due-tomorrow { color: #8a5a00; }

.type-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--blue); background: var(--blue-pale); border: 1px solid var(--blue-light);
  padding: 1px 6px; border-radius: 4px;
}

/* ── Item cards (My To-Do) ────────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: box-shadow .15s, transform .1s;
}
.item-card:hover  { box-shadow: 0 4px 16px rgba(26,92,168,.15); }
.item-card:active { transform: scale(.995); }
.item-card.p-3    { border-left-color: var(--red); }
.item-card.p-2    { border-left-color: var(--orange); }
.item-card.p-1    { border-left-color: var(--border); }
.item-card.p-none { border-left-color: var(--yellow); }
.item-card.is-issue { background: #fffafa; }
.item-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.item-card-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.item-card-title { font-size: 16px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; overflow-wrap: anywhere; }
.item-card-meta { font-size: 13px; color: var(--muted); line-height: 1.5; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.item-card-top .status-badge { margin-left: auto; }
.list-empty {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Detail view ──────────────────────────────────────────────────────────── */
/* Back: a real button that stays in view under the top bar while a long
   timeline scrolls (Devon: "needs to be more noticeable"). */
.back-bar {
  position: sticky; top: var(--topbar-h); z-index: 50;
  background: var(--bg);
  margin: -20px -20px 12px; padding: 12px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--blue);
  border: 2px solid var(--blue); border-radius: 8px;
  padding: 10px 18px; font-size: 16px; font-weight: 700; font-family: inherit;
  cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s, color .15s;
}
.back-link:hover, .back-link:focus-visible { background: var(--blue); color: var(--white); outline: none; }
.back-link .arrow { font-size: 20px; line-height: 1; }
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-title { font-size: 20px; font-weight: 700; line-height: 1.35; margin-bottom: 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.detail-field .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 2px; }
.detail-field .val { font-size: 15px; overflow-wrap: anywhere; }
.detail-text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }
.issue-banner {
  background: var(--red-light); border: 1px solid #f5c2c2; color: var(--red);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.5;
}
.issue-banner strong { display: block; margin-bottom: 4px; }

.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 8px; }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #256a29; }
.btn-warn { background: var(--surface); color: var(--red); border: 1.5px solid var(--red); }
.btn-warn:hover { background: var(--red-light); }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.num-cell { text-align: right; white-space: nowrap; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); margin-top: 5px; flex-shrink: 0; }
.tl-note .tl-dot     { background: var(--blue); }
.tl-issue .tl-dot    { background: var(--red); }
.tl-resolved .tl-dot { background: var(--green); }
.tl-status .tl-dot   { background: var(--yellow); }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.tl-issue .tl-text { color: var(--red); }
.note-box { display: flex; gap: 8px; margin-bottom: 12px; }
.note-box textarea { flex: 1; min-height: 44px; resize: vertical; }

/* ── Priority picker ──────────────────────────────────────────────────────── */
.prio-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prio-opt {
  border: 2px solid var(--border); border-radius: 8px; background: var(--surface);
  padding: 10px 6px; text-align: center; cursor: pointer; font-family: inherit; color: var(--text);
}
.prio-opt .n { display: block; font-size: 22px; font-weight: 800; line-height: 1; }
.prio-opt .l { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.prio-opt.sel-1 { border-color: var(--muted); background: var(--gray-light); }
.prio-opt.sel-2 { border-color: var(--orange); background: var(--orange-light); }
.prio-opt.sel-3 { border-color: var(--red); background: var(--red-light); }

/* ── Assignee picker ──────────────────────────────────────────────────────── */
.assign-field {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 44px; padding: 6px 8px;
  border: 1.5px solid var(--border); border-radius: 6px; background: var(--white); cursor: pointer;
}
.assign-field:hover { border-color: var(--blue); }
.assign-placeholder { color: var(--muted); font-size: 15px; font-weight: 400; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-light); color: var(--blue); border-radius: 14px;
  padding: 3px 10px; font-size: 13px; font-weight: 600;
}
.pill.pill-dept { background: var(--blue); color: var(--white); }
.picker-list { max-height: 45vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.picker-group { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); background: var(--gray-light); padding: 6px 12px; position: sticky; top: 0; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 500; font-size: 15px; cursor: pointer; flex-direction: row; }
.picker-row:last-child { border-bottom: none; }
.picker-row input { width: 18px; height: 18px; }
.picker-row .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: auto; }

/* ── Bell (notifications) ─────────────────────────────────────────────────── */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; line-height: 1;
}
.bell-btn:hover { border-color: var(--blue); }
.bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--red); color: var(--white); border-radius: 10px;
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
}
.bell-panel {
  position: absolute; right: 0; top: 48px; width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18); z-index: 300; overflow: hidden;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-popups { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--blue-pale); font-size: 13px; line-height: 1.45; border-bottom: 1px solid var(--border); }
.snooze-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bell-list { max-height: 60vh; overflow-y: auto; }
.bell-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 10px 14px; cursor: pointer; font-family: inherit; color: var(--text); }
.bell-item:hover { background: var(--blue-pale); }
.bell-item.unread { background: #f5f9ff; border-left: 4px solid var(--blue); }
.bell-item .bi-top { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.bell-item .bi-body { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.bell-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 14px; }

.unread-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--red); color: var(--white); border-radius: 10px;
  padding: 2px 8px; font-size: 12px; font-weight: 800;
}

/* ── Task chat ────────────────────────────────────────────────────────────── */
.chat-card { padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.chat-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chat-person { display: inline-flex; align-items: center; gap: 4px; background: var(--gray-light); border: 1px solid var(--border); border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.chat-person .why { font-size: 11px; color: var(--muted); }
.chat-person .x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 0 0 2px; }
.chat-person .x:hover { color: var(--red); }
.chat-tools { display: flex; gap: 6px; margin-left: auto; }
.chat-log { max-height: 55vh; min-height: 120px; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; background: #fafbfd; }
.chat-msg { max-width: 80%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg .who { font-size: 12px; color: var(--muted); margin: 0 4px 2px; }
.chat-msg.mine .who { text-align: right; }
.chat-bubble {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg.mine .chat-bubble { background: var(--blue); color: var(--white); border-color: var(--blue); border-radius: 14px 14px 4px 14px; }
.chat-bubble .mention { font-weight: 700; color: var(--blue); }
.chat-msg.mine .chat-bubble .mention { color: var(--white); text-decoration: underline; }
.chat-event { align-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 90%; }
.chat-event.ev-issue { color: var(--red); font-weight: 600; }
.chat-event.ev-resolved { color: var(--green); font-weight: 600; }
.chat-empty { align-self: center; color: var(--muted); font-size: 14px; padding: 20px 0; }
.chat-compose { position: relative; display: flex; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose textarea { flex: 1; min-height: 44px; max-height: 160px; resize: vertical; }
.chat-hint { font-size: 11px; color: var(--muted); padding: 0 18px 10px; background: var(--surface); }
.mention-list {
  position: absolute; left: 18px; bottom: 100%; margin-bottom: 4px; width: 280px; max-width: calc(100% - 36px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 60; overflow: hidden;
}
.mention-opt { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 12px; font-size: 14px; cursor: pointer; font-family: inherit; color: var(--text); }
.mention-opt.sel, .mention-opt:hover { background: var(--blue-light); color: var(--blue); }

/* ── Live-update notice ───────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--white);
  padding: 10px 18px; border-radius: 20px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 768px) { .toast { bottom: 84px; } }   /* above the bottom nav */

/* ── Small shared controls ──────────────────────────────────────────────── */
.btn-remove-line { background: none; border: 1.5px solid var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 14px; }
.btn-remove-line:hover { border-color: var(--red); color: var(--red); }
.nav-new { background: var(--blue); color: var(--white); }
.nav-new:hover { background: var(--blue-dark); color: var(--white); }

/* ── Placeholder (views built in later steps) ─────────────────────────────── */
.coming-soon {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
.mobile-nav { display: none; }

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 2px solid var(--border);
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(26,44,80,.10);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 10px;
    background: transparent;
    border: none;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    gap: 3px;
    line-height: 1.2;
    font-family: inherit;
  }
  .mobile-nav-btn .mnav-icon { font-size: 22px; line-height: 1; }
  .mobile-nav-btn.active { color: var(--blue); }

  .topbar-nav { display: none; }
  .user-greeting { display: none; }
  .topbar { padding: 0 14px; --topbar-h: 60px; }
  .topbar-logo { height: 42px; }

  #app-screen { padding-bottom: 72px; }
  .view { padding: 12px; }
  .back-bar { top: 60px; margin: -12px -12px 10px; padding: 10px 12px 8px; }   /* the phone top bar is 60px tall */
  .back-link { width: 100%; justify-content: center; padding: 12px 18px; }
  .chat-log { max-height: 60vh; padding: 12px; }
  .chat-msg { max-width: 88%; }
  .chat-compose { padding: 10px 12px 12px; }
  .chat-head { padding: 12px; }
  .chat-hint { display: none; }
  .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-width: none; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-box {
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    max-height: 90vh;
    padding: 24px 20px 32px;
  }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .login-container { margin: 32px 16px; padding: 28px 20px; }

  .form-row { flex-direction: column; }
  .toolbar-search { max-width: none; }
  .section-toolbar > .btn { width: 100%; }
  .admin-list-item { flex-direction: column; align-items: stretch; }
  .admin-list-item .item-actions .btn { width: 100%; }
  .sync-card .btn { width: 100%; }

  .action-bar .btn { flex: 1 1 45%; }
  .detail-card { padding: 14px; }
  .detail-title { font-size: 18px; }
  .note-box { flex-direction: column; }
}

/* ── Search ───────────────────────────────────────────────────────────────── */
.search-big { width: 100%; max-width: 100%; font-size: 16px; padding: 12px 14px; box-sizing: border-box; }
.search-count { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.item-card-snippet { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 14px; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.item-card-snippet .snip-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }

/* ── Sort chips ───────────────────────────────────────────────────────────── */
.sort-row { align-items: center; margin-bottom: 12px; }
.sort-label { font-size: 13px; color: var(--muted); margin-right: 2px; }

/* ── Issue notifications in the bell: red; resolutions green ──────────────── */
.bell-item.k-issue { background: #fff5f5; border-left: 4px solid var(--red); }
.bell-item.k-issue:hover { background: #ffe9e9; }
.bell-item.k-issue .bi-top { color: var(--red); font-weight: 700; }
.bell-item.k-issue .bi-body { color: var(--red); }
.bell-item.k-issue:not(.unread) { background: none; border-left: 4px solid #f1b5b5; }
.bell-item.k-resolved .bi-top { color: var(--green); font-weight: 700; }
.bell-item.k-resolved.unread { border-left-color: var(--green); background: #f4fbf6; }

/* ── "Uses Tasks" switch in the People list ───────────────────────────────── */
.item-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #b9c0c9; transition: background .15s; flex: none; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { left: 19px; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
