:root {
  --vi-ink: #10213a;
  --vi-ocean: #178ed9;
  --vi-teal: #20d3c6;
  --vi-mist: #e8f8fb;
  --vi-amber: #ffb447;

  --bg: #eff5fb;
  --panel: #ffffff;
  --line: #c8d8e7;
  --text: #132238;
  --muted: #5c7088;

  --brand: var(--vi-ocean);
  --brand-dark: #17326b;
  --brand-soft: #edf7ff;

  --radius: 14px;
  --shadow: 0 12px 30px rgba(18, 42, 84, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 580px at 8% 2%, rgba(71, 230, 203, 0.25), transparent),
    radial-gradient(1100px 650px at 96% 4%, rgba(34, 124, 255, 0.18), transparent),
    linear-gradient(180deg, #f7fcff, #eef5fb);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
  padding: 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, #2dd6cf 0%, #1ca8f8 40%, #0a3f89 100%);
  box-shadow: var(--shadow);
}

.intro-banner {
  padding: 12px 18px 14px;
  margin-bottom: 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(135deg, #0d2d5c 0%, #17326b 50%, #0a3f89 100%);
  color: #e9f8ff;
  box-shadow: var(--shadow);
}

.intro-banner-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.intro-banner-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

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

.brand-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.7px;
}

.brand p {
  margin: 4px 0 0;
  color: #e9f8ff;
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.pill {
  display: inline-block;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

.pill.active {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.72);
}

.pill.account {
  background: none;
  border: none;
  box-shadow: none;
  cursor: default;
  font-weight: 600;
}

.pill.account:hover {
  background: none;
  border: none;
}

.pill.logout {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.52);
}

.quick-link {
  display: inline-block;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-quick {
  cursor: pointer;
}

.quick-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.3);
}

.status {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 8px 14px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.guest-view {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
}

.guest-hero h2 {
  margin: 0 0 10px;
  font-size: 28px;
  color: var(--vi-ink);
}

.guest-tag {
  margin: 0 0 10px;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f5f8;
  color: var(--vi-ocean);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.guest-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-btn {
  text-decoration: none;
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #21d3c6 0%, #169ad4 58%, #2268bf 100%);
  color: #fff;
  font-weight: 700;
}

.entry-btn.secondary {
  background: #fff;
  color: var(--vi-ocean);
  border: 1px solid #bad9df;
}

.case-preview {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fafcff;
}

.case-preview h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--vi-ink);
}

.case-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.case-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(15, 90, 170, 0.08), rgba(34, 124, 255, 0.12));
  border: 1px dashed rgba(33, 120, 190, 0.4);
  font-size: 13px;
  color: #0f4f82;
  font-weight: 600;
}

.case-samples {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.case-samples li {
  margin: 0;
}

.case-samples a {
  color: #11406f;
  text-decoration: none;
  font-weight: 600;
}

.case-samples a:hover {
  text-decoration: underline;
}

.update-pill {
  display: inline-block;
  border: 1px solid #b9d9eb;
  background: #ecf7ff;
  color: #1e5a80;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.update-pill.warn {
  background: #fff3dc;
  border-color: #f1cd86;
  color: #8a5a00;
}

.update-pill.ok {
  background: #e6fbf5;
  border-color: #a9e7d4;
  color: #0b6f54;
}

.auth-required-link.locked {
  opacity: 0.72;
  cursor: not-allowed;
  filter: saturate(0.75);
}

.case-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #0e3c72;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f0f7ff;
  border: 1px solid #d3e5f5;
  margin-bottom: 10px;
}

.case-preview ul {
  margin: 0;
  padding: 0;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.login-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.wide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 220px;
}

