/* ExaGuards EMPLOYEE CONTRACTS (Frm_ContractTemplates, Usr_PositionContractTerms, Usr_EmployeeAddressTab, and later the deployments, the signing pages and the sign-in reminder).
   Inside the Usr_WinPage frame the colours are the desktop's own tokens (--inv-*, --accent ...), so light and dark follow the desktop. Every class starts ect- (short prefixes collide with the site-wide page loader).
   Narrow windows are handled by CONTAINER queries (a window on a big screen can be narrow), down to a 375 px phone. */

.ect-root { container-type: inline-size; container-name: ect; flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; color: var(--inv-text); min-width: 0; }
.ect-root > * { flex-shrink: 0; }
.ect-root *, .ect-tab *, .ect-back * { box-sizing: border-box; }
.ect-tab { color: var(--inv-text); display: flex; flex-direction: column; gap: 12px; padding: 12px 4px 20px; min-width: 0; }
.ect-muted { color: var(--inv-muted); }
.ect-small { font-size: 12.5px; }
.ect-grow { flex: 1 1 auto; }
.ect-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ect-lab { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--inv-faint); font-weight: 600; margin-bottom: 4px; }
.ect-root button:focus-visible, .ect-tab button:focus-visible, .ect-in:focus-visible, .ect-root select:focus-visible, .ect-tab select:focus-visible, .ect-back button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ect-spin { display: inline-block; animation: ectSpin 1s linear infinite; }
@keyframes ectSpin { to { transform: rotate(360deg); } }

/* layout: the list of templates and the editor */
.ect-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 14px; align-items: start; }
@container ect (max-width: 820px) { .ect-grid { grid-template-columns: minmax(0, 1fr); } }

.ect-card { background: var(--inv-card); border: 1px solid var(--inv-line); border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px rgba(0, 0, 0, .05); padding: 16px; min-width: 0; }
.ect-card > h2, .ect-sec-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.ect-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.ect-sec + .ect-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--inv-line); }

/* the list of templates */
.ect-list { display: flex; flex-direction: column; gap: 6px; }
.ect-item { appearance: none; text-align: left; width: 100%; background: var(--inv-soft); border: 1px solid var(--inv-line); color: var(--inv-text); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; }
.ect-item:hover { background: var(--inv-hover); }
.ect-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--inv-card); }
.ect-item strong { font-size: 14px; overflow-wrap: anywhere; }
.ect-item small { color: var(--inv-muted); font-size: 12px; }

.ect-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--inv-soft); border: 1px solid var(--inv-line); color: var(--inv-muted); white-space: nowrap; }
.ect-chip-good { color: var(--inv-good); background: var(--inv-good-soft); border-color: transparent; }
.ect-chip-amber { color: var(--inv-amber); background: var(--inv-amber-soft); border-color: transparent; }
.ect-chip-bad { color: var(--inv-warn); background: var(--inv-warn-soft); border-color: transparent; }

/* controls */
.ect-in { width: 100%; font: inherit; font-size: 14px; color: var(--inv-text); background: var(--inv-card); border: 1px solid var(--inv-line); border-radius: 8px; padding: 7px 10px; min-height: 36px; }
textarea.ect-in { resize: vertical; min-height: 60px; line-height: 1.4; }
.ect-in:disabled { opacity: .6; }
.ect-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--inv-text); background: var(--inv-soft); border: 1px solid var(--inv-line); border-radius: 9px; padding: 7px 14px; min-height: 36px; cursor: pointer; white-space: nowrap; }
.ect-btn:hover:not(:disabled) { background: var(--inv-hover); }
/* a button that is a link: inside a window the page's own link rule (html.exa-embedded a:not(.btn):not(.e-btn)... { color: var(--accent) }, weight 0,5,2) would win over the button colours (green text on a green button),
   so these two rules are !important (only for links that carry ect-btn) */
a.ect-btn, a.ect-btn:hover, a.ect-btn:focus { color: var(--inv-text, inherit) !important; text-decoration: none; }
a.ect-btn.ect-btn-primary, a.ect-btn.ect-btn-primary:hover, a.ect-btn.ect-btn-primary:focus { color: #fff !important; }
.ect-btn:disabled { opacity: .55; cursor: default; }
.ect-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ect-btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.ect-btn-ai { background: var(--inv-card); border-color: var(--accent); color: var(--accent); }
.ect-btn-danger { color: var(--inv-warn); }
.ect-ib { appearance: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--inv-muted); cursor: pointer; }
.ect-ib:hover:not(:disabled) { background: var(--inv-hover); color: var(--inv-text); }
.ect-ib:disabled { opacity: .35; cursor: default; }
.ect-ib-bad:hover:not(:disabled) { color: var(--inv-warn); }
.ect-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ect-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ect-fields .ect-wide { grid-column: 1 / -1; }
.ect-f { min-width: 0; }
.ect-hint { display: block; font-size: 12px; color: var(--inv-muted); margin-top: 4px; }

