/* Container Manager — /containers (restyled Oct 25, 2026).
   Loads after portfolio.css and shares its tokens and classes (the --pf-* variables are defined on
   #portfolio-ui and #containers-ui; .pf-sidebar / .pf-container* / .pf-kpi* / .pf-btn / .pf-state /
   .pf-icon come from there). Everything specific to this page is a .ct-* class below.
   Breakpoints: 1100px (two panes → one screen at a time) and 768px (phone density), like the portfolio. */

#containers-ui { max-width: 1400px; margin: 0 auto; padding: 14px 20px 40px; box-sizing: border-box; }

/* ---------- title row ---------- */
.ct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.ct-head .pf-sidebar-title { font-size: 1.9rem; }
.ct-head .pf-sidebar-title img { height: 34px; }

/* ---------- shared bits ---------- */
.ct-input, .ct-qty, .ct-filter, .ct-name-input {
    background: var(--pf-surface-2); border: 1px solid var(--pf-line); border-radius: var(--pf-radius-sm);
    color: var(--pf-text); font-family: var(--pf-font-data); font-size: .9rem; padding: 9px 11px;
    min-width: 0; outline: none; box-sizing: border-box; transition: border-color .15s;
}
.ct-input:focus, .ct-qty:focus, .ct-filter:focus, .ct-name-input:focus { border-color: var(--pf-gold); }
.ct-input::placeholder, .ct-filter::placeholder { color: var(--pf-muted); }
.ct-qty { width: 76px; padding: 7px 6px; text-align: center; font-variant-numeric: tabular-nums; }
.ct-qty:disabled { opacity: .5; }
.ct-qty::-webkit-outer-spin-button, .ct-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ct-qty { -moz-appearance: textfield; appearance: textfield; }
.pf-btn.gold { background: rgba(255, 215, 0, 0.12); border-color: rgba(255, 215, 0, 0.45); color: var(--pf-gold); }
.pf-btn.gold:hover:not(:disabled) { background: rgba(255, 215, 0, 0.2); border-color: var(--pf-gold); }
.pf-btn.danger { color: #ff8a8a; border-color: rgba(255, 92, 92, 0.35); }
.pf-btn.danger:hover:not(:disabled) { color: #ff5c5c; border-color: #ff5c5c; }
.pf-btn.small { padding: 5px 9px; font-size: .74rem; }
.ct-x { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: 1px solid transparent; background: transparent;
        color: var(--pf-muted); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0; transition: color .15s, border-color .15s, background .15s; }
.ct-x:hover { color: #ff8a8a; border-color: rgba(255, 92, 92, 0.45); background: rgba(255, 92, 92, 0.08); }
.ct-confirm { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-family: var(--pf-font-label); font-size: .78rem; color: #ff8a8a; }
.ct-confirm .pf-btn { white-space: nowrap; }
.ct-delta.up { color: #10b981; }
.ct-delta.down { color: #ef4444; }
.ct-delta.flat { color: var(--pf-muted); }
.ct-unpriced { font-family: var(--pf-font-label); font-size: .66rem; color: #e0a94a; border: 1px solid rgba(224, 169, 74, 0.4); border-radius: 999px; padding: 1px 6px; white-space: nowrap; }

/* ---------- empty / gated cards ---------- */
.ct-card { background: var(--pf-surface); border: 1px solid var(--pf-line); border-radius: var(--pf-radius); padding: 28px 24px; text-align: center; max-width: 560px; margin: 24px auto; }
.ct-card img { height: 72px; width: auto; margin-bottom: 10px; }
.ct-card h2 { margin: 0 0 8px; font-family: var(--pf-font-label); font-weight: 700; font-size: 1.3rem; color: var(--pf-text); }
.ct-card p { margin: 0 0 18px; font-family: var(--pf-font-data); font-size: .92rem; line-height: 1.5; color: var(--pf-muted); }
.ct-gate-icon { font-size: 2.2rem; margin-bottom: 6px; }
.ct-gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ct-gate-actions .pf-btn { text-decoration: none; padding: 10px 16px; }
.ct-card .ct-new { margin-top: 0; padding-top: 0; border-top: 0; justify-content: center; }
.ct-card .ct-new .ct-input { flex: 1 1 240px; max-width: 340px; }
.pf-state .pf-btn { margin-left: 10px; vertical-align: middle; }

/* ---------- two panes ---------- */
.ct-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.ct-list .pf-container-list { max-height: calc(100vh - 280px); }
.ct-list .pf-sidebar-title { font-size: 1.25rem; }
.ct-count { font-family: var(--pf-font-label); font-size: .74rem; font-weight: 600; color: var(--pf-muted); border: 1px solid var(--pf-line); border-radius: 999px; padding: 3px 9px; }
.pf-container:focus-visible { outline: 2px solid var(--pf-gold); outline-offset: 1px; }
.ct-container-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ct-chev { display: none; color: var(--pf-muted); font-size: 1.25rem; line-height: 1; }
.ct-new { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--pf-line); }
.ct-new .ct-input { flex: 1; }
.ct-main { min-width: 0; }

/* ---------- the selected container ---------- */
.ct-detail { background: var(--pf-surface); border: 1px solid var(--pf-line); border-radius: var(--pf-radius); padding: 16px; }
.ct-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; margin-bottom: 14px; }
.ct-back { display: none; }
.ct-title-block { flex: 1 1 260px; min-width: 0; }
.ct-name { margin: 0; font-family: var(--pf-font-label); font-weight: 700; font-size: 1.35rem; line-height: 1.2; color: var(--pf-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-name-input { width: 100%; font-family: var(--pf-font-label); font-weight: 700; font-size: 1.15rem; padding: 6px 10px; }
.ct-meta { font-family: var(--pf-font-data); font-size: .8rem; color: var(--pf-muted); margin-top: 4px; }
.ct-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ct-value { font-family: var(--pf-font-data); font-weight: 700; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--pf-gold); white-space: nowrap; }
.ct-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }

/* add-item bar */
.ct-add { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; gap: 8px; align-items: center; margin-bottom: 14px; }
.ct-add-search { position: relative; min-width: 0; }
.ct-add-search .ct-input { width: 100%; }
.ct-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; max-height: 360px; overflow-y: auto; background: var(--pf-surface-2); border: 1px solid var(--pf-line-strong); border-radius: var(--pf-radius-sm); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); padding: 4px; }
.ct-result { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-family: var(--pf-font-data); font-size: .88rem; color: var(--pf-text); }
.ct-result:hover, .ct-result.active { background: rgba(147, 112, 219, 0.16); color: var(--pf-gold); }
.ct-result-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-result-type { font-family: var(--pf-font-label); font-size: .7rem; color: var(--pf-muted); text-transform: uppercase; white-space: nowrap; }
.ct-add-chosen { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 6px 5px 10px; border: 1px solid rgba(255, 215, 0, 0.45); border-radius: var(--pf-radius-sm); background: rgba(255, 215, 0, 0.07); }
.ct-chosen-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pf-gold); font-family: var(--pf-font-data); font-weight: 500; font-size: .9rem; }
.ct-add-qty { width: 100%; }

/* items */
.ct-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ct-tools-count { font-family: var(--pf-font-data); font-size: .78rem; color: var(--pf-muted); white-space: nowrap; }
.ct-filter { flex: 0 1 300px; padding: 7px 11px; }
.ct-table-wrap { border-radius: var(--pf-radius-sm); }
.ct-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-family: var(--pf-font-data); }
.ct-table th { position: sticky; top: var(--pf-header-h); z-index: 2; background: var(--pf-surface-2); font-family: var(--pf-font-pixel); font-weight: 400; font-size: 1.15rem; letter-spacing: .3px; text-transform: uppercase; color: var(--pf-muted); padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--pf-line); cursor: pointer; user-select: none; white-space: nowrap; }
.ct-table th:first-child { text-align: left; }
.ct-table th:hover, .ct-table th.sorted { color: var(--pf-gold); }
.ct-table th:nth-child(2) { width: 104px; }
.ct-table th:nth-child(3) { width: 112px; }
.ct-table th:nth-child(4) { width: 96px; }
.ct-table th:nth-child(5) { width: 124px; }
.ct-table th:nth-child(6) { width: 58px; cursor: default; }
.ct-table td { padding: 7px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); text-align: right; font-size: .92rem; font-variant-numeric: tabular-nums; color: var(--pf-text); white-space: nowrap; overflow: hidden; }
.ct-table td:first-child { text-align: left; }
.ct-table tbody tr:last-child td { border-bottom: 0; }
.ct-table tbody tr:hover td { background: rgba(147, 112, 219, 0.07); }
.ct-table td.total { font-weight: 600; }
.ct-table td.ct-td-x { padding-left: 4px; padding-right: 8px; overflow: visible; position: relative; }
.ct-table .ct-td-x .ct-confirm { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); z-index: 3; flex-wrap: nowrap; width: max-content; background: var(--pf-surface-2); border: 1px solid var(--pf-line-strong); border-radius: 999px; padding: 3px 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.ct-table .pf-item a { font-size: .92rem; }
.ct-table .ct-qty { width: 68px; }
.ct-rows { display: none; }