.app-view {
  display: block;
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.workspace-head h2 {
  margin: 0;
  font-size: 22px;
}

.workspace-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.danger-btn {
  background: linear-gradient(120deg, #b23d2f, #d45f46);
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.workspace-grid {
  display: block;
}

.copilot-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 999;
  transition: opacity 0.2s ease;
}

.copilot-drawer-overlay.hidden {
  pointer-events: none;
  opacity: 0;
}

.copilot-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: var(--panel);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
  transform: translateX(100%);
  border-radius: var(--radius) 0 0 var(--radius);
}

.copilot-drawer.open {
  transform: translateX(0);
}

.copilot-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.copilot-drawer-head h2 {
  margin: 0;
  font-size: 17px;
  color: var(--vi-ink);
}

.copilot-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 14px 16px;
  min-height: 0;
}

.copilot-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.copilot-drawer-footer .copilot-quick {
  margin-bottom: 10px;
}

.copilot-history {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafcff;
  padding: 10px;
  min-height: 120px;
  max-height: none;
  overflow: auto;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.copilot-drawer-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.copilot-msg {
  margin: 0 0 10px;
}

.copilot-msg:last-child {
  margin-bottom: 0;
}

.copilot-msg .role {
  font-weight: 800;
  margin-right: 6px;
  color: #1c557a;
}

.copilot-msg.user .role {
  color: #0f4f82;
}

.copilot-msg.assistant .role {
  color: #2a5a44;
}

.copilot-drawer-footer .copilot-input {
  margin-bottom: 8px;
}

.copilot-footnote {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.panel.full-width {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--vi-ink);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #55b5c2;
  box-shadow: 0 0 0 3px rgba(18, 166, 181, 0.14);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px 12px;
  background: linear-gradient(90deg, #21d3c6 0%, #169ad4 58%, #2268bf 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.current-project {
  margin-top: 8px;
  padding: 10px;
  border-radius: 9px;
  background: var(--brand-soft);
  border: 1px solid #bee0e3;
}

.hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #9b4f00;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tab {
  background: #e8edf2;
  color: #28405c;
}

.tab.active {
  background: linear-gradient(120deg, var(--vi-ocean), var(--vi-teal));
  color: #fff;
}

.tab-panels {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.panel-body {
  margin: 0;
  display: none;
  min-height: 260px;
  max-height: 500px;
  overflow: auto;
  padding: 12px;
  background: #0f1f33;
  color: #d8ebff;
  font-size: 12px;
  line-height: 1.55;
}

.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(6, 18, 38, 0.36);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.settings-card {
  width: min(860px, 100%);
}

.settings-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 16px;
}

.settings-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafcff;
}

.settings-block h4 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--vi-ink);
}

.settings-block .hint.small {
  margin: 0 0 6px;
  font-size: 12px;
}

.optional-field.optional-hidden {
  display: none;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-head h3 {
  margin: 0;
  color: var(--vi-ink);
}

.ghost-btn {
  background: #eff6ff;
  color: #2d4a68;
  border: 1px solid #c8d9ed;
}

.corpus-grid {
  margin-top: 8px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.corpus-item {
  background: #f6fbff;
  border: 1px solid #d9e6f3;
  border-radius: 10px;
  padding: 8px 10px;
}

.corpus-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.corpus-item strong {
  display: block;
  color: #153452;
  font-size: 13px;
  word-break: break-all;
}

.panel-body.active {
  display: block;
}

@media (max-width: 1100px) {
  .guest-view {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .corpus-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .settings-blocks {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .workspace-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .workspace-actions {
    width: 100%;
  }
}

/* Nav Overview Section - Premium Styles */
.nav-overview-section {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-overview-section h2 {
  font-size: 20px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--vi-ocean), var(--vi-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.overview-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.overview-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(18, 42, 84, 0.12);
}

.card-image-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f0f7ff;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.overview-card:hover .card-image-wrap img {
  transform: scale(1.08);
}

.card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-content h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--vi-ink);
  font-weight: 700;
}

.card-content p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  flex: 1;
}

.card-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--vi-ocean);
  text-decoration: none;
  display: inline-block;
  transition: transform 0.2s ease;
}

.card-link:hover {
  transform: translateX(4px);
  color: var(--vi-teal);
}

.overview-footer-links {
  display: flex;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}

.overview-footer-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.overview-footer-links a:hover {
  color: var(--vi-ocean);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .overview-cards {
    grid-template-columns: 1fr;
  }
}