.m16-history-heading {
    align-items: flex-start;
}

.m16-history-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.m16-history-summary article {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border, #dfe5e8);
    border-radius: 14px;
    background: var(--surface, #fff);
}

.m16-history-summary span,
.m16-history-summary small {
    display: block;
    color: var(--muted, #66757d);
}

.m16-history-summary strong {
    display: block;
    margin: 5px 0 3px;
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.m16-history-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 16px;
    margin-bottom: 16px;
}

.m16-history-panel,
.m16-timeline-panel {
    min-width: 0;
}

.m16-handoff-list {
    display: grid;
    gap: 10px;
}

.m16-handoff-card {
    border: 1px solid var(--border, #dfe5e8);
    border-radius: 12px;
    padding: 14px;
}

.m16-handoff-route {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.m16-handoff-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
    margin: 0;
}

.m16-handoff-card dt {
    color: var(--muted, #66757d);
    font-size: .78rem;
}

.m16-handoff-card dd {
    margin: 2px 0 0;
    font-weight: 650;
}

.m16-task-timeline {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    position: relative;
}

.m16-task-timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border, #dfe5e8);
}

.m16-task-timeline > li {
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 12px;
}

.m16-timeline-marker {
    width: 12px;
    height: 12px;
    margin: 16px 0 0 6px;
    border-radius: 50%;
    background: #66757d;
    box-shadow: 0 0 0 4px var(--surface, #fff);
    z-index: 1;
}

.m16-task-timeline .is-assignment .m16-timeline-marker { background: #7c3aed; }
.m16-task-timeline .is-status .m16-timeline-marker { background: #d97706; }
.m16-task-timeline .is-work .m16-timeline-marker { background: #0f766e; }
.m16-task-timeline .is-attention .m16-timeline-marker { background: #b91c1c; }
.m16-task-timeline .is-completion .m16-timeline-marker { background: #15803d; }
.m16-task-timeline .is-operational .m16-timeline-marker { background: #2563eb; }

.m16-timeline-card {
    border: 1px solid var(--border, #dfe5e8);
    border-radius: 12px;
    padding: 13px 14px;
    background: var(--surface, #fff);
}

.m16-timeline-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.m16-timeline-card header strong,
.m16-timeline-card header span {
    display: block;
}

.m16-event-kind {
    margin-bottom: 2px;
    color: var(--muted, #66757d);
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.m16-timeline-card time,
.m16-timeline-card small {
    color: var(--muted, #66757d);
    font-size: .78rem;
}

.m16-timeline-card p {
    margin: 7px 0 4px;
}

.m16-history-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border, #dfe5e8);
}

.m16-history-details summary {
    cursor: pointer;
    font-weight: 700;
}

.m16-history-details > div {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 9px;
    background: var(--surface-muted, #f6f8f9);
}

/* Admin record lifecycle controls are loaded globally with the v1.6 history CSS. */
.m16-record-lifecycle-card {
    margin-top: 16px;
}

.m16-record-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.m16-record-actions form {
    margin: 0;
}

.m16-danger-button {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #d7a6a6;
    border-radius: 7px;
    background: #fff7f7;
    color: #9f2f2f;
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.m16-danger-button:hover {
    border-color: #bd7777;
    background: #fff0f0;
}

.m16-danger-button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

@media (max-width: 1000px) {
    .m16-history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .m16-history-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .m16-history-summary { grid-template-columns: 1fr; }
    .m16-handoff-card dl { grid-template-columns: 1fr; }
    .m16-timeline-card header { display: block; }
    .m16-timeline-card time { display: block; margin-top: 4px; }
    .m16-record-actions { align-items: stretch; }
    .m16-record-actions form,
    .m16-record-actions button { width: 100%; }
}
