@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-400.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-500.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-600.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-700.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-800.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  --brand: #0b6b4f;
  --brand-dark: #07513d;
  --brand-light: #e8f5f0;
  --accent: #f15f43;
  --accent-dark: #d94a31;
  --text: #172b24;
  --muted: #718078;
  --line: #e6ebe8;
  --page: #f5f7f6;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "Be Vietnam Pro", sans-serif;
  background: var(--page);
}

button, input, select { font: inherit; }
button { color: inherit; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.header-inner {
  width: min(760px, calc(100% - 32px));
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark, .speaker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: white;
  background: var(--brand);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.brand-mark i, .speaker-icon i {
  width: 3px;
  display: block;
  border-radius: 5px;
  background: currentColor;
}

.brand-mark i:nth-child(1), .speaker-icon i:nth-child(1) { height: 10px; }
.brand-mark i:nth-child(2), .speaker-icon i:nth-child(2) { height: 19px; }
.brand-mark i:nth-child(3), .speaker-icon i:nth-child(3) { height: 13px; }

.brand strong {
  font-size: 19px;
  letter-spacing: -0.05em;
}

.brand strong span { color: var(--accent); }

.connection-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.connection-pill i {
  width: 8px;
  height: 8px;
  display: block;
  border-radius: 50%;
  background: #c9a23f;
}

.connection-pill.connected i {
  background: #25a976;
  box-shadow: 0 0 0 4px rgba(37, 169, 118, 0.12);
}

.connection-pill.disconnected i { background: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 14px; }
.logout-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: white; cursor: pointer; font-size: 9px; font-weight: 700; }
.logout-button:hover { color: var(--accent-dark); border-color: #f1c1b8; background: #fff8f6; }
.logout-button:disabled { opacity: 0.5; cursor: wait; }

.page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 30px;
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.page-title h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.055em;
}

.page-title p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.control-card, .history-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(36, 58, 49, 0.07);
}

.control-card { padding: 26px; }
.field-group > label, .amount-heading label { color: var(--muted); font-size: 11px; font-weight: 700; }

.speaker-select {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 8px;
  border: 1px solid #dce4e0;
  border-radius: 12px;
  background: #fbfcfb;
}

.speaker-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  margin: 6px;
  border-radius: 9px;
}

