/* app/directory/directory.css — rules extracted VERBATIM from
   pace_platform_v8.html. The prototype is the spec; do not restyle. */

:root{
  --navy:#1a1a1a; --accent:#637947; --blue:#2563eb;
  --text:#1f2937; --muted:#6b7280; --border:#e5e7eb; --bg:#f7f7f5;
  --card-shadow:0 1px 2px rgba(16,24,40,.04);
}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  color:var(--text);background:var(--bg);font-size:13px}
.topbar{background:var(--navy);color:#fff;padding:12px 24px;
  display:flex;align-items:center;gap:14px}
.topbar .dm-mark{display:inline-flex;align-items:center}
.topbar .pyr{width:34px;height:34px;color:#fff;flex-shrink:0}
.topbar .bname{font-size:18px;font-weight:800;letter-spacing:1px;line-height:1;padding-right:16px;border-right:1px solid rgba(255,255,255,.25)}
.topbar .bname .rv-a{color:var(--accent)}
.topbar .bname .rv-b{color:#9ca3af;font-weight:600}
.topbar .who{margin-left:auto;display:flex;align-items:center;gap:10px;
  font-size:12px;color:rgba(255,255,255,.75)}
.topbar a{color:rgba(255,255,255,.8);text-decoration:none;font-size:12px}
.topbar a:hover{color:#fff}
.topbar .page-name{font-size:14px;font-weight:500;letter-spacing:1px;text-transform:uppercase}
.topbar .who-label{font-size:11px;color:rgba(255,255,255,.7);margin-right:6px}
/* Sign out had no rule here and rendered as the browser's default white
   button (6 Sep). Same outline style as the dashboard and both registers. */
.topbar .logout{background:transparent;border:1px solid rgba(255,255,255,.25);color:rgba(255,255,255,.85);
  padding:5px 12px;border-radius:6px;font-size:11px;font-family:inherit;cursor:pointer}
.topbar .logout:hover{background:rgba(255,255,255,.1)}
/* Tab bar — the register pages' .tabs/.tab rules, so all three pages
   navigate identically. Added 5 Sep, not from the prototype. */
.tabs{background:#000;padding:0 24px;display:flex;gap:2px;flex-shrink:0}
.tab{padding:10px 18px;color:rgba(255,255,255,.55);font-size:13px;font-weight:500;letter-spacing:1px;border:none;background:transparent;font-family:inherit;text-decoration:none;border-radius:6px 6px 0 0;display:inline-flex;align-items:center;gap:8px;transition:color .15s,background .15s}
a.tab:hover{color:rgba(255,255,255,.85);background:rgba(255,255,255,.05)}
.tab.active{color:var(--navy);background:var(--bg)}
.wrap{max-width:1180px;margin:0 auto;padding:26px 24px 70px}
.page-h h1{font-size:19px;font-weight:700;color:var(--navy);margin:0 0 4px}
.page-h .sub{color:var(--muted);font-size:12px}
.dir-note{background:#f0f4ec;border:1px solid #d5dfc8;border-radius:9px;
  padding:12px 14px;font-size:11.5px;line-height:1.6;color:#41502f;margin:16px 0}

.dir-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.dir-toolbar .btn { padding: 7px 13px; border: 1px solid #d1d5db; background: #fff; border-radius: 7px; font-size: 12px; cursor: pointer; }
.dir-toolbar .btn:hover { border-color: var(--accent); color: var(--accent); }
.dir-toolbar .btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.co-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); margin-bottom: 14px; overflow: hidden; }
.co-head { padding: 13px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); background: #fcfcfd; }
.co-head h3 { font-size: 14px; color: var(--navy); }
.co-type { font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; padding: 3px 9px; border-radius: 10px; text-transform: uppercase; }
.co-type.builder { background: #1a1a1a; color: #fff; }
.co-type.developer { background: #dbeafe; color: #1e40af; }
.co-type.architect { background: #fce7f3; color: #9d174d; }
.co-type.consultant { background: #ede9fe; color: #5b21b6; }
.co-type.subcontractor { background: #f3f4f6; color: #4b5563; }
.co-mods { display: flex; gap: 5px; flex-wrap: wrap; }
.co-mods span { font-size: 9.5px; background: #f3f4f6; color: var(--muted); padding: 2px 8px; border-radius: 8px; }
/* One look for every control on a company card or person row. */
.co-addp,
.co-head .co-remove,
.co-head .co-revoke-all,
.person-row .pr-act {
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--navy);
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.co-addp:hover,
.co-head .co-remove:hover,
.co-head .co-revoke-all:hover,
.person-row .pr-act:hover { background: #f7f7f5; text-decoration: none; }
/* Taking a firm off the project, or locking out a whole firm at once,
   reads red. Revoking one person does not: Nathan, 22 Oct, "Change
   revoke access to black like add person". It is an everyday action on
   a row, done once per leaver, and a row of red down the card made the
   ordinary look alarming. The two that act on the whole company keep
   the colour, which is the distinction worth drawing. */
.co-head .co-remove,
.co-head .co-revoke-all { color: #b91c1c; border-color: #fca5a5; }
.co-head .co-remove:hover,
.co-head .co-revoke-all:hover { background: #fef2f2; }

/* Add person sits under the people it adds to, not in the header. */
.co-addp-row { padding: 8px 18px 12px; }
.co-head .co-edit { font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0 4px; }
.co-head .co-edit:hover { color: var(--accent); }
.dir-section { margin-bottom: 24px; }
.dir-section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.dir-section-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy); font-weight: 700; }
.dir-section-head .sec-count { font-size: 11px; color: var(--muted); }
.sec-add { margin-left: auto; white-space: nowrap; padding: 7px 14px; border: 1px solid var(--accent); background: var(--accent); border-radius: 7px; font-size: 12px; cursor: pointer; color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.sec-add:hover { background: #4e5d38; border-color: #4e5d38; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; background: #ede9fe; color: #5b21b6; padding: 2px 7px; border-radius: 8px; }
.tag-chip.trade { background: #e0f2fe; color: #075985; }
.tag-chip .x { cursor: pointer; font-weight: 700; opacity: 0.6; }
.tag-chip .x:hover { opacity: 1; }
.co-editrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 18px; background: #faf7ff; border-top: 1px dashed #e9d5ff; }
.co-editrow select { padding: 6px 9px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 11.5px; font-family: inherit; }
.co-editrow label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.co-editrow input { flex: 1; padding: 6px 9px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 11.5px; font-family: inherit; }
.co-editrow button { padding: 6px 12px; background: var(--navy); color: #fff; border: 0; border-radius: 6px; font-size: 11.5px; cursor: pointer; }
.person-row { display: grid; grid-template-columns: 1.2fr 1.6fr 130px 90px 220px auto; gap: 10px; align-items: center; padding: 9px 18px; border-bottom: 1px solid #f3f4f6; font-size: 12px; }
.person-row:last-child { border-bottom: 0; }
.person-row .pr-name { font-weight: 600; color: var(--navy); }
.person-row .pr-email { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }

.dir-note { font-size: 11px; color: var(--muted); background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 9px 13px; margin-bottom: 16px; line-height: 1.5; }

/* Membership management (5 Sep) */
.person-row .pr-role{font:inherit;font-size:11px;padding:3px 6px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:var(--text);max-width:130px}


/* Shared confirm dialog + toast, the registers' rules (5 Sep). */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: none; align-items: center; justify-content: center; z-index: 360; backdrop-filter: blur(2px); }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 12px; max-width: 580px; width: 92%; max-height: 80vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 16px; color: var(--navy); margin: 0; }
.modal-head .close { margin-left: auto; cursor: pointer; padding: 4px 10px; border-radius: 4px; color: var(--muted); }
.modal-head .close:hover { background: #f3f4f6; }
.modal-body { padding: 18px 24px; font-size: 13px; line-height: 1.55; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.btn { padding: 8px 14px; min-height: 32px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 13px; opacity: 0; transition: all 0.25s; z-index: 380; max-width: 420px; line-height: 1.5; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.person-row .pr-company { font: inherit; font-size: 11px; padding: 3px 6px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: var(--text); min-width: 210px; }

/* Add-company dialog + green actions (6 Sep) */
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: #4e5d38; border-color: #4e5d38; }
.ei { width: 1.05em; height: 1.05em; vertical-align: -0.16em; margin-right: 4px; flex-shrink: 0; }
.dam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.dam-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dam-grid label.wide { grid-column: 1 / -1; }
.dam-grid input, .dam-grid select { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; color: var(--text); background: #fff; }
.dam-msg { font-size: 12.5px; color: #991b1b; margin-top: 10px; min-height: 1.2em; }
.dir-section .sec-add { margin-left: 0; }
.dir-section-head .sec-add { margin-left: auto; }

/* ---- the project-role list (0055) ---------------------------------
   Rows, not chips: each one carries a name you can correct in place,
   the section it files a firm under, and — only for a role somebody
   here added — a way to take it off the list again. */
.role-list { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.role-row {
  display: grid; grid-template-columns: 1fr auto 22px;
  align-items: center; gap: 8px;
}
.role-row .rl-label,
.role-row .rl-label-ro {
  font: inherit; font-size: 11.5px; color: var(--navy);
  padding: 5px 8px; border-radius: 6px; min-width: 0;
}
.role-row .rl-label { border: 1px solid transparent; background: transparent; }
.role-row .rl-label:hover  { border-color: var(--border); background: #fff; }
.role-row .rl-label:focus  { border-color: var(--border); background: #fff; outline: 2px solid rgba(99,121,71,.35); outline-offset: -1px; }
.role-row .rl-kind {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.role-row .rl-remove {
  font: inherit; font-size: 15px; line-height: 1;
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  border: 1px solid #fca5a5; background: #fff; color: #b91c1c; cursor: pointer;
}
.role-row .rl-remove:hover { background: #fef2f2; }
.role-row .rl-std { font-size: 9.5px; color: var(--muted); text-align: right; }
.role-add { display: flex; gap: 6px; margin-top: 8px; }
.role-add #new-role { flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 11.5px; }
.role-add #new-role-kind { padding: 6px 7px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 11px; }

/* ---- the Trades and Disciplines lists (0063) ------------------------
   Chips rather than rows, because there are twenty-odd trades and a
   column of rows that long is worse than a wrap. The name is an input
   styled flat until you touch it, same as the Project roles list beside
   it: a trade a sample is on cannot be deleted, so renaming is the only
   way to correct one. */
.ml-chips { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ml-chip { display: inline-flex; align-items: center; gap: 2px; }
.ml-chip .ml-name {
  font: inherit; font-size: inherit; color: inherit;
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  padding: 1px 3px; margin: -1px 0; min-width: 2em;
}
.ml-chip .ml-name:hover { border-color: rgba(0, 0, 0, .18); background: rgba(255, 255, 255, .65); }
.ml-chip .ml-name:focus {
  border-color: rgba(0, 0, 0, .28); background: #fff;
  outline: 2px solid rgba(99, 121, 71, .35); outline-offset: -1px;
}
.ml-chip .x { cursor: pointer; opacity: .55; padding: 0 2px; }
.ml-chip .x:hover { opacity: 1; color: #b91c1c; }
.ml-add { display: flex; gap: 6px; margin-top: 8px; }
.ml-add .ml-new {
  flex: 1; min-width: 0; padding: 6px 9px;
  border: 1px solid #d1d5db; border-radius: 6px; font-size: 11.5px; font-family: inherit;
}

/* ---- organisation administrators (0069) ----------------------------
   Sits inside the "who may edit this directory" card, because who
   administers the organisation and who may edit its directory are the
   same question asked twice. */
.org-admins { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.org-admins .oa-list { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.org-admins .oa-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 10px;
  background: #eef3e9; color: #3f4a2e; border: 1px solid #d7e2c9;
}
.org-admins .oa-chip .x { cursor: pointer; opacity: .55; padding: 0 1px; font-size: 13px; }
.org-admins .oa-chip .x:hover { opacity: 1; color: #b91c1c; }
.org-admins .oa-add { margin-top: 8px; }
.org-admins .oa-add select {
  font: inherit; font-size: 11.5px; padding: 6px 9px;
  border: 1px solid #d1d5db; border-radius: 6px; background: #fff; max-width: 100%;
}
