/* Shared base styles for ABBA web pages */
@font-face {
  font-family: "KoiFont";
  src: url("./fonts/KoiFont.woff2") format("woff2");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(64, 158, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  font-family: "KoiFont", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html.page-auth-pending body {
  visibility: hidden;
}

body.auth-page {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(44, 117, 184, 0.26), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(108, 51, 176, 0.22), transparent 20%),
    radial-gradient(circle at 50% 82%, rgba(19, 132, 121, 0.18), transparent 24%),
    linear-gradient(180deg, #091018 0%, #111729 45%, #0d1220 100%);
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.site-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-tight {
  padding: 22px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.04;
  font-weight: 800;
}

.hero-copy {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.hero-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.pill.muted {
  background: #f3f4f6;
  color: var(--muted);
}

.nav-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  box-shadow: none;
}

.ghost-button {
  width: 100%;
}

.grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-grid {
  margin-top: 0;
}

.three-up {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 21px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top-gap {
  margin-top: 18px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #484038;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 6px;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: rgba(95, 88, 79, 0.82);
}

textarea {
  resize: vertical;
}

button {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
  box-shadow: none;
}

button:hover {
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(64, 158, 255, 0.2);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row button {
  flex: 1 1 140px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  text-align: left;
}

.menu-item.active {
  background: linear-gradient(135deg, #d9752f, #af5321);
}

.mini-label {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

.feedback,
.result-box,
.list-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  min-height: 60px;
  white-space: pre-wrap;
}

.feedback.error {
  color: var(--warn);
  border-color: rgba(139, 47, 47, 0.22);
  background: rgba(139, 47, 47, 0.08);
}

.feedback.success {
  color: var(--accent-strong);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.info-grid div {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.info-grid dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.info-grid dd {
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.list-entry {
  padding: 12px 0;
  border-bottom: 1px solid rgba(122, 107, 85, 0.14);
}

.list-entry.clickable {
  cursor: pointer;
}

.list-entry.clickable:hover {
  background: rgba(11, 107, 99, 0.06);
  border-radius: 12px;
  padding-left: 10px;
  padding-right: 10px;
}

.list-entry:last-child {
  border-bottom: none;
}

.list-entry strong {
  display: block;
  margin-bottom: 4px;
}

.list-entry small {
  color: var(--muted);
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty {
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric {
  font-size: 34px;
  font-weight: 800;
}

.config-summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.config-summary-card {
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.config-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.config-summary-head h3 {
  margin: 0;
  font-size: 18px;
}

.config-summary-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.config-summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(18, 83, 78, 0.08);
}

.config-summary-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.config-summary-list span {
  color: var(--muted);
}

.config-summary-list strong {
  color: var(--ink-strong);
  text-align: right;
}

.inset-panel {
  padding: 18px;
  background: #fbfcff;
}

.inset-panel h3 {
  margin-top: 0;
}

.helper-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.empty-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  background: #fafbfc;
}

.attention-bounce {
  animation: attention-bounce 900ms ease;
  background: linear-gradient(135deg, #b23434, #7e1d1d) !important;
  color: #fff !important;
  border-color: rgba(126, 29, 29, 0.56) !important;
}

@keyframes attention-bounce {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-4px) scale(1.03); }
  55% { transform: translateY(0) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

.admin-only {
  display: none;
}

.admin-only.active {
  display: grid;
}

@media (max-width: 920px) {
  .two-up,
  .three-up,
  .inline-fields,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero-status {
    justify-content: flex-start;
  }

  .config-summary-head {
    justify-content: flex-start;
  }

  .config-summary-list li {
    flex-direction: column;
  }
}

.app-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.abba-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.abba-brand-lockup,
.abba-user-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.abba-brand-lockup-compact {
  gap: 0;
}

.abba-header-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.abba-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.abba-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
}

.abba-brand-copy-wide {
  min-width: 280px;
}

.abba-brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.abba-brand-copy strong {
  font-size: 18px;
  line-height: 1.2;
}

.abba-brand-copy span {
  color: var(--muted);
  font-size: 12px;
}

.header-inline-path {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.abba-header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.header-breadcrumb-sep {
  color: #a8b0bd;
}

.header-toolbox,
.header-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.header-toolbox-button {
  width: auto;
  margin: 0;
  box-shadow: none;
}

.header-toolbox img,
.header-tool-chip img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.muted-chip {
  background: #f8fafc;
  color: var(--muted);
}

.abba-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.abba-top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.abba-top-nav .menu-item {
  width: auto;
  min-width: 108px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(225, 231, 244, 0.8);
}

.abba-top-nav .menu-item.active {
  background: linear-gradient(135deg, #4f8cff, #2e68db);
}

.abba-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--ink);
}

.abba-user-popover {
  position: relative;
}

.abba-user-popover.align-start .abba-user-card {
  left: 0;
  right: auto;
}

.abba-user-popover.align-end .abba-user-card {
  right: 0;
  left: auto;
}

.abba-user-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  list-style: none;
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.abba-user-trigger::-webkit-details-marker {
  display: none;
}

.abba-user-trigger:hover,
.abba-user-popover[open] .abba-user-trigger {
  border-color: #d9ecff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.abba-user-card {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 12;
  min-width: 280px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  color: var(--ink);
}

.abba-user-card .helper-text {
  color: var(--muted);
}

.user-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.user-card-pills .nav-link {
  min-height: 32px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.user-card-note {
  margin: 12px 0 0;
  line-height: 1.6;
}

.abba-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e9eef6;
  border: 1px solid #dce3ee;
  color: #5b6472;
  font-weight: 700;
  transition: transform 240ms ease;
}

.abba-user-trigger:hover .abba-avatar {
  transform: scale(1.04);
}

.abba-avatar.large {
  width: 88px;
  height: 88px;
  font-size: 30px;
}

.abba-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-hero-card {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.workspace-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 16px;
  margin: 20px;
  align-items: start;
}

.workspace-layout.sidebar-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.workspace-sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.workspace-layout.sidebar-collapsed .workspace-sidebar {
  align-items: center;
  padding: 12px 8px;
}

.workspace-layout.sidebar-collapsed .workspace-sidebar-head {
  display: none;
}

.workspace-sidebar-head h2 {
  margin: 0;
}

.workspace-tree-group {
  display: grid;
  gap: 6px;
}

.workspace-tree-menu,
.workspace-tree-children {
  display: grid;
  gap: 6px;
}

.workspace-tree-children[hidden] {
  display: none !important;
}

.workspace-tree-parent,
.workspace-tree-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.workspace-tree-parent {
  min-height: 50px;
  justify-content: center;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
}

.workspace-tree-child {
  min-height: 38px;
  padding: 8px 10px 8px 28px;
  position: relative;
  opacity: 0.96;
}

.workspace-tree-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.workspace-tree-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.workspace-tree-parent-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.workspace-tree-parent-copy strong {
  font-size: 14px;
  line-height: 1.2;
}

.workspace-tree-parent-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.workspace-tree-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #7c8798;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.menu-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.menu-icon-badge.subtle {
  background: #f4f6fb;
  color: #6d7b8f;
}

.menu-icon-badge img {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.workspace-tree-child strong {
  font-size: 12px;
  font-weight: 600;
}

.workspace-tree-child span {
  color: var(--muted);
  line-height: 1.4;
  font-size: 11px;
}

.workspace-tree-child .menu-icon-badge {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.workspace-tree-child .menu-icon-badge img {
  width: 12px;
  height: 12px;
}

.workspace-tree-parent.active,
.workspace-tree-child.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.workspace-tree-parent.active .workspace-tree-caret {
  background: #d9ecff;
  color: var(--accent);
}

.workspace-tree-parent:hover,
.workspace-tree-child:hover {
  background: #f8fbff;
  border-color: #e5f1ff;
  transform: translateX(1px);
}

.workspace-tree-child.active::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.portal-breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.portal-breadcrumb {
  margin: 0;
  color: #315fbc;
  font-size: 16px;
  font-weight: 600;
}

.portal-sidebar-toggle {
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.portal-sidebar-toggle img {
  width: 20px;
  height: 20px;
}

.portal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-breadcrumb-link {
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #315fbc;
  box-shadow: none;
  font-size: 15px;
  font-weight: 600;
}

.portal-breadcrumb-link.current {
  color: var(--ink);
}

.header-logout-button {
  min-width: 108px;
  padding: 0 16px;
}

.portal-breadcrumb-link:hover {
  transform: none;
  text-decoration: underline;
  box-shadow: none;
}

.portal-breadcrumb-sep {
  color: #94a3b8;
}

.workspace-layout.sidebar-collapsed .workspace-tree-parent,
.workspace-layout.sidebar-collapsed .workspace-tree-child {
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
}

.workspace-layout.sidebar-collapsed .workspace-tree-parent-copy,
.workspace-layout.sidebar-collapsed .workspace-tree-copy,
.workspace-layout.sidebar-collapsed .workspace-tree-caret {
  display: none !important;
}

.workspace-layout.sidebar-collapsed .workspace-tree-row {
  justify-content: center;
}

.workspace-layout.sidebar-collapsed .workspace-tree-group {
  width: 100%;
}

.workspace-layout.sidebar-collapsed .workspace-tree-children {
  gap: 8px;
  margin-top: 4px;
}

.workspace-layout.sidebar-collapsed .workspace-tree-child {
  padding: 8px;
}

.workspace-layout.sidebar-collapsed .menu-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

.tool-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-card-button {
  width: auto;
  min-height: 160px;
  padding: 18px 20px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tool-card-button.active {
  border-color: #d9ecff;
  background: var(--accent-soft);
  box-shadow: 0 8px 18px rgba(64, 158, 255, 0.08);
}

.tool-card-button:hover {
  transform: translateY(-1px);
  border-color: #d9ecff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.tool-card-button strong,
.tool-card-button span {
  display: block;
}

.tool-card-button strong {
  font-size: 20px;
}

.tool-card-button span {
  margin-top: 10px;
  line-height: 1.6;
  color: var(--muted);
}

@media (max-width: 920px) {
  .abba-site-header,
  .portal-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .abba-user-meta {
    align-items: flex-start;
  }

  .abba-header-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    border-radius: 18px;
  }

  .tool-card-grid {
    grid-template-columns: 1fr;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .workspace-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .workspace-sidebar {
    position: static;
    max-height: none;
  }
}