/* notes */
.ect-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; padding: 9px 12px; border-radius: 10px; background: var(--inv-soft); border: 1px solid var(--inv-line); color: var(--inv-muted); }
.ect-note i { margin-top: 2px; color: var(--inv-faint); }
.ect-note-bad { background: var(--inv-warn-soft); color: var(--inv-warn); border-color: transparent; }
.ect-note-bad i { color: inherit; }
.ect-note-amber { background: var(--inv-amber-soft); color: var(--inv-text); border-color: transparent; }
.ect-note-amber i { color: var(--inv-amber); }
.ect-note-good { background: var(--inv-good-soft); color: var(--inv-text); border-color: transparent; }
.ect-note-good i { color: var(--inv-good); }
.ect-draft { border-left: 4px solid var(--inv-amber); }

/* the points editor */
.ect-pts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ect-pt { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.ect-pt-n { font-weight: 700; color: var(--inv-muted); padding-top: 8px; text-align: right; font-variant-numeric: tabular-nums; }
.ect-pt-act { display: inline-flex; gap: 2px; }
.ect-pt-ai { border-color: var(--accent); }

/* tags */
.ect-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ect-tag { appearance: none; font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--inv-card); border: 1px dashed var(--inv-line); color: var(--inv-text); cursor: pointer; }
.ect-tag:hover { border-color: var(--accent); color: var(--accent); }
.ect-tag code { font-size: 11.5px; color: var(--inv-muted); margin-left: 4px; }

/* positions */
.ect-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ect-check { display: inline-flex; gap: 7px; align-items: center; font-size: 13.5px; cursor: pointer; }

/* the paper: a preview of a filled contract */
.ect-sheet { background: #fff; color: #1a1a1a; border: 1px solid var(--inv-line); border-radius: 6px; padding: 28px 34px; max-width: 760px; margin: 0 auto; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.ect-sheet h1, .ect-sheet h2, .ect-sheet h3, .ect-sheet h4 { font-family: Georgia, "Times New Roman", serif; margin: 1.1em 0 .4em; line-height: 1.25; }
.ect-sheet h1 { font-size: 22px; } .ect-sheet h2 { font-size: 18px; } .ect-sheet h3 { font-size: 16px; } .ect-sheet h4 { font-size: 15px; }
.ect-sheet p { margin: 0 0 .8em; } .ect-sheet ul, .ect-sheet ol { margin: 0 0 .8em 1.4em; padding: 0; }
.ect-sheet u { background: #FFF1C2; text-decoration-color: #B26A00; }
.ect-sheet-head { text-align: center; margin-bottom: 8px; color: #555; font-size: 12.5px; }
@container ect (max-width: 560px) { .ect-sheet { padding: 18px 16px; } }

/* tables: headers align like their values */
.ect-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ect-table th, .ect-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--inv-line); vertical-align: top; }
.ect-table th { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--inv-faint); font-weight: 600; }
.ect-table-wrap { overflow-x: auto; }

/* proposal (the AI's draft before it is kept) */
.ect-proposal { border: 1px dashed var(--accent); border-radius: 12px; padding: 12px 14px; background: var(--inv-soft); display: flex; flex-direction: column; gap: 10px; }
.ect-proposal-body { max-height: 360px; overflow: auto; }

/* "Ask AI for a point" under a list of points: one box, one button */
.ect-ask { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--inv-soft); display: flex; flex-direction: column; gap: 6px; }
.ect-ask .ect-row { flex-wrap: nowrap; }
.ect-ask-in { flex: 1 1 auto; min-width: 0; }
@container ect (max-width:520px) { .ect-ask .ect-row { flex-wrap: wrap; } .ect-ask-in { flex: 1 1 100%; } }

