/* src/styles.css */
:root {
  --buncss-light: initial;
  --buncss-dark: ;
  color-scheme: light;
  --ink: #181a17;
  --muted: #656a60;
  --paper: #f5f2ea;
  --panel: #fffdf7;
  --line: #d8d1bf;
  --line-strong: #1e221d;
  --green: #0b8f5a;
  --green-dark: #06613f;
  --blue: #315f86;
  --amber: #f0c84b;
  --red: #b63c34;
  --red-soft: #fff0ed;
  --shadow: 0 22px 80px #1e221d29;
  font-family: Avenir Next, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Noto Sans CJK SC, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body, #root {
  min-height: 100%;
}

body {
  color: var(--ink);
  background: linear-gradient(#181a170e 1px, transparent 1px), linear-gradient(90deg, #181a170e 1px, transparent 1px), var(--paper);
  background-size: 28px 28px;
  min-width: 320px;
  margin: 0;
}

button, input, textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  position: relative;
  width: min(1160px, 100vw - 32px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 40px 0 52px;
}

.authShell {
  width: min(760px, 100vw - 32px);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 2px solid var(--line-strong);
  align-items:  end;
  gap: 28px;
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.eyebrow {
  color: var(--green-dark);
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

h1 {
  color: var(--ink);
  letter-spacing: 0;
  margin: 0;
  font-size: clamp(36px, 6vw, 70px);
  font-weight: 900;
  line-height: .94;
}

.statusChip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--ink);
  text-align: right;
  align-items:  center;
  gap: 12px;
  min-width: 230px;
  max-width: 340px;
  padding: 12px 14px;
}

.statusChip span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.35;
}

.statusChip strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.2;
}

