:root {
  --mint: #eef8f1;
  --mint-dark: #dff2e7;
  --teal: #198da0;
  --soft-gray: #f4f6f8;
  --text-dark: #1f2a37;
}

body {
  font-family: "Noto Sans TC", "Segoe UI", sans-serif;
  background: var(--mint);
  color: var(--text-dark);
}

.auth-body {
  background: linear-gradient(135deg, #ecf7f0, #f4fbf7);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-wrapper {
  width: 100%;
  max-width: 480px;
}

.auth-card {
  background: white;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.12);
}

.auth-form .form-control {
  border-radius: 12px;
  padding: 12px 14px;
}

.auth-link {
  color: #1a8fa2;
  text-decoration: none;
  font-weight: 600;
}

.auth-footer {
  text-align: center;
  color: #6b7c86;
  font-size: 14px;
}

.upload-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: #f5faf7;
}

.upload-card {
  width: min(820px, 100%);
  background: #ffffff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.upload-header {
  text-align: center;
  margin-bottom: 24px;
}

.upload-header h4 {
  font-weight: 700;
}

.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  color: #64748b;
  background: #f8fbff;
  margin-bottom: 20px;
}

.upload-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #eef2ff;
  color: #4f46e5;
  display: grid;
  place-items: center;
  font-size: 28px;
  margin: 0 auto 12px;
}

.upload-title {
  font-weight: 600;
  color: #1f2a37;
}

.upload-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.upload-dropzone input[type="file"] {
  max-width: 360px;
  margin: 0 auto;
}

.upload-submit {
  border-radius: 999px;
  padding: 12px 18px;
}

.upload-footer {
  text-align: center;
  margin-top: 16px;
}

.app-shell {
  min-height: 100vh;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 24px;
}

