/* ============================================================================
   CASE NOTES (Case Note and Justification Drafter). Its own sheet, like
   Success Stories. Colors come from the tool tokens in styles.css
   (data-tool="notes", teal); nothing here hard-codes a tool color except the
   soft-check panel, which uses the shared warning yellow.
   The record button and dictation status reuse the story-record classes in
   success-stories.css.
   ============================================================================ */

/* Home: six cards fill three rows of two, so Career Pathways no longer needs
   the full-width last row (that rule only applies to an odd count). */
.tool-card:nth-child(6) { animation-delay: 300ms; }

#caseNotesPage > .page-head { margin-bottom: 2rem; }
#caseNotesPage > .page-head .feature-identifier { margin-bottom: 1rem; }
#caseNotesPage > .page-head h2 { margin: 0 0 1.25rem; }
#caseNotesPage > .page-head .page-description { margin: 0; max-width: 64ch; }
body[data-tool="notes"] #caseNotesPage.active > .page-head > h2 {
    text-decoration: underline;
    text-decoration-color: var(--tool);
    text-decoration-thickness: 3px;
    text-underline-offset: 8px;
}
#caseNotesPage [hidden] { display: none !important; }

.cn-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0 1.25rem;
}
.cn-row .form-group select,
.cn-row .form-group input { width: 100%; }

/* Date of contact (SD-69). Chrome and Safari draw a calendar button inside
   the field whose name Chrome doubles ("Show date picker Show date picker").
   Where that button can be styled it is hidden and ours shows instead, with
   one name; elsewhere (Firefox) the browser's own button stays and ours is
   not shown, so there is never a second calendar button. */
.cn-date-wrap { display: flex; gap: 0.5rem; align-items: stretch; }
.cn-date-wrap input { flex: 1 1 auto; min-width: 0; }
.cn-date-btn { display: none; }
@supports selector(::-webkit-calendar-picker-indicator) {
    #cnContactDate::-webkit-calendar-picker-indicator { display: none; }
    .cn-date-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: none;
        min-width: 44px;
        min-height: 44px;
        padding: 0 0.6rem;
        color: var(--text-primary);
        background: var(--white);
        border: 2px solid var(--border);
        border-radius: var(--radius-md);
        cursor: pointer;
    }
    .cn-date-btn:hover { border-color: var(--border-dark); }
}

.cn-justification {
    margin: 0.25rem 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
}
.cn-justification-fields { margin-top: 0.75rem; }
.cn-justification-fields .form-group { margin-bottom: 0; }

.cn-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}
.cn-check input { width: 18px; height: 18px; accent-color: var(--tool); margin: 0; }
.cn-closing { font-weight: 400; color: var(--text-muted); font-size: 0.95rem; margin: 0.25rem 0 0.5rem; }

.cn-rule {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--tool);
    background: var(--tool-tint);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-weight: 600;
    color: var(--text-primary);
}
.cn-rule svg { flex: none; margin-top: 0.1rem; color: var(--tool-text); }

.cn-text-group textarea { width: 100%; min-height: 14rem; line-height: 1.55; }
/* Near and over the length limit (SD-59). */
.cn-text-group .fly-counter[data-state="near"] { color: #92400e; font-weight: 600; }
.cn-text-group .fly-counter[data-state="over"] { color: #b91c1c; font-weight: 600; }

.cn-pii {
    margin: 0 0 1rem;
    padding: 1rem 1.25rem;
    background: #fef9c3;
    border: 1px solid #ca8a04;
    border-radius: var(--radius-md);
    color: #422006;
}
.cn-pii-head { margin: 0 0 0.5rem; }
.cn-pii-list { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.cn-pii-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(202, 138, 4, 0.35);
}
.cn-pii-list li:last-child { border-bottom: 0; }
.cn-pii-kind { font-weight: 600; }
.cn-pii-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(255, 255, 255, 0.7); padding: 0 0.3rem; border-radius: 4px; }
.cn-pii-list .link-button { color: #713f12; font-weight: 600; }
.cn-pii-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cn-pii-status { flex-basis: 100%; font-size: 0.875rem; color: #713f12; }
textarea.cn-pii-target { outline: 3px solid #ca8a04; outline-offset: 2px; transition: outline-color 1.2s ease-out; }

.cn-results { margin-top: 1.5rem; padding: 1.75rem; border-top: 5px solid var(--tool); }
.cn-results h3 { margin: 0 0 0.35rem; }
.cn-results textarea {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.55;
}
.cn-missing {
    margin: 0.5rem 0 1rem;
    padding: 1rem 1.25rem;
    background: var(--tool-tint);
    border-radius: var(--radius-md);
}
.cn-missing h4 { margin: 0 0 0.25rem; color: var(--tool-text); }
.cn-missing ul { margin: 0.35rem 0 0; padding-left: 1.25rem; }
.cn-numbers {
    margin: 0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    background: #fef9c3;
    border: 1px solid #ca8a04;
    border-radius: var(--radius-md);
    color: #422006;
}
.cn-numbers mark { background: #fde047; color: #422006; padding: 0 0.2rem; border-radius: 3px; }
.cn-tweaks { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-top: 0.75rem; }
.cn-tweaks .link-button { min-height: 44px; }

@media (max-width: 640px) {
    .cn-row { grid-template-columns: 1fr; }
    .cn-results { padding: 1.25rem; }
    #caseNotesPage .form-actions .btn { width: 100%; }
}

/* Touch targets (test report 2026-10-18, SD-29; width SD-70): the "Fix" link
   buttons in the Case Notes and Fly on the Wall identifying-info lists are
   44px in both directions, not just tall. */
.cn-pii-list .link-button { min-height: 44px; min-width: 44px; justify-content: center; }