.statusChip small {
  display: block;
  overflow: hidden;
  color: var(--green-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.statusLogoutButton {
  display: grid;
  border: 2px solid var(--line-strong);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  background: #fff;
  place-items:  center;
  width: 36px;
  height: 36px;
  transition: transform .12s, box-shadow .12s, background-color .12s;
}

.statusLogoutButton:hover {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(340px, .94fr);
  align-items:  start;
  gap: 22px;
}

.panel {
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  background: #fffdf7f5;
}

.panelHeader {
  display: flex;
  border-bottom: 2px solid var(--line-strong);
  justify-content: space-between;
  align-items:  center;
  gap: 16px;
  min-height: 74px;
  padding: 18px 20px;
}

.panelTitle {
  margin: 0;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.2;
}

.panelHint {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.panelMark {
  display: inline-grid;
  border: 2px solid var(--line-strong);
  background: var(--amber);
  color: var(--ink);
  flex: none;
  place-items:  center;
  min-width: 52px;
  height: 34px;
  font-weight: 900;
}

.presetTrigger {
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
  font-size: 12px;
}

.presetTrigger:hover {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}

.conversationPanel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: min(720px, 100svh - 212px);
  min-height: 560px;
}

.conversation {
  display: flex;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 20px;
}

.message {
  display: flex;
  animation: rise .2s ease both;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.bubble {
  border: 2px solid var(--line-strong);
  background: #fff;
  width: -moz-fit-content;
  width: fit-content;
  max-width: min(720px, 90%);
  box-shadow: 5px 5px #181a172e;
}

.message.user .bubble {
  color: #fff;
  background: var(--blue);
}

.message.assistant .bubble {
  color: var(--ink);
  background: #fff;
}

.bubble p {
  overflow-wrap: anywhere;
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.64;
}

.imageStack, .imageGrid {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.imageGrid {
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  max-width: min(540px, 74vw);
}

.imageFrame {
  position: relative;
  margin: 0;
}

.imageFrame img {
  display: block;
  object-fit: contain;
  border: 2px solid var(--line-strong);
  background: #fff;
  width: min(100%, 540px);
  max-height: min(54svh, 580px);
}

.downloadButton, .logoutButton, .iconButton, .sendButton, .draftPreview button {
  display: grid;
  border: 2px solid var(--line-strong);
  color: var(--ink);
  background: #fff;
  place-items:  center;
}

.downloadButton, .logoutButton, .iconButton, .sendButton, .draftPreview button {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background-color .12s, opacity .12s;
}

.downloadButton {
  position: absolute;
  box-shadow: 4px 4px 0 var(--ink);
  width: 36px;
  height: 36px;
  bottom: 10px;
  right: 10px;
}

.downloadButton:hover, .logoutButton:hover, .iconButton:hover, .sendButton:not(:disabled):hover, .draftPreview button:hover, .authSubmit:not(:disabled):hover {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}

.accountBar {
  display: flex;
  align-items:  center;
  gap: 10px;
}

.historyToggle {
  display: inline-flex;
  border: 2px solid var(--line-strong);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  background: #fff;
  align-items:  center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  transition: transform .12s, box-shadow .12s, background-color .12s;
  font-size: 12px;
  font-weight: 850;
}

.historyToggle:hover, .historyToggle.active {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}

.historyToggle.active {
  background: #fff7cf;
}

.logoutButton {
  width: 36px;
  height: 36px;
}

.logoutButton {
  box-shadow: 4px 4px 0 var(--ink);
}

.historyPanel {
  display: grid;
  overflow-y: auto;
  border-bottom: 2px solid var(--line-strong);
  background: #fff7cf;
  gap: 12px;
  max-height: 260px;
  padding: 14px 20px;
}

.historyToolbar, .historyConfirm, .historyActions {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 8px;
}

.historyToolbar {
  justify-content: space-between;
}

.historyToolbar > strong {
  font-size: 13px;
  font-weight: 900;
}

.historyConfirm span {
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
}

.historyItem {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  border: 2px solid var(--line-strong);
  background: #fff;
  align-items:  start;
  gap: 12px;
  padding: 10px;
}

.historyItem img {
  display: block;
  object-fit: cover;
  border: 2px solid var(--line-strong);
  background: #fff;
  width: 86px;
  height: 86px;
}

.historyItem strong {
  display: block;
  font-size: 13px;
  font-weight: 850;
}

.historyItem p, .historyEmpty {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.historyItem p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.historyItem button, .historyToolbar button {
  border: 2px solid var(--line-strong);
  background: var(--green);
  color: #fff;
  cursor: pointer;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.historyActions {
  margin-top: 8px;
}

.historyItem button.danger, .historyToolbar button.danger {
  background: var(--red);
}

.historyToolbar button:not(.danger) {
  color: var(--ink);
  background: #fff;
}

.pending .bubble {
  min-width: min(330px, 82vw);
}

.forgeLoader {
  position: relative;
  display: flex;
  overflow: hidden;
  color: var(--muted);
  align-items:  center;
  gap: 10px;
  min-height: 58px;
  padding: 13px 14px;
}

.forgeLoader svg {
  color: var(--green-dark);
  animation: spin .9s linear infinite;
}

.forgeLoader span {
  font-size: 13px;
  font-weight: 750;
}

.scanlines {
  position: absolute;
  overflow: hidden;
  border: 2px solid var(--line-strong);
  background: #fff;
  height: 8px;
  inset: auto 14px 8px;
}

.scanlines:after {
  content: "";
  display: block;
  background: var(--blue);
  animation: scan 1.1s ease-in-out infinite;
  width: 42%;
  height: 100%;
}

.controlPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 360px;
  padding: 20px;
}

.accountPanel {
  border: 2px solid var(--line-strong);
  background: #fff;
  margin: 0 20px 20px;
}

.accountPanelHeader {
  display: flex;
  border-bottom: 2px solid var(--line-strong);
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  padding: 12px 14px;
}

.accountPanelHeader strong {
  font-size: 15px;
  font-weight: 850;
}

.accountPanelHeader span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.accountPanel .authCard {
  padding: 14px;
}

.accountPanel .authCard > :not(.panelHeader) {
  margin-left: 0;
  margin-right: 0;
}

.walletPanel {
  display: grid;
  border: 2px solid var(--line-strong);
  background: #fff;
  gap: 14px;
  margin: 0 20px 20px;
}

.walletPanelHeader {
  display: flex;
  border-bottom: 2px solid var(--line-strong);
  background: #effaf3;
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  padding: 14px;
}

.walletPanelHeader div {
  display: grid;
  gap: 3px;
}

.walletPanelHeader span, .ledgerItem span, .ledgerTitle, .adminSectionTitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.walletPanelHeader strong {
  font-size: 24px;
  line-height: 1.15;
}

.walletIconButton, .walletPayButton, .payLink, .rechargeChannels button, .quickAmounts button {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  background: #fff;
  font-weight: 850;
}

.walletIconButton {
  display: grid;
  box-shadow: 4px 4px 0 var(--ink);
  place-items:  center;
  width: 38px;
  height: 38px;
}

.walletIconButton:disabled, .walletPayButton:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.walletIconButton svg, .walletPayButton svg {
  flex: none;
}

.walletIconButton:disabled svg, .walletPayButton:disabled svg {
  animation: spin .9s linear infinite;
}

.rechargeBox {
  display: grid;
  gap: 12px;
  padding: 0 14px;
}

.rechargeChannels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rechargeChannels button, .quickAmounts button {
  min-height: 38px;
  box-shadow: 3px 3px #181a1733;
}

.rechargeChannels button.active, .quickAmounts button.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 3px 3px 0 var(--ink);
}

.quickAmounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quickAmounts button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  font-size: 12px;
}

.rechargeInputRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items:  end;
  gap: 10px;
}

.walletPayButton, .payLink {
  display: inline-flex;
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  justify-content: center;
  align-items:  center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
}

.walletPayButton {
  color: #fff;
  background: var(--green);
}

.payLink {
  background: #fff7cf;
}

.walletNotice {
  border: 2px solid var(--line);
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.walletNotice.ok {
  color: var(--green-dark);
  background: #effaf3;
  border-color: #0b8f5a73;
}

.walletNotice.error {
  background: var(--red-soft);
  color: var(--red);
  border-color: #b63c3473;
}

.ledgerGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.ledgerSection {
  display: grid;
  align-content:  start;
  gap: 8px;
  min-width: 0;
}

.ledgerTitle, .adminSectionTitle {
  display: flex;
  align-items:  center;
  gap: 7px;
}

.ledgerTitle strong, .adminSectionTitle strong {
  color: var(--ink);
  font-size: 13px;
}

.ledgerList {
  display: grid;
  gap: 8px;
}

.ledgerItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 2px solid var(--line);
  background: #fffdf7;
  align-items:  center;
  gap: 10px;
  padding: 9px 10px;
}

.ledgerItem div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ledgerItem strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
}

.ledgerItem em {
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.ledgerEmpty {
  border: 2px dashed var(--line);
  color: var(--muted);
  margin: 0;
  padding: 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.inputRow {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 52px;
  align-items:  end;
  gap: 12px;
}

.iconButton {
  box-shadow: 5px 5px 0 var(--ink);
  width: 48px;
  height: 48px;
}

.iconButton.lit {
  background: #effaf3;
}

.sendButton {
  color: #fff;
  background: var(--green);
  box-shadow: 5px 5px 0 var(--ink);
  width: 52px;
  height: 52px;
}

.sendButton svg {
  animation: none;
}

.sendButton:disabled, .authSubmit:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

textarea, .fieldLabel input {
  border: 2px solid var(--line-strong);
  outline: none;
  color: var(--ink);
  background: #fff;
  border-radius: 0;
  width: 100%;
}

textarea {
  resize: vertical;
  min-height: 156px;
  max-height: 300px;
  padding: 14px 15px;
  font-size: 14px;
  line-height: 1.58;
}

textarea:focus, .fieldLabel input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px #0b8f5a24;
}

textarea::placeholder, .fieldLabel input::placeholder {
  color: #8a8f84;
}

input[type="file"] {
  display: none;
}

.modalBackdrop {
  position: fixed;
  z-index: 50;
  display: grid;
  background: #181a176b;
  place-items:  center;
  padding: 20px;
  inset: 0;
}

.presetModal {
  position: relative;
  overflow-y: auto;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 10px 10px 0 var(--ink);
  width: min(620px, 100vw - 32px);
  max-height: min(760px, 100svh - 40px);
}

.modalCloseButton {
  position: absolute;
  z-index: 1;
  display: grid;
  border: 2px solid var(--line-strong);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  background: #fff;
  place-items:  center;
  width: 36px;
  height: 36px;
  top: 12px;
  right: 12px;
}

.presetPanel {
  display: grid;
  background: #fff;
  border: 0;
  gap: 12px;
  padding: 20px;
}

.presetPanelHeader {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  padding-right: 46px;
}

.presetPanelHeader strong {
  font-size: 15px;
  font-weight: 850;
}

.presetPanelHeader span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.presetLoginHint {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.presetChoiceSection {
  display: grid;
  gap: 8px;
}

.presetChoiceSection > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.presetChoiceList {
  display: grid;
  overflow-y: auto;
  gap: 10px;
  max-height: 220px;
  padding-right: 4px;
}

.presetChoice {
  display: grid;
  border: 2px solid var(--line-strong);
  color: var(--ink);
  background: #fff;
  gap: 5px;
  box-shadow: 4px 4px #181a1733;
}

.presetChoice.active, .presetChoice:hover {
  box-shadow: 4px 4px 0 var(--ink);
  background: #fff7cf;
}

.presetChoiceBody {
  display: grid;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  gap: 5px;
  width: 100%;
  padding: 11px 12px 6px;
}

.presetChoice strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.presetChoice small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.presetChoiceActions {
  display: flex;
  border-top: 2px solid var(--line);
  justify-content: space-between;
  align-items:  center;
  gap: 10px;
  padding: 8px 10px 10px;
}

.presetChoiceActions button {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  background: #fff;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 3px 3px #181a172e;
}

.presetChoiceActions button.active {
  background: var(--green);
  color: #fff;
}

.presetChoiceActions button.danger {
  background: var(--red);
  color: #fff;
}

.presetChoiceActions button:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.presetEmpty {
  border: 2px dashed var(--line);
  color: var(--muted);
  background: #fffdf7;
  margin: 0;
  padding: 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.presetCreateGrid {
  display: grid;
  gap: 12px;
}

.presetPromptField textarea {
  resize: vertical;
  min-height: 96px;
  max-height: 160px;
  padding: 10px;
  font-size: 13px;
}

.presetSaveButton {
  border: 2px solid var(--line-strong);
  background: var(--blue);
  color: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  min-height: 42px;
  font-weight: 850;
}

.presetSaveButton:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.outputPanel {
  border: 2px solid var(--line-strong);
  background: #fff;
}

.outputPanelHeader {
  display: flex;
  border-bottom: 2px solid var(--line-strong);
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  padding: 12px 14px;
}

.outputPanelHeader strong {
  font-size: 15px;
  font-weight: 850;
}

.outputPanelHeader span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.outputGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.selectLabel, .rangeLabel {
  display: grid;
  color: var(--muted);
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  font-weight: 750;
}

.selectLabel select, .selectLabel input, .selectLabel textarea {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  outline: none;
  background: #fff;
  border-radius: 0;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  font-weight: 750;
}

.selectLabel input {
  height: 42px;
}

.selectLabel select:focus, .selectLabel input:focus, .selectLabel textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px #0b8f5a24;
}

.customSizeFields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rangeLabel {
  grid-column: 1 / -1;
}

.rangeLabel input {
  accent-color: var(--green);
  width: 100%;
}

.rangeLabel.disabled {
  opacity: .55;
}

.draftPreviewList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 12px;
}

.draftPreview {
  position: relative;
}

.draftPreview img {
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--line-strong);
  background: #fff;
  width: 100%;
}

.draftPreview button {
  position: absolute;
  background: var(--amber);
  box-shadow: 3px 3px 0 var(--ink);
  width: 28px;
  height: 28px;
  top: -8px;
  right: -8px;
}

.errorText, .authError {
  background: var(--red-soft);
  color: var(--red);
  border: 2px solid #b63c3473;
  margin: 0;
  padding: 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.authStage {
  width: min(100%, 520px);
}

.authCard {
  display: grid;
  gap: 18px;
  padding: 0 0 22px;
}

.authCard > :not(.panelHeader) {
  margin-left: 20px;
  margin-right: 20px;
}

.authTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.authTabs button {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  background: #fff;
  min-height: 46px;
  font-weight: 850;
}

.authTabs button.active {
  color: #fff;
  background: var(--blue);
}

.fieldLabel {
  display: grid;
  color: var(--muted);
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
}

.fieldLabel input {
  height: 52px;
  padding: 0 14px;
  font-size: 14px;
}

.authSubmit {
  display: inline-flex;
  border: 2px solid var(--line-strong);
  color: #fff;
  background: var(--green);
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  justify-content: center;
  align-items:  center;
  gap: 8px;
  min-height: 50px;
  font-weight: 850;
}

.authSubmit svg, .authChecking svg {
  animation: spin .9s linear infinite;
}

.authChecking {
  display: flex;
  color: var(--muted);
  align-items:  center;
  gap: 10px;
  font-size: 13px;
  font-weight: 750;
}

.adminShell {
  width: min(1040px, 100vw - 32px);
}

.adminPanel {
  min-height: 360px;
}

.adminStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 20px 0;
}

.adminStatCard {
  display: grid;
  border: 2px solid var(--line-strong);
  background: #fff;
  gap: 7px;
  min-width: 0;
  padding: 14px;
  box-shadow: 4px 4px #181a172e;
}

.adminStatIcon {
  display: grid;
  border: 2px solid var(--line-strong);
  background: var(--amber);
  place-items:  center;
  width: 34px;
  height: 34px;
}

.adminStatCard span, .adminStatCard small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.adminStatCard strong {
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.1;
}

.miniButton, .walletActions button {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  background: #fff;
  min-height: 40px;
  transition: transform .12s, box-shadow .12s, opacity .12s;
  font-weight: 850;
}

.miniButton {
  padding: 0 14px;
}

.miniButton:hover:not(:disabled), .walletActions button:hover {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(2px, 2px);
}

.miniButton:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.adminNotice {
  border: 2px solid var(--line);
  background: #fff;
  margin: 16px 20px 0;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.adminNotice.ok {
  color: var(--green-dark);
  background: #effaf3;
  border-color: #0b8f5a73;
}

.adminNotice.error {
  background: var(--red-soft);
  color: var(--red);
  border-color: #b63c3473;
}

.walletList {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.priceSettings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border: 2px solid var(--line-strong);
  background: #fff7cf;
  align-items:  end;
  gap: 12px;
  margin: 20px 20px 0;
  padding: 14px;
}

.priceSettings > div {
  display: grid;
  gap: 6px;
}

.priceSettings > div span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.priceSettings > div strong {
  font-size: 20px;
  line-height: 1.25;
}

.walletRow {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, .8fr) minmax(160px, .9fr) auto;
  border: 2px solid var(--line-strong);
  background: #fff;
  align-items:  end;
  gap: 12px;
  padding: 14px;
}

.walletIdentity, .walletBalance, .walletAmount {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.walletIdentity span, .walletBalance span, .walletAmount span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.walletIdentity strong, .walletBalance strong {
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.25;
}

.walletAmount input {
  border: 2px solid var(--line-strong);
  color: var(--ink);
  outline: none;
  background: #fff;
  border-radius: 0;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  font-weight: 750;
}

.walletAmount input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px #0b8f5a24;
}

.walletActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.walletActions button {
  padding: 0 12px;
}

.adminRechargePanel {
  display: grid;
  border: 2px solid var(--line-strong);
  background: #fff;
  gap: 12px;
  margin: 20px 20px 0;
  padding: 14px;
}

.adminRechargeList {
  display: grid;
  gap: 10px;
}

.adminRechargeRow {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(88px, .8fr) minmax(88px, .8fr) minmax(70px, .6fr) minmax(70px, .6fr) minmax(92px, .8fr);
  border: 2px solid var(--line);
  background: #fffdf7;
  align-items:  center;
  gap: 10px;
  padding: 10px;
}

.adminRechargeRow div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.adminRechargeRow span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.adminRechargeRow strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.25;
}

