/* =====================================================================
   NXT-Mobile — Dashboard + Repair v2 styles
   Sits after app.css. Add ONE link to header.php:
     <link rel="stylesheet" href="/assets/css/app-v2.css">
   ===================================================================== */

/* ---------- shared utility / atoms used by v2 layouts -------------- */
.mono       { font-family: var(--mono, 'Space Mono', monospace) }
.small      { font-size: 12px }
.linkish    { color: var(--acid); text-decoration: none }
.linkish:hover { text-decoration: underline }
.muted      { color: var(--muted) }
.mt         { margin-top: 12px }
.mb         { margin-bottom: 12px }

/* "panel" exists in app.css; here we add a header bar for it */
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-head h3 {
  margin: 0; font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--acid);
}
.panel-head h4.sub {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0;
}
.panel-sub  { font-size: 12px; color: var(--muted) }

/* status pills already exist; add the mail-in carrier pills */
.pill { display: inline-flex; align-items: center; padding: 4px 10px;
        border-radius: 99px; font-size: 11px; letter-spacing: .08em;
        text-transform: uppercase; font-weight: 700;
        background: var(--panel-2, #1b2a3a); color: var(--ink) }
.b-pending   { background:#3a2d12; color: var(--amber, #ffb454) }
.b-quoted    { background:#1e3a52; color:#bcdcef }
.b-accepted  { background:#1e4438; color:#9be0c0 }
.b-repair    { background:#3a2d12; color: var(--amber, #ffb454) }
.b-ready     { background:#1e4438; color:#9be0c0 }
.b-completed { background:#1f3329; color:#9be0c0 }
.b-cancelled { background:#3a1f1f; color:#ff9c9c }

.ship-wait   { background:#2a3340; color:#a8bdc9 }
.ship-trans  { background:#1e3a52; color:#bcdcef }
.ship-ok     { background:#1e4438; color:#9be0c0 }
.ship-err    { background:#3a1f1f; color:#ff9c9c }

.carrier-usps  { color:#3a4ad9; font-weight:700 }
.carrier-ups   { color:#b78a2d; font-weight:700 }
.carrier-fedex { color:#9a47ab; font-weight:700 }
.carrier-dhl   { color:#d4a01a; font-weight:700 }

.btn-tiny { padding: 5px 12px; font-size: 12px; border-radius: 99px }

/* ====================================================================
   DASHBOARD
   ==================================================================== */
.dash-strip {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 22px;
  padding: 24px 26px;
  background: linear-gradient(135deg,
      var(--panel, #152230) 0%, var(--bg-2, #0f2030) 100%);
  border: 1px solid var(--line, #25384a);
  border-radius: 14px;
  margin-bottom: 18px;
}
.dash-hello {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--ink);
  line-height: 1.15;
}
.dash-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px }

.dash-stats {
  display: flex; gap: 14px;
}
.dstat {
  min-width: 88px; text-align: center;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line, #25384a);
  border-radius: 12px;
  padding: 10px 14px;
  transition: .25s;
}
.dstat b {
  display: block; font-size: 24px; font-weight: 800;
  color: var(--ink); font-family: var(--mono, monospace);
  letter-spacing: -.02em;
}
.dstat span {
  display: block; font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-top: 2px;
}
.dstat.glow {
  border-color: var(--amber, #ffb454);
  box-shadow: 0 0 0 1px var(--amber, #ffb454),
              0 0 22px -6px var(--amber, #ffb454);
}
.dstat.glow b { color: var(--amber, #ffb454) }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dash-col-main, .dash-col-side { display: flex; flex-direction: column; gap: 18px }

.dash-col-side .sticky {
  position: sticky; top: 18px;
}

/* ----- order cards (active + past) ----- */
.ord-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.ord-list.compact { gap: 8px }

.ord-card {
  display: block; text-decoration: none;
  background: var(--bg-2, #0f2030);
  border: 1px solid var(--line, #25384a);
  border-radius: 12px;
  padding: 14px 15px 12px;
  color: var(--ink);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  position: relative; overflow: hidden;
}
.ord-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--acid, #ffb454); opacity: .6;
}
.ord-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-2, #324a60);
  box-shadow: 0 14px 30px -18px rgba(0,0,0,.6);
}
.ord-card.past { opacity: .72 }
.ord-card.past::before { background: var(--muted) }

.ord-card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.ord-card-h .ref {
  font-family: var(--mono, monospace); font-size: 12px;
  color: var(--acid, #ffb454); letter-spacing: .06em;
}
.ord-card-b { padding: 4px 0 8px }
.ord-device { font-weight: 600; font-size: 15px; line-height: 1.3 }
.ord-repair { color: var(--muted); font-size: 13px; margin-top: 2px }
.ord-card-f {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px;
  border-top: 1px dashed var(--line); padding-top: 8px;
  font-size: 12px;
}
.ord-price {
  font-family: var(--mono, monospace); color: var(--ink); font-weight: 700;
}
.ord-pay {
  text-transform: uppercase; letter-spacing: .1em; font-size: 10px;
  padding: 2px 8px; border-radius: 99px;
  background: var(--panel-2, #1b2a3a); color: var(--muted);
}
.ord-pay.paid    { color: #9be0c0; background:#1e4438 }
.ord-pay.refunded{ color: #ff9c9c; background:#3a1f1f }
.ord-when { color: var(--muted) }

/* ----- mail-in table ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch }
.ord-table  {
  width: 100%; border-collapse: collapse; min-width: 540px;
  font-size: 13px;
}
.ord-table th, .ord-table td {
  padding: 11px 12px; text-align: left;
  border-bottom: 1px solid var(--line, #25384a);
}
.ord-table th {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.ord-table tbody tr:hover { background: rgba(255,255,255,.02) }

/* ----- collapsible past section ----- */
.det-panel summary {
  list-style: none; cursor: pointer; padding: 4px 0;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.det-panel summary::-webkit-details-marker { display: none }
.det-panel .chev { transition: transform .25s ease; color: var(--muted) }
.det-panel[open] .chev { transform: rotate(180deg) }
.det-panel[open] .ord-list { margin-top: 14px; animation: fadeIn .25s ease }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px) } to { opacity:1; transform:none } }

/* ----- chat feed (sidebar) ----- */
.chat-feed { list-style: none; margin: 0; padding: 0; display:flex;
             flex-direction: column; gap: 6px }
.chat-feed li a {
  display: block; text-decoration: none; color: var(--ink);
  padding: 10px 12px;
  border-left: 2px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,.015);
  transition: .18s;
}
.chat-feed li a:hover {
  background: rgba(255,255,255,.04);
  border-left-color: var(--line-2, #324a60);
}
.chat-feed li.unread a {
  background: linear-gradient(90deg, rgba(255,180,84,.10), rgba(255,180,84,0));
  border-left-color: var(--amber, #ffb454);
}
.cf-head {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  margin-bottom: 4px;
}
.cf-head .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}
.chat-feed li.unread .cf-head .dot {
  background: var(--amber, #ffb454);
  box-shadow: 0 0 0 0 rgba(255,180,84,.6);
  animation: pulse-dot 1.6s ease-out infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0   rgba(255,180,84,.55) }
  70%  { box-shadow: 0 0 0 10px rgba(255,180,84,0) }
  100% { box-shadow: 0 0 0 0   rgba(255,180,84,0) }
}
.cf-ref  { color: var(--acid, #ffb454); font-size: 11px; letter-spacing:.06em }
.cf-when { color: var(--muted); font-size: 11px; margin-left: auto }
.cf-meta { color: var(--muted); font-size: 11px; letter-spacing: .04em }
.cf-body {
  color: var(--ink); font-size: 13px; line-height: 1.5; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.fade-in { animation: slideIn .35s ease }
@keyframes slideIn { from { opacity:0; transform: translateY(-6px) } to { opacity:1; transform:none } }

/* ----- empty states ----- */
.empty {
  padding: 26px 18px; text-align: center;
  border: 1px dashed var(--line, #25384a); border-radius: 12px;
}
.empty.subtle { padding: 14px 16px; text-align: left }
.empty p { color: var(--muted); font-size: 13px; margin: 0 0 10px }

/* ====================================================================
   REPAIR PAGE
   ==================================================================== */
.rep-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg,
      var(--panel, #152230) 0%, var(--bg-2, #0f2030) 100%);
  border: 1px solid var(--line, #25384a);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 18px;
}
.rep-strip-l { display: flex; flex-wrap: wrap; align-items: center; gap: 12px }
.back {
  color: var(--muted); text-decoration: none; font-size: 12px;
  letter-spacing: .06em;
}
.back:hover { color: var(--ink) }
.ref-h {
  margin: 0; font-family: var(--mono, monospace);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--ink); letter-spacing: .04em;
}
.price-blk {
  text-align: right; display: flex; flex-direction: column; gap: 2px;
}
.price-now {
  font-family: var(--mono, monospace); font-size: 22px;
  color: var(--acid, #ffb454); letter-spacing: -.01em;
}

.rep-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.rep-col-main, .rep-col-side { display: flex; flex-direction: column; gap: 18px }
.rep-col-side .sticky { position: sticky; top: 18px; max-height: calc(100vh - 36px);
                        display: flex; flex-direction: column }

/* Definition list look */
.dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 18px;
  margin: 0;
}
.dl dt { color: var(--muted); font-size: 11px; letter-spacing: .12em;
         text-transform: uppercase; padding-top: 2px }
.dl dd { margin: 0; color: var(--ink); font-size: 14px }

.prose { color: var(--ink); font-size: 14px; line-height: 1.65; white-space: pre-wrap }

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.img-tile {
  display: block; aspect-ratio: 4/3; overflow: hidden;
  border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--line); position: relative;
}
.img-tile img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
  display: block;
}
.img-tile:hover img { transform: scale(1.05); filter: brightness(1.08) }
.img-tile.tech { aspect-ratio: auto; display: flex; flex-direction: column }
.img-tile.tech img { aspect-ratio: 4/3 }
.img-tile.tech figcaption {
  padding: 8px 10px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--bg-2);
}
.tech-panel { border-color: rgba(255,180,84,.32) }

/* Chat panel */
.chat-panel { min-height: 380px; max-height: calc(100vh - 36px);
              display: flex; flex-direction: column }
.chat-stream {
  flex: 1; min-height: 280px;
  overflow-y: auto;
  padding: 4px 4px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2, #324a60) transparent;
}
.chat-empty {
  margin: auto; color: var(--muted); font-size: 13px;
  padding: 24px 8px; text-align: center;
}
.msg {
  max-width: 88%;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px;
  animation: msgIn .25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(4px) } to { opacity:1; transform:none } }
.msg.mine { align-self: flex-end;
            background: linear-gradient(135deg, #1e3a52, #152e44);
            border-color: #2a4d68 }
.msg.shop { align-self: flex-start;
            background: linear-gradient(135deg, #2a210d, #1e1707);
            border-color: rgba(255,180,84,.32) }
.msg-h {
  display: flex; gap: 8px; align-items: baseline; font-size: 11px;
  margin-bottom: 4px;
}
.msg-who  { color: var(--acid); letter-spacing: .08em;
            text-transform: uppercase; font-weight: 700 }
.msg-when { color: var(--muted); margin-left: auto }
.msg-b    { color: var(--ink); font-size: 14px; line-height: 1.5;
            word-wrap: break-word }

.chat-input {
  display: flex; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1; padding: 11px 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font: 14px var(--disp, system-ui);
}
.chat-input input:focus { outline: none; border-color: var(--acid) }

/* ====================================================================
   Toasts (used on dashboard + repair for cross-quote notifications)
   ==================================================================== */
.toast-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 9500;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 320px; max-width: calc(100vw - 36px);
  background: var(--panel, #152230);
  border: 1px solid var(--line-2, #324a60);
  border-left: 4px solid var(--amber, #ffb454);
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration: none; color: var(--ink);
  box-shadow: 0 14px 40px -12px rgba(0,0,0,.7);
  transform: translateX(120%); opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
}
.toast.in  { transform: translateX(0); opacity: 1 }
.toast.out { transform: translateX(120%); opacity: 0 }
.toast .t-h { display: flex; align-items: center; gap: 8px; font-size: 12px }
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%;
                background: var(--amber, #ffb454);
                box-shadow: 0 0 8px var(--amber, #ffb454) }
.toast .t-ref { color: var(--amber, #ffb454); font-family: var(--mono, monospace) }
.toast .t-x {
  margin-left: auto; background: transparent; border: 0;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.toast .t-x:hover { color: var(--ink) }
.toast .t-meta { color: var(--muted); font-size: 11px;
                 letter-spacing: .04em; margin: 4px 0 6px }
.toast .t-body { color: var(--ink); font-size: 13px; line-height: 1.45;
                 display: -webkit-box; -webkit-line-clamp: 3;
                 -webkit-box-orient: vertical; overflow: hidden }

/* ====================================================================
   Responsive — collapse to single column without media-query churn
   ==================================================================== */
@media (max-width: 960px) {
  .dash-strip { grid-template-columns: 1fr; text-align: left }
  .dash-stats { justify-content: flex-start; flex-wrap: wrap }
  .dash-grid, .rep-grid { grid-template-columns: 1fr }
  .dash-col-side .sticky, .rep-col-side .sticky { position: static; max-height: none }
  .chat-panel { max-height: 620px }
}
@media (max-width: 540px) {
  .dash-strip   { padding: 18px 16px }
  .rep-strip    { padding: 14px 16px }
  .dl           { grid-template-columns: 1fr; gap: 2px 0 }
  .dl dt        { margin-top: 8px }
  .ord-card-f   { flex-wrap: wrap }
  .toast        { right: 10px; left: 10px; width: auto }
}
