/* Grafix Order Tracking & Chat */
:root {
	--gfx-accent: var(--wd-primary-color, #2a5bd7);
	--gfx-ink: #1d2330;
	--gfx-muted: #6b7280;
	--gfx-line: #e5e7eb;
	--gfx-soft: #f5f6f8;
	--gfx-card: #ffffff;
	--gfx-wa: #1f9d55;
	--gfx-radius: 14px;
}

.gfx-tracker, .gfx-card, .gfx-widget, .gfx-app-inline, .gfx-admin-box, .gfx-inbox { color: var(--gfx-ink); box-sizing: border-box; }
.gfx-tracker *, .gfx-card *, .gfx-widget *, .gfx-app-inline *, .gfx-admin-box *, .gfx-inbox * { box-sizing: border-box; }

/* ---------- Tracker ---------- */
.gfx-tracker { background: var(--gfx-card); border: 1px solid var(--gfx-line); border-radius: var(--gfx-radius); padding: 22px; margin: 0 0 28px; }
.gfx-tracker-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.gfx-eyebrow { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--gfx-muted); margin-bottom: 2px; }
.gfx-current { font-size: 20px; line-height: 1.25; }
.gfx-pct { font-size: 14px; font-weight: 600; color: var(--gfx-accent); }
.gfx-bar { height: 8px; background: var(--gfx-soft); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.gfx-bar span { display: block; height: 100%; width: var(--gfx-pct, 0%); background: var(--gfx-accent); border-radius: inherit; transition: width .5s ease; }
.gfx-steps { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; counter-reset: none; }
.gfx-steps li { list-style: none !important; margin: 0 !important; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; font-size: 12.5px; line-height: 1.3; color: var(--gfx-muted); position: relative; }
.gfx-steps li::before { content: ""; position: absolute; top: 14px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--gfx-line); }
.gfx-steps li:first-child::before { display: none; }
.gfx-steps li.is-done::before, .gfx-steps li.is-current::before { background: var(--gfx-accent); }
.gfx-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--gfx-soft); border: 2px solid var(--gfx-line); color: var(--gfx-muted); position: relative; z-index: 1; }
.gfx-steps li.is-done .gfx-dot { background: var(--gfx-accent); border-color: var(--gfx-accent); color: #fff; }
.gfx-steps li.is-current .gfx-dot { background: #fff; border-color: var(--gfx-accent); color: var(--gfx-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gfx-accent) 18%, transparent); }
.gfx-steps li.is-done, .gfx-steps li.is-current { color: var(--gfx-ink); }
.gfx-steps li.is-current .gfx-label { font-weight: 600; }

.gfx-log { margin-top: 20px; border-top: 1px solid var(--gfx-line); padding-top: 14px; }
.gfx-log summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.gfx-log ul { list-style: none !important; margin: 12px 0 0 !important; padding: 0 0 0 16px !important; border-left: 2px solid var(--gfx-line); }
.gfx-log li { list-style: none !important; margin: 0 0 12px !important; position: relative; font-size: 14px; }
.gfx-log li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--gfx-accent); }
.gfx-log time { display: block; font-size: 12px; color: var(--gfx-muted); }
.gfx-log p { margin: 2px 0 0; color: var(--gfx-muted); }

@media (max-width: 640px) {
	.gfx-tracker { padding: 16px; }
	.gfx-steps { grid-auto-flow: row; gap: 0; }
	.gfx-steps li { flex-direction: row; text-align: left; gap: 12px; padding: 6px 0; }
	.gfx-steps li::before { top: -10px; bottom: auto; left: 14px; right: auto; width: 2px; height: 16px; }
}

/* ---------- Card around order chat ---------- */
.gfx-card { background: var(--gfx-card); border: 1px solid var(--gfx-line); border-radius: var(--gfx-radius); margin: 28px 0; overflow: hidden; }
.gfx-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--gfx-line); }
.gfx-card-head h2 { margin: 0 !important; font-size: 18px; }

