/* Subscription history editor. Shares the compact-row look of the add-user list beside it, with a
   card per period since a period carries nested discounts rather than being one flat row. */

.sub-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.sub-summary {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

.sub-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #fff;
    color: #4a5568;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sub-add-btn:hover:not(:disabled) {
    background: #f0faf9;
    border-color: #008080;
    color: #008080;
}

.sub-add-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.sub-period {
    padding: 10px 12px 12px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fbfdfd;
}

.sub-period-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sub-period-title {
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    margin-right: auto;
}

.sub-period-badge {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sub-badge-active {
    background: #def7ec;
    color: #046c4e;
}

.sub-badge-scheduled {
    background: #e1effe;
    color: #1e429f;
}

.sub-badge-ended {
    background: #edf2f7;
    color: #718096;
}

.sub-badge-draft {
    background: #fef3c7;
    color: #92400e;
}

.sub-fields {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.sub-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 140px;
    min-width: 0;
    margin: 0;
}

.sub-cell-plan {
    flex: 1 1 210px;
}

.sub-cell-wide {
    flex: 1 1 240px;
}

.sub-cell-narrow {
    flex: 0 1 120px;
}

.sub-cell-tiny {
    flex: 0 1 100px;
}

.sub-cell > span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
}

.sub-hint {
    font-style: normal;
    font-weight: 400;
    color: #a0aec0;
}

/* Scoped tightly: the organisation page styles bare `input` with a 10px margin that would break the
   row's alignment. */
.sub-period input,
.sub-period select {
    width: 100%;
    margin: 0;
    padding: 7px 9px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #2d3748;
    box-sizing: border-box;
}

.sub-period input:focus,
.sub-period select:focus {
    outline: none;
    border-color: #008080;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.12);
}

/* The rate card for the selected plan. Reads as a note, not a field. */
.sub-plan-summary {
    margin: 8px 0 0;
    font-size: 11px;
    color: #718096;
}

.sub-plan-summary:empty {
    display: none;
}

.sub-discounts {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.sub-discounts-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
}

.sub-add-discount {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: none;
    color: #008080;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.sub-add-discount:hover:not(:disabled) {
    color: #00565a;
}

.sub-discount-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.sub-discount-row:last-child {
    margin-bottom: 0;
}

.sub-remove {
    flex: 0 0 auto;
    width: 30px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.sub-remove:hover:not(:disabled) {
    color: #c53030;
    border-color: #feb2b2;
    background: #fff5f5;
}

.sub-empty {
    margin: 0;
    font-size: 12px;
    color: #a0aec0;
    font-style: italic;
}

.sub-disabled {
    opacity: 0.6;
}
