/* ============================================================================
   Quote Workflow Simplification — Phase 2C-4b-7
   ============================================================================
   Always-editable master quote view, autosave indicator, status timeline.
   Builds on the existing master.css design language (heavy borders,
   Fraunces / Inter, magenta + yellow accents).
*/

.cpp-quote-edit {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

.cpp-quote-edit__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #161616;
}

.cpp-quote-edit__title {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.cpp-quote-edit__num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    color: #c61b6f;
}

.cpp-quote-edit__sub {
    font-size: 0.95rem;
    color: #444;
    margin: 0;
}

.cpp-quote-edit__status-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.cpp-locked-pill {
    background: #f3f3f3;
    border: 2px solid #161616;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
}

.cpp-back {
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
}
.cpp-back:hover { color: #161616; text-decoration: underline; }

/* ============== TWO-COLUMN LAYOUT ============== */
.cpp-quote-edit__layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
}
@media (max-width: 1100px) {
    .cpp-quote-edit__layout { grid-template-columns: 1fr; }
}

.cpp-quote-edit__main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cpp-quote-edit__section {
    background: #fffaf0;
    border: 2px solid #161616;
    padding: 1.25rem;
}

.cpp-quote-edit__h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cpp-quote-edit__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

/* ============== FIELDS ============== */
.cpp-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.cpp-field--full { grid-column: 1 / -1; }

.cpp-field__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.cpp-field__hint {
    font-style: italic;
    font-weight: 400;
    color: #666;
    text-transform: none;
    letter-spacing: 0;
}

.cpp-field input[type="text"],
.cpp-field input[type="email"],
.cpp-field input[type="tel"],
.cpp-field input[type="number"],
.cpp-field input[type="date"],
.cpp-field textarea {
    border: 2px solid #161616;
    background: #fff;
    padding: 0.55rem 0.7rem;
    font: inherit;
    width: 100%;
}
.cpp-field input:focus,
.cpp-field textarea:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px #ffd000;
}
.cpp-field input:disabled,
.cpp-field textarea:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

/* ============== LINE ITEMS ============== */
.cpp-quote-items__list {
    border: 2px solid #161616;
    background: #fff;
    margin-bottom: 1rem;
}

