/* ==========================================================================
   Square Ibis — app components: banners, state pages, charts, parcel form & drawer
   ========================================================================== */

/* ---------- banners & state pages ---------- */

.banners:empty { display: none; }
.banners { display: flex; flex-direction: column; gap: 0; }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 24px; font-size: 13px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.banner svg { width: 16px; height: 16px; flex: none; }
.banner span { flex: 1; }
.banner.info { background: color-mix(in srgb, var(--violet) 8%, transparent); }
.banner.info svg { color: var(--violet); }
.banner.warn { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.banner.warn svg { color: var(--amber); }
.banner.bad { background: color-mix(in srgb, var(--rose) 9%, transparent); }
.banner.bad svg { color: var(--rose); }

.state-page { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 20px; text-align: center; position: relative; z-index: 1; }
.state-page h1 { font-size: 44px; font-weight: 700; letter-spacing: -.03em; }
.state-page p { color: var(--text-2); max-width: 460px; }
.state-page .es-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); }
.state-page .es-icon svg { width: 26px; height: 26px; }

/* ---------- charts ---------- */

.chart { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.lg-item { display: inline-flex; align-items: center; gap: 7px; }
.lg-line { display: inline-block; width: 16px; height: 2.5px; border-radius: 2px; background: var(--c); flex: none; }
.chart-box { position: relative; width: 100%; }
.chart-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-svg .tick { fill: var(--text-3); font-size: 10.5px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-svg .area { fill: var(--c); opacity: .1; stroke: none; }
.chart-svg .dot { fill: var(--c); stroke: var(--bg-2); stroke-width: 2; }
.chart-svg .end-label { fill: var(--text); font-size: 11.5px; font-weight: 600; font-family: var(--mono); }
.chart-svg .cross { stroke: var(--text-3); stroke-width: 1; }
.chart-svg rect:focus { outline: none; }
.chart-tip { position: absolute; z-index: 2; min-width: 150px; padding: 9px 11px; border-radius: 12px; background: color-mix(in srgb, var(--panel-solid) 94%, transparent); border: 1px solid var(--border-strong); box-shadow: var(--shadow); pointer-events: none; font-size: 12px; backdrop-filter: blur(10px); }
.tip-title { font-size: 11px; color: var(--text-3); margin-bottom: 5px; text-transform: capitalize; }
.tip-row { display: flex; align-items: center; gap: 8px; padding: 1px 0; color: var(--text-2); }
.tip-row b { font-family: var(--mono); color: var(--text); min-width: 34px; font-weight: 600; }

.barlist { display: flex; flex-direction: column; gap: 4px; }
.bl-row { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 5px 6px; border-radius: 10px; color: inherit; text-decoration: none; animation: fieldIn .45s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
a.bl-row:hover { background: var(--surface-2); text-decoration: none; }
.bl-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; line-height: 1.25; }
.bl-label small { font-size: 11px; color: var(--text-3); }
.bl-track { height: 18px; display: flex; align-items: center; }
.bl-bar { display: block; height: 14px; max-height: 24px; border-radius: 0 4px 4px 0; background: var(--series-1); transform-origin: left; animation: growX .9s var(--ease-out) both; }
:root[dir="rtl"] .bl-bar { border-radius: 4px 0 0 4px; transform-origin: right; }
.bl-value { font-family: var(--mono); font-size: 12.5px; color: var(--text); min-width: 42px; text-align: end; }

.stackbar { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.sb-seg { display: block; min-width: 4px; background: hsl(var(--h) 80% 60%); transition: filter .2s; }
.sb-seg.h-gray { background: var(--gray); }
a.sb-seg:hover { filter: brightness(1.2); }

.pipeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pipe-step { --h: 230; display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; transition: transform .25s var(--ease-out), border-color .25s, background .25s; position: relative; overflow: hidden; }
.pipe-step::before { content: ""; position: absolute; inset-inline-start: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: hsl(var(--h) 80% 62%); }
.pipe-step.h-gray::before { background: var(--gray); }
.pipe-step:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.pipe-step b { font-family: var(--mono); font-size: 20px; font-weight: 500; letter-spacing: -.02em; }
.pipe-step span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-step.is-zero { opacity: .55; }

/* ---------- dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }
.hero-figure { display: flex; align-items: baseline; gap: 10px; }
.hero-figure b { font-size: 48px; font-weight: 600; letter-spacing: -.04em; line-height: 1; white-space: nowrap; }
.hero-figure span { color: var(--text-2); font-size: 13px; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: inherit; text-decoration: none; font-size: 13.5px; transition: background .2s, transform .2s var(--ease); }
.alert-item:hover { background: var(--surface-3); text-decoration: none; transform: translateX(2px); }
:root[dir="rtl"] .alert-item:hover { transform: translateX(-2px); }
.alert-item svg { width: 17px; height: 17px; color: var(--amber); flex: none; }
.alert-item b { font-family: var(--mono); margin-inline-start: auto; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px dashed var(--border); font-size: 13px; animation: fieldIn .4s var(--ease-out) both; cursor: pointer; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover .feed-main b { text-decoration: underline; text-underline-offset: 3px; }
.feed-main { min-width: 0; display: flex; flex-direction: column; }
.feed-main b { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.feed-main span { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.leader { display: flex; flex-direction: column; gap: 2px; }
.leader-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 4px; border-radius: 10px; font-size: 13px; }
.leader-row:hover { background: var(--surface-2); }
.leader-row .num { font-size: 12.5px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray); display: inline-block; margin-inline-start: 6px; }
.online-dot.on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }

/* ---------- parcels list ---------- */

.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.stab { --h: 230; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: all .2s; }
.stab i { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--h) 80% 62%); }
.stab.h-gray i { background: var(--gray); }
.stab b { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text-3); }
.stab:hover { border-color: var(--border-strong); color: var(--text); }
.stab[aria-pressed="true"] { color: var(--text); background: hsl(var(--h) 80% 60% / .12); border-color: hsl(var(--h) 80% 62% / .4); }
.stab.h-gray[aria-pressed="true"] { background: var(--surface-3); border-color: var(--border-strong); }
.stab[aria-pressed="true"] b { color: var(--text); }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters-row .select, .filters-row .input { width: auto; min-width: 150px; height: 36px; font-size: 13px; }
.filters-row .search { flex: 1 1 240px; max-width: 380px; }
.filters-row input[type="date"] { min-width: 0; width: 148px; }
.cell-customer { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-customer .mono { font-size: 12px; color: var(--text-3); }
.cell-dest { display: flex; flex-direction: column; min-width: 0; }
.cell-dest small { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.row-flags { display: inline-flex; gap: 4px; margin-inline-start: 6px; vertical-align: middle; }
.row-flags svg { width: 13px; height: 13px; color: var(--text-3); }
.row-flags span { display: inline-flex; }
.row-flags .flag-bad svg { color: var(--rose); }

/* ---------- parcel form ---------- */

.order-form { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.of-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.of-main > .form-section { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: inset 0 1px 0 var(--highlight); animation: fadeUp .5s var(--ease-out) both; }
.of-main > .form-section + .form-section { border-top: 1px solid var(--border); padding-top: 18px; }
.of-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 12px; }
.of-money { gap: 14px; background: linear-gradient(160deg, rgba(var(--a1-rgb), .08), var(--surface) 55%); }
.of-actions { display: flex; flex-direction: column; gap: 8px; }
.of-actions .btn { width: 100%; }
.money-box { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.mb-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.mb-row b { color: var(--text); font-weight: 500; }
.mb-row.total { padding: 9px 0; font-size: 14px; color: var(--text); font-weight: 600; }
.mb-row.total b { font-size: 21px; font-weight: 600; letter-spacing: -.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mb-row.muted { font-size: 12.5px; }
.switch-row { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.reputation { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 0; }
.reputation:empty { display: none; }
.desk-choice:empty { display: none; }
.of-advanced { border-top: 1px dashed var(--border-strong); padding-top: 12px; }
.of-advanced > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); list-style: none; }
.of-advanced > summary::-webkit-details-marker { display: none; }
.of-advanced > summary svg { width: 15px; height: 15px; color: var(--accent); }
.of-advanced[open] > summary { margin-bottom: 12px; }
.dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.weight-note:empty { display: none; }
.weight-note { color: var(--amber); }
.modal .order-form { grid-template-columns: minmax(0, 1fr); }
.modal .of-side { position: static; }
.modal .of-main > .form-section { padding: 0; border: 0; background: none; box-shadow: none; animation: none; }

/* ---------- parcel drawer ---------- */

.tracking-lg { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.od-progress { padding: 4px 0 6px; }
.od-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.od-grid .card { animation: none; }
.od-customer { display: flex; flex-direction: column; gap: 6px; }
.od-name { font-size: 16px; font-weight: 600; }
.phone-line { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; padding-inline: 10px 4px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.phone-num { font-size: 14px; font-weight: 500; color: var(--text); }
.od-hist { font-size: 12px; }
.od-cod { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.od-cod span { font-size: 12.5px; color: var(--text-2); }
.od-cod b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.od-ticket { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: inherit; font-size: 13px; }
.od-ticket:hover { text-decoration: none; border-color: var(--border-strong); }
.tl-gps { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; font-size: 11.5px; }
.tl-gps svg { width: 12px; height: 12px; }
.tl-title svg { width: 14px; height: 14px; color: var(--cyan); }
.note-composer { display: flex; flex-direction: column; gap: 8px; }
.pod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.pod-photo { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.pod-photo img { display: block; width: 100%; height: 180px; object-fit: cover; }
.pod-sig { display: grid; place-items: center; min-height: 120px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text); padding: 8px; }
.pod-sig svg { width: 100%; max-height: 120px; }

/* ---------- misc ---------- */

.mono { font-family: var(--mono); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.creds { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.creds-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.creds-row span { color: var(--text-3); min-width: 90px; }
.creds-row b { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .02em; flex: 1; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .order-form { grid-template-columns: minmax(0, 1fr); }
  .of-side { position: static; }
}
@media (max-width: 760px) {
  .od-grid { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .filters-row .select, .filters-row .input { min-width: 0; flex: 1 1 140px; }
  .banner { padding: 9px 14px; }
  .hero-figure b { font-size: 40px; }
}
