/*
 * SkyHub Portal CSS Split: orders.css
 * Source: assets/css/aop-app.css lines 1439-1799
 * Purpose: Customer order confirmation, drafts, filters and order drawer layout polish.
 * Phase: v0.12.2.9 Architecture Stabilisation Phase 2 — CSS split only.
 */

/* v0.5.0 — Customer order draft/submission confirmation */
.aop-order-confirmation-card { display: grid; gap: 20px; }
.aop-order-confirmation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.aop-order-confirmation-head h2 { margin: 4px 0 8px; font-size: 30px; letter-spacing: -0.03em; }
.aop-order-confirmation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aop-order-confirmation-grid div { border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 18px; padding: 14px; background: rgba(248, 250, 252, 0.82); }
.aop-order-confirmation-grid span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--aop-muted); margin-bottom: 6px; }
.aop-order-confirmation-grid strong { display: block; font-size: 16px; color: var(--aop-ink); }
.aop-order-confirmation-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.aop-order-save-result .aop-table-wrap { margin-top: 8px; }
@media (max-width: 860px) {
  .aop-order-confirmation-head { display: grid; }
  .aop-order-confirmation-grid { grid-template-columns: 1fr; }
}

/* v0.5.2 draft continuation polish */
.aop-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aop-order-header-card.is-editing-draft {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.96));
}

.aop-order-confirmation-actions {
  flex-wrap: wrap;
}

/* v0.5.3 draft cancel + order filter polish */
.aop-btn-danger {
  background: rgba(218, 74, 98, 0.12);
  color: #b42345;
  border: 1px solid rgba(218, 74, 98, 0.24);
}
.aop-btn-danger:hover {
  background: rgba(218, 74, 98, 0.18);
}
.aop-btn.is-saving,
.aop-form.is-saving .aop-btn {
  opacity: 0.72;
  pointer-events: none;
}
.aop-table tr.is-filtered-out,
.aop-table tr[hidden] {
  display: none !important;
}
.aop-order-filter-empty {
  margin-top: 12px;
}

/* v0.5.6 — Order drawer layout polish */
.aop-record-detail .aop-drawer-record-title {
  margin-bottom: 4px;
}
.aop-order-detail-status {
  margin: 14px 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.92));
  display: grid;
  gap: 12px;
}
.aop-order-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.aop-order-status-copy {
  min-width: 0;
}
.aop-order-status-copy h3 {
  margin: 4px 0 7px;
  color: var(--aop-navy);
  font-size: 18px;
  letter-spacing: -0.03em;
  line-height: 1.12;
}
.aop-order-status-copy p {
  margin: 0;
  color: var(--aop-muted);
  line-height: 1.5;
  font-size: 12.5px;
}
.aop-order-status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(11, 18, 49, 0.08);
  color: var(--aop-navy);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.aop-order-next-action {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.70);
  border: 1px solid rgba(148, 163, 184, 0.18);
}
.aop-order-next-action strong {
  color: var(--aop-navy);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .10em;
}
.aop-order-next-action span {
  color: var(--aop-ink);
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 750;
}
.aop-order-status-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.aop-order-status-facts span {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 15px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.74);
  min-width: 0;
}
.aop-order-status-facts small {
  color: var(--aop-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 850;
}
.aop-order-status-facts strong {
  color: var(--aop-ink);
  font-size: 13px;
  line-height: 1.25;
  word-break: normal;
}
.aop-order-progress-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.aop-order-progress-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--aop-muted);
  font-size: 12px;
  font-weight: 900;
}
.aop-order-progress-list li::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
  justify-self: center;
  background: rgba(148, 163, 184, 0.45);
  box-shadow: 0 0 0 5px rgba(148, 163, 184, 0.10);
}
.aop-order-progress-list li span {
  color: inherit;
  min-width: 0;
}
.aop-order-progress-list li small {
  color: inherit;
  opacity: .74;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
.aop-order-progress-list li.is-complete {
  color: #1e7f58;
}
.aop-order-progress-list li.is-complete::before {
  background: #1e7f58;
  box-shadow: 0 0 0 5px rgba(30, 127, 88, 0.12);
}
.aop-order-progress-list li.is-active {
  color: var(--aop-navy);
}
.aop-order-progress-list li.is-active::before {
  background: var(--aop-cyan);
  box-shadow: 0 0 0 5px rgba(46, 181, 213, 0.18);
}
.aop-order-status-draft {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(255, 255, 255, 0.94));
}
.aop-order-status-cancelled {
  border-color: rgba(218, 74, 98, 0.22);
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.92), rgba(255, 255, 255, 0.94));
}
.aop-detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.aop-detail-section-heading span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(46, 181, 213, 0.10);
  color: #0b7892;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.aop-order-line-cards {
  display: grid;
  gap: 10px;
}
.aop-order-line-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.88));
}
.aop-order-line-main {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}
.aop-order-line-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: var(--aop-navy);
  color: #fff;
  font-size: 10px;
  font-weight: 950;
}
.aop-order-line-main strong {
  display: block;
  color: var(--aop-navy);
  font-size: 13px;
  line-height: 1.25;
}
.aop-order-line-main p {
  margin: 3px 0 0;
  color: var(--aop-muted);
  font-size: 12px;
  line-height: 1.4;
}
.aop-order-line-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.aop-order-line-meta span {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 13px;
  background: rgba(248, 250, 252, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.18);
  min-width: 0;
}
.aop-order-line-meta small,
.aop-order-line-note small {
  color: var(--aop-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 950;
}
.aop-order-line-meta strong {
  color: var(--aop-ink);
  font-size: 12px;
  line-height: 1.2;
  word-break: break-word;
}
.aop-order-line-note {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.16);
}
.aop-order-line-note span {
  color: var(--aop-ink);
  font-size: 12px;
  line-height: 1.4;
}
.aop-order-action-panel {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.aop-order-action-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.07);
}
.aop-order-action-group > span {
  color: var(--aop-muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.aop-order-action-group.is-primary {
  background: rgba(46, 181, 213, 0.08);
  border-color: rgba(46, 181, 213, 0.16);
}
.aop-order-drawer-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}
@media (max-width: 760px) {
  .aop-order-status-header,
  .aop-detail-section-heading {
    align-items: flex-start;
  }
  .aop-order-status-facts,
  .aop-order-line-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .aop-order-progress-list li {
    grid-template-columns: 16px minmax(0, 1fr);
  }
  .aop-order-progress-list li small {
    grid-column: 2;
  }
}




/* v0.22.2.7.7 — validation-aware customer order timeline */
.aop-order-progress-list li.is-rejected {
  color: #991b1b;
}
.aop-order-progress-list li.is-rejected::before {
  background: #dc2626;
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.14);
}
.aop-order-status-approved .aop-order-status-badge,
.aop-order-status-submitted .aop-order-status-badge,
.aop-order-status-cancelled .aop-order-status-badge {
  white-space: normal;
  text-align: center;
}