/* toasts */
.ct-toasts { position: fixed; top: calc(var(--pf-header-h) + 12px); right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.ct-toast { background: var(--pf-surface-2); border: 1px solid var(--pf-line-strong); border-left: 3px solid var(--pf-gold); border-radius: var(--pf-radius-sm); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); padding: 10px 14px; font-family: var(--pf-font-data); font-size: .86rem; color: var(--pf-text); max-width: 360px; animation: ct-in .18s ease-out; }
.ct-toast.error { border-left-color: #ff5c5c; }
@keyframes ct-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- compact (tablets and phones, <= 1100px): one screen at a time ---------- */
@media (max-width: 1100px) {
    .ct-layout { display: block; }
    .ct-list .pf-container-list { max-height: none; }
    .ct-chev { display: inline; }
    .ct-back { display: inline-flex; flex: 0 0 100%; justify-content: flex-start; align-self: stretch; width: max-content; }
    #containers-ui:not(.view-detail) .ct-main { display: none; }
    #containers-ui.view-detail .ct-list, #containers-ui.view-detail .ct-kpis { display: none; }
    .ct-title-block { flex-basis: 200px; }
}

/* ---------- phones ---------- */
@media (max-width: 768px) {
    #containers-ui { padding: 10px 12px 32px; }
    .ct-head { margin-bottom: 10px; }
    .ct-head .pf-sidebar-title { font-size: 1.6rem; }
    .ct-head .pf-sidebar-title img { height: 28px; }
    .pf-kpi-sub .ct-long { display: none; }
    .ct-detail { padding: 12px; }
    .ct-detail-head { gap: 8px 12px; margin-bottom: 12px; }
    .ct-name { font-size: 1.15rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .ct-value { font-size: 1.25rem; }
    .ct-head-right { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
    .ct-actions { flex: 1 1 auto; }
    .ct-add { grid-template-columns: minmax(0, 1fr) 68px auto; gap: 6px; }
    .ct-add { position: relative; }
    .ct-add-search { position: static; }
    .ct-results { max-height: 50vh; top: calc(100% + 6px); left: 0; right: 0; }
    .ct-tools { flex-wrap: wrap; }
    .ct-filter { flex: 1 1 100%; }
    .ct-table-wrap { display: none; }
    .ct-rows { display: flex; flex-direction: column; gap: 6px; }
    .ct-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 10px; border-radius: var(--pf-radius-sm); background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.04); }
    .ct-row .pf-icon { width: 40px; height: 32px; }
    .ct-row-main { flex: 1; min-width: 0; }
    .ct-row-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: inherit; text-decoration: none; font-family: var(--pf-font-data); font-weight: 500; font-size: .88rem; line-height: 1.25; }
    .ct-row-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; font-family: var(--pf-font-data); font-size: .76rem; color: var(--pf-muted); font-variant-numeric: tabular-nums; }
    .ct-row-qty { display: inline-flex; align-items: center; gap: 2px; }
    .ct-row-qty .ct-qty { width: 56px; padding: 3px 4px; font-size: .8rem; }
    .ct-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0; flex: 0 0 auto; }
    .ct-row-right .ct-x { margin-right: -2px; }
    .ct-row-total { font-family: var(--pf-font-data); font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; color: var(--pf-gold); white-space: nowrap; }
    .ct-toasts { top: auto; bottom: 80px;   /* above the phone bottom bar (60px) */ left: 12px; right: 12px; align-items: center; }
    .ct-toast { max-width: 100%; }
}