/* "Start from an old contract" under the main points of a template: choose a file or paste text, then one button */
.ect-import { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--inv-soft); display: flex; flex-direction: column; gap: 8px; }
.ect-pick { position: relative; display: inline-flex; }
.ect-pick-in { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.ect-pick-in:focus-visible + .ect-btn { outline: 2px solid var(--accent, #176916); outline-offset: 2px; }
.ect-pick-in:disabled { cursor: not-allowed; }
.ect-pick-in:disabled + .ect-btn { opacity: .55; }
.ect-import-file { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; padding: 3px 4px 3px 10px; border: 1px solid var(--inv-line); border-radius: 10px; background: var(--inv-card); }
.ect-import-file .ect-file-name { overflow-wrap: anywhere; font-weight: 600; font-size: 13px; min-width: 0; }
.ect-import-paste summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--inv-muted); padding: 4px 0; }
.ect-import-paste textarea { width: 100%; margin-top: 6px; resize: vertical; }
.ect-import-done { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--inv-card); border: 1px solid var(--inv-line); border-left: 4px solid var(--inv-good); }
.ect-import-facts { margin: 4px 0 0 18px; padding: 0; font-size: 13px; line-height: 1.5; color: var(--inv-muted); }
.ect-import-facts li { margin-bottom: 2px; overflow-wrap: anywhere; }
.ect-import .ect-row > .ect-btn-ai { margin-left: auto; }
@container ect (max-width:520px) { .ect-import .ect-row > .ect-btn-ai { margin-left: 0; flex: 1 1 100%; } }

/* deployments: the people / positions pickers, the three ways to sign, the progress bar */
.ect-people { display: flex; flex-direction: column; gap: 5px; max-height: 210px; overflow: auto; padding: 8px 10px; border: 1px solid var(--inv-line); border-radius: 10px; background: var(--inv-card); }
.ect-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ect-type { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border: 1px solid var(--inv-line); border-radius: 12px; background: var(--inv-soft); cursor: pointer; position: relative; }
.ect-type input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ect-type strong { font-size: 14px; display: flex; align-items: center; gap: 7px; }
.ect-type span { font-size: 12.5px; color: var(--inv-muted); line-height: 1.4; }
.ect-type.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--inv-card); }
.ect-type:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ect-bar { height: 10px; border-radius: 999px; background: var(--inv-soft); border: 1px solid var(--inv-line); overflow: hidden; margin: 6px 0; }
.ect-bar > span { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }

/* the signature box on the sheet, and the pad */
.ect-sigbox { margin-top: 24px; border: 2px dashed #8a929c; border-radius: 6px; min-height: 110px; padding: 8px 12px; position: relative; font-family: "Segoe UI", Arial, sans-serif; }
.ect-sigcap { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: #1b7a2b; margin-bottom: 6px; }
.ect-sigimg { max-height: 90px; max-width: 320px; display: block; }
.ect-sigline { margin-top: 8px; font-size: 12.5px; font-family: "Segoe UI", Arial, sans-serif; }
.ect-pad { display: block; width: 100%; max-width: 620px; height: 200px; background: #fff; border: 2px dashed #8a929c; border-radius: 8px; touch-action: none; cursor: crosshair; }

/* the reminder card on the desktop (outside any window: it uses the desktop's own tokens) */
.ect-remind { position: fixed; right: 16px; bottom: 64px; z-index: 1500; width: min(360px, calc(100vw - 32px)); background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); color: var(--text, #12301A); border: 1px solid rgba(18, 48, 26, .18); border-left: 4px solid var(--accent, #176916); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .28); padding: 12px 14px; font-family: var(--fb, "Segoe UI", Arial, sans-serif); font-size: 13px; }
[data-theme=dark] .ect-remind { background: rgba(22, 30, 25, .94); border-color: rgba(255, 255, 255, .16); }
.ect-remind.bad { border-left-color: #D32F2F; }
.ect-remind-head { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.ect-remind.bad .ect-remind-head i { color: #D32F2F; }
.ect-remind-body { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.ect-remind-row { display: flex; flex-direction: column; }
.ect-remind-row span { font-weight: 600; overflow-wrap: anywhere; }
.ect-remind-row small { color: var(--text2, #45614C); font-size: 12px; }
.ect-remind-act { display: flex; gap: 8px; justify-content: flex-end; }
.ect-remind-btn { appearance: none; font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; min-height: 34px; border-radius: 9px; border: 1px solid rgba(18, 48, 26, .22); background: transparent; color: inherit; cursor: pointer; }
.ect-remind-btn.primary { background: var(--accent, #176916); border-color: var(--accent, #176916); color: #fff; }
.ect-remind-btn:focus-visible { outline: 2px solid var(--accent, #176916); outline-offset: 2px; }

.ect-toast { position: fixed; right: 18px; bottom: 18px; background: var(--inv-card); color: var(--inv-text); border: 1px solid var(--inv-line); border-left: 4px solid var(--inv-good); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 2000; font-size: 13.5px; max-width: min(420px, 90vw); }
.ect-toast-bad { border-left-color: var(--inv-warn); }

.ect-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1990; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ect-modal { background: var(--inv-card); color: var(--inv-text); border: 1px solid var(--inv-line); border-radius: 14px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }

/* hand-signed upload: the chosen files and the reasons of a verdict */
.ect-files { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ect-file { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--inv-line); border-radius: 10px; background: var(--inv-soft); min-height: 40px; }
.ect-file-name { overflow-wrap: anywhere; font-weight: 600; font-size: 13px; min-width: 0; }
.ect-file > .ect-small { white-space: nowrap; flex: 0 0 auto; }
.ect-file { flex-wrap: wrap; }
/* in a narrow window the name gets a line of its own, the size and the three buttons sit under it */
@container ect (max-width: 520px) { .ect-file-name { flex: 1 1 100%; } .ect-file > .ect-grow { flex: 1 1 0; } }
.ect-btn-icon { padding: 6px 9px; min-width: 36px; min-height: 36px; justify-content: center; }
.ect-reasons { margin: 6px 0 0 18px; padding: 0; line-height: 1.55; font-size: 13.5px; }
.ect-reasons li { margin-bottom: 3px; overflow-wrap: anywhere; }

/* lockout: the bare layout and the lock screen.
   At the top level of the page (no desktop around it, not inside a window) the desktop's colour tokens do not exist, so the lock screen carries its own copy of the ones it uses. Inside a window (html.exa-embedded) the
   window's own tokens are used and follow the desktop's light / dark. */
html:not(.exa-embedded) .ect-lock { --accent: #176916; --inv-text: #12301A; --inv-muted: #45614C; --inv-faint: #66806C; --inv-line: #DCE8DD; --inv-soft: #EEF6EE; --inv-card: #FFFFFF; --inv-hover: #F1F8F1; --inv-good: #136019; --inv-good-soft: rgba(47, 179, 46, .18); --inv-warn: #981F19; --inv-warn-soft: rgba(220, 38, 38, .14); --inv-amber: #724A05; --inv-amber-soft: rgba(217, 119, 6, .16); font-family: Roboto, "Segoe UI", system-ui, sans-serif; }
html[data-theme=dark]:not(.exa-embedded) .ect-lock { --accent: #4CBB4B; --inv-text: #E6F4E8; --inv-muted: #A9C4AF; --inv-faint: #7F9985; --inv-line: #25382B; --inv-soft: #16271D; --inv-card: #14241A; --inv-hover: #1B3024; --inv-good: #7FE07D; --inv-good-soft: rgba(76, 187, 75, .24); --inv-warn: #FF9C94; --inv-warn-soft: rgba(248, 113, 113, .22); --inv-amber: #F5C04E; --inv-amber-soft: rgba(245, 158, 11, .22); }
.ect-lock { min-height: 100dvh; display: flex; flex-direction: column; background: var(--inv-bg, #f3f6f4); color: var(--inv-text, #14201a); }
.ect-lock-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #7a1f1f; color: #fff; font-size: 14px; flex-wrap: wrap; }
.ect-lock-msg { opacity: .92; }
.ect-lock-btn { appearance: none; font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; padding: 6px 12px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; cursor: pointer; }
.ect-lock-btn:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.ect-lock-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ect-lock-main { flex: 1 1 auto; padding: 16px; }
.ect-lock-card { max-width: 640px; margin: 6vh auto 0; padding: 26px 28px; background: var(--inv-card, #fff); border: 1px solid var(--inv-line, #d9e2dc); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .12); }
.ect-lock-card h1 { font-size: 22px; margin: 6px 0 10px; }
.ect-lock-icon { width: 48px; height: 48px; border-radius: 50%; background: rgba(122, 31, 31, .12); color: #7a1f1f; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.ect-lock-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ect-lock-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--inv-line, #d9e2dc); border-radius: 12px; background: var(--inv-soft, #f6f9f7); flex-wrap: wrap; }
[data-theme=dark] .ect-lock { background: #0f1612; color: #e6efe9; }
[data-theme=dark] .ect-lock-card { background: #16201a; border-color: rgba(255, 255, 255, .14); }
[data-theme=dark] .ect-lock-icon { background: rgba(248, 113, 113, .22); color: #FF9C94; }