/* v0.23.2.8.3 — New Order Product Picker Modal + Non-Catalogue Item */
.aop-order-product-picker {
    display: grid;
    gap: 7px;
    min-width: 250px;
}
.aop-product-picker-trigger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-height: 46px;
    padding: 9px 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}
.aop-product-picker-trigger:hover,
.aop-product-picker-trigger:focus {
    border-color: rgba(0, 107, 134, 0.45);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 107, 134, 0.10);
}
.aop-product-picker-trigger strong {
    color: #12172f;
    font-size: 13px;
    line-height: 1.2;
}
.aop-product-picker-trigger small,
.aop-product-picker-status {
    color: #68738a;
    font-size: 11px;
    line-height: 1.25;
}
.aop-product-picker-status {
    display: none;
}
.aop-non-catalogue-item-name {
    width: 100%;
    border-color: rgba(0, 107, 134, 0.22) !important;
    background: #f7fbfd !important;
}
.aop-line-row.is-non-catalogue-line {
    background: rgba(0, 107, 134, 0.035);
}
.aop-line-row.is-non-catalogue-line [data-aop-line-description],
.aop-line-row.is-non-catalogue-line [data-aop-line-uom] {
    background: #fff !important;
    border-color: rgba(0, 107, 134, 0.22) !important;
}
.aop-product-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.aop-product-picker-modal.is-open {
    display: flex;
}
.aop-product-picker-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 34, 0.58);
    backdrop-filter: blur(4px);
}
.aop-product-picker-dialog {
    position: relative;
    width: min(780px, 96vw);
    max-height: min(760px, 92vh);
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(180px, 1fr) auto;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 34px 90px rgba(8, 14, 34, 0.32);
}
.aop-product-picker-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #f2f6fa;
    color: #12172f;
    font-size: 22px;
    cursor: pointer;
}
.aop-product-picker-modal-head {
    padding: 26px 30px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.aop-product-picker-modal-head h2 {
    margin: 4px 0 4px;
    color: #12172f;
    font-size: 24px;
    line-height: 1.1;
}
.aop-product-picker-modal-head p {
    margin: 0;
    color: #68738a;
}
.aop-product-picker-modal-search {
    display: grid;
    gap: 6px;
    padding: 18px 30px;
    background: #f7fbfd;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.aop-product-picker-modal-search input {
    width: 100%;
    height: 46px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.13);
    padding: 0 14px;
    font-weight: 800;
}
.aop-product-picker-modal-search small {
    color: #68738a;
    font-weight: 700;
}
.aop-product-picker-modal-results {
    overflow: auto;
    padding: 16px 20px;
    background: #fff;
}
.aop-product-picker-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.aop-product-picker-result:hover,
.aop-product-picker-result:focus {
    background: #eef7fb;
    border-color: rgba(0, 107, 134, 0.24);
    outline: none;
}
.aop-product-picker-result strong {
    color: #12172f;
    font-size: 14px;
}
.aop-product-picker-result small,
.aop-product-picker-empty {
    color: #68738a;
    font-size: 12px;
}
.aop-product-picker-empty {
    padding: 18px;
    border: 1px dashed rgba(15, 23, 42, 0.16);
    border-radius: 18px;
    background: #f8fafc;
}
.aop-product-picker-modal-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 30px 24px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}
@media (max-width: 780px) {
    .aop-product-picker-modal { padding: 12px; align-items: stretch; }
    .aop-product-picker-dialog { width: 100%; max-height: 96vh; border-radius: 22px; }
    .aop-product-picker-modal-head,
    .aop-product-picker-modal-search,
    .aop-product-picker-modal-foot { padding-left: 18px; padding-right: 18px; }
    .aop-product-picker-modal-foot { flex-direction: column; }
}


