/* ==========================================================================
   Protech Task Portal — stylesheet
   ========================================================================== */

:root {
  /* A shade deeper than the cards sit on elsewhere, so white surfaces lift off
     the page instead of melting into it. */
  --bg:            #eef1f6;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --text:          #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;

  --primary:       #4f46e5;
  --primary-dark:  #4338ca;
  --primary-soft:  #eef2ff;

  --navy:          #1e293b;
  --navy-2:        #0f172a;

  --green:         #059669;
  --green-soft:    #ecfdf5;
  --amber:         #d97706;
  --amber-soft:    #fffbeb;
  --red:           #dc2626;
  --red-soft:      #fef2f2;
  --blue:          #2563eb;
  --blue-soft:     #eff6ff;
  --slate-soft:    #f1f5f9;

  --radius:   12px;
  --radius-sm: 8px;
  /* Two layers on purpose: a hairline that reads as the card's edge even on a
     pale background, and a soft drop beneath it. The old single soft shadow
     was invisible against --bg, which is what made every screen look flat. */
  --shadow:    0 1px 1px rgba(15,23,42,.04), 0 2px 4px rgba(15,23,42,.04), 0 8px 20px -8px rgba(15,23,42,.12);
  --shadow-lg: 0 10px 40px rgba(15,23,42,.16);

  --topbar-h: 60px;
  --sidebar-w: 236px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* `hidden` attribute must always win over any display rule below
   (otherwise .modal-host / #app / .scrim stay on screen and eat every click). */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; cursor: pointer; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--text-3); font-weight: 400; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
  transition: .15s background, .15s border-color, .15s box-shadow, .15s transform;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.3), 0 4px 12px -4px rgba(79,70,229,.45);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.94); background: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--slate-soft); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  font-size: 19px; color: var(--text-2);
}
.icon-btn:hover { background: var(--slate-soft); }

/* ---------------------------------------------------------------- fields */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea, .inp {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
  transition: .15s border-color, .15s box-shadow;
}
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-error {
  background: var(--red-soft); border: 1px solid #fecaca; color: #991b1b;
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px;
}

/* ================================================================ LOGIN */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #312e81 55%, #4f46e5 100%);
}
.login-card {
  width: min(940px, 100%);
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  background: linear-gradient(160deg, var(--navy-2), #312e81);
  color: #fff; padding: 40px 34px; display: flex; flex-direction: column;
}
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 26px; font-weight: 800;
  margin-bottom: 18px;
}
.brand-mark.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; margin: 0; }
.login-brand h1 { font-size: 30px; letter-spacing: .16em; }

/* The logo artwork has a white background, so on the dark brand panel and the
   dark top bar it sits on its own white card rather than floating. */
.brand-logo {
  display: inline-block; margin: 0 0 20px;
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(15,23,42,.25);
}
.brand-logo img { display: block; width: 236px; max-width: 100%; }

/* Only the P mark up here — the full lockup's wording is unreadable at the
   height a top bar allows, so the wordmark is set in text beside it instead. */
