/* View-specific pieces: the phone, QR, dropzone, send log, receipt */

/* ============================================================
   THE PHONE — sits on the counter, shows what the customer sees
   ============================================================ */

.phone {
  --screen: #E9E1D5;
  position: relative;
  width: 100%;
  max-width: 292px;
  margin: 0 auto;
  padding: 10px;
  border-radius: 40px;
  background: linear-gradient(160deg, #21382e, #0a1c14 60%);
  box-shadow: var(--shadow-phone), inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.22);
  animation: phone-in var(--dur-slower) var(--ease-spring) 200ms both;
  transition: max-width var(--dur-slow) var(--ease-out);
}

@keyframes phone-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.counter[data-mode='running'] .phone {
  max-width: 236px;
}

.phone__screen {
  position: relative;
  border-radius: 31px;
  overflow: hidden;
  background: var(--screen);
  display: flex;
  flex-direction: column;
  min-height: 372px;
}

/* Speaker pill */
.phone::before {
  content: '';
  position: absolute;
  top: 19px;
  left: 50%;
  transform: translateX(-50%);
  width: 62px;
  height: 5px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.55);
  z-index: 3;
}

.phone__bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 26px 13px 11px;
  background: linear-gradient(var(--forest-700), var(--forest-800));
  color: var(--fg-on-chrome);
  flex-shrink: 0;
}

.phone__avatar {
  width: 27px;
  height: 27px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--green-400), var(--forest-600));
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.phone__who {
  min-width: 0;
  flex: 1;
}

.phone__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone__meta {
  font-size: var(--fs-2xs);
  color: var(--green-300);
  line-height: 1.3;
}

.phone__chat {
  position: relative;
  flex: 1;
  padding: 14px 11px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  overflow: hidden;
}

/* Kirana doodles on the phone wallpaper too — same artwork, warmer ink */
.phone__chat::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--doodles);
  background-size: 118px 118px;
  filter: invert(1) sepia(0.5);
  opacity: 0.055;
  pointer-events: none;
}

.bubble {
  position: relative;
  align-self: flex-end;
  max-width: 88%;
  padding: 7px 10px 16px 10px;
  border-radius: 11px 3px 11px 11px;
  background: var(--bubble);
  box-shadow: 0 1px 1px rgba(20, 32, 27, 0.16);
  font-size: 12.5px;
  line-height: 1.42;
  color: var(--ink-900);
  white-space: pre-wrap;
  word-break: break-word;
  animation: bubble-in var(--dur) var(--ease-spring) both;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Bubble tail */
.bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  width: 8px;
  height: 12px;
  background: var(--bubble);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.bubble__time {
  position: absolute;
  right: 9px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  color: rgba(20, 32, 27, 0.45);
  font-family: var(--font-mono);
}

.bubble__time svg {
  width: 13px;
  height: 8px;
  color: #4a9fd8;
}

.bubble--media {
  padding-top: 7px;
}

.bubble__media {
  display: block;
  width: 100%;
  border-radius: 7px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.06);
  object-fit: cover;
  max-height: 118px;
}

.bubble__doc {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  margin-bottom: 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.bubble__doc svg {
  width: 18px;
  height: 18px;
  color: var(--brick-500);
  flex-shrink: 0;
}

.bubble__doc span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Typing indicator shown while the composer is being edited */
.typing {
  align-self: flex-end;
  display: flex;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 11px 3px 11px 11px;
  background: var(--bubble);
  box-shadow: 0 1px 1px rgba(20, 32, 27, 0.16);
  animation: bubble-in var(--dur-fast) var(--ease-out) both;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: var(--r-full);
  background: rgba(20, 32, 27, 0.34);
  animation: typing-bounce 1.15s var(--ease-in-out) infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.phone__empty {
  align-self: center;
  margin: auto 0;
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(20, 32, 27, 0.42);
  line-height: 1.5;
  max-width: 22ch;
  position: relative;
}

.counter__caption {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--fg-on-chrome-muted);
  line-height: 1.5;
}

.counter__caption b {
  color: var(--green-300);
  font-weight: 600;
}

/* ============================================================
   Counter blocks (telemetry, log)
   ============================================================ */

.cblock {
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 0 1px var(--border-chrome);
  animation: rise var(--dur) var(--ease-out) both;
}

.cblock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}

.cblock__head .eyebrow {
  color: var(--fg-on-chrome-muted);
}

.now-sending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--fs-sm);
}

.now-sending__to {
  font-family: var(--font-mono);
  color: var(--green-300);
}

.now-sending__wait {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-on-chrome-muted);
}