/* ---------- Thread ---------- */
.gfx-thread { display: flex; flex-direction: column; min-height: 0; }
.gfx-msgs { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--gfx-soft); min-height: 220px; max-height: 440px; overscroll-behavior: contain; }
.gfx-chat-tall .gfx-msgs { max-height: 60vh; min-height: 360px; }
.gfx-empty { margin: auto; text-align: center; color: var(--gfx-muted); font-size: 14px; max-width: 280px; padding: 20px 0; }
.gfx-msg { max-width: 78%; padding: 9px 13px 6px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.gfx-msg p { margin: 0 0 4px !important; }
.gfx-msg a { color: inherit; text-decoration: underline; }
.gfx-msg.is-mine { align-self: flex-end; background: var(--gfx-accent); color: #fff; border-bottom-right-radius: 4px; }
.gfx-msg.is-theirs { align-self: flex-start; background: #fff; border: 1px solid var(--gfx-line); border-bottom-left-radius: 4px; }
.gfx-msg.is-system { align-self: center; background: transparent; color: var(--gfx-muted); font-size: 12.5px; text-align: center; max-width: 92%; padding: 2px 8px; }
.gfx-msg.is-system .gfx-text::before { content: "● "; color: var(--gfx-accent); }
.gfx-who { font-size: 12px; font-weight: 600; margin-bottom: 2px; color: var(--gfx-accent); }
.gfx-time { font-size: 11px; opacity: .7; text-align: right; margin-top: 2px; }
.gfx-msg.is-system .gfx-time { text-align: center; }
.gfx-img { display: block; margin: 4px 0; text-decoration: none !important; }
.gfx-img img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; }
.gfx-file { display: inline-flex !important; align-items: center; gap: 6px; padding: 6px 10px; margin: 4px 0; border-radius: 8px; background: rgba(0,0,0,.06); text-decoration: none !important; font-size: 13px; }
.gfx-msg.is-mine .gfx-file { background: rgba(255,255,255,.18); }

.gfx-filechip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px; font-size: 13px; background: #fff; border-top: 1px solid var(--gfx-line); }
.gfx-filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gfx-filechip button { border: 0; background: none; font-size: 18px; cursor: pointer; padding: 0 4px; color: var(--gfx-muted); min-height: 0; line-height: 1; }
.gfx-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid var(--gfx-line); }
.gfx-compose.is-busy { opacity: .6; pointer-events: none; }
.gfx-compose textarea { flex: 1; resize: none; min-height: 40px !important; height: 40px; max-height: 140px; padding: 9px 12px !important; border: 1px solid var(--gfx-line) !important; border-radius: 20px !important; font: inherit; font-size: 14.5px; line-height: 1.4; background: var(--gfx-soft) !important; box-shadow: none !important; margin: 0 !important; color: var(--gfx-ink); }
.gfx-compose textarea:focus { outline: 2px solid color-mix(in srgb, var(--gfx-accent) 40%, transparent); outline-offset: 0; background: #fff !important; }
.gfx-attach { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: var(--gfx-muted); margin: 0 !important; }
.gfx-attach:hover { background: var(--gfx-soft); color: var(--gfx-ink); }
.gfx-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.gfx-send { flex: 0 0 40px; width: 40px; height: 40px !important; min-height: 0 !important; padding: 0 !important; display: grid !important; place-items: center; border-radius: 50% !important; border: 0 !important; background: var(--gfx-accent) !important; color: #fff !important; cursor: pointer; }
.gfx-send:hover { filter: brightness(1.08); }

/* ---------- WhatsApp & buttons ---------- */
.gfx-wa { display: inline-flex !important; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--gfx-wa); color: #fff !important; font-size: 13.5px; font-weight: 600; text-decoration: none !important; line-height: 1.2; }
.gfx-wa:hover { filter: brightness(1.08); }
.gfx-wa-block { display: flex !important; justify-content: center; margin-top: 12px; }
.gfx-btn { display: block; text-align: center; padding: 11px 16px; border-radius: 10px; background: var(--gfx-accent); color: #fff !important; font-weight: 600; text-decoration: none !important; margin-bottom: 10px; }
.gfx-btn:hover { filter: brightness(1.08); }
.gfx-stage-chip { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--gfx-soft); font-size: 12.5px; white-space: nowrap; }
.gfx-unread-chip { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #e11d48; color: #fff !important; font-size: 11.5px; font-weight: 600; text-decoration: none !important; }
.gfx-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #e11d48; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; }
.gfx-badge[hidden] { display: none !important; }

/* ---------- Conversation list ---------- */
.gfx-threads { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.gfx-greet { margin: 0 0 6px !important; padding: 12px 14px; background: var(--gfx-soft); border-radius: 12px; font-size: 14px; line-height: 1.45; }
.gfx-thread-item { display: flex !important; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 12px 14px !important; border: 1px solid var(--gfx-line) !important; border-radius: 12px !important; background: #fff !important; color: var(--gfx-ink) !important; cursor: pointer; font: inherit; text-transform: none !important; letter-spacing: normal !important; min-height: 0 !important; line-height: 1.3 !important; box-shadow: none !important; }
.gfx-thread-item:hover { border-color: var(--gfx-accent) !important; }
.gfx-ti-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gfx-ti-main strong { font-size: 14.5px; }
.gfx-ti-main small { font-size: 12.5px; color: var(--gfx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gfx-ti-arrow { font-size: 22px; color: var(--gfx-muted); }

/* My Account inline app */
.gfx-app-inline { border: 1px solid var(--gfx-line); border-radius: var(--gfx-radius); overflow: hidden; background: #fff; }
.gfx-app-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--gfx-line); }
.gfx-app-head .gfx-back { border: 0 !important; background: none !important; color: var(--gfx-accent) !important; padding: 0 !important; min-height: 0 !important; cursor: pointer; font-weight: 600; text-transform: none !important; box-shadow: none !important; }
.gfx-app-head .gfx-back[hidden] { display: none; }
.gfx-app-body .gfx-threads { padding: 18px; }

/* ---------- Floating widget ---------- */
.gfx-widget { position: fixed; bottom: 22px; z-index: 99990; font-size: 14px; }
.gfx-pos-left { left: 22px; }
.gfx-pos-right { right: 22px; }
.gfx-fab { width: 58px; height: 58px; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 0 !important; background: var(--gfx-accent) !important; color: #fff !important; display: grid !important; place-items: center; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.2); position: relative; transition: transform .2s ease; }
.gfx-fab:hover { transform: scale(1.05); }
.gfx-fab .gfx-badge { position: absolute; top: -2px; right: -2px; border: 2px solid #fff; }
.gfx-ico-close { display: none; }
.gfx-widget.is-open .gfx-ico-open { display: none; }
.gfx-widget.is-open .gfx-ico-close { display: block; }
.gfx-panel { position: absolute; bottom: 72px; width: 370px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 120px); background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.22); display: flex; flex-direction: column; overflow: hidden; animation: gfx-pop .18s ease-out; }
.gfx-panel[hidden] { display: none; }
.gfx-pos-left .gfx-panel { left: 0; }
.gfx-pos-right .gfx-panel { right: 0; }
@keyframes gfx-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.gfx-panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 18px; background: var(--gfx-accent); color: #fff; }
.gfx-panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.gfx-panel-title strong { font-size: 15.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gfx-panel-title span { font-size: 12px; opacity: .85; }
.gfx-panel-head button { width: 34px; height: 34px; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: rgba(255,255,255,.15) !important; color: #fff !important; font-size: 22px; line-height: 1; cursor: pointer; display: grid !important; place-items: center; box-shadow: none !important; }
.gfx-panel-head button[hidden] { display: none !important; }
.gfx-panel-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.gfx-panel-body > div { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gfx-panel-body .gfx-thread { height: 100%; }
.gfx-panel-body .gfx-msgs { max-height: none; min-height: 0; }
.gfx-guest { padding: 18px; }

@media (max-width: 768px) {
	.gfx-widget { bottom: 76px; }
	.gfx-pos-left { left: 14px; }
	.gfx-pos-right { right: 14px; }
	.gfx-fab { width: 52px; height: 52px; }
	.gfx-widget.is-open { left: 0; right: 0; bottom: 0; top: 0; }
	.gfx-widget.is-open .gfx-fab { display: none !important; }
	.gfx-widget.is-open .gfx-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; bottom: 0; }
}

/* ---------- Admin ---------- */
.gfx-admin-box .gfx-tracker { margin-bottom: 14px; }
.gfx-stage-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.gfx-stage-form select { min-width: 220px; }
.gfx-stage-form input { flex: 1; min-width: 220px; }
.gfx-admin-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.gfx-admin-chat-head h4 { margin: 0; font-size: 14px; }
.gfx-admin-box .gfx-chat-inline, .gfx-inbox-main .gfx-chat-inline { border: 1px solid var(--gfx-line); border-radius: 12px; overflow: hidden; }

.gfx-inbox { display: grid; grid-template-columns: 320px 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.gfx-inbox-list { background: #fff; border: 1px solid #dcdcde; border-radius: 12px; overflow: hidden; max-height: 78vh; overflow-y: auto; }
.gfx-inbox-item { display: grid; gap: 2px; padding: 12px 14px; border-bottom: 1px solid #f0f0f1; text-decoration: none; color: var(--gfx-ink); }
.gfx-inbox-item:hover { background: #f6f7f7; }
.gfx-inbox-item.is-active { background: #f0f6fc; box-shadow: inset 3px 0 0 #2271b1; }
.gfx-inbox-item.is-unread strong { font-weight: 700; }
.gfx-ii-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gfx-ii-ref { font-size: 12px; color: #2271b1; }
.gfx-ii-prev { font-size: 13px; color: var(--gfx-muted); }
.gfx-ii-time { font-size: 11px; color: #a7aaad; }
.gfx-inbox-main { background: #fff; border: 1px solid #dcdcde; border-radius: 12px; padding: 18px; min-height: 300px; }
.gfx-inbox-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.gfx-inbox-head h2 { margin: 0 0 2px; }
.gfx-inbox-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gfx-inbox-empty { color: var(--gfx-muted); padding: 16px; margin: 0; }
.gfx-tracker-compact .gfx-tracker { padding: 14px 16px; }
.gfx-tracker-compact .gfx-log { display: none; }
@media (max-width: 960px) { .gfx-inbox { grid-template-columns: 1fr; } }
