﻿/* layout-common-before.css */
.app {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
}

.app::after {
  content: "";
  position: absolute;
  inset: 0.55rem;
  z-index: 120;
  pointer-events: none;
  border: 0.125rem dashed transparent;
  border-radius: var(--radius);
  background: transparent;
  opacity: 0;
  transition: opacity 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

body[data-file-dragging="true"] .app::after {
  opacity: 1;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 999rem color-mix(in srgb, var(--accent) 16%, transparent);
}

body[data-authenticated="false"] .app {
  display: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

body[data-authenticated="true"] .auth-shell {
  display: none;
}

.auth-card {
  width: min(30rem, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.4rem;
  border-radius: var(--radius);
  background: var(--glass-strong);
  border: 0.0625rem solid var(--glass-border);
  box-shadow: var(--liquid-shadow);
  backdrop-filter: blur(1.25rem) saturate(150%);
}

body .auth-card {
  background: var(--glass-strong);
  border-color: var(--glass-border);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.auth-logo {
  display: block;
  width: min(12rem, 52vw);
  height: 2.25rem;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.auth-brand .brand-title,
.auth-brand .brand-sub {
  display: block;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.28rem;
  border-radius: var(--radius);
  border: 0.0625rem solid var(--glass-border);
  background: var(--panel-strong);
}

.auth-tab {
  min-height: 2.5rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab:hover,
.auth-tab.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-panel[hidden] {
  display: none;
}

.auth-field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-field input {
  width: 100%;
  min-height: 3rem;
  border-radius: var(--radius);
  border: 0.0625rem solid var(--stroke);
  padding: 0.8rem 0.95rem;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.auth-field input:focus {
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  box-shadow: 0 0 0 0.18rem var(--focus-ring);
}

.auth-error {
  margin: 0;
  color: #a12d2d;
  font-size: 0.8125rem;
  line-height: 1.45;
}

body .auth-error {
  color: #ffb7b7;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-business-btn {
  width: 100%;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-weight: 800;
}

.auth-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.auth-check input {
  width: 1rem;
  height: 1rem;
  margin: 0.1rem 0 0;
  accent-color: var(--accent-strong);
}

.auth-legal-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
  border-top: 0.0625rem solid var(--glass-border);
}

.auth-legal-links a {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.auth-legal-links a:hover {
  text-decoration: underline;
}

@media (max-width: 30rem) {
  .auth-card {
    padding: 1.25rem;
  }

  .auth-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .auth-logo {
    width: min(13rem, 100%);
  }
}

body .app {
  border-color: transparent;
}

/* app-header-layout.css */
.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(24rem, 34rem) minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 1.45rem;
  row-gap: 0.45rem;
  min-height: 4.35rem;
  padding: 0.45rem 1.25rem;
  background: var(--glass-strong);
  color: var(--ink);
  border: 0.0625rem solid color-mix(in srgb, var(--glass-border) 76%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 0.45rem 1.4rem rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(1.25rem) saturate(150%);
  overflow: visible;
  flex-shrink: 0;
}

.topbar-brand-group,
.topbar-navigation-group,
.topbar-user-group {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-brand-group {
  justify-self: start;
  gap: 0.75rem;
}

.topbar-navigation-group {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: max-content;
  max-width: min(48rem, calc(100% - 30rem));
  transform: translate(-50%, -50%);
  justify-self: center;
  justify-content: center;
  gap: 1rem;
  overflow: hidden;
}

.topbar-user-group {
  justify-self: end;
  justify-content: flex-end;
  min-width: max-content;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  height: 2.8rem;
  padding: 0.15rem 0;
  border-radius: var(--radius);
  border: 0.0625rem solid transparent;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

body .brand {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.brand-logo {
  display: block;
  width: 11.6rem;
  height: 2.55rem;
  object-fit: contain;
  object-position: center;
  opacity: 0.96;
  filter: drop-shadow(0 0.3rem 0.6rem rgba(0, 0, 0, 0.18));
  flex: 0 0 auto;
}

.brand-company-name {
  min-width: 0;
  max-width: clamp(11rem, 22vw, 24rem);
  overflow: hidden;
  color: color-mix(in srgb, var(--ink) 78%, transparent);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.88;
}

.brand-company-name::before {
  content: "";
  display: inline-block;
  width: 0.0625rem;
  height: 0.9em;
  margin: 0 0.48rem 0 0.05rem;
  vertical-align: -0.12em;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
}

.profile-chip {
  min-width: 8.75rem;
  max-width: 15.5rem;
  min-height: 3rem;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 0.0625rem solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.profile-chip:hover,
.profile-chip:focus-visible {
  background: var(--flat-hover, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--glass-border));
  outline: none;
}

.user-avatar {
  width: 2.45rem;
  min-width: 2.45rem;
  height: 2.45rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 0.0625rem solid color-mix(in srgb, var(--accent) 34%, transparent);
  font-weight: 900;
  font-size: 0.78rem;
}

.user-avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.user-avatar-image[hidden],
.user-initials[hidden] {
  display: none;
}

.user-chip-copy {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.user-profile-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.user-profile-meta .user-role {
  flex: 1 1 auto;
  margin: 0;
}

.user-score-badge {
  flex: 0 0 auto;
  max-width: 4.8rem;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 0.0625rem solid color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.36rem;
}

.user-name-edit-icon {
  width: 0.78rem;
  height: 0.78rem;
  flex: 0 0 auto;
  opacity: 0.86;
  filter: brightness(0) invert(0.92);
  pointer-events: none;
}

body[data-art-theme="light"] .user-name-edit-icon,
body[data-art-theme="cream"] .user-name-edit-icon {
  filter: none;
  opacity: 0.74;
}

.user-name,
.user-role {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.1;
}

.user-role {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.1;
}

.brand-dot {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 0.75rem 1.5rem color-mix(in srgb, var(--accent) 24%, transparent);
  flex-shrink: 0;
}

.brand-dot svg {
  width: 1.15rem;
  height: 1.15rem;
}

.brand-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 800;
}

.brand-sub {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-left: 0;
  justify-self: end;
  min-width: 0;
}

.admin-ai-control {
  position: relative;
  flex: 0 0 auto;
}

.admin-ai-control[hidden] {
  display: none;
}

.admin-ai-status-btn {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.85rem;
  border-radius: 100rem;
  border: 0.0625rem solid var(--glass-border);
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.06);
}

.admin-ai-status-btn:hover,
.admin-ai-status-btn[aria-expanded="true"] {
  background: var(--flat-hover, var(--panel));
}

.admin-ai-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 100rem;
  background: #b6bbc2;
  box-shadow: 0 0 0 0.18rem rgba(182, 187, 194, 0.14);
  flex: 0 0 auto;
}

.admin-ai-dot[data-tone="live"] {
  background: #16a36f;
  box-shadow: 0 0 0 0.18rem rgba(22, 163, 111, 0.16);
}

.admin-ai-dot[data-tone="mock"] {
  background: #d99b1f;
  box-shadow: 0 0 0 0.18rem rgba(217, 155, 31, 0.16);
}

.admin-ai-dot[data-tone="offline"] {
  background: #c04444;
  box-shadow: 0 0 0 0.18rem rgba(192, 68, 68, 0.16);
}

.admin-ai-status-copy {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  text-align: left;
}

.admin-ai-status-copy strong {
  font-size: 0.75rem;
  line-height: 1;
}

.admin-ai-status-copy small {
  max-width: 7.4rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ai-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 90;
  width: min(32rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 0.0625rem solid var(--glass-border);
  background: var(--glass-strong);
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(1.15rem) saturate(145%);
}

.admin-ai-panel[hidden] {
  display: none;
}

.admin-ai-panel-head,
.admin-ai-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-ai-eyebrow,
.admin-ai-panel h3,
.admin-ai-updated {
  margin: 0;
}

.admin-ai-eyebrow {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-ai-panel h3 {
  font-size: 1rem;
}

.admin-ai-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.admin-ai-health-item {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
  padding: 0.7rem;
  border: 0.0625rem solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--panel);
}

.admin-ai-health-item span,
.admin-ai-health-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ai-health-item strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.admin-ai-health-item strong[data-tone="live"] {
  color: #3bd39a;
}

.admin-ai-health-item strong[data-tone="mock"] {
  color: #efbc50;
}

.admin-ai-health-item strong[data-tone="offline"] {
  color: #ff8c8c;
}

.admin-ai-settings-form {
  display: grid;
  gap: 0.55rem;
}

.admin-ai-prompt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.admin-ai-prompt-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.admin-ai-settings-form label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-ai-settings-form textarea {
  width: 100%;
  min-height: 8.5rem;
  resize: vertical;
  border-radius: var(--radius);
  border: 0.0625rem solid var(--stroke);
  padding: 0.75rem;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  outline: none;
}

.admin-ai-settings-form textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 0 0 0.18rem var(--focus-ring);
}

.admin-ai-settings-form textarea.is-readonly {
  cursor: default;
  color: var(--muted);
}

.admin-ai-updated {
  color: var(--muted);
  font-size: 0.72rem;
}

.admin-ai-prompt-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}

.admin-ai-prompt-modal {
  width: min(48rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100dvh - 2rem));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--radius);
  border: 0.0625rem solid var(--glass-border);
  background: var(--glass-strong);
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.36);
  overflow: hidden;
}

.admin-ai-prompt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 0.0625rem solid var(--glass-border);
}

.admin-ai-prompt-modal-head p,
.admin-ai-prompt-modal-head h3 {
  margin: 0;
}

.admin-ai-prompt-modal-head p {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-ai-prompt-modal-head h3 {
  font-size: 1rem;
}

.admin-ai-prompt-modal-content {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  flex: 0 1 auto;
  justify-content: flex-start;
  justify-self: center;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  padding: 0.2rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 0.0625rem solid color-mix(in srgb, var(--glass-border) 72%, transparent);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

body .top-nav {
  background: var(--panel-strong);
  border-color: var(--glass-border);
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  width: 2.35rem;
  min-width: 2.35rem;
  max-width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 0.0625rem solid transparent;
  flex: 0 0 auto;
  overflow: hidden;
  transition:
    background-color 0.1s ease,
    color 0.1s ease,
    border-color 0.1s ease,
    box-shadow 0.1s ease;
}

.nav-btn:hover {
  background: #dbece5;
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.nav-btn.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-strong));
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  box-shadow: 0 0 0 0.0625rem color-mix(in srgb, var(--accent) 22%, transparent), 0 0 1.25rem color-mix(in srgb, var(--accent) 18%, transparent);
}

body .nav-btn:hover {
  background: var(--flat-hover, var(--panel));
}

body .nav-btn.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-strong));
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}

