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

:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-bg: #eef2ff;
  --green: #10b981;
  --green-bg: #ecfdf5;
  --red: #ef4444;
  --orange: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 30%, #e0e7ff 60%, #f0f9ff 100%);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.5;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--gray-900);
}
.logo svg { color: var(--primary); }

.header-right {
  font-size: 14px;
  color: var(--gray-500);
  font-weight: 500;
}

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
}

/* CDK Section */
.cdk-section {
  display: flex;
  gap: 40px;
  align-items: center;
  background: linear-gradient(135deg, #fff 60%, var(--primary-bg) 100%);
}

.cdk-left { flex: 1; }

.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cdk-left h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: var(--gray-500);
}

.cdk-right {
  flex: 1;
  max-width: 420px;
}

.input-label {
  display: block;
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 500;
  margin-bottom: 6px;
}

.cdk-input-group {
  display: flex;
  gap: 8px;
}

.cdk-input-group input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  font-family: 'Consolas', 'Monaco', monospace;
}
.cdk-input-group input:focus { border-color: var(--primary); }

.cdk-status {
  font-size: 12px;
  margin-top: 4px;
  color: var(--primary);
  min-height: 18px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gray-900);
  color: #fff;
}
.btn-primary:hover { background: var(--gray-700); }

.btn-outline {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}
.btn-outline:hover { border-color: var(--gray-400); background: var(--gray-50); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-link {
  background: none;
  color: var(--primary);
  padding: 6px 12px;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

.btn-receiving {
  background: var(--green);
  color: #fff;
  border-radius: 20px;
}
.btn-receiving:hover { background: #059669; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 20px;
  border-right: 1px solid var(--gray-200);
  min-width: 120px;
}
.status-item:last-of-type { border-right: none; flex: 1; }

.status-label { font-size: 11px; color: var(--gray-400); }
.status-value { font-size: 15px; font-weight: 600; color: var(--gray-800); }

/* Dual Cards */
.dual-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-checking {
  background: var(--green);
  animation: pulse 1.5s infinite;
}
.dot-received {
  background: var(--green);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* Phone Card */
.phone-number {
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 8px 0 6px;
  letter-spacing: 0.5px;
}

.phone-project-info {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 10px;
  padding: 4px 10px;
  background: rgba(79, 70, 229, 0.08);
  border-radius: 6px;
  display: inline-block;
}

.phone-tip {
  font-size: 12px;
  color: var(--green);
  background: var(--green-bg);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.phone-check {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-400);
  padding: 6px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 12px;
}

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

.sync-label {
  font-size: 12px;
  color: var(--primary);
  margin-top: 8px;
  min-height: 18px;
}

/* SMS Card */
.sms-sync {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-400);
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 16px;
}

.sms-code-display {
  min-height: 70px;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.sms-placeholder {
  display: flex;
  gap: 10px;
}
.sms-placeholder .dash {
  width: 28px;
  height: 6px;
  background: var(--primary);
  border-radius: 3px;
  opacity: .6;
}

.sms-code {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 4px;
}

.sms-text {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 16px;
  min-height: 20px;
}

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

/* SMS Status Badge */
#smsStatus {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid #a7f3d0;
}
#smsStatus.received {
  color: var(--primary);
  background: var(--primary-bg);
  border-color: #c7d2fe;
}

/* Change Section */
.change-section { background: #f0fdf4; border: 1px solid #bbf7d0; }
.change-section .card-title svg { color: var(--green); }

.change-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--gray-600);
}

.review-pending-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  margin-right: 6px;
  animation: pulse 1.5s infinite;
  vertical-align: middle;
}

/* History Section */
.history-list { display: flex; flex-direction: column; gap: 8px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.history-item .code {
  font-weight: 700;
  color: var(--primary);
  font-size: 16px;
  min-width: 80px;
}
.history-item .text {
  flex: 1;
  color: var(--gray-600);
}
.history-item .time {
  font-size: 12px;
  color: var(--gray-400);
  text-align: right;
  min-width: 140px;
}

.empty-state {
  text-align: center;
  color: var(--gray-400);
  font-size: 14px;
  padding: 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gray-900);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all .3s;
  z-index: 9999;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Screenshot Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-card {
  background: #fff; border-radius: 16px; width: 460px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: #9ca3af; width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #f3f4f6; color: #374151; }
.modal-body { padding: 20px 24px; }
.modal-desc { font-size: 13px; color: #6b7280; margin-bottom: 16px; line-height: 1.5; }
.upload-area {
  border: 2px dashed #d1d5db; border-radius: 12px; padding: 24px;
  text-align: center; cursor: pointer; transition: all .2s; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: rgba(79,70,229,.04); }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-placeholder span { font-size: 13px; color: #9ca3af; }
.screenshot-preview { max-width: 100%; max-height: 250px; border-radius: 8px; object-fit: contain; }
.modal-status {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 12px 16px; border-radius: 10px; background: #f8fafc; font-size: 13px;
}
.status-spinner {
  width: 18px; height: 18px; border: 2px solid #e5e7eb; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0;
}
.modal-status.success { background: #ecfdf5; color: #065f46; }
.modal-status.error { background: #fef2f2; color: #991b1b; }
.modal-status.success .status-spinner, .modal-status.error .status-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid #f0f0f0;
}

/* Responsive */
@media (max-width: 768px) {
  .cdk-section { flex-direction: column; gap: 20px; }
  .cdk-right { max-width: 100%; }
  .cdk-left h1 { font-size: 22px; }
  .dual-cards { grid-template-columns: 1fr; }
  .status-bar { flex-wrap: wrap; }
  .status-item { border-right: none; min-width: auto; }
  .container { padding: 0 12px; }
  .phone-number { font-size: 24px; }
  .sms-code { font-size: 36px; }
  .header { padding: 12px 16px; }
}
