/* ================================================================
   Authentication
   ================================================================ */

.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(380px, 0.88fr) minmax(0, 1.12fr);
  background: var(--paper);
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px 48px 38px;
  background:
    radial-gradient(circle at 85% 0%, rgba(214, 255, 114, 0.13), transparent 35%),
    radial-gradient(circle at 0% 100%, rgba(255, 107, 74, 0.12), transparent 42%),
    linear-gradient(150deg, #0c342c, #061b16);
  color: var(--paper);
  overflow: hidden;
}
.auth-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; z-index: 2; }
.auth-back { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: rgba(255, 255, 255, 0.45); }
.auth-back:hover { color: var(--lime); }
.auth-brand-copy { position: relative; z-index: 2; max-width: 470px; margin: 50px 0; }
.auth-brand-copy h1 {
  margin-top: 17px;
  font-size: clamp(2.6rem, 4.1vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.06em;
  font-weight: 800;
}
.auth-brand-copy > p { margin-top: 20px; max-width: 390px; color: rgba(255, 255, 255, 0.5); font-size: 13.5px; line-height: 1.85; }
.auth-quote { margin-top: 48px; padding-left: 20px; border-left: 1px solid rgba(214, 255, 114, 0.35); position: relative; }
.quote-mark {
  position: absolute;
  left: 14px;
  top: -27px;
  font-size: 56px;
  color: rgba(214, 255, 114, 0.22);
  font-family: Georgia, serif;
  line-height: 1;
}
.auth-quote blockquote { font-size: 14px; line-height: 1.8; color: rgba(255, 255, 255, 0.72); }
.quote-by { display: block; margin-top: 10px; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lime); }
.auth-brand-foot { position: relative; z-index: 2; display: flex; gap: 34px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.auth-brand-foot > div { display: flex; flex-direction: column; }
.auth-brand-foot strong { font-family: var(--font-mono); font-size: 17px; font-weight: 550; color: var(--lime); }
.auth-brand-foot span { font-size: 9px; color: rgba(255, 255, 255, 0.35); }
.auth-orbit { position: absolute; right: -180px; bottom: -200px; width: 520px; height: 520px; border: 1px solid rgba(214, 255, 114, 0.09); border-radius: 50%; }
.auth-orbit::before { content: ""; position: absolute; inset: 70px; border: 1px solid rgba(214, 255, 114, 0.08); border-radius: 50%; }
.auth-orbit::after { content: ""; position: absolute; inset: 145px; border: 1px solid rgba(214, 255, 114, 0.07); border-radius: 50%; }
.auth-orbit span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px rgba(214, 255, 114, 0.7); }
.auth-orbit span:first-child { top: 54px; left: 86px; }
.auth-orbit span:nth-child(2) { top: 230px; right: 35px; }
.auth-orbit span:last-child { bottom: 65px; left: 170px; }

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 32px;
  min-width: 0;
}
.auth-card { width: min(432px, 100%); }
.auth-head { margin-bottom: 25px; }
.auth-kicker { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--forest); font-weight: 750; }
.auth-head h2 { margin-top: 8px; font-size: 33px; line-height: 1.1; letter-spacing: -0.045em; font-weight: 800; }
.auth-head p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .field { gap: 6px; }
.auth-form .field label { font-size: 12px; }
.auth-form .btn-block { margin-top: 3px; }
.auth-switch { text-align: center; font-size: 12px; color: var(--muted); }
.auth-switch a { color: var(--forest); font-weight: 650; }
.auth-legal {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
  color: var(--muted-light);
  font-size: 9.5px;
  line-height: 1.6;
  text-align: center;
}
.auth-legal .icon { margin-top: 1px; }
.password-meter { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.password-meter span { height: 3px; flex: 1; border-radius: 3px; background: var(--paper-3); transition: background 0.2s ease; }
.password-meter span.is-on { background: var(--forest); }
.password-meter span.is-on:nth-child(1) { background: var(--coral); }
.password-meter span.is-on:nth-child(2) { background: #e7b844; }
.password-meter span.is-on:nth-child(3) { background: #64b87e; }
.password-meter span.is-on:nth-child(4) { background: var(--forest); }
.password-meter em { flex: 2.2; font-size: 9px; color: var(--muted-light); font-style: normal; text-align: right; }
.demo-accounts { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-accounts-head { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted-light); margin-bottom: 8px; }
.demo-accounts-head em { font-style: normal; }
.demo-accounts button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  text-align: left;
  margin-bottom: 6px;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.demo-accounts button:hover { background: var(--surface); border-color: var(--line-strong); }
.demo-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--forest);
  color: var(--lime);
  font-size: 10px;
  font-weight: 700;
  flex: none;
}
.demo-avatar-admin { background: var(--coral); color: #fff; }
.demo-accounts button > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.demo-accounts strong { font-size: 11.5px; font-weight: 650; }
.demo-accounts small { font-size: 9px; color: var(--muted); font-family: var(--font-mono); }
.demo-accounts .icon { color: var(--muted); }
.auth-foot-links { display: flex; gap: 8px; margin-top: 30px; font-size: 10px; color: var(--muted-light); }
.auth-foot-links a:hover { color: var(--ink); }
.auth-mobile-brand { display: none; }
.captcha-dialog { width: min(500px, 100%); }
.captcha-modal-copy { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 10px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.captcha-modal-copy .icon { flex: none; margin-top: 1px; color: var(--forest); }
.captcha-modal-note { margin-top: 9px; text-align: center; font-size: 9px; color: var(--muted-light); }
.captcha-slot { min-height: 214px; border-radius: 13px; transition: box-shadow 0.2s ease; }
.captcha-slot.is-highlighted { box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.35); }
.captcha-fallback { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: -5px; font-size: 9px; color: var(--muted-light); }
.captcha-fallback button { border: 0; background: transparent; color: var(--forest); font-size: 9px; font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.slider-captcha {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  user-select: none;
}
.captcha-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.captcha-head > span { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--muted); font-weight: 650; }
.captcha-refresh { border: 0; background: transparent; color: var(--forest); font-size: 9.5px; font-weight: 600; padding: 2px 0; }
.captcha-refresh:hover { text-decoration: underline; text-underline-offset: 2px; }
.captcha-stage {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 9px;
  background: var(--forest);
  line-height: 0;
}
.captcha-bg { display: block; width: 100%; height: auto; pointer-events: none; }
.captcha-piece {
  position: absolute;
  left: 0;
  top: 38px;
  width: 44px;
  height: 44px;
  border: 1.5px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(214, 255, 114, 0.16);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(214, 255, 114, 0.18);
  pointer-events: none;
  z-index: 2;
  line-height: 1;
  transition: transform 0.12s ease;
}
.slider-captcha.is-dragging .captcha-piece { transition: none; }
.captcha-stage-hint {
  position: absolute;
  left: 9px;
  bottom: 7px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(4, 18, 14, 0.45);
  color: rgba(255, 255, 255, 0.64);
  font-size: 8px;
  line-height: 1.5;
}
.captcha-track {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 40px;
  margin: 9px auto 0;
  border-radius: 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: none;
}
.captcha-track-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  background: rgba(214, 255, 114, 0.38);
  pointer-events: none;
}
.captcha-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 30px;
  font-size: 9.5px;
  color: var(--muted-light);
  pointer-events: none;
  white-space: nowrap;
}
.captcha-handle {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  height: 100%;
  width: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  transition: transform 0.12s ease, background 0.18s ease;
}
.captcha-handle:active { cursor: grabbing; }
.slider-captcha.is-dragging .captcha-handle { transition: none; }
.captcha-handle:disabled { cursor: wait; opacity: 0.65; }
.slider-captcha.is-verified .captcha-handle { background: var(--green); color: #fff; cursor: default; }
.slider-captcha.is-verified .captcha-track-fill { background: rgba(30, 122, 88, 0.2); }
.slider-captcha.is-error .captcha-track { animation: captcha-shake 0.32s ease; border-color: #e1a99d; }
.slider-captcha.is-error .captcha-handle { background: var(--coral); }
@keyframes captcha-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.captcha-status { display: none; margin-top: 7px; font-size: 9.5px; line-height: 1.5; color: var(--muted); }
.captcha-status.is-visible { display: flex; }
.captcha-status.is-error { color: var(--red); }
.captcha-status.is-success { color: var(--green); }
.slider-captcha[data-state="loading"] .captcha-stage { opacity: 0.65; }
.auth-closed { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.auth-closed .icon { color: var(--forest); }
.auth-closed h3 { font-size: 17px; }
.auth-closed p { color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 6px; }

/* ================================================================
   App shell
   ================================================================ */

.layout-console,
.layout-admin { background: #f6f4ed; }

.app-shell { min-height: 100dvh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 130;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: #fbfaf5;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  margin-bottom: 22px;
}
.sidebar-brand .brand-word { font-size: 15px; }
.admin-badge {
  margin-left: auto;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--coral);
  background: var(--coral-soft);
  padding: 3px 5px;
  border-radius: 4px;
}
.workspace-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 4px 18px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(13, 43, 37, 0.045);
  font-size: 10.5px;
  color: var(--muted);
}
.workspace-pill em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: 7px; letter-spacing: 0.1em; color: var(--muted-light); }
.workspace-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.admin-pill { background: rgba(255, 107, 74, 0.08); color: #9a3c28; }
.sidebar-nav { display: flex; flex-direction: column; gap: 20px; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 0 11px 7px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-light);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav-item .icon { color: var(--muted-light); transition: color 0.16s ease; }
.nav-item:hover { background: rgba(13, 43, 37, 0.045); color: var(--ink); }
.nav-item:hover .icon { color: var(--forest); }
.nav-item.is-active { background: var(--forest); color: #fff; font-weight: 600; box-shadow: 0 8px 18px -12px rgba(13, 59, 51, 0.7); }
.nav-item.is-active .icon { color: var(--lime); }
.nav-active-dot {
  margin-left: auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lime);
}
.nav-external { margin-left: auto; color: var(--muted-light); }
.nav-item.is-active .nav-external { color: rgba(255, 255, 255, 0.45); }
.admin-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 4px 0;
  padding: 9px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  font-size: 10.5px;
  color: var(--forest);
  font-weight: 600;
}
.admin-entry:hover { background: rgba(214, 255, 114, 0.18); border-color: var(--forest); }
.admin-entry .icon:last-child { margin-left: auto; }
.admin-shell .admin-entry { color: var(--muted); }
.console-entry { margin-top: 22px; }
.sidebar-user { margin-top: auto; padding-top: 18px; }
.sidebar-user-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.sidebar-user-main:hover { background: rgba(13, 43, 37, 0.045); }
.sidebar-user-copy { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-copy strong { font-size: 11.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { font-size: 9px; color: var(--muted-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.sidebar-balance span { font-size: 9px; color: var(--muted); }
.sidebar-balance strong { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--forest); }
.sidebar-scrim { display: none; }

.app-main { margin-left: var(--sidebar-width); min-width: 0; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgba(246, 244, 237, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(13, 43, 37, 0.08);
}
.sidebar-toggle { display: none; }
.topbar-crumb { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted-light); min-width: 0; }
.topbar-crumb strong { color: var(--ink); font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; position: relative; }
.topbar-doc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 11px;
  color: var(--muted);
}
.topbar-doc:hover { background: rgba(13, 43, 37, 0.05); color: var(--ink); }
.topbar-bell { position: relative; width: 33px; height: 33px; }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--coral); border: 1px solid var(--paper); }
.topbar-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--forest);
}
.topbar-balance em { font-style: normal; font-family: var(--font-sans); font-size: 9px; color: var(--coral); padding-left: 6px; border-left: 1px solid var(--line); }
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--coral-soft);
  color: #a03c26;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 3px;
  border-radius: 999px;
  color: var(--muted);
}
.topbar-user:hover { background: rgba(13, 43, 37, 0.05); }
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 248px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 10;
}
.user-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu-head { display: flex; gap: 9px; align-items: center; padding: 9px 8px 11px; border-bottom: 1px solid var(--line); }
.user-menu-head > div { display: flex; flex-direction: column; min-width: 0; }
.user-menu-head strong { font-size: 12px; }
.user-menu-head span { font-size: 9.5px; color: var(--muted-light); overflow: hidden; text-overflow: ellipsis; }
.user-menu-balance { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px; }
.user-menu-balance span { font-size: 10px; color: var(--muted); }
.user-menu-balance strong { font-family: var(--font-mono); font-size: 13px; color: var(--forest); }
.user-menu > a, .user-menu > button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: left;
}
.user-menu > a:hover, .user-menu > button:hover { background: var(--paper); color: var(--ink); }
.user-menu > button { color: var(--red); }
.app-content { width: 100%; max-width: 1380px; margin: 0 auto; padding: 28px 30px 60px; }
.mobile-bottom-nav { display: none; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 25px;
}
.page-kicker { font-size: 9px; font-weight: 750; letter-spacing: 0.16em; color: var(--muted-light); text-transform: uppercase; }
.page-head h1 { margin-top: 7px; font-size: clamp(1.85rem, 2.8vw, 2.5rem); line-height: 1.1; letter-spacing: -0.05em; font-weight: 800; }
.head-dot { color: var(--lime-strong); -webkit-text-stroke: 1px var(--forest); }
.page-sub { margin-top: 7px; color: var(--muted); font-size: 12.5px; max-width: 650px; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.banner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 20px;
  font-size: 12px;
}
.banner-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--paper); flex: none; }
.banner > div { flex: 1; min-width: 0; }
.banner strong { font-size: 12px; font-weight: 700; display: block; }
.banner p { color: var(--muted); font-size: 11px; margin-top: 1px; }
.banner-warning { border-color: #f3d7a4; background: #fff9ec; }
.banner-warning .banner-icon { background: #ffefcf; color: #93610c; }
.banner-success { border-color: #bfe4ce; background: #f2fbf6; }
.banner-success .banner-icon { background: #dff5e8; color: #1b6b4d; }
.banner-info { border-color: #cfdbf6; background: #f5f8ff; }
.banner-info .banner-icon { background: #e6eeff; color: #2f57b5; }

.stats-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.stat-card {
  position: relative;
  padding: 17px 18px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-top > span:first-child { font-size: 10.5px; color: var(--muted); font-weight: 550; }
.stat-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--paper); color: var(--forest); }
.stat-value { margin-top: 9px; font-size: clamp(1.55rem, 2.3vw, 1.9rem); line-height: 1.05; letter-spacing: -0.045em; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 10px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 3px; }
.stat-foot { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; font-size: 10px; color: var(--muted); }
.stat-muted { color: var(--muted-light); }
.stat-accent { background: linear-gradient(150deg, #fffdf8, #f5ffd9); border-color: rgba(13, 59, 51, 0.18); }
.trend { display: inline-flex; align-items: center; gap: 1px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; padding: 1px 4px; border-radius: 4px; }
.trend-up { color: var(--green); background: rgba(30, 122, 88, 0.08); }
.trend-down { color: var(--red); background: rgba(213, 69, 47, 0.08); }
.trend-flat { color: var(--muted); background: var(--paper); }
.spark-bars { display: flex; align-items: flex-end; gap: 2px; height: 18px; position: absolute; right: 16px; bottom: 16px; width: 52px; opacity: 0.6; }
.spark-bars i { flex: 1; background: var(--spark-color); border-radius: 1px; min-height: 2px; opacity: 0.5; }
.spark-bars i:last-child { opacity: 1; }

.dash-grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 17px; margin-bottom: 17px; }
.dash-grid-bottom { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, 1fr); gap: 17px; margin-bottom: 17px; }
.chart-panel { overflow: hidden; }
.models-usage-panel { display: flex; flex-direction: column; }
.model-usage-list { padding: 0 20px 6px; display: flex; flex-direction: column; gap: 15px; }
.model-usage-row { display: flex; flex-direction: column; gap: 5px; }
.model-usage-top { display: flex; align-items: center; gap: 7px; }
.usage-rank { font-family: var(--font-mono); font-size: 8.5px; color: var(--muted-light); }
.model-usage-top strong { font-size: 11.5px; font-weight: 600; }
.usage-cost { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.usage-bar { height: 4px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--forest), var(--forest-3)); transition: width 0.4s ease; }
.model-usage-sub { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted-light); }
.usage-total { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.usage-total strong { font-family: var(--font-mono); font-size: 15px; color: var(--ink); }
.notices-panel { display: flex; flex-direction: column; }
.dash-notices { display: flex; flex-direction: column; }
.dash-notice { padding: 0 20px 15px; cursor: pointer; }
.dash-notice + .dash-notice { padding-top: 14px; border-top: 1px solid var(--line); }
.dash-notice-meta { display: flex; align-items: center; gap: 8px; }
.dash-notice-meta time { font-size: 9px; color: var(--muted-light); }
.dash-notice h3 { margin-top: 6px; font-size: 12.5px; font-weight: 650; line-height: 1.45; }
.dash-notice p { margin-top: 4px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.dash-notice-link { display: inline-flex; align-items: center; gap: 3px; margin-top: 7px; font-size: 9.5px; color: var(--forest); font-weight: 600; }
.dash-notice:hover h3 { color: var(--forest); }
.support-card { display: flex; align-items: center; gap: 10px; margin: auto 20px 18px; padding: 12px; border-radius: 11px; background: var(--paper); }
.support-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface); color: var(--forest); flex: none; }
.support-card > div { flex: 1; }
.support-card strong { font-size: 11px; }
.support-card p { font-size: 9.5px; color: var(--muted); }

.onboarding-card {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: 17px;
  background:
    radial-gradient(circle at 100% 0%, rgba(214, 255, 114, 0.12), transparent 40%),
    linear-gradient(145deg, #0b2d26, #071e19);
  color: var(--paper);
}
.onboarding-copy h2 { margin-top: 8px; font-size: 23px; letter-spacing: -0.04em; }
.onboarding-copy p { margin: 6px 0 14px; color: rgba(255, 255, 255, 0.45); font-size: 11px; line-height: 1.65; max-width: 340px; }
.onboarding-code .code-block { box-shadow: none; background: rgba(0, 0, 0, 0.26); }
.onboarding-code pre { font-size: 9.5px; }

/* ================================================================
   Model plaza & playground
   ================================================================ */

.plaza-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
  overflow: hidden;
}
.plaza-summary > div { display: flex; align-items: baseline; gap: 5px; padding: 14px 18px; background: var(--surface); }
.plaza-summary span { font-size: 10px; color: var(--muted); margin-right: auto; }
.plaza-summary strong { font-family: var(--font-mono); font-size: 18px; font-weight: 550; letter-spacing: -0.03em; }
.plaza-summary em { font-style: normal; font-size: 8.5px; color: var(--muted-light); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  flex-wrap: wrap;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--muted);
}
.filter-search:focus-within { border-color: var(--forest); background: var(--surface); }
.filter-search input { flex: 1; border: 0; background: transparent; outline: 0; font-size: 12px; min-width: 0; }
.filter-chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip {
  border: 1px solid transparent;
  background: transparent;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 550;
  white-space: nowrap;
  flex: none;
}
.chip:hover { background: var(--paper); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-result { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 0 2px 12px; font-size: 10.5px; color: var(--muted); }
.filter-hint { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-light); }
.filter-bar-inline { margin-bottom: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 13px 18px; }

.plaza-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plaza-card { cursor: default; min-height: 340px; padding: 20px; }
.plaza-card:hover { transform: none; }
.plaza-title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plaza-title-row h3 { font-size: 18px; }
.plaza-title-row code { font-size: 9px; color: var(--muted-light); }
.plaza-card > p { -webkit-line-clamp: 3; min-height: 54px; }
.plaza-meta { display: flex; gap: 14px; margin-top: 12px; font-size: 9.5px; color: var(--muted); }
.plaza-meta span { display: inline-flex; align-items: center; gap: 4px; }
.plaza-prices { display: flex; gap: 20px; margin-top: auto; padding: 15px 0 13px; border-top: 1px solid var(--line); }
.plaza-prices > div { display: flex; align-items: baseline; gap: 2px; }
.plaza-prices span { font-size: 9px; color: var(--muted-light); margin-right: 3px; }
.plaza-prices strong { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.plaza-prices em { font-style: normal; font-size: 7.5px; color: var(--muted-light); }
.plaza-actions { display: flex; gap: 7px; }
.plaza-actions .btn { flex: 1; }
.plaza-actions .btn-ghost { background: var(--paper); border-color: transparent; }

/* Model detail modal */

.model-detail { display: flex; flex-direction: column; gap: 18px; }
.model-detail-head { display: flex; gap: 16px; align-items: flex-start; }
.model-detail-head > div { flex: 1; }
.detail-badges { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.model-detail-head p { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.detail-grid > div { background: var(--surface); padding: 13px 15px; display: flex; flex-direction: column; gap: 3px; }
.detail-grid span { font-size: 9px; color: var(--muted-light); }
.detail-grid strong { font-family: var(--font-mono); font-size: 14px; font-weight: 550; }
.detail-grid small { font-family: var(--font-sans); font-size: 8px; color: var(--muted-light); }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-note {
  display: flex;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}
.detail-note .icon { color: var(--forest); margin-top: 1px; flex: none; }

/* Playground */

.playground-modal .modal-body { padding: 0; overflow: hidden; }
.playground-modal .modal-head { padding: 16px 20px 13px; }
.playground-modal .modal-foot { display: none; }
.playground {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  height: min(680px, calc(100dvh - 168px));
  min-height: 480px;
}
.pg-side { padding: 17px; border-right: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 15px; overflow-y: auto; }
.pg-field { display: flex; flex-direction: column; gap: 6px; }
.pg-field label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.pg-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 9px;
  font-size: 11px;
}
.pg-label-row { display: flex; justify-content: space-between; align-items: center; }
.pg-label-row output { font-family: var(--font-mono); font-size: 10px; color: var(--forest); }
.pg-field input[type="range"] { width: 100%; accent-color: var(--forest); }
.range-labels { display: flex; justify-content: space-between; font-size: 8px; color: var(--muted-light); }
.pg-quota {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  padding: 9px 11px;
  border: 1px solid rgba(13, 59, 51, 0.16);
  border-radius: 9px;
  background: rgba(214, 255, 114, 0.16);
}
.pg-quota span { font-size: 8.5px; color: var(--muted); }
.pg-quota strong { font-family: var(--font-mono); font-size: 12px; color: var(--forest); }
.pg-quota small { width: 100%; font-size: 8px; color: var(--muted-light); }
.pg-quota.is-exhausted { background: #fff1ed; border-color: #f0cfc6; }
.pg-quota.is-exhausted strong { color: var(--red); }
.pg-model-info { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.pg-info-provider { display: flex; align-items: center; gap: 8px; }
.pg-info-provider .model-glyph { width: 28px; height: 28px; border-radius: 7px; font-size: 10px; }
.pg-info-provider > div { display: flex; flex-direction: column; }
.pg-info-provider strong { font-size: 11px; }
.pg-info-provider span { font-size: 8.5px; color: var(--muted); }
.pg-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.pg-info-grid > div { display: flex; flex-direction: column; }
.pg-info-grid span { font-size: 7.5px; color: var(--muted-light); }
.pg-info-grid strong { font-family: var(--font-mono); font-size: 9px; font-weight: 550; }
.pg-side .btn-block { justify-content: flex-start; }
.pg-note { display: flex; gap: 6px; margin-top: auto; font-size: 8.5px; line-height: 1.6; color: var(--muted-light); }
.pg-note .icon { flex: none; }
.pg-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.pg-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.pg-head-model { display: flex; align-items: baseline; gap: 7px; }
.pg-head-model strong { font-size: 12px; }
.pg-head-model span { font-family: var(--font-mono); font-size: 9px; color: var(--muted-light); }
.pg-status { display: inline-flex; align-items: center; gap: 4px; font-size: 8.5px; color: var(--green); }
.pg-status i { width: 4px; height: 4px; border-radius: 50%; background: var(--green); }
.pg-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-image: radial-gradient(rgba(13, 43, 37, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  background-position: -9px -9px;
}
.pg-messages::-webkit-scrollbar { width: 7px; }
.pg-messages::-webkit-scrollbar-thumb { background: rgba(13, 59, 51, 0.24); border-radius: 99px; }
.pg-messages::-webkit-scrollbar-thumb:hover { background: rgba(13, 59, 51, 0.4); }
.pg-msg { display: flex; gap: 9px; max-width: 88%; }
.pg-msg-user { margin-left: auto; flex-direction: row-reverse; }
.pg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--forest);
  font-size: 9px;
  font-weight: 700;
  flex: none;
  border: 1px solid var(--line);
}
.pg-msg-user .pg-avatar { background: var(--forest); color: var(--lime); border-color: var(--forest); }
.pg-msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pg-bubble {
  padding: 10px 13px;
  border-radius: 3px 12px 12px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  word-break: break-word;
}
.pg-msg-user .pg-bubble { background: var(--forest); border-color: var(--forest); color: #fff; border-radius: 12px 3px 12px 12px; }
.pg-bubble p { margin: 0 0 8px; }
.pg-bubble p:last-child { margin-bottom: 0; }
.pg-bubble h3, .pg-bubble h4, .pg-bubble h5 { font-size: 12.5px; margin: 8px 0 4px; }
.pg-bubble ul, .pg-bubble ol { padding-left: 17px; margin: 5px 0; }
.pg-bubble li { margin-bottom: 2px; }
.pg-bubble code { background: rgba(13, 43, 37, 0.07); padding: 1px 4px; border-radius: 3px; font-size: 10px; }
.pg-msg-user .pg-bubble code { background: rgba(255, 255, 255, 0.16); }
.md-code { margin: 7px 0; padding: 10px; border-radius: 7px; background: #0a211b; color: #d6e3dc; overflow-x: auto; }
.md-code code { background: transparent !important; padding: 0 !important; color: inherit; font-size: 9.5px; line-height: 1.7; }
.pg-bubble a { color: var(--forest); text-decoration: underline; }
.pg-msg-user .pg-bubble a { color: var(--lime); }
.pg-usage { font-family: var(--font-mono); font-size: 8px; color: var(--muted-light); display: flex; align-items: center; gap: 4px; }
.pg-msg-user .pg-usage { justify-content: flex-end; }
.pg-error { display: flex; gap: 4px; align-items: flex-start; color: var(--red); font-size: 9px; }
.pg-error-inline { color: var(--red); }
.typing { display: inline-flex; gap: 3px; padding: 3px 0; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 70%, 100% { transform: translateY(0); opacity: 0.35; } 35% { transform: translateY(-3px); opacity: 1; } }
.pg-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pg-suggestions button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 9.5px;
  color: var(--muted);
  text-align: left;
}
.pg-suggestions button:hover { border-color: var(--forest); color: var(--forest); }
.pg-composer-wrap { flex: none; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.pg-composer { border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); padding: 8px 9px 7px 12px; }
.pg-composer:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(13, 59, 51, 0.08); }
.pg-composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 12px; line-height: 1.6; max-height: 160px; padding: 2px 0; }
.pg-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.pg-hint { font-size: 8px; color: var(--muted-light); }
.pg-hint [data-pg-count] { font-family: var(--font-mono); color: var(--muted); }
.pg-hint [data-pg-count].is-near-limit { color: var(--coral); }
.pg-composer textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.pg-hint kbd { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 1px 3px; font-size: 7px; }
.pg-send { width: 32px; height: 32px; padding: 0; border-radius: 9px; }
.pg-send.is-stop { background: var(--coral); }
.pg-disclaimer { margin-top: 6px; text-align: center; font-size: 8px; color: var(--muted-light); }
