* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  background: #f5f6fa;
  color: #333;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page { display: none; }
.page.active { display: block; }

/* Login */
.login-box {
  padding: 60px 32px 40px;
  text-align: center;
}

.logo {
  font-size: 48px;
  font-weight: 700;
  color: #003366;
  letter-spacing: 4px;
}

.logo-sub {
  font-size: 16px;
  color: #666;
  margin: 8px 0 40px;
}

.input {
  width: 100%;
  height: 48px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  margin-bottom: 12px;
  background: #fff;
  -webkit-appearance: none;
}

.input:focus {
  border-color: #003366;
  box-shadow: 0 0 0 2px rgba(0,51,102,0.1);
}

.btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
}

.btn-primary {
  background: #003366;
  color: #fff;
}

.btn-primary:active {
  background: #002244;
}

.btn-add {
  width: 80px;
  height: 44px;
  font-size: 15px;
  flex-shrink: 0;
  margin-left: 8px;
}





/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #003366;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 18px;
  font-weight: bold;
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
  letter-spacing: 0.33em;
  margin-left: -0.5em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-email {
  font-size: 13px;
  opacity: 0.9;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;

  white-space: nowrap;
}

.btn-back {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 0;
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* Add Case */
.add-case {
  display: flex;
  padding: 10px 20px;
  gap: 8px;
  align-items: center;
}

.add-case .input {
  flex: 1;
  margin-bottom: 0;
}

/* Error */
.error-msg {
  color: #e74c3c;
  font-size: 14px;
  padding: 0 20px 8px;
}

/* Case List */
.case-card {
  background: #fff;
  margin: 0 16px 10px;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.case-card:active {
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

.case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.case-number {
  font-size: 16px;
  font-weight: 600;
  color: #003366;
}

.case-delete {
  color: #999;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.case-delete:active {
  color: #e74c3c;
}

.case-status {
  font-size: 14px;
  color: #333;
  margin-bottom: 4px;
  word-break: break-word;
  white-space: pre-line;
}

.case-status.error {
  color: #e74c3c;
}

.status-more {
  color: #0066cc;
  cursor: pointer;
  font-weight: bold;
  margin-left: 4px;
  white-space: nowrap;
}
.status-more:hover { text-decoration: underline; }
.status-extra { display: none; }
.status-main { cursor: default; }

.case-meta {
  font-size: 12px;
  color: #999;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 15px;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Page - Settings */
.tab-page { display: none; }
.tab-page.active { display: block; }
.tab-content { padding-bottom: 80px; }

.section {
  background: #fff;
  margin: 12px 16px;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #003366;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio, .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
}

.radio input, .checkbox input {
  width: 18px;
  height: 18px;
  accent-color: #003366;
}

.sub-info {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
}

.sub-info .tier {
  font-weight: 600;
  color: #003366;
}

.sub-info .expired {
  color: #e74c3c;
}

.bind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 15px;
}

.bind-status {
  font-size: 16px;
  color: #999;
}

.bind-status.bound {
  color: #28a745;
  font-weight: bold;
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  display: flex;
  border-top: 1px solid #eee;
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 8px;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  min-width: 0;
}

.tab-item.active {
  color: #003366;
  font-weight: 600;
}

.tab-item span:first-child {
  font-size: 24px;
  margin-bottom: 1px;
}

/* History Page */
.history-list {
  padding: 16px;
}

.history-item {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  position: relative;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: #e0e0e0;
}

.history-item:last-child::before {
  display: none;
}

.history-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #003366;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.history-dot.first {
  background: #999;
}

.history-dot.changed {
  background: #003366;
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-status {
  font-size: 15px;
  font-weight: 500;
  color: #333;
}

.history-time {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.history-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.history-tag.first {
  background: #f0f0f0;
  color: #999;
}

.history-tag.changed {
  background: #e8f4fd;
  color: #003366;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}


.btn-action {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
}

/* Action Links */
.action-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.action-links .btn {
  width: auto;
  height: 36px;
  padding: 0 18px;
  font-size: 14px;
}

.btn-reg {
  background: #0d3b0f;
  color: #fff;
}

.btn-reg:active {
  background: #082509;
}

.btn-forgot {
  background: #a7360e;
  color: #fff;
}

.btn-forgot:active {
  background: #7a2508;
}


/* ===== Responsive: Tablet & Desktop ===== */
@media (min-width: 768px) {
  .login-box {
    max-width: 380px;
    margin: 0 auto;
    padding-top: 80px;
  }

  .tab-content {
    max-width: 500px;
    margin: 0 auto;
  }

  .header {
    justify-content: space-between;
    max-width: 100%;
  }

  .add-case {
    max-width: 500px;
    margin: 0 auto;
  }

  .case-card {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .section {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .history-list {
    max-width: 500px;
    margin: 0 auto;
  }

  .tab-bar {
    max-width: 500px;
    left: 50%;
    transform: translateX(-47%);
    border-radius: 12px 12px 0 0;
  }
}

@media (min-width: 1024px) {
  .login-box {
    max-width: 420px;
    padding-top: 120px;
  }

  .tab-content {
    max-width: 700px;
  }

  .case-card,
  .section,
  .add-case,
  .history-list {
    max-width: 700px;
  }

  .tab-bar {
    max-width: 700px;
  }

  .logo {
    font-size: 56px;
  }
}


/* Code row - side by side layout */
.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.code-row .code-input {
  width: 160px;
  flex: none;
}

/* Code button - dark green */
.btn-code {
  background: #0d3b0f;
  color: #fff;
  letter-spacing: 0.5em;
  white-space: nowrap;
}

.btn-code:active {
  background: #082509;
}

/* Code hint (spam warning) */
.code-hint {
  font-size: 12px;
  color: #8b0000;
  text-align: center;
  margin-top: 8px;
  margin-bottom: 16px;
}
#forgot-step2 { margin-top: 8px; }

/* Header centering fix */
.header-title {
  font-size: 18px;
  font-weight: bold;
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
  letter-spacing: 0.33em;
  margin-left: -0.5em;
}

/* Confirm buttons & phone bind */
.btn-confirm {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: #003366;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.btn-confirm:active { background: #002244; }
.phone-bind-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.phone-bind-row .input { flex: 1; }

.btn-phone-bind:active { background: #072508; }


/* Bind button for WeChat */
.btn-bind {
  padding: 4px 14px;
  background: #003366;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-bind:active { background: #002244; }
.btn-bind:disabled { background: #999; cursor: not-allowed; }

/* Phone bind form */
.phone-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.carrier-select {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  -webkit-appearance: auto;
  appearance: auto;
}
.btn-phone-bind {
  padding: 2px 6px;
  background: #0d3b0f;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-phone-bind:active { background: #072508; }

/* Phone form - input + carrier radios */
.phone-input {
  width: 100%;
}
.carrier-radios {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.carrier-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  word-break: keep-all;
}
.carrier-radio input[type="radio"] {
  margin: 0;
  accent-color: #003366;
}

/* Phone box - blue border */
.phone-box {
  border: 2px solid #003366;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}


/* Phone bind button same as WeChat .btn-bind */
#phone-bind-btn.btn-bind {
  font-size: 14px;
  padding: 6px 20px;
  margin-top: 4px;
}

/* Arrow line: centered on its own line */
.arrow-line {
  text-align: center;
  padding: 6px 0;
}
.arrow-icon {
  font-size: 22px;
  line-height: 1;
}
.carrier-hint {
  text-align: center;
  color: #333;
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 8px;
}


.phone-title {
  font-size: 16px;
  margin-bottom: 12px;
}

/* Subscription page */
.sub-header {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #003366;
  margin-bottom: 16px;
}
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-card {
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  background: #fff;
}
.plan-premium {
  border-color: #003366;
  background: #f0f5ff;
}
.plan-name {
  font-size: 18px;
  font-weight: bold;
  color: #003366;
  margin-bottom: 8px;
}
.plan-price {
  font-size: 28px;
  font-weight: bold;
  color: #003366;
}
.plan-period {
  font-size: 14px;
  font-weight: normal;
  color: #666;
}
.plan-features {
  font-size: 14px;
  color: #555;
  margin: 12px 0;
  line-height: 1.8;
}
.plan-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: #003366;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.plan-btn:active { background: #002244; }
.upgrade-btn { background: #0d3b0f; }
.upgrade-btn:active { background: #072508; }
.sub-active {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 16px;
}
.sub-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
.sub-row:last-child { border-bottom: none; }
.sub-label { color: #888; }
.sub-value { color: #333; font-weight: 500; }
.status-active { color: #0d3b0f; font-weight: bold; }
.status-canceled { color: #a7360e; }
.status-expired { color: #999; }
.sub-usage {
  text-align: center;
  font-size: 15px;
  color: #555;
  margin: 12px 0 8px;
  padding: 10px;
  background: #f5f6fa;
  border-radius: 6px;
}

/* Admin page - hidden by default, shown via JS */


.badge-updated {
  color: #e74c3c;
  font-weight: 600;
  font-size: 13px;
}

.badge-nochange {
  color: #28a745;
  font-weight: 600;
  font-size: 13px;
}

.case-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.case-status.changed-today {
  color: #e74c3c;
}
