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

html, body {
  height: 100%;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ════════════════════════════════════
   SIDEBAR
════════════════════════════════════ */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid #f0f1f3;
}

.brand-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f4ff;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.3px;
}
.brand-sub {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-item:hover { background: #f9fafb; color: #374151; }
.nav-item.active { background: #eff6ff; color: #2563eb; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #f0f1f3;
}
.sidebar-footer-text { font-size: 11px; color: #c4c9d4; }

/* ════════════════════════════════════
   MAIN
════════════════════════════════════ */
.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 6px; }

.breadcrumb-item {
  font-size: 14px;
  color: #9ca3af;
  font-weight: 400;
}
.breadcrumb-item.active { color: #111827; font-weight: 600; }
.breadcrumb-sep { color: #d1d5db; font-size: 13px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  width: 300px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-search:hover { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.topbar-search svg { width: 15px; height: 15px; color: #9ca3af; flex-shrink: 0; }
.topbar-search span { flex: 1; color: #9ca3af; font-size: 13px; }
.topbar-search kbd {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #9ca3af;
  font-family: inherit;
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Views ── */
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.18s;
  padding: 28px 32px 40px;
}
.view.active {
  visibility: visible;
  opacity: 1;
}
.view-preview { padding: 0; display: flex; flex-direction: column; }

/* ════════════════════════════════════
   HOME VIEW
════════════════════════════════════ */

/* ── Hero Banner ── */
.hero-banner {
  display: flex;
  align-items: center;
  background: linear-gradient(125deg, #1d4ed8 0%, #2563eb 45%, #0891b2 100%);
  border-radius: 16px;
  padding: 36px 40px;
  margin-bottom: 28px;
  overflow: hidden;
  position: relative;
}
.hero-banner::before {
  content: '';
  position: absolute;
  right: -60px; top: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.hero-banner::after {
  content: '';
  position: absolute;
  right: 60px; bottom: -100px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.hero-left { flex: 1; position: relative; z-index: 1; }

.hero-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  letter-spacing: 0.3px;
}

.hero-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  margin-top: 10px;
  line-height: 1.6;
}

.hero-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.hero-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 9px;
  padding: 0 16px;
  flex: 1;
  max-width: 480px;
  transition: background 0.15s, border-color 0.15s;
}
.hero-search-input-wrap:focus-within {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.6);
}
.hero-search-input-wrap svg { width: 16px; height: 16px; color: rgba(255,255,255,0.7); flex-shrink: 0; }

#hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
  padding: 12px 0;
}
#hero-search-input::placeholder { color: rgba(255,255,255,0.55); }

.hero-search-btn {
  background: #fff;
  color: #2563eb;
  border: none;
  padding: 11px 24px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.hero-search-btn:hover { opacity: 0.9; }


/* ── Home Body ── */
.home-body { display: flex; flex-direction: column; gap: 24px; }

/* ── Panel ── */
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid #e5e7eb;
}

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

.panel-title-wrap { display: flex; align-items: center; gap: 8px; }
.panel-bar {
  width: 3px; height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2563eb, #06b6d4);
  flex-shrink: 0;
}
.panel-title { font-size: 15px; font-weight: 700; color: #111827; }

/* ── Hot Companies Grid ── */
.hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.hot-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.hot-card:hover { background: #eff6ff; border-color: #bfdbfe; transform: translateY(-1px); }

.hot-card-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.hot-card-name { font-size: 13px; font-weight: 600; color: #1f2937; }
.hot-card-code { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.hot-skeleton { display: contents; }
.sk-card {
  height: 82px;
  border-radius: 10px;
  background: linear-gradient(90deg,#f3f4f6 25%,#e9eaec 50%,#f3f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Latest Reports Table ── */
.reports-table {
  width: 100%;
  border-collapse: collapse;
}
.reports-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 0 12px 10px;
  border-bottom: 1px solid #f0f1f3;
  white-space: nowrap;
}
.reports-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #f9fafb;
  vertical-align: middle;
}
.reports-table tr:last-child td { border-bottom: none; }
.reports-table tbody tr { cursor: pointer; transition: background 0.1s; }
.reports-table tbody tr:hover { background: #f9fafb; }

.tbl-company-cell { display: flex; align-items: center; gap: 10px; }
.tbl-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.tbl-company-name { font-size: 13px; font-weight: 500; color: #374151; }
.tbl-title { font-size: 13px; color: #1f2937; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-date { font-size: 12px; color: #9ca3af; white-space: nowrap; }
.tbl-action {
  color: #2563eb;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tbl-action svg { width: 13px; height: 13px; }

/* ── Type Tag ── */
.type-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.tt-annual { background: #eff6ff; color: #2563eb; }
.tt-semi   { background: #f0fdf4; color: #16a34a; }
.tt-q1,
.tt-q3     { background: #fff7ed; color: #d97706; }
.tt-other  { background: #f3f4f6; color: #6b7280; }

/* ── Latest Materials Table ── */
.mat-table {
  width: 100%;
  border-collapse: collapse;
}
.mat-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 0 12px 10px;
  border-bottom: 1px solid #f0f1f3;
  white-space: nowrap;
}
.mat-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f9fafb;
  vertical-align: middle;
}
.mat-table tr:last-child td { border-bottom: none; }
.mat-table tbody tr { cursor: pointer; transition: background 0.1s; }
.mat-table tbody tr:hover { background: #f9fafb; }

.mat-company-cell { display: flex; align-items: center; gap: 9px; }
.mat-avatar {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.mat-company-name { font-size: 13px; font-weight: 500; color: #374151; white-space: nowrap; }
.mat-title {
  font-size: 13px; color: #1f2937;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.mat-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.mt-annual  { background: #eff6ff; color: #2563eb; }
.mt-semi    { background: #f0fdf4; color: #16a34a; }
.mt-quarter { background: #fff7ed; color: #d97706; }
.mt-other   { background: #f3f4f6; color: #6b7280; }
.mat-year { font-size: 13px; color: #374151; }
.mat-date { font-size: 12px; color: #9ca3af; white-space: nowrap; }
.mat-size { font-size: 12px; color: #9ca3af; white-space: nowrap; }

/* ════════════════════════════════════
   SEARCH VIEW
════════════════════════════════════ */
.search-view-header { margin-bottom: 22px; }

.view-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 14px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 640px;
}
.search-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-input-wrap svg { width: 17px; height: 17px; color: #9ca3af; margin-left: 14px; flex-shrink: 0; }

#search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 12px;
  font-size: 14px;
  color: #1f2937;
  font-family: inherit;
  background: transparent;
}
#search-input::placeholder { color: #9ca3af; }

.search-clear-btn {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.search-clear-btn:hover { color: #374151; }

.search-submit-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0 22px;
  height: 100%;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.search-submit-btn:hover { background: #1d4ed8; }

/* Search Hint */
.search-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 0;
  gap: 10px;
}
.search-hint-icon { font-size: 56px; }
.search-hint-title { font-size: 18px; font-weight: 600; color: #374151; }
.search-hint-sub { font-size: 13px; color: #9ca3af; }
.search-hint-examples {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.search-hint-examples span {
  background: #eff6ff;
  color: #2563eb;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-hint-examples span:hover { background: #dbeafe; }

/* Result count */
.result-count { font-size: 13px; color: #6b7280; margin-bottom: 14px; }

/* Search Result Table */
.search-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.search-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.search-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.search-table tr:last-child td { border-bottom: none; }
.search-table tbody tr { cursor: pointer; transition: background 0.1s; }
.search-table tbody tr:hover { background: #f9fafb; }

.stbl-company { display: flex; align-items: center; gap: 10px; }
.stbl-avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.stbl-name { font-size: 14px; font-weight: 500; color: #1f2937; }
.stbl-code { font-size: 11px; color: #2563eb; background: #eff6ff; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.stbl-market, .stbl-industry { font-size: 13px; color: #6b7280; }
.stbl-action { color: #2563eb; font-size: 13px; font-weight: 500; white-space: nowrap; }

/* ════════════════════════════════════
   COMPANY DETAIL VIEW
════════════════════════════════════ */
.view-nav { margin-bottom: 18px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2563eb;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
  transition: opacity 0.15s;
}
.back-link:hover { opacity: 0.7; }
.back-link svg { width: 16px; height: 16px; }

/* Company Profile Card */
.company-profile-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px 26px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.cp-logo-wrap { flex-shrink: 0; }
.cp-logo {
  width: 64px; height: 64px;
  border-radius: 14px;
  object-fit: contain;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}
.cp-logo-fallback {
  width: 64px; height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.cp-info { flex: 1; min-width: 0; }
.cp-name { font-size: 20px; font-weight: 700; color: #111827; margin-bottom: 8px; }
.cp-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cp-tag {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 5px;
  font-weight: 500;
}
.cp-tag-code { background: #eff6ff; color: #2563eb; }
.cp-tag-mkt  { background: #f0fdf4; color: #16a34a; }
.cp-tag-ind  { background: #faf5ff; color: #7c3aed; }

.cp-desc { font-size: 13px; color: #6b7280; line-height: 1.65; max-width: 700px; }

/* Company Info Grid */
.cp-info-grid {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px 24px;
  margin-bottom: 22px;
}

.cp-info-item {}
.cp-info-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.cp-info-value {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

/* ════════════════════════════════════
   SHARED
════════════════════════════════════ */
.loading-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 60px 0;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2563eb;
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }
@keyframes dot-bounce {
  0%,80%,100% { transform: scale(0.55); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 10px;
  color: #9ca3af;
}
.empty-icon { font-size: 48px; }
.empty-text { font-size: 14px; color: #6b7280; }
.empty-sub  { font-size: 13px; color: #9ca3af; }
