@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading ────────────────────────────────────────── */
.loading-dots { display: flex; gap: 6px; justify-content: center; }
.loading-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: #ccc;
  animation: dot-pulse 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(.8); opacity: .4; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ── Login ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.login-card {
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 12px;
  padding: 40px;
  width: 100%; max-width: 400px;
}


.login-card h1 {
  font-size: 24px; font-weight: 500;
  margin-bottom: 5px;
}

.login-subtitle {
  font-size: 13px; color: #999;
  margin-bottom: 32px;
  letter-spacing: .02em;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; color: #555;
  margin-bottom: 7px;
}
.form-group input[type="email"] {
  width: 100%; padding: 11px 14px;
  border: 1px solid #e0e0e0; border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .2s;
}
.form-group input[type="email"]:focus { border-color: #1a1a1a; }

.btn-primary {
  width: 100%; padding: 12px;
  background: #1a1a1a; color: #fff;
  border: none; border-radius: 8px;
  font-size: 14px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: opacity .2s;
  text-align: center; text-decoration: none; display: block;
}
.btn-primary:hover { opacity: .82; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.error-msg { font-size: 13px; color: #dc2626; margin-top: 8px; margin-bottom: 8px; }

/* Success */
.success-view { text-align: center; }
.success-icon {
  width: 54px; height: 54px; border-radius: 50%;
  background: #f0fdf4;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; color: #16a34a;
}
.success-view h2 { font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.success-view p { font-size: 14px; color: #666; line-height: 1.65; }

/* No account */
.no-account-view { text-align: center; }
.no-account-icon {
  width: 54px; height: 54px; border-radius: 50%;
  background: #fef3c7;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.no-account-view h2 { font-size: 20px; font-weight: 500; margin-bottom: 10px; }
.no-account-view p { font-size: 14px; color: #666; line-height: 1.65; margin-bottom: 24px; }

/* ── Header ─────────────────────────────────────────── */
.header {
  background: #fff; border-bottom: 1px solid #ebebeb;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  position: sticky; top: 0; z-index: 100;
}
.header-name { font-size: 18px; font-weight: 500; display: block; }
.header-subtitle { font-size: 12px; color: #aaa; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-signout {
  padding: 8px 14px; background: #f5f5f5;
  border: 1px solid #e4e4e4; border-radius: 6px;
  font-size: 13px; font-family: inherit; color: #555;
  cursor: pointer; transition: background .15s;
}
.btn-signout:hover { background: #ebebeb; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  padding: 7px; border-radius: 7px; color: #666;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #f0f0f0; color: #1a1a1a; }

/* ── Navigation ─────────────────────────────────────── */
.nav-wrapper {
  background: #fff; border-bottom: 1px solid #ebebeb;
  position: sticky; top: 64px; z-index: 99;
}
.nav-inner {
  max-width: 720px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center;
  overflow-x: auto; scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-tab {
  flex-shrink: 0;
  padding: 15px 11px;
  font-size: 13px; color: #888;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover { color: #1a1a1a; }
.nav-tab.active { color: #1a1a1a; border-bottom-color: #1a1a1a; font-weight: 500; }

.nav-divider {
  width: 1px; height: 18px;
  background: #e8e8e8; margin: 0 8px; flex-shrink: 0;
}
.nav-contact { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-shrink: 0; }
.nav-contact a {
  padding: 8px; color: #888;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color .15s, background .15s;
}
.nav-contact a:hover { color: #1a1a1a; background: #f5f5f5; }

/* ── Content ─────────────────────────────────────────── */
.content { max-width: 720px; margin: 0 auto; padding: 28px 24px; }
.section { display: none; }
.section.active { display: block; }

/* ── Card ────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #ebebeb;
  border-radius: 10px; padding: 22px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 11px; font-weight: 500; color: #aaa;
  letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-secondary {
  padding: 8px 13px; background: #f5f5f5;
  border: 1px solid #e4e4e4; border-radius: 6px;
  font-size: 13px; font-family: inherit; color: #555;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn-secondary:hover { background: #ebebeb; }

/* ── Documents ───────────────────────────────────────── */
.doc-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid #ebebeb; border-radius: 8px;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: background .15s;
}
.doc-item:hover { background: #fafafa; }
.doc-icon {
  width: 34px; height: 34px; background: #f5f5f5; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #777; flex-shrink: 0;
}
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 14px; font-weight: 500; }
.doc-meta { font-size: 12px; color: #aaa; margin-top: 2px; }

.upload-area {
  border: 1.5px dashed #e0e0e0; border-radius: 8px;
  padding: 28px 20px; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
  margin-top: 14px;
}
.upload-area:hover { border-color: #aaa; background: #fafafa; }
.upload-area .upload-label { font-size: 13px; color: #888; margin-top: 8px; display: block; }
.upload-area .upload-hint { font-size: 12px; color: #bbb; margin-top: 4px; display: block; }

.uploaded-docs { margin-top: 14px; }
.uploaded-doc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #ebebeb; border-radius: 7px;
  margin-bottom: 8px; font-size: 13px;
}
.uploaded-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploaded-doc-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Tracking ────────────────────────────────────────── */
.tracking-controls { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-select {
  padding: 7px 10px; border: 1px solid #e4e4e4; border-radius: 6px;
  font-size: 13px; font-family: inherit; background: #fff;
  cursor: pointer; outline: none; color: #555;
}
.add-row-btn {
  padding: 7px 13px; background: #f5f5f5;
  border: 1px solid #e4e4e4; border-radius: 6px;
  font-size: 13px; font-family: inherit; cursor: pointer; color: #555;
  transition: background .15s;
}
.add-row-btn:hover { background: #ebebeb; }

.tracking-table-wrap { overflow-x: auto; border: 1px solid #ebebeb; border-radius: 8px; }
table.tracking-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 580px;
}
table.tracking-table th {
  padding: 9px 11px; text-align: left; font-weight: 500; color: #999;
  background: #fafafa; border-bottom: 1px solid #ebebeb; white-space: nowrap;
}
table.tracking-table td {
  padding: 7px 11px; border-bottom: 1px solid #f2f2f2; vertical-align: middle;
}
table.tracking-table tr:last-child td { border-bottom: none; }
table.tracking-table td input {
  width: 100%; border: none; background: transparent;
  font-size: 13px; font-family: inherit; outline: none; color: #1a1a1a;
}
table.tracking-table td:hover { background: #fafafa; }
.delete-row-btn {
  background: none; border: none; cursor: pointer; color: #d4d4d4;
  padding: 4px; border-radius: 4px; display: flex; align-items: center;
  transition: color .15s;
}
.delete-row-btn:hover { color: #ef4444; }

/* ── Video ───────────────────────────────────────────── */
.video-embed {
  border-radius: 8px; overflow: hidden;
  aspect-ratio: 16/9; background: #1a1a1a; margin-bottom: 12px;
}
.video-embed iframe { width: 100%; height: 100%; border: none; display: block; }
.video-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.video-notes textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #e4e4e4; border-radius: 7px;
  font-size: 13px; font-family: inherit; resize: vertical; min-height: 70px; outline: none;
  transition: border-color .2s;
}
.video-notes textarea:focus { border-color: #1a1a1a; }

/* ── Body Map ─────────────────────────────────────────── */
.body-map-container {
  display: flex; gap: 24px; justify-content: center;
  align-items: flex-start; margin-bottom: 18px;
}
.body-map-view { display: flex; flex-direction: column; align-items: center; flex: 1; }
.body-map-view h4 {
  font-size: 10px; letter-spacing: .1em; color: #bbb;
  text-transform: uppercase; margin-bottom: 10px;
}
.body-map-view svg { width: 100%; max-width: 180px; cursor: default; }

.body-zone { cursor: pointer; transition: opacity .15s; }
.body-zone:hover { opacity: .75; }

.zone-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: #666; margin-bottom: 18px;
}
.zone-legend-item { display: flex; align-items: center; gap: 6px; }
.zone-dot { width: 9px; height: 9px; border-radius: 50%; }

.zone-notes-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.zone-note-item {
  padding: 9px 12px; border-radius: 7px;
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
}

/* ── Mind Web ─────────────────────────────────────────── */
.mind-web-container {
  background: #fff; border: 1px solid #ebebeb;
  border-radius: 10px; overflow: hidden;
  padding: 0; margin-bottom: 16px;
}
.mind-web-title {
  text-align: center; padding: 18px 20px 0;
  font-size: 12px; color: #bbb;
  letter-spacing: .09em; text-transform: uppercase;
}
#mindWebCanvas { display: block; width: 100%; }

/* ── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.38);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #fff; border-radius: 12px; padding: 28px;
  width: 100%; max-width: 460px; max-height: 84vh; overflow-y: auto;
  transform: translateY(6px) scale(.97); transition: transform .2s;
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 18px; font-weight: 500; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: #999; padding: 4px; border-radius: 4px;
  display: flex; align-items: center; transition: color .15s;
}
.modal-close:hover { color: #1a1a1a; }

.modal-status {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; background: #f2f2f2; color: #777;
  margin-bottom: 16px;
}
.modal-desc { font-size: 14px; line-height: 1.72; color: #444; margin-bottom: 20px; }
.modal-section-title {
  font-size: 11px; font-weight: 500; color: #aaa;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.modal-list { list-style: none; padding: 0; }
.modal-list li {
  padding: 6px 0; font-size: 13px; color: #555;
  border-bottom: 1px solid #f2f2f2;
}
.modal-list li:last-child { border-bottom: none; }

/* ── Footer ──────────────────────────────────────────── */
.footer {
  text-align: center; padding: 28px 24px;
  font-size: 12px; color: #c0c0c0;
}
.footer a { color: #aaa; text-decoration: none; }
.footer a:hover { color: #555; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .login-card { padding: 28px 20px; }
  .content { padding: 20px 16px; }
  .card { padding: 16px; }
  .nav-tab { padding: 13px 9px; font-size: 12px; }
  .body-map-container { gap: 18px; }
  .body-map-view svg { width: 90px; }
  table.tracking-table { min-width: 520px; }
}

@media (max-width: 380px) {
  .login-card { padding: 24px 16px; }
  .body-map-container { flex-direction: column; align-items: center; gap: 24px; }
  .body-map-view svg { width: 120px; }
}
