:root {
  color: #152026;
  background: #e8eef0;
  font-family: Inter, "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

body.auth-pending {
  overflow: hidden;
}

.shell[hidden],
.password-widget[hidden] {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 76%), rgb(232 242 237 / 88%)),
    #e8eef0;
  backdrop-filter: blur(6px);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-card,
.password-panel {
  width: min(100%, 380px);
  padding: 24px;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  background: #f7fbf8;
  box-shadow: 0 18px 50px rgb(35 54 66 / 18%);
}

.auth-card {
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: #06c755;
}

.auth-card h2 {
  margin: 2px 0 0;
  color: #152026;
  font-size: 24px;
  line-height: 1.25;
}

.auth-subtitle {
  margin: 10px 0 4px;
  color: #63727a;
  font-size: 13px;
  line-height: 1.5;
}

.auth-card button {
  width: 100%;
  margin-top: 16px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgb(6 199 85 / 22%);
}

.auth-card .workflow-field {
  margin-top: 18px;
}

.auth-card input {
  min-height: 46px;
  border: 1px solid #b9cbc2;
  border-radius: 8px;
  background: white;
}

.auth-card input:focus,
.workflow-field textarea:focus,
.workflow-field input:focus,
.workflow-field select:focus,
.quick-reply-row input:focus,
.quick-reply-row select:focus,
.scenario-controls select:focus,
.scenario-add input:focus {
  outline: 3px solid rgb(6 199 85 / 18%);
  border-color: #06a947;
}

.password-widget {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 15;
  display: grid;
  justify-items: start;
  gap: 10px;
}

.password-widget-actions {
  display: flex;
  gap: 8px;
}

.password-toggle {
  min-height: 36px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgb(35 54 66 / 16%);
}

.password-panel {
  width: min(360px, calc(100vw - 36px));
}

.mini-dashboard {
  position: fixed;
  left: 18px;
  top: 18px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, auto));
  gap: 8px;
  width: min(320px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  background: #f7fbf8;
  box-shadow: 0 12px 30px rgb(35 54 66 / 10%);
}

.mini-dashboard p,
.mini-dashboard strong {
  margin: 0;
}

.mini-dashboard p {
  color: #506069;
  font-size: 12px;
  font-weight: 800;
}

.mini-dashboard strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.mini-dashboard button {
  grid-column: 1 / -1;
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 520px) minmax(300px, 360px);
  align-items: center;
  gap: 28px;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: 24px;
}

.scenario-panel {
  align-self: center;
  padding: 18px;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  background: #f7fbf8;
  box-shadow: 0 12px 30px rgb(35 54 66 / 10%);
}

.workflow-panel {
  align-self: center;
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  background: #f7fbf8;
  box-shadow: 0 12px 30px rgb(35 54 66 / 10%);
}

.editor-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.editor-tab {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #b9cbc2;
  border-radius: 6px;
  background: white;
  color: #506069;
  font-size: 13px;
}

.editor-tab.active {
  border-color: #087842;
  background: #d8f4e3;
  color: #087842;
}

.panel-heading,
.quick-reply-editor-heading,
.workflow-actions,
.quick-reply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-kicker {
  margin: 0 0 2px;
  color: #63727a;
  font-size: 12px;
  font-weight: 800;
}

.workflow-panel h2 {
  margin: 0;
  font-size: 18px;
}

.step-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #d8f4e3;
  color: #087842;
  font-size: 12px;
  font-weight: 800;
}

.workflow-field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: #506069;
  font-size: 12px;
  font-weight: 700;
}

.workflow-field textarea,
.workflow-field input,
.workflow-field select,
.quick-reply-row input,
.quick-reply-row select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #b9cbc2;
  border-radius: 6px;
  background: white;
  color: #152026;
  font: inherit;
}

.workflow-field textarea {
  resize: vertical;
  line-height: 1.5;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #506069;
  font-size: 12px;
  font-weight: 700;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: #087842;
}

.quick-reply-editor-heading {
  margin-top: 18px;
  color: #506069;
  font-size: 13px;
}

.quick-reply-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.quick-reply-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.small-button,
.remove-quick-reply {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: #087842;
  font-size: 13px;
}