.tb-logo {
  display: flex; align-items: center; flex: none;
  background: #fff; border-radius: 9px; padding: 4px;
}
.tb-logo img { display: block; width: 28px; height: 28px; }
.brand-sub { color: #c7d2fe; margin: 6px 0 26px; font-size: 14px; }
.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.brand-points li { position: relative; padding-left: 24px; color: #e0e7ff; font-size: 13.5px; }
.brand-points li::before {
  content: "✓"; position: absolute; left: 0; top: -1px;
  color: #a5b4fc; font-weight: 700;
}
.brand-foot { margin-top: auto; padding-top: 28px; color: #818cf8; font-size: 12px; }

.login-form { padding: 40px 34px; }
.login-form h2 { font-size: 22px; }
.login-form > .muted { margin: 5px 0 22px; font-size: 13.5px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; font-size: 15px;
  width: 32px; height: 32px; border-radius: 6px; opacity: .55;
}
.pw-toggle:hover { background: var(--slate-soft); opacity: 1; }

/* ================================================================ SHELL */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px; position: sticky; top: 0; z-index: 40;
}
.topbar .icon-btn { color: #cbd5e1; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.1); }
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.tb-title { font-weight: 800; letter-spacing: .13em; font-size: 14px; line-height: 1.1; }
.tb-sub { font-size: 11px; color: #94a3b8; line-height: 1.2; }

.topbar-search { flex: 1; max-width: 420px; margin-left: 10px; position: relative; }

/* People results hang under the search box. Tasks keep filtering the list
   behind it, so the two kinds of result never fight for the same space. */
.search-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  max-height: 340px; overflow-y: auto;
}
.sp-head {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 14px 6px;
}
.sp-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 14px; border: none; background: transparent;
  cursor: pointer; text-align: left; border-top: 1px solid var(--border);
}
.sp-head + .sp-item { border-top: none; }
.sp-item:hover { background: var(--primary-soft); }
.sp-id { min-width: 0; flex: 1; display: block; }
.sp-name { display: block; font-weight: 650; font-size: 13.5px; }
.sp-sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.sp-count { flex: none; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.sp-empty { padding: 14px; font-size: 13px; color: var(--text-3); }
.topbar-search input {
  width: 100%; padding: 8px 13px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08);
  color: #fff; outline: none;
}
.topbar-search input::placeholder { color: #94a3b8; }
.topbar-search input:focus { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); }

.user-menu { position: relative; margin-left: auto; }
.avatar-btn { border: none; background: transparent; cursor: pointer; padding: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  letter-spacing: .02em;
}
.dropdown {
  position: absolute; right: 0; top: 46px; width: 232px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60;
}
.dd-head { padding: 14px; border-bottom: 1px solid var(--border); }
.dd-name { font-weight: 650; }
.dd-role { font-size: 12px; color: var(--primary); font-weight: 600; margin-top: 2px; }
.dd-mail { font-size: 12px; margin-top: 3px; word-break: break-all; }
.dd-item {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px; border: none; background: transparent; cursor: pointer; font-size: 13.5px;
}
.dd-item:hover { background: var(--surface-2); }
.dd-item.danger { color: var(--red); border-top: 1px solid var(--border); }

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px 10px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: .15s background, .15s color;
}
/*
 * Each icon sits in its own rounded tile. That is what carries the state: the
 * tile tints on hover and fills solid indigo when the item is the open screen,
 * so "where am I" is answered by a shape rather than by a pale lavender wash
 * that had to be hunted for. The icons are inline SVG stroked with
 * `currentColor`, so one colour rule moves the glyph with its label.
 */
.nav-item i {
  font-style: normal; width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--surface-2);
  color: var(--text-3);
  transition: .15s color, .15s background, .15s box-shadow;
}
.nav-item i svg { width: 17px; height: 17px; display: block; }

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover i { background: #e7ebf2; color: var(--text-2); }

.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 650; }
.nav-item.active i {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 6px -1px rgba(79,70,229,.5);
}
.nav-item.active:hover i { background: var(--primary-dark); color: #fff; }
.nav-item .badge {
  margin-left: auto; font-style: normal; background: var(--red); color: #fff;
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}
.nav-item .badge:empty { display: none; }
/* A rule above the label, so the two groups read as two groups rather than as
   a caption floating in the gap. */
.nav-sep {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); font-weight: 700;
  margin: 14px 10px 6px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-foot { margin-top: auto; padding-top: 14px; }
.me-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border);
}
.me-name { font-size: 13px; font-weight: 650; }
.me-role { font-size: 11.5px; color: var(--text-3); }

.content { flex: 1; min-width: 0; padding: 22px; }

/* ---------------------------------------------------------------- page */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h2 { font-size: 23px; letter-spacing: -.02em; }
.page-head p { margin: 5px 0 0; color: var(--text-3); font-size: 13px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 16px; }

/* ---------------------------------------------------------------- stats */
.stat-grid {
  display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary);
}
.stat.green::after { background: var(--green); }
.stat.amber::after { background: var(--amber); }
.stat.red::after   { background: var(--red); }
.stat.blue::after  { background: var(--blue); }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }
.stat-value { font-size: 27px; font-weight: 700; margin-top: 5px; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }

/* Grid/flex items default to min-width:auto, so a wide child (e.g. a table with
   min-width) would stop the column shrinking and push the whole page sideways. */
