/* Custom fields builder on the issue and epic forms (field menu, field cards, chips). */

/* custom fields panel */
.cf-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cf-title {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--text);
}

.cf-sub {
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: 2px;
}

.cf-add {
    position: relative;
    flex: none;
}

.cf-add-btn {
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 7px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.cf-add-btn:hover {
    background: #2f4cc4;
}

.cf-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 250px;
    padding: 6px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(9, 30, 66, .18);
}

.cf-menu.open {
    display: block;
}

.cf-menu-title {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 14px 8px;
}

.cf-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    font-size: var(--fs-sm);
    color: var(--text);
    text-align: left;
    padding: 8px 14px;
    cursor: pointer;
}

.cf-menu button + button {
    border-top: 1px solid var(--surface-3);
}

.cf-menu button:hover,
.cf-menu button:focus-visible {
    background: var(--surface-3);
    outline: none;
}

.cf-menu button small {
    color: var(--muted);
    font-size: var(--fs-xs);
}

.cf-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: var(--fs-2xs);
    font-weight: 700;
    line-height: 1;
}

.ci-textarea {
    background: #F3E8FF;
    color: #7E22CE;
}

.ci-text {
    background: #E0EDFF;
    color: #1D4ED8;
    font-family: Georgia, serif;
    font-size: var(--fs-sm);
}

.ci-date {
    background: #E0E7FF;
    color: var(--primary-hover);
}

.ci-number {
    background: #E0F2FE;
    color: #0369A1;
    font-size: var(--fs-2xs);
}

.ci-dropdown {
    background: #DCFCE7;
    color: #15803D;
    font-size: var(--fs-2xs);
}

.ci-checkbox {
    background: #EDE9FE;
    color: #6D28D9;
}

.ci-money {
    background: #D1FAE5;
    color: #047857;
}

.cf-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.cf-card {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 14px;
    background: #fff;
}

.cf-card:focus-within {
    border-color: #B3C7F7;
    box-shadow: 0 0 0 3px rgba(59, 91, 219, .08);
}

.cf-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.cf-label {
    flex: 1;
    min-width: 0;
    border: none;
    border-bottom: 1px dashed transparent;
    background: none;
    outline: none;
    padding: 2px 0;
    font: inherit;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text);
}

.cf-label::placeholder {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--faint-ink);
}

.cf-label:hover {
    border-bottom-color: var(--border);
}

.cf-label:focus {
    border-bottom-color: var(--accent);
}

.cf-del {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: none;
    color: var(--faint-ink);
    font-size: var(--fs-lg);
    line-height: 1;
    cursor: pointer;
}

.cf-del:hover {
    background: var(--danger-soft);
    color: #DC2626;
    border-color: #FCA5A5;
}

.cf-input {
    width: 100%;
    box-sizing: border-box;
}

textarea.cf-input {
    resize: vertical;
    min-height: 64px;
    line-height: 1.5;
}

.cf-narrow {
    max-width: 240px;
}

.cf-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    cursor: pointer;
}

.cf-check input {
    width: 16px;
    height: 16px;
}

.cf-money {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    overflow: hidden;
}

.cf-money:focus-within {
    border-color: var(--accent);
    background: #fff;
}

.cf-money .cf-cur {
    border: none;
    border-right: 1px solid var(--border);
    background: #F1F3F7;
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 0 6px;
    cursor: pointer;
    outline: none;
}

.cf-money .cf-amt {
    border: none;
    background: none;
    font: inherit;
    font-size: var(--fs-sm);
    padding: 7px 10px;
    width: 170px;
    outline: none;
}

.cf-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.cf-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 9px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-size: var(--fs-xs);
    font-weight: 500;
}

.cf-chip button {
    border: none;
    background: none;
    color: #6366F1;
    cursor: pointer;
    font-size: var(--fs-md);
    line-height: 1;
    padding: 0 3px;
    border-radius: 50%;
}

.cf-chip button:hover {
    background: #C7D2FE;
}

.cf-opt-input {
    flex: 1;
    min-width: 170px;
    border: 1px dashed var(--border);
    border-radius: 7px;
    background: none;
    font: inherit;
    font-size: var(--fs-xs);
    padding: 5px 8px;
    outline: none;
}

.cf-opt-input:focus {
    border-style: solid;
    border-color: var(--accent);
}

.cf-empty {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 9px;
    padding: 20px 16px;
    font-size: var(--fs-sm);
    color: var(--muted);
}

.cf-empty b {
    color: var(--text);
}

/* "N fields carried over from other issues in EPIC" above the field list */
.cf-tpl-note {
    margin-top: 14px;
    padding: 8px 11px;
    border-radius: 7px;
    font-size: var(--fs-xs);
    line-height: 1.45;
    background: #EEF4FF;
    border: 1px solid #C9DAFF;
    color: #1E3A8A;
}

.cf-tpl-note[hidden] {
    display: none;
}

.cf-tpl-note + .cf-list {
    margin-top: 10px;
}

/* A multi-line text field's value, keeping its line breaks. */
.cf-multiline {
    white-space: pre-line;
}

/* Two fields with the same name: both outlined, with a note under the name
   (custom-fields.js cfMarkDuplicates). Saving is refused until they differ. */
.cf-card.is-dup {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}
.cf-card.is-dup .cf-label {
    color: var(--danger-ink);
    border-bottom-color: var(--danger);
}
.cf-dup-note {
    margin: -2px 0 8px;
    font-size: var(--fs-2xs);
    font-weight: 500;
    line-height: 1.35;
    color: var(--danger);
}
.cf-dup-note[hidden] {
    display: none;
}