/* Countdown ring */
.ring {
  width: 15px;
  height: 15px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.ring circle {
  fill: none;
  stroke-width: 2.5;
}

.ring .ring__track {
  stroke: rgba(255, 255, 255, 0.16);
}

.ring .ring__bar {
  stroke: var(--green-400);
  stroke-linecap: round;
  transition: stroke-dashoffset 500ms linear;
}

/* ---- Live send log ---- */

.log {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 216px;
  overflow-y: auto;
  margin: 0 calc(var(--s-4) * -1) calc(var(--s-4) * -1);
  padding: 0 var(--s-4) var(--s-3);
}

.log__row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: var(--fs-xs);
  animation: log-in var(--dur) var(--ease-out) both;
}

@keyframes log-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.log__icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
}

.log__icon svg {
  width: 10px;
  height: 10px;
}

.log__row[data-s='sent'] .log__icon {
  background: rgba(31, 191, 107, 0.22);
  color: var(--green-300);
}

.log__row[data-s='failed'] .log__icon {
  background: rgba(188, 59, 38, 0.3);
  color: #ff9c86;
}

.log__who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-on-chrome);
}

.log__who small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-on-chrome-muted);
}

.log__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-on-chrome-muted);
  flex-shrink: 0;
}

.log__row[data-s='failed'] .log__tag {
  color: #ff9c86;
}

/* ============================================================
   Step 1 — QR / connection
   ============================================================ */

.qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-7) var(--s-6);
}

.qr__frame {
  position: relative;
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: pop var(--dur-slow) var(--ease-spring) both;
}

.qr__frame img {
  display: block;
  width: 216px;
  height: 216px;
  image-rendering: pixelated;
}

/* Corner brackets */
.qr__frame span {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--green-500);
}

.qr__frame span:nth-child(1) {
  top: 6px;
  left: 6px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 7px 0 0 0;
}

.qr__frame span:nth-child(2) {
  top: 6px;
  right: 6px;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 7px 0 0;
}

.qr__frame span:nth-child(3) {
  bottom: 6px;
  left: 6px;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 7px;
}

.qr__frame span:nth-child(4) {
  bottom: 6px;
  right: 6px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 7px 0;
}

/* Scan sweep */
.qr__frame::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  height: 2px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, transparent, var(--green-500), transparent);
  box-shadow: 0 0 14px 2px rgba(31, 191, 107, 0.6);
  animation: scan 2.6s var(--ease-in-out) infinite;
}

@keyframes scan {
  0%, 100% {
    transform: translateY(0);
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
  50% {
    transform: translateY(214px);
  }
}

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  counter-reset: step;
  max-width: 400px;
}

.steps li {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  font-size: var(--fs-sm);
  color: var(--ink-600);
  line-height: 1.45;
  list-style: none;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--forest-800);
  color: var(--green-300);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
}

.steps b {
  color: var(--ink-900);
}

/* Connected state */
.linked {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, rgba(31, 191, 107, 0.13), rgba(31, 191, 107, 0.03));
  box-shadow: inset 0 0 0 1px rgba(31, 191, 107, 0.3);
  animation: pop var(--dur-slow) var(--ease-spring) both;
}

.linked__badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-full);
  background: var(--green-500);
  color: var(--accent-ink);
  flex-shrink: 0;
  box-shadow: 0 6px 18px -6px rgba(22, 160, 90, 0.8);
}

.linked__badge svg {
  width: 22px;
  height: 22px;
}

.linked__num {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  color: var(--forest-700);
  letter-spacing: -0.01em;
}

/* ============================================================
   Step 2 — dropzone
   ============================================================ */

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-6);
  border-radius: var(--r-lg);
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  border: 2px dashed var(--paper-400);
  transition: all var(--dur) var(--ease-out);
}

.drop:hover,
.drop.is-over {
  border-color: var(--green-500);
  background: rgba(31, 191, 107, 0.06);
  transform: translateY(-2px);
}

.drop__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--forest-800);
  color: var(--green-300);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur) var(--ease-spring);
}

.drop:hover .drop__icon {
  transform: translateY(-3px) rotate(-4deg);
}

.drop__icon svg {
  width: 24px;
  height: 24px;
}

.drop__title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36;
  font-size: var(--fs-lg);
  font-weight: 600;
}

.drop__text {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.file-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--forest-800);
  color: var(--fg-on-chrome);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.file-tag svg {
  width: 13px;
  height: 13px;
  color: var(--green-300);
}

.file-tag button {
  color: var(--fg-on-chrome-muted);
  display: grid;
  place-items: center;
  transition: color var(--dur-fast);
}