.remove-quick-reply {
  padding: 0;
  background: #a23b3b;
  font-size: 18px;
}

.secondary-button {
  background: #64767b;
}

.danger-button {
  background: #a23b3b;
}

.workflow-actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.workflow-actions button {
  min-height: 38px;
  border-radius: 6px;
}

.workflow-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: #63727a;
  font-size: 12px;
  line-height: 1.5;
}

.workflow-hint {
  margin: 8px 0 0;
  color: #63727a;
  font-size: 12px;
  line-height: 1.5;
}

.scenario-panel h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.phone {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  height: 100%;
  overflow: hidden;
  border: 1px solid #cfdadd;
  border-radius: 24px;
  background: #eef7f1;
  box-shadow: 0 18px 50px rgb(35 54 66 / 18%);
}

.line-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 16px;
  background: #06c755;
  color: white;
}

.line-header p,
.line-header h1 {
  margin: 0;
}

.scenario-controls,
.scenario-add {
  display: grid;
  gap: 10px;
}

.scenario-add {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #dbe5df;
}

.scenario-controls label,
.scenario-add label {
  display: grid;
  gap: 5px;
  color: #506069;
  font-size: 12px;
  font-weight: 700;
}

.scenario-controls select,
.scenario-add input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #b9cbc2;
  border-radius: 6px;
  background: white;
  color: #152026;
  font: inherit;
}

.scenario-controls select:disabled,
.scenario-add input:disabled {
  background: #edf2ef;
  color: #84918a;
}

.add-row,
.edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.edit-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.scenario-add input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #b9cbc2;
  border-radius: 6px;
}

.icon-button {
  min-height: 38px;
  padding: 0;
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
}

.icon-button:disabled {
  background: #cbd8d1;
  cursor: default;
}

.line-header p {
  color: rgb(255 255 255 / 82%);
  font-size: 12px;
  font-weight: 700;
}

.line-header h1 {
  margin-top: 4px;
  font-size: 18px;
}

button,
input {
  border: 0;
  border-radius: 999px;
  color: #152026;
  font: inherit;
}

button {
  min-height: 42px;
  padding: 0 16px;
  background: #06c755;
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.link-join-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.link-join-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgb(255 255 255 / 36%);
  background: rgb(255 255 255 / 18%);
  color: white;
  white-space: nowrap;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px;
  overflow: auto;
  background:
    linear-gradient(rgb(255 255 255 / 18%), rgb(255 255 255 / 18%)),
    #d7e7dd;
}

.bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 18px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgb(34 51 59 / 10%);
}

.bubble.user {
  align-self: flex-end;
  border-top-right-radius: 5px;
  background: #9fe870;
}

.bubble.bot {
  align-self: flex-start;
  border-top-left-radius: 5px;
  background: white;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 90%;
  align-self: flex-start;
}

.quick-reply {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #06a947;
  border-radius: 7px;
  background: white;
  color: #087842;
  font-size: 14px;
}

.quick-reply:disabled {
  border-color: #cbd8d1;
  background: #eef3f0;
  color: #87958d;
  cursor: default;
}

.bubble.image {
  display: grid;
  min-width: 140px;
  min-height: 92px;
  place-items: center;
  background: #c9f3b4;
  color: #426635;
  font-weight: 800;
}

.composer {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-top: 1px solid #cfdadd;
  background: #f7fbf8;
}

input {
  min-height: 42px;
  padding: 0 14px;
  background: white;
}

.upload {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: white;
  color: #06a947;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
}

.upload input {
  display: none;
}

@media (max-width: 600px) {
  .shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .scenario-panel,
  .workflow-panel {
    order: 2;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .workflow-panel {
    order: 3;
    max-height: none;
  }

  .phone {
    order: 1;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
}

@media (min-width: 601px) and (max-width: 1200px) {
  .shell {
    grid-template-columns: minmax(250px, 320px) minmax(0, 520px);
    align-items: start;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .phone {
    height: calc(100dvh - 48px);
  }

  .workflow-panel {
    grid-column: 1 / -1;
    width: min(100%, 868px);
    max-height: none;
    justify-self: center;
  }
}

@media (max-width: 360px) {
  .composer {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .composer button {
    grid-column: 2;
  }
}