.adminEmpty {
  background: #fffdf7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes scan {
  0% {
    transform: translateX(-120%);
  }

  55%, 100% {
    transform: translateX(260%);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (width <= 900px) {
  .shell, .authShell {
    width: min(100vw - 24px, 680px);
    padding-top: 24px;
  }

  .masthead, .workspace {
    grid-template-columns: 1fr;
  }

  .statusChip {
    text-align: left;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .walletRow, .adminStats, .ledgerGrid {
    grid-template-columns: 1fr 1fr;
  }

  .adminRechargeRow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .priceSettings {
    grid-template-columns: 1fr 1fr;
  }

  .walletRow .walletAmount, .walletActions {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: clamp(34px, 13vw, 56px);
  }

  .conversationPanel {
    height: min(640px, 64svh);
    min-height: 440px;
  }
}

@media (width <= 560px) {
  .shell, .authShell {
    width: 100%;
    padding: 18px 12px 26px;
  }

  .panelHeader {
    min-height: 68px;
    padding: 14px;
  }

  .conversation {
    padding: 14px;
  }

  .bubble {
    max-width: 94%;
  }

  .bubble p {
    font-size: 14px;
  }

  .imageFrame img {
    max-height: 48svh;
  }

  .composer {
    min-height: 0;
    padding: 14px;
  }

  .inputRow {
    grid-template-columns: 44px minmax(0, 1fr) 48px;
    gap: 9px;
  }

  .iconButton {
    width: 44px;
    height: 44px;
  }

  .sendButton {
    width: 48px;
    height: 48px;
  }

  textarea {
    min-height: 120px;
  }

  .imageGrid {
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    max-width: 78vw;
  }

  .walletRow, .adminStats, .ledgerGrid, .adminRechargeRow, .rechargeInputRow {
    grid-template-columns: 1fr;
  }

  .quickAmounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .priceSettings {
    grid-template-columns: 1fr;
  }

  .walletRow .walletAmount, .walletActions {
    grid-column: auto;
  }
}