.nav-btn:hover,
.nav-btn:focus-visible {
  outline: none;
}

.nav-btn:focus-visible {
  box-shadow: 0 0 0 0.18rem var(--focus-ring);
}

.nav-icon {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: currentColor;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.nav-icon svg,
.nav-icon img {
  width: 1.05rem;
  height: 1.05rem;
}

.nav-icon img {
  display: block;
  object-fit: contain;
}

body .nav-btn .nav-icon img {
  filter: var(--ui-icon-filter);
  opacity: 0.9;
}

body .nav-btn:hover .nav-icon img,
body .nav-btn:focus-visible .nav-icon img {
  filter: var(--ui-icon-strong-filter);
  opacity: 1;
}

body .nav-btn.active .nav-icon img {
  filter: var(--ui-icon-strong-filter);
  opacity: 1;
}

.nav-btn:hover .nav-icon,
.nav-btn:focus-visible .nav-icon {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.nav-btn.active .nav-icon {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-dark);
}

.nav-copy {
  display: none;
}

.topbar .profile-chip {
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  background: var(--panel-strong);
  border-color: var(--glass-border);
  box-shadow: none;
}

.topbar .profile-chip .user-avatar {
  width: 2.45rem;
  height: 2.45rem;
  background: var(--accent-soft);
}

body *,
body *::before,
body *::after {
  background-image: none !important;
  mask-image: none !important;
}

/* layout-common-after.css */
.views {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-top: 0.55rem;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.view-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.view-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(21rem, 24rem) minmax(0, 1fr) minmax(18rem, 21rem);
  height: 100%;
  min-height: 0;
  gap: 0.55rem;
}

.panel {
  background: var(--glass);
  border: 0.0625rem solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--liquid-shadow);
  backdrop-filter: blur(1.1rem) saturate(145%);
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

.panel-left,
.panel-right {
  display: flex;
  flex-direction: column;
}

.panel-left {
  background: var(--glass);
  min-height: 0;
  overflow: hidden;
}

body .panel,
body .panel-left,
body .panel-center,
body .panel-right {
  background: var(--panel);
  border-color: var(--glass-border);
}

.panel-center {
  background: var(--glass);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-right {
  background: var(--glass);
}

.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.65rem;
  padding: 0.85rem 0.9rem 0.65rem;
  background: transparent;
}

.panel-header h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 800;
}

.panel-new-conversation-btn {
  justify-self: end;
}

.panel-header .filters {
  grid-column: 1 / -1;
}

.panel,
.metric-card {
  animation: floatIn 0.45s ease both;
}

.panel-center {
  animation-delay: 0.08s;
}
