:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #62717b;
  --line: #dfe7ea;
  --panel: #ffffff;
  --wash: #f3f7f8;
  --teal: #00a7a8;
  --blue: #2d8cff;
  --green: #2ab86f;
  --orange: #f3a92b;
  --shadow: 0 18px 45px rgba(21, 42, 51, 0.12);
  font-family: ui-sans-serif, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #071817;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(420px, 1fr);
  gap: 56px;
  align-items: center;
  padding: 64px;
  background:
    linear-gradient(90deg, rgba(7, 24, 23, 0.96), rgba(7, 24, 23, 0.78)),
    radial-gradient(circle at 78% 28%, rgba(0, 167, 168, 0.28), transparent 32%);
}

.login-panel {
  color: white;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.98;
}

.intro {
  max-width: 420px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 16px;
  max-width: 390px;
  margin-top: 34px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px 16px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.login-form button,
.action-row button,
.panel-header button,
.suggestion-title button {
  border-radius: 8px;
  padding: 13px 18px;
  color: white;
  background: var(--teal);
  font-weight: 800;
}

.error-text {
  min-height: 22px;
  color: #ffb1a4;
}

.login-preview {
  position: relative;
  min-height: 560px;
  border-radius: 18px;
  background: #f8fbfc;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #0c8f9c 0 12%, transparent 12%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(16, 24, 32, 0.06) 47px),
    repeating-linear-gradient(90deg, transparent 0 140px, rgba(16, 24, 32, 0.06) 141px);
}

.metric-card,
.rag-stack,
.line-card {
  position: absolute;
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow);
}

.metric-card {
  left: 70px;
  bottom: 58px;
  width: 190px;
  padding: 24px;
  text-align: center;
}

.metric-card strong {
  display: block;
  color: var(--blue);
  font-size: 54px;
}

.rag-stack {
  left: -28px;
  top: 110px;
  display: grid;
  grid-template-columns: repeat(3, 54px);
  gap: 10px;
  padding: 18px;
}

.rag-stack span {
  border-radius: 6px;
  padding: 10px 0;
  color: white;
  background: var(--orange);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.rag-stack span:nth-child(2) {
  background: #eb5b5b;
}

.rag-stack span:nth-child(3) {
  background: var(--blue);
}

.rag-stack strong {
  grid-column: 1 / -1;
  color: var(--blue);
  text-align: center;
  font-size: 30px;
}

.line-card {
  right: 36px;
  top: 170px;
  padding: 18px 22px;
}

.line-card strong {
  display: block;
  margin-top: 8px;
  color: var(--teal);
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--wash);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  color: white;
  background: #071817;
}

.brand {
  margin-bottom: 18px;
  font-size: 24px;
  font-weight: 900;
}

.nav,
.logout {
  border-radius: 8px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  text-align: left;
}

.nav.active,
.nav:hover {
  color: white;
  background: rgba(0, 167, 168, 0.24);
}

.logout {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
}

.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: white;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-row div,
.settings-box,
.panel-header {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
}

.summary-row strong {
  display: block;
  font-size: 24px;
}

.summary-row span {
  color: var(--muted);
}

.desk-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
}

.case-list {
  display: grid;
  gap: 10px;
}

.case-item {
  position: relative;
  display: grid;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: white;
  text-align: left;
}

.case-item.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 167, 168, 0.12);
}

.case-meta,
.case-item span {
  color: var(--muted);
  font-size: 13px;
}

.case-item em {
  position: absolute;
  right: 14px;
  bottom: 14px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.case-item em.high {
  color: #9f2616;
  background: #ffe4df;
}

.case-item em.medium {
  color: #8a5a00;
  background: #fff1c7;
}

.case-item em.low {
  color: #17683e;
  background: #dff7ea;
}

.case-detail,
.knowledge-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 24px rgba(21, 42, 51, 0.06);
}

.case-detail {
  min-height: 620px;
  padding: 22px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.detail-head span,
.detail-head p {
  color: var(--muted);
}

.detail-head h3 {
  margin-bottom: 8px;
}

.detail-head b {
  height: fit-content;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--teal);
  background: rgba(0, 167, 168, 0.1);
}

.messages {
  display: grid;
  gap: 12px;
  padding: 20px 0;
}

.bubble {
  max-width: 72%;
  border-radius: 14px;
  padding: 13px 15px;
  background: #eef5f6;
}

.bubble.ai {
  margin-left: auto;
  background: #dcf7ef;
}

.bubble span {
  color: var(--muted);
  font-size: 12px;
}

.bubble p {
  margin: 6px 0 0;
  line-height: 1.6;
}

.suggestion-box {
  border: 1px solid #bfe4e4;
  border-radius: 8px;
  padding: 16px;
  background: #f7ffff;
}

.suggestion-title,
.action-row,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.suggestion-title button {
  padding: 9px 12px;
  color: var(--teal);
  background: white;
  border: 1px solid #bfe4e4;
}

textarea {
  width: 100%;
  min-height: 130px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
}

.send-status {
  min-height: 22px;
  margin: -2px 0 12px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
}

.send-status:empty {
  display: block;
}

.action-row {
  justify-content: flex-end;
}

.action-row .secondary {
  color: var(--ink);
  background: #eaf0f2;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.knowledge-card {
  padding: 18px;
}

.knowledge-card span,
.knowledge-card p {
  color: var(--muted);
}

.knowledge-card strong {
  color: var(--blue);
}

.settings-box {
  max-width: 780px;
}

.settings-box code {
  display: block;
  border-radius: 8px;
  padding: 14px;
  background: #101820;
  color: #b9f8ea;
  overflow-wrap: anywhere;
}

.settings-box li {
  margin: 10px 0;
  color: var(--muted);
}

@media (max-width: 960px) {
  .login-view,
  .dashboard,
  .desk-layout {
    grid-template-columns: 1fr;
  }

  .login-view {
    padding: 28px;
  }

  .login-preview {
    min-height: 360px;
  }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
  }

  .brand {
    margin: 0 16px 0 0;
    white-space: nowrap;
  }

  .logout {
    margin-top: 0;
  }

  .topbar,
  .summary-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .summary-row {
    display: grid;
  }
}
