/* Tharsol Connect: documents to sign (Settings -> My documents, Admin -> HR -> Documents to sign, the signing and
   countersigning pages). Namespaced (.sg-*), Connect's tokens only, so the same in light and dark. The sections, fields,
   buttons and pills are employees.css's (.ep-*). */

.sg-page { min-height: 100vh; background: var(--bg); color: var(--text); }
.sg-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border); }
    .sg-head h1 { font-size: 16px; margin: 0; }
    .sg-head .sg-sub { color: var(--muted); font-size: 12.5px; }
    .sg-head .ep-grow { flex: 1; }
.sg-main { max-width: 980px; margin: 0 auto; padding: 16px; box-sizing: border-box; }

.sg-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; padding: 0; list-style: none; }
    .sg-steps li { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
        border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
    .sg-steps li.on { --c: var(--accent); border-color: color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); }
    .sg-steps li.done { --c: var(--ok); border-color: color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); }

.sg-pages { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
    .sg-pages button:not(.ep-link) { min-width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
    .sg-pages button.on { border-color: var(--accent); color: var(--accent); }
    .sg-pages button.done { --c: var(--ok); border-color: color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); }

.sg-sheet { position: relative; margin: 0 auto; max-width: 860px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08)); }
    .sg-sheet > img { display: block; width: 100%; height: auto; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
    .sg-sheet .sg-end { height: 1px; }
.sg-box { position: absolute; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 11px; font-weight: 700; }
    .sg-box.todo { border: 2px dashed var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); cursor: pointer; }
    .sg-box.todo:disabled { cursor: default; opacity: .7; }
    .sg-box.done { border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); background: transparent; }
    .sg-box.done img { max-width: 100%; max-height: 100%; }
    .sg-box.field { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 3px; }
    .sg-box.field.on { border-width: 2.5px; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.sg-ghost { position: absolute; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); pointer-events: none; }
.sg-place { cursor: crosshair; }

.sg-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px auto; max-width: 860px; }
    .sg-bar .ep-grow { flex: 1; }

.sg-pad { display: block; width: 100%; height: 150px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
    .sg-pad.small { height: 90px; max-width: 280px; }
.sg-pads { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.sg-tabs { display: flex; gap: 6px; margin: 0 0 10px; }

.sg-fields { display: flex; flex-direction: column; gap: 4px; }
    .sg-fields label { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
    .sg-fields label.on { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font-weight: 600; }
    .sg-fields .sg-where { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.sg-editor { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }

.sg-mono { font-family: var(--font-mono, "Roboto Mono", Consolas, monospace); font-size: 12px; word-break: break-all; color: var(--muted); }
.sg-events { font-size: 12.5px; }
    .sg-events td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Admin -> Documents to sign: a row of fields lines its boxes up along the bottom, so a label that wraps onto two lines
   doesn't push its box below the others, and a checkbox sits level with the boxes beside it. */
.sg-grid { align-items: end; }
    .sg-grid > .ep-check { min-height: 34px; }
    .sg-grid + .ep-hint { margin-top: 10px; }

/* The company certificate's details: the label column only as wide as its longest label. */
.ep-table.sg-kv { margin: 0 0 12px; }
    .ep-table.sg-kv th { width: 1%; padding-right: 28px; border-bottom-color: var(--line); vertical-align: middle; }
    .ep-table.sg-kv td { vertical-align: middle; }

@media (max-width: 720px) {
    .sg-editor, .sg-pads { grid-template-columns: 1fr; }
    .sg-main { padding: 12px; }
}