.sidebar {
  background: #f8fbf9;
  border-radius: 24px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.brand {
  background: #f1f8f7;
  border-radius: 16px;
  padding: 12px 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #0ea5a0;
  color: white;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.brand-title {
  font-weight: 700;
}

.brand-subtitle {
  font-size: 12px;
  color: #5b7281;
}

.nav-pills .nav-link {
  color: #546b7a;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 600;
}

.nav-pills .nav-link.active {
  background: #1a8fa2;
  color: white;
  box-shadow: 0 12px 24px rgba(26, 143, 162, 0.3);
}

.sidebar-footer {
  margin-top: auto;
}

.footer-card {
  border: 1px dashed #d4e7d9;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: #688076;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  background: #f9fbf9;
  padding: 16px 20px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.search-pill {
  flex: 1;
  max-width: 520px;
  background: #eef6f4;
  color: #6b8a8f;
  padding: 10px 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  border: none;
  background: #f1f5f9;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #64748b;
}

.profile-pill {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background: #e0f2f1;
  color: #0f766e;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.content-body {
  background: #eef7f0;
  border-radius: 24px;
  padding: 24px;
  box-shadow: inset 0 0 0 1px #e2ede3;
}

.km-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.icon-badge {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 20px;
}

.accent-orange {
  background: #f4a63f;
}

.accent-purple {
  background: #b157c9;
}

.accent-indigo {
  background: #6b7ad6;
}

.accent-red {
  background: #e76b6b;
}

.accent-green {
  background: #5fbf7b;
}

.accent-blue {
  background: #4eb7e8;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.analytics-card {
  background: white;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 12px;
  height: 180px;
  margin-bottom: 12px;
}

.bar-group {
  background: linear-gradient(180deg, #37c3d1, #9be5c4);
  height: var(--value);
  border-radius: 12px 12px 8px 8px;
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  gap: 8px;
}

.donut-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(
    #7fc97f 0% 33%,
    #4eb7e8 33% 58%,
    #f4a63f 58% 83%,
    #e76b6b 83% 100%
  );
  position: relative;
  margin: 0 auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 35px;
  background: white;
  border-radius: 50%;
}

.donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: #64748b;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.legend-dot.green {
  background: #7fc97f;
}

.legend-dot.blue {
  background: #4eb7e8;
}

.legend-dot.orange {
  background: #f4a63f;
}

.legend-dot.red {
  background: #e76b6b;
}

.upload-card,
.chat-card {
  background: white;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.upload-zone {
  border: 2px dashed #cfe6dc;
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  color: #6b8a8f;
  background: #f6fbf8;
}

.upload-zone i {
  font-size: 32px;
  color: #1a8fa2;
}

.upload-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 20px;
  background: #f5f9f7;
  border-radius: 16px;
  padding: 12px;
}

.upload-meta .label {
  font-size: 12px;
  color: #7c9191;
}

.chat-window {
  background: #f5faf7;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 12px;
  min-height: 220px;
}

.chat-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  max-width: 80%;
  font-size: 14px;
}

.chat-bubble.bot {
  background: #e2f4ee;
  color: #2f4f4a;
}

.chat-bubble.user {
  background: #e9f0fb;
  color: #2b3a55;
  justify-self: end;
}

.chat-input {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.chat-input .form-control {
  border-radius: 999px;
}

@media (max-width: 992px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .nav-pills {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-pills .nav-link {
    flex: 1 1 140px;
  }

  .sidebar-footer {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .search-pill {
    max-width: none;
  }

  .profile-pill {
    justify-content: space-between;
  }
}

/* ===========================
   KM Cards（回到原本樣式）
   =========================== */

.km-card{
  background: #ffffff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

/* 原本上方色條（像你截圖那樣一條） */
.km-card::before{
  content:"";
  position:absolute;
  left: 16px;
  right: 16px;
  top: 14px;
  height: 18px;
  border-radius: 10px;
  background: var(--km-accent, #4eb7e8);
}

/* 讓 icon 跟原本一樣：小小放左上 */
.km-card .icon-badge{
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: transparent;
  color: #111827;
  position: relative;
  margin-top: 2px;
}

/* 卡片文字區往下避開色條 */
.km-card h5{
  font-weight: 800;
  font-size: 18px;
  margin-top: 18px; /* 避開上方色條 */
  margin-bottom: 0;
}

.km-card p{
  margin-bottom: 0;
  color: #64748b;
  font-size: 14px;
}

.km-card a{
  color: #2563eb;
  text-decoration: none;
  font-weight: 700;
}

.accent-green  { --km-accent:#5fbf7b; }
.accent-blue   { --km-accent:#4eb7e8; }
.accent-red    { --km-accent:#e76b6b; }
.accent-orange { --km-accent:#f4a63f; }
.accent-purple { --km-accent:#b157c9; }
.accent-indigo { --km-accent:#6b7ad6; }

.km-grid,
.content-body .row.g-4 {
  /* 讓卡片區更像第二張，外圈留白自然 */
  margin-top: 4px;
}

/* 卡片本體：更大、更圓、更「軟」 */
.km-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 26px 26px 22px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  min-height: 220px;

  display: flex;
  flex-direction: column;
  gap: 14px;

  transition: transform .15s ease, box-shadow .15s ease;
}

.km-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.12);
}

/* header 區：左上 icon */
.km-card__header {
  margin-bottom: 6px;
}

/* icon：大、圓角方塊、有一點「可愛感」 */
.km-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.10);
}

.km-icon i {
  font-size: 28px;
  line-height: 1;
  color: #fff;
}

/* 文字：更像第二張（標題更粗更大） */
.km-card__title {
  margin: 0;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .2px;
  color: #111827;
}

.km-card__desc {
  margin: 0;
  font-size: .95rem;
  line-height: 1.55;
  color: rgba(17, 24, 39, .62);
  max-width: 28rem;
}

/* 底部按鈕：大膠囊、置中、淡底色、外框 teal */
.km-card__footer {
  margin-top: auto;
  padding-top: 8px;
}

.km-card__btn {
  width: 100%;
  height: 52px;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  font-weight: 800;
  text-decoration: none;

  /* 第二張圖那種青綠框 + 淡底 */
  border: 2px solid #198da0;
  color: #0f6f80;
  background: rgba(25, 141, 160, 0.06);

  transition: transform .15s ease, background .15s ease, color .15s ease;
}

.km-card__btn:hover {
  transform: translateY(-1px);
  background: rgba(25, 141, 160, 0.10);
}

/* accent 顏色：保留你既有 class 名稱，但讓它更「飽和好看」 */
.accent-green  { background: #22c55e !important; }
.accent-blue   { background: #3b82f6 !important; }
.accent-red    { background: #fb7185 !important; }
.accent-orange { background: #f59e0b !important; }
.accent-purple { background: #a855f7 !important; }
.accent-indigo { background: #6366f1 !important; }

/* ===== KM 卡片：白底 + 只有 icon 有顏色 + 按鈕置中 ===== */

/* 1) 卡片永遠白色（不吃 accent 背景色） */
.km-card{
  background:#fff !important;
  border-radius: 26px;
  padding: 26px 26px 22px;
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 18px 40px rgba(15,23,42,.08);
  min-height: 220px;

  display:flex;
  flex-direction:column;
  gap: 14px;
}

/* 2) icon 方塊：有顏色、大小像你要的 */
.km-icon{
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display:grid;
  place-items:center;
  box-shadow: 0 14px 24px rgba(15,23,42,.10);
}
.km-icon i{
  font-size: 28px;
  color: #fff;
}

/* 3) 標題/描述 */
.km-card__title{
  margin:0;
  font-weight: 800;
  font-size: 1.15rem;
  color:#111827;
}
.km-card__desc{
  margin:0;
  font-size:.95rem;
  line-height:1.55;
  color: rgba(17,24,39,.62);
}

/* 4) 讓按鈕在卡片內置中（你說的「框框內置中」） */
.km-card__footer{
  margin-top:auto;
  display:flex;
  justify-content:center;
  padding-top: 10px;
}

/* 5) 進入KM 按鈕：膠囊、置中、固定寬度漂亮 */
.km-card__btn{
  width: min(320px, 100%);
  height: 54px;
  border-radius: 999px;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  font-weight: 800;
  text-decoration:none;

  border: 2px solid #198da0;
  color: #0f6f80;
  background: rgba(25,141,160,.06);

  transition: transform .15s ease, background .15s ease;
}
.km-card__btn:hover{
  transform: translateY(-1px);
  background: rgba(25,141,160,.10);
}

/* 6) accent 只控制 icon 背景，不要去染整張卡 */
.accent-green  { background:#22c55e !important; }
.accent-blue   { background:#3b82f6 !important; }
.accent-red    { background:#fb7185 !important; }
.accent-orange { background:#f59e0b !important; }
.accent-purple { background:#a855f7 !important; }
.accent-indigo { background:#6366f1 !important; }
/* ===== km_home white card + colored icon + centered button ===== */
.km-home-card{
  background:#fff !important;
  border-radius:24px;
  padding:20px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  display:flex;
  flex-direction:column;
  gap: 10px;
  min-height: 200px;
}

.km-home-title{
  margin: 0;
  font-weight: 800;
  font-size: 18px;
}

.km-home-desc{
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

/* 讓 icon 方塊真的吃到 accent 顏色 */
.km-home-card .icon-badge{
  color:#fff;
}

/* 進入KM 置中，做成框框按鈕 */
.km-home-btn{
  margin-top: auto;
  height: 44px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  font-weight: 800;

  border: 2px solid #2f74ff;
  color: #2f74ff;
  background: transparent;
}

.km-home-btn:hover{
  background: #2f74ff;
  color:#fff;
}