/* v0.23.2.8.7.1 — New Order line card/grid layout for desktop portal widths */
.aop-order-form .aop-line-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 14px;
}
.aop-order-form .aop-line-table-wrap {
    overflow: visible !important;
}
.aop-order-form #aopLineEditor.aop-line-table,
.aop-order-form #aopLineEditor.aop-line-table thead,
.aop-order-form #aopLineEditor.aop-line-table tbody {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border: 0;
    background: transparent;
}
.aop-order-form #aopLineEditor.aop-line-table thead {
    display: none;
}
.aop-order-form #aopLineEditor .aop-line-row {
    display: grid !important;
    grid-template-columns: 54px minmax(260px, 1.35fr) minmax(220px, 1fr) minmax(52px, auto);
    grid-template-areas:
        "num product product action"
        "desc desc desc desc"
        "qty uom price total"
        "note note note note";
    gap: 12px;
    align-items: stretch;
    margin: 0 0 14px;
    padding: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.90));
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}
.aop-order-form #aopLineEditor .aop-line-row > td {
    display: grid !important;
    width: auto !important;
    min-width: 0;
    padding: 0 !important;
    border: 0;
    background: transparent;
    text-align: left;
    vertical-align: top;
}
.aop-order-form #aopLineEditor .aop-line-row > td::before {
    content: attr(data-label);
    display: block;
    margin: 0 0 5px;
    color: #68738a;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.aop-order-form #aopLineEditor .aop-line-no {
    grid-area: num;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px !important;
    height: 38px;
    border-radius: 15px;
    background: #111735;
    color: #fff;
    font-weight: 950;
    font-size: 15px;
    align-self: start;
    text-align: center;
}
.aop-order-form #aopLineEditor .aop-line-no::before,
.aop-order-form #aopLineEditor .aop-line-action-cell::before {
    display: none;
}
.aop-order-form #aopLineEditor .aop-line-product-cell { grid-area: product; }
.aop-order-form #aopLineEditor .aop-line-description-cell { grid-area: desc; }
.aop-order-form #aopLineEditor .aop-line-qty-cell { grid-area: qty; }
.aop-order-form #aopLineEditor .aop-line-uom-cell { grid-area: uom; }
.aop-order-form #aopLineEditor .aop-line-price-cell { grid-area: price; }
.aop-order-form #aopLineEditor .aop-line-total-cell { grid-area: total; }
.aop-order-form #aopLineEditor .aop-line-note-cell { grid-area: note; }
.aop-order-form #aopLineEditor .aop-line-action-cell {
    grid-area: action;
    align-items: start;
    justify-content: end;
}
.aop-order-form #aopLineEditor input,
.aop-order-form #aopLineEditor select,
.aop-order-form #aopLineEditor .aop-product-picker-trigger {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
    font-size: 13px;
}
.aop-order-form #aopLineEditor .aop-order-product-picker {
    min-width: 0;
}
.aop-order-form #aopLineEditor .aop-line-description-cell input,
.aop-order-form #aopLineEditor .aop-line-note-cell input {
    min-height: 48px;
}
.aop-order-form #aopLineEditor .aop-line-delete {
    width: 34px;
    height: 34px;
}
.aop-order-form #aopLineEditor .aop-line-row.is-non-catalogue-line {
    border-color: rgba(0, 107, 134, 0.20);
    background: linear-gradient(180deg, rgba(240,251,255,.98), rgba(255,255,255,.94));
}
@media (max-width: 1380px) {
    .aop-order-form #aopLineEditor .aop-line-row {
        grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr) 42px;
        grid-template-areas:
            "num product product action"
            "desc desc desc desc"
            "qty uom price total"
            "note note note note";
    }
}
@media (max-width: 1180px) {
    .aop-order-form #aopLineEditor .aop-line-row {
        grid-template-columns: 44px minmax(0, 1fr) 42px;
        grid-template-areas:
            "num product action"
            "desc desc desc"
            "qty uom uom"
            "price total total"
            "note note note";
    }
}