.file-tag button:hover {
  color: #fff;
}

/* ============================================================
   Step 3 — composer
   ============================================================ */

.composer {
  position: relative;
}

.composer__count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--fg-subtle);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  pointer-events: none;
}

.media-pick {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px var(--border);
}

.media-pick__thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-xs);
  object-fit: cover;
  background: var(--paper-300);
  flex-shrink: 0;
}

.media-pick__name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-pick__size {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}

/* ============================================================
   Step 4 — send controls
   ============================================================ */

.launch {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-6);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--forest-800), var(--forest-900));
  color: var(--fg-on-chrome);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.launch::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--doodles);
  background-size: 240px 240px;
  opacity: 0.05;
  pointer-events: none;
}

.launch__body {
  flex: 1;
  min-width: 0;
  position: relative;
}

.launch__title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 60;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.launch__text {
  font-size: var(--fs-sm);
  color: var(--fg-on-chrome-muted);
  margin-top: var(--s-1);
  line-height: 1.45;
}

.launch__text b {
  color: var(--green-300);
  font-family: var(--font-mono);
  font-weight: 500;
}

.launch__actions {
  display: flex;
  gap: var(--s-3);
  position: relative;
  flex-shrink: 0;
}

/* ============================================================
   Run summary — printed as a paper receipt
   ============================================================ */

.receipt {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-6) var(--s-8);
  background: #fffdf8;
  box-shadow: var(--shadow-lg);
  animation: receipt-in var(--dur-slower) var(--ease-spring) both;
}

@keyframes receipt-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Torn bottom edge */
.receipt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 10px;
  background: #fffdf8;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10' viewBox='0 0 20 10'%3E%3Cpath d='M0 0h20v0L10 10 0 0z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-size: 20px 10px;
  -webkit-mask-repeat: repeat-x;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10' viewBox='0 0 20 10'%3E%3Cpath d='M0 0h20v0L10 10 0 0z' fill='%23000'/%3E%3C/svg%3E");
  mask-size: 20px 10px;
  mask-repeat: repeat-x;
}

.receipt__head {
  text-align: center;
  padding-bottom: var(--s-5);
  border-bottom: 2px dashed var(--paper-400);
}

.receipt__mark {
  width: 38px;
  height: 38px;
  margin: 0 auto var(--s-3);
}

.receipt__title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 90;
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.receipt__sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: var(--s-2);
}

.receipt__hero {
  text-align: center;
  padding: var(--s-6) 0 var(--s-5);
  border-bottom: 2px dashed var(--paper-400);
}

.receipt__big {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144;
  font-size: var(--fs-4xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--forest-700);
  font-feature-settings: 'tnum' 1;
}

.receipt__big-lbl {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  margin-top: var(--s-2);
}

.receipt__lines {
  padding: var(--s-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  border-bottom: 2px dashed var(--paper-400);
}

.receipt__line {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-sm);
}

.receipt__line span:first-child {
  color: var(--ink-600);
}

.receipt__line i {
  flex: 1;
  border-bottom: 1px dotted var(--paper-500);
  min-width: 20px;
}

.receipt__line b {
  font-family: var(--font-mono);
  font-weight: 500;
  font-feature-settings: 'tnum' 1;
}

.receipt__line[data-tone='bad'] b {
  color: var(--brick-500);
}

.receipt__line[data-tone='ok'] b {
  color: var(--forest-600);
}

.receipt__foot {
  padding-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.receipt__stamp {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-500);
}

/* Bloom behind the receipt on completion */
.summary-wrap {
  position: relative;
  padding: var(--s-6) 0;
}

.summary-wrap::before {
  content: '';
  position: absolute;
  top: 8%;
  left: 50%;
  width: 460px;
  height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(31, 191, 107, 0.26), transparent 68%);
  pointer-events: none;
  animation: fade var(--dur-slower) var(--ease-out) 180ms both;
}

/* ============================================================
   Saved contact lists
   ============================================================ */

/* Pushes the save controls to the far end of a toolbar. */
.toolbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.toolbar__right .input {
  width: 260px;
}

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}

.picker__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  text-align: left;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
}

.picker__item:hover {
  box-shadow: inset 0 0 0 1.5px var(--green-500);
  transform: translateY(-1px);
}

.picker__item--editing {
  cursor: default;
  flex-wrap: wrap;
}

.picker__item--editing:hover {
  box-shadow: inset 0 0 0 1px var(--border);
  transform: none;
}

.picker__body {
  flex: 1;
  min-width: 0;
}

.picker__name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker__meta {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: 2px;
}

.picker__tools {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
