:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  --brand: #0f172a;
  --bg: #f8fafc;
  --fg: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
}
* {
  box-sizing: border-box;
}
html, body {
  min-height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button, input, select, textarea {
  font-family: var(--font-sans);
  color: inherit;
  font-size: 14px;
}
button {
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 14px;
  background: #fff;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
button.primary {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-color: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
}
button.secondary {
  background: #e2e8f0;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.4);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
}
.icon-btn.danger {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  color: #fff;
  border-color: #b91c1c;
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.3);
}
.btn-danger {
  background: #ef4444;
  color: #fff;
  border: 1px solid #ef4444;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}
input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
textarea {
  resize: vertical;
  min-height: 120px;
}
.hidden,
.dev-hidden {
  display: none !important;
}
main.content {
  display: block;
  min-height: 100vh;
  background: #fff;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.grid {
  display: grid;
  gap: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.global-wait-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(1.5px);
  z-index: 9999;
  pointer-events: none;
}

.global-wait-overlay.show {
  display: flex;
  pointer-events: all;
}

.global-wait-box {
  background: #fff;
  padding: 28px 32px;
  border-radius: 22px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.26);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 240px;
  text-align: center;
}

.global-wait-box img {
  width: 96px;
  height: auto;
}

.global-wait-title {
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
}

.global-wait-desc {
  font-size: 13px;
  color: #475569;
  max-width: 260px;
  line-height: 1.4;
}
.crumb button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
}
main.content.security-locked {
  pointer-events: none;
  filter: grayscale(.4);
  opacity: .65;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal[aria-hidden="false"],
.modal.show {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  color: var(--fg);
  width: min(420px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
}
.modal-body {
  font-size: 14px;
  line-height: 1.6;
}
.modal-close {
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.modal-open {
  overflow: hidden;
}
.security-modal .modal-panel,
.progress-modal .modal-panel {
  background: #0f172a;
  color: #f8fafc;
}
.progress-modal .modal-body {
  color: #e2e8f0;
}

.version-info-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2200;
}
.version-info-btn:hover,
.version-info-btn:focus-visible {
  opacity: 0.95;
  transform: scale(1.05);
  outline: none;
}
.version-info-popup {
  position: fixed;
  bottom: 54px;
  right: 16px;
  max-width: 240px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  background: rgba(15, 23, 42, 0.92);
  color: #f1f5f9;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.45);
  z-index: 2200;
  display: none;
}
.version-info-popup[data-open="true"] {
  display: block;
}
.version-info-popup strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  color: #bae6fd;
}

.version-info-menu {
  display: none;
  margin: 8px 16px;
  padding: 10px 12px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
  font-size: 12px;
  line-height: 1.5;
}
.version-info-menu strong {
  display: block;
  color: #bae6fd;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.version-info-menu[data-open="true"] {
  display: block;
}

.version-storage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.version-storage-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  text-align: left;
  font-size: 12px;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.32);
}
.version-storage-row span:last-child {
  color: #bae6fd;
}
.version-storage-total {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.78);
  color: #bfdbfe;
}

.upload-file-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  max-height: 140px;
  overflow-y: auto;
  background: rgba(241, 245, 249, 0.35);
}
.upload-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  color: #1f2937;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.upload-file-list li:last-child {
  border-bottom: none;
}
.upload-file-name {
  flex: 1;
  margin-right: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-size {
  color: #64748b;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.loading-modal .modal-panel {
  align-items: center;
  text-align: center;
}
.confirm-modal .modal-panel {
  background: #fff;
  color: var(--fg);
}
.nickname-modal .modal-panel,
.avatar-modal .modal-panel {
  background: #fff;
  color: var(--fg);
}
.scan-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
}
.scan-overlay.show {
  display: flex;
}
.scan-panel {
  position: relative;
  width: min(440px, 92vw);
  border-radius: 18px;
  background: #0f172a;
  color: #f8fafc;
  padding: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.scan-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(15, 23, 42, 0.35);
  color: #f8fafc;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
}
.scan-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1120;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-status {
  min-height: 20px;
  font-size: 13px;
  color: #bae6fd;
  letter-spacing: 0.3px;
  text-align: center;
}
.security-message {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}
label {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.table-scroll {
  max-width: 100%;
  overflow: auto;
}
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  display: none;
  z-index: 1500;
  max-width: calc(100vw - 32px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
}
.toast.show {
  display: inline-flex;
}
.toast.toast-success {
  background: rgba(22, 163, 74, 0.95);
}
.toast.toast-warning {
  background: rgba(217, 119, 6, 0.95);
}
.toast.toast-error {
  background: rgba(220, 38, 38, 0.95);
}
.toast-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.toast-icon svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}
.toast-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 auto;
}
.toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}
.toast-text {
  font-weight: 600;
}
.toast-sub {
  font-size: 11px;
  opacity: 0.85;
}
.call-log-entry {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.call-log-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1.3;
  background: rgba(226, 232, 240, 0.85);
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}
.call-log-chip.success {
  background: rgba(220, 252, 231, 0.9);
  color: #166534;
}
.call-log-chip.missed {
  background: rgba(254, 243, 199, 0.9);
  color: #92400e;
}
.call-log-chip.failed {
  background: rgba(254, 226, 226, 0.95);
  color: #991b1b;
}
.call-log-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.08);
  color: currentColor;
}
.call-log-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}
.call-log-text-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.call-log-text-group .call-log-main {
  font-weight: 600;
}
.call-log-text-group .call-log-sub {
  font-size: 11px;
  opacity: 0.75;
}
.call-log-chip.success .call-log-icon {
  background: rgba(34, 197, 94, 0.2);
}
.call-log-chip.missed .call-log-icon {
  background: rgba(251, 191, 36, 0.25);
}
.call-log-chip.failed .call-log-icon {
  background: rgba(248, 113, 113, 0.2);
}
.alert {
  border-radius: 12px;
  padding: 12px 14px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.4);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #e2e8f0;
  color: #1f2937;
}
.contact-item .name {
  display: flex;
  align-items: center;
  gap: 6px;
}
.contact-item .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #64748b;
  border: 1px solid rgba(15, 23, 42, 0.35);
  box-sizing: border-box;
}
.contact-item .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.contact-item .presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  display: none;
}
.contact-item .presence-dot.online {
  display: inline-flex;
}
.contact-item.pending-invite {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}
.contact-item.pending-invite .avatar {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: rgba(15, 23, 42, 0.2);
}
.contact-item.pending-invite .name-text {
  color: #6b7280;
}
.contact-item.pending-invite .meta {
  color: #6b7280;
}
.contact-item.pending-invite .presence-dot,
.contact-item.pending-invite .item-delete {
  display: none;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.25);
  border-radius: 999px;
}
