/* ================================================================
   pvi-encryption-keys.css
   Page-specific CSS (Block 2) for pvi-encryption-keys.
   The engine substitutes this filename into the master frame's
   <<stylesheet>> marker at render. Colors come from the :root
   variables declared in pvi-master-frame.css — no hardcoded hex.
   ================================================================ */

/* Centered single-column wrapper */
.keys-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1rem 3rem;
}

/* Card (matches the system-wide .su-section card pattern) */
.su-section {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    padding: 1.75rem 1.75rem 2rem;
    margin-bottom: 1.5rem;
}
.su-section h3 {
    margin: 0 0 1.25rem;
    padding-bottom: .65rem;
    border-bottom: 2px solid var(--rule);
    font-size: 1.25rem;
    color: var(--dark-grey);
}

/* Intro copy */
.keys-desc {
    margin: 0 0 1.5rem;
    font-size: .95rem;
    line-height: 1.55;
    color: var(--dark-grey);
}

/* Error slot — toggled via <<error_class>> ('' hidden, 'is-shown' visible),
   text supplied by <<error_message>>. Reuses the dictionary §11.5 contract. */
.error-block {
    display: none;
    margin: 0 0 1.25rem;
    padding: .7rem 1rem;
    font-size: .9rem;
    line-height: 1.45;
    color: var(--dull-red);
    background: var(--dull-red-bg);
    border-left: 4px solid var(--dull-red);
    border-radius: 6px;
}
.error-block.is-shown { display: block; }

/* Create-key form */
.keys-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.keys-lbl {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--mid-grey);
}
.req { color: var(--dull-red); }
.keys-grid input {
    width: 100%;
    padding: .55rem .7rem;
    font-size: .95rem;
    color: var(--dark-grey);
    background: var(--white);
    border: 1px solid var(--light-grey);
    border-radius: 6px;
    font-family: inherit;
}
.keys-grid input:focus {
    outline: none;
    border-color: var(--dull-blue);
    box-shadow: 0 0 0 3px var(--focus-ring-blue);
}
.keys-note {
    margin: 0 0 1.5rem;
    font-size: .8rem;
    line-height: 1.45;
    color: var(--mid-grey);
}
.keys-submit-btn {
    width: 100%;
    padding: .7rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background: var(--green);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.keys-submit-btn:hover { background: var(--green-hover); }

/* Org-key lineage table — body rows supplied by <<rows>> */
.keys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.keys-table th {
    text-align: left;
    padding: .5rem .65rem;
    border-bottom: 2px solid var(--rule);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mid-grey);
}
.keys-table td {
    padding: .7rem .65rem;
    border-bottom: 1px solid var(--rule);
    color: var(--dark-grey);
    vertical-align: middle;
}
.keys-table tr:last-child td { border-bottom: none; }
.key-label { font-weight: 600; }
.keys-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--mid-grey);
    font-size: .9rem;
}

/* Status badges — active / expired / revoked (account_key_status ENUM) */
.tag {
    display: inline-block;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: capitalize;
}
.tag-active  { background: var(--surface); color: var(--green);    border: 1px solid var(--green); }
.tag-expired { background: var(--surface); color: var(--mid-grey); border: 1px solid var(--light-grey); }
.tag-revoked { background: var(--dull-red-bg); color: var(--dull-red); border: 1px solid var(--dull-red); }

/* Return-to-dashboard action — secondary nav below the cards */
.keys-actions {
    margin-top: 1.5rem;
    text-align: center;
}
.keys-dashboard-btn {
    display: inline-block;
    padding: .7rem 1.6rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background: var(--mid-grey);
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}
.keys-dashboard-btn:hover { background: var(--mid-grey-hover); }

/* Responsive */
@media (max-width: 560px) {
    .keys-grid { grid-template-columns: 1fr; }
    .keys-wrap { padding: 1.5rem .75rem 2.5rem; }
    .su-section { padding: 1.25rem 1.25rem 1.5rem; }
}