.cpp-line-item {
    display: grid;
    grid-template-columns:
        minmax(180px, 1.4fr)   /* name */
        minmax(200px, 2fr)     /* config */
        70px                   /* qty */
        100px                  /* price */
        80px                   /* discount */
        90px                   /* total */
        30px;                  /* remove */
    gap: 0.5rem;
    align-items: center;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #ddd;
}
.cpp-line-item:last-child { border-bottom: none; }
.cpp-line-item:nth-child(even) { background: #fafaf2; }

.cpp-line-item__name {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cpp-line-item__name strong {
    font-size: 0.95rem;
}
.cpp-line-item__sku {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #888;
}

.cpp-line-kind {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    width: fit-content;
}
.cpp-line-kind--product { background: #ffe0ef; color: #b91656; }
.cpp-line-kind--service { background: #fff3c4; color: #946800; }

.cpp-line-item__config-static {
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 0.2rem;
}
.cpp-line-item__desc-input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 0.3rem 0.4rem;
    font-size: 0.85rem;
    background: transparent;
}
.cpp-line-item__desc-input:focus {
    outline: none;
    border-color: #161616;
    background: #fff;
}

.cpp-line-item__qty input,
.cpp-line-item__discount input {
    width: 100%;
    border: 1px solid #161616;
    padding: 0.3rem;
    text-align: center;
    font: inherit;
}
.cpp-line-item__price-input {
    width: 75px;
    border: 1px solid #161616;
    padding: 0.3rem;
    font: inherit;
}
.cpp-line-item__total {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}
.cpp-line-item__remove {
    background: transparent;
    border: none;
    color: #c61b6f;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.cpp-line-item__remove:hover {
    color: #fff;
    background: #c61b6f;
    border-radius: 50%;
}

.cpp-quote-items__empty {
    padding: 2rem;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* ============== ADD LINE ============== */
.cpp-quote-items__add {
    border: 2px dashed #c61b6f;
    background: #fff5fa;
    padding: 1rem;
}
.cpp-quote-items__add-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #161616;
}
.cpp-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 0.8rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    color: #666;
}
.cpp-tab:hover { color: #161616; }
.cpp-tab--on {
    color: #c61b6f;
    border-bottom-color: #c61b6f;
}

.cpp-quote-items__add-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) auto;
    gap: 0.5rem;
    align-items: center;
}
.cpp-quote-items__add-form select,
.cpp-quote-items__add-form input {
    border: 2px solid #161616;
    padding: 0.5rem;
    font: inherit;
    background: #fff;
}

/* ============== SIDEBAR ============== */
.cpp-quote-edit__side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cpp-quote-edit__panel {
    background: #fffaf0;
    border: 2px solid #161616;
    padding: 1rem;
}

.cpp-quote-edit__panel h3 {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    margin: 0 0 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============== TOTALS ============== */
.cpp-totals {
    width: 100%;
    border-collapse: collapse;
}
.cpp-totals tr td {
    padding: 0.4rem 0;
    border-bottom: 1px dashed #ccc;
    vertical-align: middle;
}
.cpp-totals tr:last-child td { border-bottom: none; }
.cpp-totals td:last-child {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}
.cpp-totals__grand td {
    border-top: 2px solid #161616;
    padding-top: 0.7rem !important;
    font-size: 1.1rem;
}
.cpp-totals__inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.cpp-totals__inline-input {
    border: 1px solid #161616;
    padding: 0.2rem 0.3rem;
    width: 70px;
    font: inherit;
    text-align: right;
}

/* ============== AUTOSAVE STATUS INDICATOR ============== */
.cpp-autosave-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #444;
    padding: 0.5rem 0.6rem;
    background: #fff;
    border: 1px solid #ddd;
    margin-bottom: 0.8rem;
}
.cpp-autosave-status__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cpp-autosave-status__dot--ok      { background: #1c9a3f; }
.cpp-autosave-status__dot--saving  {
    background: #ffd000;
    animation: cpp-pulse 0.8s ease-in-out infinite;
}
.cpp-autosave-status__dot--error   { background: #c61b6f; }
.cpp-autosave-status__dot--unsaved { background: #ff9320; }
.cpp-autosave-status__dot--idle    { background: #ccc; }

@keyframes cpp-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ============== ACTION BUTTONS ============== */
.cpp-quote-edit__action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cpp-btn--block {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.85rem;
    font-weight: 600;
    border: 2px solid #161616;
    cursor: pointer;
}
.cpp-btn--ghost {
    background: #fff;
    color: #161616;
}
.cpp-btn--ghost:hover { background: #fffaf0; }
.cpp-btn--solid {
    background: #161616;
    color: #fff;
}
.cpp-btn--solid:hover { background: #c61b6f; border-color: #c61b6f; }

.cpp-btn__hint {
    display: block;
    font-style: italic;
    font-weight: 400;
    font-size: 0.78rem;
    margin-top: 0.15rem;
    opacity: 0.8;
}

.cpp-quote-edit__sep {
    border: none;
    border-top: 1px solid #ddd;
    margin: 1rem 0;
}

.cpp-quote-edit__locked-msg {
    background: #f5f5f5;
    border: 1px solid #ccc;
    padding: 0.7rem;
    font-size: 0.9rem;
    color: #555;
    text-align: center;
}

/* ============== TIMELINE ============== */
.cpp-timeline__list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cpp-timeline__item {
    position: relative;
    padding: 0.6rem 0 0.6rem 1.5rem;
    border-left: 2px solid #ddd;
    margin-left: 0.4rem;
}
.cpp-timeline__item:last-child { border-left-color: transparent; padding-bottom: 0; }
.cpp-timeline__dot {
    position: absolute;
    left: -7px;
    top: 0.85rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #161616;
}
.cpp-timeline__item--customer .cpp-timeline__dot { background: #c61b6f; }
.cpp-timeline__item--system   .cpp-timeline__dot { background: #888; }

.cpp-timeline__body strong { display: block; font-size: 0.92rem; }
.cpp-timeline__body time {
    display: block;
    font-size: 0.78rem;
    color: #666;
    margin-top: 0.15rem;
}
.cpp-timeline__body small {
    display: block;
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
}
.cpp-timeline__note {
    display: block;
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
}

/* ============== MAGIC LINK ============== */
.cpp-magic-link {
    width: 100%;
    border: 1px solid #161616;
    padding: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    background: #fff;
    cursor: pointer;
}

/* ============== STATUS PILLS ============== */
.cpp-status {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 2px solid #161616;
}
.cpp-status--draft     { background: #f3f3f3; }
.cpp-status--sent      { background: #ffd000; }
.cpp-status--viewed    { background: #c4e7ff; }
.cpp-status--accepted  { background: #b8eebd; }
.cpp-status--declined  { background: #ffb8b8; }
.cpp-status--expired   { background: #ddd; color: #666; }
.cpp-status--converted { background: #c61b6f; color: #fff; border-color: #c61b6f; }

/* ============== CUSTOMER-SIDE: "UPDATED" BADGE ============== */
.cpp-quote-updated-badge {
    background: #ffd000;
    border: 3px solid #161616;
    padding: 0.7rem 1rem;
    margin: 1rem 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============== REPEAT ORDER BUTTON ============== */
.cpp-order-repeat {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed #ddd;
}