.speaker-select select {
  width: 100%;
  padding: 16px 42px 16px 8px;
  border: 0;
  outline: 0;
  appearance: none;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.chevron {
  position: absolute;
  right: 17px;
  top: 16px;
  color: var(--muted);
  pointer-events: none;
  font-size: 18px;
}

.speaker-status-line {
  min-height: 27px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px 0;
  color: var(--muted);
  font-size: 10px;
}

.speaker-status-line button {
  margin-left: auto;
  padding: 4px 0;
  border: 0;
  color: var(--brand);
  background: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.device-status {
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.device-status.online { color: #126347; background: #dff3e9; }
.device-status.ready { color: #126347; background: #dff3e9; }
.device-status.offline { color: #9d3425; background: #fae2dc; }
.device-status.unknown { color: #735f2e; background: #f6edce; }

.divider { height: 1px; margin: 22px 0; background: var(--line); }

.amount-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.amount-heading span {
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--brand);
  background: var(--brand-light);
  font-size: 9px;
  font-weight: 900;
}

.amount-field {
  display: flex;
  align-items: baseline;
  margin-top: 7px;
  border-bottom: 2px solid var(--text);
}

.amount-field input {
  width: 100%;
  min-width: 0;
  padding: 2px 0 5px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: clamp(50px, 11vw, 72px);
  font-weight: 700;
  letter-spacing: -0.065em;
}

.amount-field input::placeholder { color: #dce3e0; }
.amount-field > span { color: var(--accent); font-size: 27px; font-weight: 700; }
.amount-words { min-height: 18px; margin: 8px 0 18px; color: var(--accent-dark); font-size: 11px; }

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.quick-amounts button {
  padding: 9px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfa;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  transition: 0.16s ease;
}

.quick-amounts button:hover { border-color: var(--accent); color: var(--accent-dark); background: #fff7f5; }

.send-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 18px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(217, 74, 49, 0.2);
  font-size: 12px;
  font-weight: 800;
  transition: 0.16s ease;
}

.send-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.send-button:disabled, .speaker-status-line button:disabled { opacity: 0.5; cursor: wait; transform: none; }
.send-icon { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: white; font-size: 7px; }

.device-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.device-metrics > div { padding: 11px 13px; }
.device-metrics > div + div { border-left: 1px solid var(--line); }
.device-metrics span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8px; font-weight: 700; }
.device-metrics strong { font-size: 14px; }

.last-command {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--brand-light);
}

.last-command span { flex: 0 0 auto; color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.last-command p { margin: 0; font-size: 10px; line-height: 1.45; }

.history-card { margin-top: 14px; padding: 20px 24px; }
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-head h2 { margin: 0; font-size: 14px; }
.history-head button { padding: 4px 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 9px; font-weight: 800; }
.activity-list { margin-top: 8px; }
.activity-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.activity-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-light); font-size: 10px; font-weight: 900; }
.activity-icon.outgoing { color: var(--accent-dark); background: #fff0ec; }
.activity-icon.error { color: white; background: var(--accent-dark); }
.activity-item div { min-width: 0; }
.activity-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.activity-item div span, .activity-state { color: var(--muted); font-size: 8px; }
.empty-state { padding: 18px 0 5px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 10px; }

footer { display: flex; justify-content: space-between; padding: 18px 2px 0; color: #98a49f; font-size: 8px; }
footer span:first-child { color: var(--brand); font-weight: 800; }

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(340px, calc(100% - 40px));
  padding: 12px 15px;
  border-radius: 9px;
  color: white;
  background: var(--brand-dark);
  box-shadow: 0 14px 35px rgba(23, 43, 36, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
  font-size: 11px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a93629; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(11, 107, 79, 0.13), transparent 28rem),
    radial-gradient(circle at 90% 85%, rgba(241, 95, 67, 0.1), transparent 25rem),
    var(--page);
}

.login-shell { width: min(400px, 100%); }
.login-brand { width: max-content; margin: 0 auto 24px; }
.login-card { padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 22px 60px rgba(36, 58, 49, 0.1); }
.login-heading { margin-bottom: 26px; }
.login-heading > span { color: var(--accent-dark); font-size: 8px; font-weight: 800; letter-spacing: 0.14em; }
.login-heading h1 { margin: 7px 0 5px; font-size: 28px; letter-spacing: -0.04em; }
.login-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.login-card form > label { display: block; margin: 15px 0 6px; color: var(--text); font-size: 10px; font-weight: 700; }
.login-card input { width: 100%; padding: 12px 13px; border: 1px solid #dce4e0; border-radius: 9px; outline: 0; color: var(--text); background: #fbfcfb; font-size: 12px; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 107, 79, 0.1); background: white; }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-field button { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 8px; border: 0; color: var(--brand); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.login-error { min-height: 17px; margin: 10px 0 4px; color: #b33a29; font-size: 10px; }
.login-button { width: 100%; padding: 12px 16px; border: 0; border-radius: 9px; color: white; background: var(--brand); cursor: pointer; font-size: 11px; font-weight: 800; box-shadow: 0 9px 20px rgba(11, 107, 79, 0.2); }
.login-button:hover { background: var(--brand-dark); }
.login-button:disabled { opacity: 0.6; cursor: wait; }
.login-footer { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 8px; }

.qrpay-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 10%, rgba(11, 107, 79, 0.14), transparent 25rem),
    radial-gradient(circle at 90% 90%, rgba(241, 95, 67, 0.1), transparent 22rem),
    var(--page);
}

.qrpay-shell { width: min(390px, 100%); }
.qrpay-brand { width: max-content; margin: 0 auto 24px; }
.qrpay-card { padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: 0 22px 60px rgba(36, 58, 49, 0.11); text-align: center; }
.payment-symbol, .success-symbol { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 16px; color: white; background: var(--brand); font-size: 25px; font-weight: 800; }
.success-symbol { border-radius: 50%; background: #22a36f; }
.payment-eyebrow { color: var(--accent-dark); font-size: 8px; font-weight: 800; letter-spacing: 0.14em; }
.qrpay-card h1 { margin: 7px 0 5px; font-size: 25px; letter-spacing: -0.04em; }
.payment-amount { margin: 5px 0 24px; color: var(--brand); font-size: 36px; font-weight: 800; letter-spacing: -0.055em; }
.payment-detail { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10px; }
.payment-detail span { color: var(--muted); }
.payment-note { margin: 18px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.payment-button { width: 100%; padding: 13px 16px; border: 0; border-radius: 10px; color: white; background: var(--brand); cursor: pointer; font-size: 11px; font-weight: 800; box-shadow: 0 10px 22px rgba(11, 107, 79, 0.2); }
.payment-button:hover { background: var(--brand-dark); }
.payment-button:disabled { opacity: 0.55; cursor: wait; }
.payment-expiry { margin: 12px 0 0; color: var(--muted); font-size: 8px; }
.payment-error { min-height: 15px; margin: 8px 0 0; color: #b33a29; font-size: 9px; }
.payment-success { padding-top: 42px; padding-bottom: 42px; }
.qrpay-footer { margin: 17px 0 0; color: var(--muted); text-align: center; font-size: 8px; }

@media (max-width: 580px) {
  .header-inner { height: 62px; }
  .brand strong { font-size: 17px; }
  .connection-pill { font-size: 9px; }
  .connection-pill span { display: none; }
  .header-actions { gap: 9px; }
  .page { padding-top: 28px; }
  .page-title { display: block; }
  .page-title p { margin-top: 8px; }
  .control-card { padding: 18px; border-radius: 15px; }
  .quick-amounts { grid-template-columns: repeat(2, 1fr); }
  .last-command { align-items: flex-start; flex-direction: column; gap: 3px; }
  .history-card { padding: 17px 18px; }
  .login-card { padding: 26px 22px; }
  .qrpay-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