.grid-2 > *, .grid-3 > *, .detail-grid > *, .stat-grid > * { min-width: 0; }

/* ---------------------------------------------------------------- bars */
.bar-row { display: grid; grid-template-columns: 110px 1fr 74px; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--green); }
.bar-fill.open { background: var(--blue); }
.bar-fill.over { background: var(--red); }
.bar-meta { font-size: 12px; color: var(--text-3); text-align: right; }

/* ---------------------------------------------------------------- filters */
.filters {
  display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 14px;
  align-items: center;
}
.filters select, .filters input {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); outline: none; font-size: 13px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: .15s border-color, .15s box-shadow;
}
.filters select:hover, .filters input:hover { border-color: var(--border-strong); }
.filters select:focus, .filters input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
/* A magnifier drawn into the padding, so a search box reads as one at a glance
   rather than as a very wide empty field. */
.filters input[type="search"] {
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 15px 15px;
}

/* ---------------------------------------------------------------- task list */
.task-list { display: grid; gap: 10px; }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: var(--radius); padding: 14px 16px; cursor: pointer;
  box-shadow: var(--shadow); transition: .15s transform, .15s box-shadow;
}
.task-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(15,23,42,.1); }
.task-card.p-High { border-left-color: var(--red); }
.task-card.p-Medium { border-left-color: var(--amber); }
.task-card.p-Low { border-left-color: var(--blue); }

.tc-top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.tc-title { font-weight: 640; font-size: 15px; line-height: 1.35; }
.tc-code { font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; }
.tc-desc {
  color: var(--text-2); font-size: 13px; margin-top: 6px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tc-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 11px; font-size: 12.5px; color: var(--text-2); align-items: center; }
