:root {
  --bg: #070a0f;
  --bg-soft: #0c1118;
  --panel: rgba(14, 20, 29, 0.92);
  --panel-soft: rgba(18, 25, 35, 0.78);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7fa;
  --muted: #8e9aaa;
  --muted-light: #b7c0cc;
  --accent: #cfd7e3;
  --danger: #ff9b9b;
  --sidebar-width: 280px;
  --radius: 16px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, #17202c 0, transparent 42%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Loading */

.loading-view {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}

.loading-mark {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Login */

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 34px 38px 38px;
  background: linear-gradient(
    180deg,
    rgba(18, 25, 35, 0.94),
    rgba(10, 15, 22, 0.96)
  );
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.brand-login {
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
}

.brand-logo {
  display: block;
  width: min(100%, 290px);
  height: 190px;
  object-fit: contain;
}

.login-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted-light);
  font-size: 0.85rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(4, 8, 13, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input:focus {
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.primary-button {
  min-height: 48px;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: #eef2f7;
  color: #0a0e14;
  font-weight: 700;
  transition:
    transform 120ms ease,
    opacity 120ms ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-message {
  margin: -2px 0 0;
  font-size: 0.85rem;
}

.error-message {
  color: var(--danger);
}

/* Application shell */

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  background: rgba(8, 12, 18, 0.96);
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  min-height: 118px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 190px;
  height: 105px;
  object-fit: contain;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-light);
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border);
  color: var(--text);
}

.nav-icon {
  width: 20px;
  color: var(--muted);
  font-size: 1.15rem;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.user-summary {
  display: flex;
  align-items: center;
  gap: 11px;
}

.user-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.user-data {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-data strong,
.user-data span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-data strong {
  font-size: 0.85rem;
}

.user-data span {
  color: var(--muted);
  font-size: 0.72rem;
}

.logout-button {
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted-light);
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

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

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 42px;
}

.workspace-header h1 {
  margin: 5px 0 0;
  font-size: 1.8rem;
  font-weight: 650;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.header-user {
  color: var(--muted-light);
  font-size: 0.85rem;
}

.workspace-section {
  max-width: 1080px;
}

.welcome-card,
.empty-state {
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.welcome-card h2,
.empty-state h2 {
  margin: 8px 0 10px;
  font-size: 1.55rem;
}

.welcome-card p,
.empty-state p {
  max-width: 680px;
  margin: 0;
  color: var(--muted-light);
  line-height: 1.65;
}

.partner-assistant {
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.partner-assistant p,
.partner-assistant li {
  color: var(--muted-light);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.partner-assistant .partner-notice {
  padding: 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
}

.partner-search-form { display: grid; gap: 18px; max-width: 640px; }
.partner-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.partner-actions button { padding: 12px 20px; margin: 0; }
.secondary-button {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-soft);
}
.partner-assistant select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}
.partner-assistant button:focus-visible,
.partner-assistant select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.partner-results { list-style: none; padding: 0; display: grid; gap: 12px; }
.partner-results li { padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.partner-results strong { display: block; color: var(--text); }
.partner-results p { margin: 6px 0 0; }
.partner-assistant .error-message { color: var(--danger); }

/* Responsive */

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

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .sidebar-brand {
    min-height: 90px;
  }

  .sidebar-logo {
    height: 78px;
  }

  .sidebar-footer {
    margin-top: 24px;
  }

  .workspace {
    padding: 28px 22px;
  }
}

@media (max-width: 480px) {
  .login-panel {
    padding: 26px 22px 28px;
  }

  .brand-logo {
    height: 160px;
  }

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