/* ============================================================
   AGENT PROFILE — "Personnel File" (agp- prefix)
   Restyles the CONTENTS of the existing #cc-info-panel and widens that panel to
   ~520px in profile mode only. Approved per docs/agent-profile-plan.md §1/§2 — this
   is the ONLY aesthetic change; nothing else (background layers, workspace dims,
   header, shadows, sidebar) is touched. Light-only, matching the portal's tokens.
   ============================================================ */

/* Widen the info panel only when it is showing a profile. */
.cc-info-panel--profile {
    width: 520px;
    max-width: 94vw;
}

.cc-info-panel--profile .cc-info-panel-body {
    padding: 0;
}

@media (width <= 640px) {
    .cc-info-panel--profile {
        width: 100%;
        max-width: 100%;
    }
}

/* Standalone modal — the same profile opened outside the Conference Room. */
.agp-modal-overlay {
    position: fixed;
    inset: 0;

    /* Above the surfaces it launches from — .sa-popout and .ab-overlay are z-index 9000. */
    z-index: 9500;
    background: rgba(20, 20, 25, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.agp-modal {
    position: relative;
    width: 520px;
    max-width: 100%;
    background: var(--color-bg, #fff);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.agp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 6px;
    padding: 5px;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.agp-modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--color-text);
}

.agp-modal-body {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* ---- Paper document ---- */
.agp-file {
    --agp-accent: var(--color-primary-dark, #3730a3);
    --agp-paper: #fbfaf7;
    --agp-rule: rgba(35, 37, 43, 0.10);
    --agp-rule-soft: rgba(35, 37, 43, 0.06);
    --agp-serif: "Iowan Old Style", palatino, "Palatino Linotype", georgia, serif;
    --agp-mono: ui-monospace, "SF Mono", menlo, consolas, monospace;

    background: var(--agp-paper);
    color: var(--color-text);
    padding: 28px 26px 32px;
    min-height: 100%;
    box-sizing: border-box;
}

.agp-missing {
    padding: 24px;
    color: var(--color-text-faint);
}

/* ---- Header ---- */
.agp-eyebrow {
    font-family: var(--agp-mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-faint);
    margin-bottom: 14px;
}

.agp-headline {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--agp-rule);
}

.agp-seal {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--agp-accent);
    border-radius: 4px;
    font-family: var(--agp-serif);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--agp-accent);
    background: transparent;
}

.agp-headline-text {
    min-width: 0;
}

.agp-name {
    margin: 0;
    font-family: var(--agp-serif);
    font-size: 29px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--color-text);
}

.agp-subline {
    margin-top: 5px;
    font-size: 13px;
    font-style: italic;
    color: var(--color-text-muted);
}

.agp-subline .agp-role {
    color: var(--agp-accent);
    font-style: normal;
    font-weight: 500;
}

/* ---- Field grid (one column, stacked label/value) ---- */
.agp-grid {
    margin-top: 6px;
}

.agp-field {
    padding: 11px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-field-label {
    display: block;
    font-size: 10.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-faint);
    margin-bottom: 3px;
}

.agp-field-value {
    display: block;
    font-size: 14px;
    line-height: 1.45;
    color: var(--color-text);
}

.agp-live {
    color: var(--color-text-faint);
}

/* ---- Sections ---- */
.agp-section {
    margin-top: 26px;
}

.agp-section-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--agp-accent);
    padding-bottom: 7px;
    border-bottom: 1px solid var(--agp-rule);
}

/* Persona statement block */
.agp-persona {
    margin: 0;
    padding: 2px 0 2px 16px;
    border-left: 2px solid var(--agp-accent);
    font-family: var(--agp-serif);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
}

.agp-persona p {
    margin: 0 0 10px;
}

.agp-persona p:last-child {
    margin-bottom: 0;
}

.agp-principles {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.agp-principles li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--color-text-muted);
}

.agp-principles li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--agp-accent);
}

.agp-persona-extra {
    margin: 14px 0 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* Prose (statement of role) */
.agp-prose {
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text-muted);
}

.agp-prose p {
    margin: 0 0 10px;
}

.agp-prose p:last-child {
    margin-bottom: 0;
}

/* Governance clauses */
.agp-gov {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}

.agp-gov-item {
    display: flex;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-gov-item:last-child {
    border-bottom: none;
}

.agp-gov-num {
    flex-shrink: 0;
    font-family: var(--agp-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--agp-accent);
    padding-top: 1px;
}

.agp-gov-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--color-text);
}

/* Record of work (shell — hydrated in Task B) */
.agp-record {
    font-size: 13.5px;
    color: var(--color-text-muted);
}

.agp-pending {
    margin: 0;
    color: var(--color-text-faint);
}

/* Notes on file */
.agp-notes {
    display: flex;
    flex-direction: column;
}

.agp-note {
    padding: 10px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-note:last-child {
    border-bottom: none;
}

.agp-note-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
}

.agp-note-type {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--agp-accent);
}

.agp-note-date {
    font-family: var(--agp-mono);
    font-size: 11px;
    color: var(--color-text-faint);
}

.agp-note-title {
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--color-text);
}

/* Signature block */
.agp-signature {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--agp-rule);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agp-sig-label {
    font-size: 10.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-faint);
}