.tc-meta b { font-weight: 600; color: var(--text); }
.tc-progress { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; }
.tc-progress > div { height: 100%; background: var(--primary); border-radius: 999px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  border: 1px solid transparent; white-space: nowrap;
}
.tag.s-Pending      { background: var(--slate-soft); color: var(--text-2); border-color: var(--border-strong); }
.tag.s-InProgress   { background: var(--blue-soft);  color: #1d4ed8; border-color: #bfdbfe; }
.tag.s-OnHold       { background: var(--amber-soft); color: #b45309; border-color: #fde68a; }
.tag.s-Completed    { background: var(--green-soft); color: #047857; border-color: #a7f3d0; }
.tag.s-Cancelled    { background: var(--slate-soft); color: var(--text-3); border-color: var(--border-strong); }
.tag.pr-High   { background: var(--red-soft);   color: #b91c1c; border-color: #fecaca; }
.tag.pr-Medium { background: var(--amber-soft); color: #b45309; border-color: #fde68a; }
.tag.pr-Low    { background: var(--blue-soft);  color: #1d4ed8; border-color: #bfdbfe; }
.tag.overdue   { background: var(--red); color: #fff; }
.tag.dept      { background: var(--primary-soft); color: var(--primary-dark); border-color: #c7d2fe; }

/* ---------------------------------------------------------------- empty */
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty .big { font-size: 34px; opacity: .35; margin-bottom: 10px; }

/* ---------------------------------------------------------------- tree */
.tree { --indent: 22px; }
.tree-node { position: relative; }
.tree-children { margin-left: var(--indent); border-left: 1px dashed var(--border-strong); padding-left: 14px; }
.person {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 8px; transition: .15s;
}
.person:hover { border-color: var(--border-strong); background: var(--surface-2); }
.person.selectable { cursor: pointer; }
.person.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(79,70,229,.14); }
.person.locked { opacity: .55; cursor: not-allowed; }
.person .avatar { width: 34px; height: 34px; font-size: 12px; flex: none; }
.p-name { font-weight: 640; font-size: 13.5px; }
.p-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.p-right { margin-left: auto; text-align: right; display: flex; align-items: center; gap: 8px; }
.role-pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px; background: var(--slate-soft); color: var(--text-2);
}
.role-MD        { background: #1e293b; color: #fff; }
.role-DEPT_HEAD { background: #ede9fe; color: #6d28d9; }
.role-MANAGER   { background: var(--blue-soft); color: #1d4ed8; }
.role-TEAM_LEAD { background: var(--amber-soft); color: #b45309; }
.role-EXECUTIVE { background: var(--green-soft); color: #047857; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
table.tbl th {
  text-align: left; padding: 11px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 700;
  /* A tinted strip so the header reads as a header rather than a faint first
     row. Sticky, because these tables run to twenty-odd rows. */
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
/* Only round it where the table IS the card - otherwise a header sitting under
   a .card-head would get rounded corners in the middle of a card. */
.card-body > .table-wrap:first-child:last-child > table.tbl thead th:first-child { border-top-left-radius: var(--radius); }
.card-body > .table-wrap:first-child:last-child > table.tbl thead th:last-child  { border-top-right-radius: var(--radius); }

table.tbl td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: .12s background; }
table.tbl tbody tr:hover { background: var(--primary-soft); }
/* Counts line up down the column instead of wandering with the digit widths. */
table.tbl td, table.tbl th { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- permissions matrix */
.perm-tbl th:not(:first-child), .perm-tbl td:not(:first-child) { text-align: center; }
.perm-tbl th:first-child, .perm-tbl td:first-child { white-space: nowrap; }
.perm-tbl input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.perm-tbl input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .65; }
.perm-md-row { background: var(--primary-soft); }
.perm-md-row td { font-weight: 650; }

/* ---------------------------------------------------------------- modal */
.modal-host { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.modal {
  position: relative; width: min(760px, 100%); max-height: 92vh; overflow: auto;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.modal.wide { width: min(900px, 100%); }
.modal-head {
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot {
  position: sticky; bottom: 0; background: var(--surface);
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* picker inside new-task modal */
.picker {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  max-height: 290px; overflow-y: auto; padding: 10px; background: var(--surface-2);
}
.picker-hint { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }

.file-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; cursor: pointer;
  background: var(--surface-2);
}
.file-drop:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.file-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.file-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; display: inline-flex; gap: 7px; align-items: center;
}
.file-chip button { border: none; background: transparent; cursor: pointer; color: var(--red); font-weight: 700; }

/* ---------------------------------------------------------------- detail */
.detail-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; }
.kv { display: grid; grid-template-columns: 116px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-weight: 600; font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; font-weight: 550; }

.timeline { display: grid; gap: 14px; }
.tl-item { display: flex; gap: 11px; }
.tl-item .avatar { width: 32px; height: 32px; font-size: 11.5px; flex: none; }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-name { font-weight: 640; font-size: 13.5px; }
.tl-time { font-size: 11.5px; color: var(--text-3); }
.tl-text { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.55; white-space: pre-wrap; }
.tl-system { font-size: 12.5px; color: var(--text-3); font-style: italic; }
.tl-sys-row { display: flex; gap: 9px; align-items: center; padding-left: 4px; }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; }

.attach-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px;
  background: var(--surface-2); font-size: 13px;
}
.attach-item a { color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------------- toast */
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; }
.toast {
  background: var(--navy); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 330px;
  animation: toastIn .18s ease-out;
}
.toast.err { background: var(--red); }
.toast.ok  { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- misc */
.scrim { display: none; }
.only-mobile { display: none !important; }
.bottom-nav { display: none; }
.skeleton { padding: 40px; text-align: center; color: var(--text-3); }

/* ================================================================ RESPONSIVE */
@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .login-card { grid-template-columns: 1fr; }
  .login-brand { padding: 26px 24px; }
  .login-brand h1 { font-size: 24px; }
  .brand-points { display: none; }
  .brand-foot { display: none; }
  .login-form { padding: 26px 24px 30px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .only-mobile { display: flex !important; }
  .only-desktop { display: none !important; }

  .topbar-search { display: none; }
  .content { padding: 16px 14px 88px; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
    z-index: 70; transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); width: 264px; padding-top: 18px;
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 60; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    align-items: center; justify-content: space-around;
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--text-3); font-weight: 600; padding: 4px 8px; min-width: 56px;
  }
  .bn-item i { font-style: normal; display: inline-flex; }
.bn-item i svg { width: 20px; height: 20px; display: block; }
  .bn-item.active { color: var(--primary); }
  .bn-fab {
    width: 50px; height: 50px; border-radius: 50%; border: none;
    background: var(--primary); color: #fff; font-size: 26px; line-height: 1;
    box-shadow: 0 6px 18px rgba(79,70,229,.42); cursor: pointer; margin-top: -22px;
  }

  /* tighter person rows so names and role pills don't wrap on a phone */
  .card-head { flex-wrap: wrap; }
  .card-head > .muted { display: none; }
  .tree { --indent: 10px; }
  .tree-children { padding-left: 9px; }
  .person { gap: 9px; padding: 9px 10px; }
  .p-name, .p-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .p-right > .muted { display: none; }
  .role-pill { font-size: 9.5px; padding: 2px 6px; white-space: nowrap; }

  .modal { max-height: 94vh; border-radius: 14px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 15px 16px; }
  .modal-foot { padding: 12px 16px; }
  .stat-value { font-size: 23px; }
  .bar-row { grid-template-columns: 88px 1fr 60px; }
  .kv { grid-template-columns: 96px 1fr; }
  .toast-host { left: 12px; right: 12px; bottom: 86px; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head h2 { font-size: 18px; }
}

/* ================================================================ SIMPLE VIEW
   Stripped-down employee screen. `.layout` is a flex row with `.content` as
   flex:1 — hiding the sidebar simply removes it from that flex row, so the
   content already reflows to full width with no manual offset needed; we
   just cap and centre it here for readability. */
body.simple-mode .sidebar,
body.simple-mode .scrim,
body.simple-mode .bottom-nav,
body.simple-mode .topbar-search,
body.simple-mode #newTaskBtnTop {
  display: none;
}
body.simple-mode .content {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.simple-greet h2 { font-size: 21px; }
.simple-greet p { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }

.simple-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin: 18px 0;
}
.simple-stat {
  min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 10px; text-align: center;
}
.simple-stat-val { font-size: 30px; font-weight: 700; line-height: 1; color: var(--primary); }
.simple-stat.od .simple-stat-val { color: var(--red); }
.simple-stat.done .simple-stat-val { color: var(--green); }
.simple-stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 650; margin-top: 6px; }

.simple-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.simple-chip {
  min-height: 40px;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
}
.simple-chip:hover { background: var(--surface-2); }
.simple-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.simple-list { display: grid; gap: 12px; }
.simple-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; cursor: pointer; transition: .15s transform, .15s box-shadow;
}
.simple-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(15,23,42,.1); }

/* ------------------------------------------------------------------ bell */
/* Tickets raised from the app land on the administrator, who previously had no
   way of knowing until they opened Query by User. */
.bell-menu { position: relative; }
.bell-btn { position: relative; font-size: 16px; line-height: 1; }
.bell-btn.has-new { animation: bell-nudge .5s ease-in-out 1; }
@keyframes bell-nudge {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  60% { transform: rotate(9deg); }
}
@media (prefers-reduced-motion: reduce) { .bell-btn.has-new { animation: none; } }

.bell-count {
  position: absolute; top: 1px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--red, #dc2626); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.bell-pop { width: min(320px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; }
.bell-item { display: block; width: 100%; text-align: left; }
.bell-title { font-weight: 600; font-size: 13px; }
.bell-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.bell-more { font-size: 12px; color: var(--brand, #4f46e5); }
.bell-empty { padding: 16px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* A tile that leads somewhere says so, and a tile that does not stays inert —
   the admin's used to show a number with nowhere to click through to. */
.stat.clickable { cursor: pointer; transition: .15s transform, .15s box-shadow; }
.stat.clickable:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(15,23,42,.1); }

/* ------------------------------------------------------- sign-in details */
/* The one moment a password exists in the clear. It has to be readable across
   a room and copyable in one go, so: monospace, generous spacing, and the
   whole block selectable as a fallback when the clipboard API is unavailable
   (a LAN address is not a secure context). */
.creds {
  background: var(--slate-soft, #f8fafc);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 12px;
}
.creds-head { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.creds-row { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; }
.creds-row > span { flex: 0 0 74px; font-size: 11.5px; color: var(--text-3); }
.creds-row > code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13.5px; font-weight: 600; color: var(--text-1);
  word-break: break-all; user-select: all;
}
.creds-row > code.muted { font-weight: 400; font-size: 12px; color: var(--text-3); user-select: none; }
.creds .btn { margin-top: 10px; }
.creds-note { font-size: 11.5px; color: var(--text-3); margin-top: 10px; line-height: 1.5; }

/* ------------------------------------------------- login details screen */

.lg-note {
  margin: -4px 0 16px; font-size: 12px; line-height: 1.6; color: var(--text-3);
  max-width: 108ch;
}
.lg-note b { color: var(--text-2); font-weight: 650; }

/* The password is the whole point of this screen, so it is set as a token
   rather than loose text: monospace, because a lowercase l and a 1 get read
   out down a phone line, and selectable in one click. */
.lg-pw-cell { display: inline-flex; align-items: center; gap: 7px; }
.lg-pw {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  letter-spacing: .02em; user-select: all;
  background: var(--slate-soft); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}
/* Quiet until the row is under the pointer - twenty-four Copy buttons shouting
   at once is what made this column look like noise rather than an action. */
.lg-copy { opacity: 0; transition: .12s opacity; font-size: 12px; }
table.tbl tbody tr:hover .lg-copy, .lg-copy:focus-visible { opacity: 1; }
@media (hover: none) { .lg-copy { opacity: 1; } }

.lg-default {
  background: var(--amber-soft); color: #b45309; border-color: #fde68a;
  font-size: 10px; letter-spacing: .03em;
}
.lg-why { font-size: 11.5px; color: var(--text-3); font-style: italic; }

/* A task that was handed to somebody else: a record, not something to open.
   No pointer and no hover lift, so it does not promise a click it cannot keep. */
.simple-card.moved { cursor: default; background: var(--slate-soft, #f8fafc); }
.simple-card.moved:hover { transform: none; box-shadow: var(--shadow); }
.simple-card.moved .simple-card-title { color: var(--text-2); }
.tag.moved-tag { background: var(--surface); color: var(--text-3); border: 1px solid var(--border-strong); }
.simple-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.simple-card-top > * { min-width: 0; }
.simple-card-title { font-weight: 650; font-size: 16px; line-height: 1.35; }

.simple-from { display: flex; align-items: center; gap: 11px; margin-top: 12px; }
.simple-from .avatar { flex: none; }
.simple-from > div { min-width: 0; }
.simple-from-name { font-size: 13.5px; font-weight: 550; }
.simple-due { font-size: 13px; color: var(--text-3); margin-top: 2px; font-weight: 600; }
.simple-due.od { color: var(--red); }
.simple-progress-label { font-size: 12px; color: var(--text-3); margin-top: 4px; text-align: right; }

.simple-status-btns { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.simple-status-btns > * { min-width: 0; }
.simple-status-btn { min-height: 44px; font-size: 13.5px; }

.simple-range { width: 100%; height: 40px; }

@media (max-width: 420px) {
  .simple-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .simple-stat-val { font-size: 26px; }
}

/* ============================================================ ASSIGNED BY ME
   Person-grouped list: one block per person, one compact row per task.
   Deliberately lighter than .task-card — this screen only has to answer
   "who has what, and where is it", so the detail stays in the modal. */
.abm-search-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; color: var(--text-2); font-size: 13px;
}

.abm-person {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.abm-person-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.abm-person-head .avatar { flex: none; }
.abm-person-name { font-weight: 700; font-size: 14.5px; }
.abm-person-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.abm-person-count {
  margin-left: auto; flex: none; text-align: right;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.abm-person-count .od { color: var(--red); }

.abm-rows > .abm-row + .abm-row { border-top: 1px solid var(--border); }
.abm-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; cursor: pointer;
}
.abm-row:hover { background: var(--primary-soft); }
.abm-row-main { min-width: 0; flex: 1; }
.abm-code { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .3px; }
.abm-title {
  font-size: 14px; font-weight: 600; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.abm-row-meta { display: flex; align-items: center; gap: 12px; flex: none; }
.abm-due { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.abm-due.od { color: var(--red); }
.abm-n { opacity: .6; }

@media (max-width: 820px) {
  .abm-row { flex-wrap: wrap; gap: 6px 10px; }
  .abm-row-main { flex: 1 0 100%; }
  .abm-title { white-space: normal; }
  .abm-row-meta { width: 100%; justify-content: flex-start; }
  .abm-person-count { font-size: 12px; }
}