.agp-sig-name {
    font-family: var(--agp-serif);
    font-size: 17px;
    color: var(--color-text);
}

/* Honest line (minimal profiles) */
.agp-honest {
    margin: 22px 0 0;
    font-size: 13px;
    font-style: italic;
    line-height: 1.55;
    color: var(--color-text-muted);
}

/* Admin edit link */
.agp-actions {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--agp-rule);
}

.agp-edit-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--agp-accent);
}

.agp-edit-link:hover {
    text-decoration: underline;
}

/* ---- Record of work (hydrated ledger, Task B) ---- */
.agp-record-list {
    display: flex;
    flex-direction: column;
}

.agp-record-link {
    display: grid;
    grid-template-columns: 62px 1fr auto;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--agp-rule-soft);
    padding: 9px 0;
    cursor: pointer;
    font: inherit;
    color: var(--color-text);
}

.agp-record-link:hover {
    background: rgba(55, 48, 163, 0.04);
}

.agp-record-date {
    font-family: var(--agp-mono);
    font-size: 11px;
    color: var(--color-text-faint);
}

.agp-record-entry {
    font-size: 13.5px;
    line-height: 1.35;
    color: var(--color-text);
}

.agp-record-outcome {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.agp-record-more {
    margin-top: 6px;
}

.agp-record-more > summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--agp-accent);
    padding: 6px 0;
    list-style: none;
}

.agp-record-more > summary::-webkit-details-marker {
    display: none;
}

.agp-record-more > summary::before {
    content: "▸ ";
}

.agp-record-more[open] > summary::before {
    content: "▾ ";
}

/* Outcome/log tag colors */
.agp-tag-ok {
    color: var(--color-success, #16a34a);
}

.agp-tag-error {
    color: var(--color-error, #dc2626);
}

.agp-tag-warn {
    color: var(--color-warning, #b45309);
}

.agp-tag-info {
    color: var(--color-text-faint);
}

/* ---- Saved sign-ins (Task B, read-only; revoke in Task C) ---- */
.agp-creds {
    display: flex;
    flex-direction: column;
}

.agp-cred {
    padding: 10px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-cred:last-child {
    border-bottom: none;
}

.agp-cred-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.agp-cred-label {
    font-size: 13.5px;
    color: var(--color-text);
}

.agp-cred-status {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-faint);
}

.agp-cred-active {
    color: var(--color-success, #16a34a);
}

.agp-cred-revoked,
.agp-cred-expired {
    color: var(--color-text-faint);
}

.agp-cred-meta {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--color-text-faint);
}

/* ---- Run detail (Mission-Control-style log) ---- */
.agp-back {
    background: none;
    border: none;
    padding: 0 0 16px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--agp-accent);
}

.agp-rd-head {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--agp-rule);
}

.agp-rd-date {
    font-family: var(--agp-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-faint);
}

.agp-rd-title {
    margin: 4px 0 0;
    font-family: var(--agp-serif);
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text);
}

.agp-rd-outcome {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.agp-rd-log {
    font-family: var(--agp-mono);
    font-size: 12px;
    line-height: 1.5;
}

.agp-rd-line {
    display: grid;
    grid-template-columns: 68px 76px 1fr;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-rd-ts {
    color: var(--color-text-faint);
}

.agp-rd-tag {
    font-weight: 600;
    letter-spacing: 0.04em;
}

.agp-rd-msg {
    color: var(--color-text);
    overflow-wrap: anywhere;
}

/* ---- Memory (on file) editor — Task C ---- */
.agp-mem-group {
    margin-bottom: 18px;
}

.agp-mem-group:last-child {
    margin-bottom: 0;
}

.agp-mem-grouphead {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.agp-mem-hint {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--color-text-faint);
}

.agp-mem-empty {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-text-faint);
}

.agp-note-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-note-body {
    flex: 1;
    min-width: 0;
}

.agp-note-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1px;
}

.agp-note-item-content {
    font-size: 13px;
    line-height: 1.45;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.agp-note-del {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px 4px;
    color: var(--color-text-faint);
    border-radius: 4px;
}

.agp-note-del:hover {
    color: var(--color-error, #dc2626);
    background: rgba(220, 38, 38, 0.08);
}

.agp-note-add {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agp-note-title,
.agp-note-content {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid var(--agp-rule);
    border-radius: 6px;
    background: var(--color-bg, #fff);
    color: var(--color-text);
    resize: vertical;
}

.agp-note-title:focus,
.agp-note-content:focus {
    outline: none;
    border-color: var(--agp-accent);
}

.agp-note-addbtn {
    align-self: flex-start;
    background: var(--agp-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}

.agp-note-addbtn:disabled {
    opacity: 0.55;
    cursor: default;
}

.agp-mem-item {
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 6px 0;
    border-bottom: 1px solid var(--agp-rule-soft);
}

.agp-mem-item:last-child {
    border-bottom: none;
}

.agp-cred-forget {
    margin-top: 5px;
    background: none;
    border: 1px solid var(--agp-rule);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--color-text-muted);
}

.agp-cred-forget:hover {
    border-color: var(--color-error, #dc2626);
    color: var(--color-error, #dc2626);
}
