:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --line: #d9e1ec;
  --accent: #1667c7;
  --accent-dark: #0f4f9a;
  --ok: #17803b;
  --warn: #a15c00;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  height: 100dvh;
  padding-top: 44px;
  padding-bottom: 40px;
  overflow: hidden;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 44px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
}

.brand-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.username-badge {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-avatar,
.online-user-dot {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--user-color, #3b82f6) !important;
  color: #ffffff !important;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(31, 41, 51, .08);
}

.logout-form {
  height: 30px;
  margin: 0;
  display: flex;
  align-items: center;
}

.logout-form button {
  height: 30px;
  min-width: 62px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334e68;
  font-size: 12px;
  line-height: 1;
}

.logout-form button:hover {
  background: #e6f0ff;
  color: #243b53;
}

nav {
  height: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 62px;
  height: 30px;
  border: 1px solid var(--line);
  color: #334e68;
  background: #ffffff;
  text-decoration: none;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

nav a:hover {
  background: #e6f0ff;
  color: #243b53;
}

nav .nav-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 62px;
  height: 30px;
  border: 1px solid var(--line);
  padding: 0 9px;
  border-radius: 6px;
  color: #334e68;
  background: #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: not-allowed;
  opacity: .42;
  user-select: none;
}

nav a.active {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #dbeafe;
}

.nav-icon {
  font-size: 15px;
  line-height: 1;
}

.header-actions {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.enterprise-public-link,
.public-header-button {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334e68;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
}

.public-header-button {
  width: auto;
  min-width: 62px;
}

.enterprise-public-link:hover,
.public-header-button:hover {
  background: #e6f0ff;
  color: #243b53;
}

.header-actions button {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.public-shortcut-popover {
  position: fixed;
  right: 16px;
  bottom: 48px;
  z-index: 30;
  width: 300px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 41, 51, .18);
  color: var(--text);
}

.public-shortcut-popover[hidden] {
  display: none;
}

.public-shortcut-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.public-shortcut-title button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.public-shortcut-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.public-shortcut-list span:nth-child(odd) {
  color: var(--accent);
  font-weight: 750;
  white-space: nowrap;
}

main {
  width: min(1080px, calc(100vw - 32px));
  height: calc(100dvh - 84px);
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  align-content: start;
  gap: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.scroll-top-button {
  position: fixed;
  right: 18px;
  bottom: 52px;
  z-index: 18;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: #334e68;
  box-shadow: 0 8px 24px rgba(31, 41, 51, .16);
  font-size: 18px;
  line-height: 1;
}

.scroll-top-button:hover {
  background: #e6f0ff;
  color: #243b53;
}

.scroll-top-button[hidden] {
  display: none;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: 40px;
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-top: 1px solid #d9e2ec;
  background: #ffffff;
  color: #52606d;
  font-size: 13px;
}

.stats-left {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.footer-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  white-space: nowrap;
}

.footer-button {
  width: auto;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.footer-button:hover {
  background: #f8fafc;
  color: var(--text);
}

.footer-button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.footer-button-icon {
  font-size: 14px;
  line-height: 1;
}

.footer-console {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 40px;
  z-index: 9;
  height: 160px;
  overflow: auto;
  border-top: 1px solid #1f2937;
  background: #111827;
  color: #d1d5db;
}

.footer-console[hidden] {
  display: none;
}

.footer-console pre {
  margin: 0;
  padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 650;
}

input {
  width: 240px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #ffffff;
}

button {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

@media (max-width: 720px) {
  body {
    padding-top: 88px;
  }

  header {
    min-height: 88px;
    padding: 10px 16px;
    display: grid;
    gap: 10px;
    align-items: stretch;
  }

  main {
    height: calc(100dvh - 128px);
  }

  input {
    width: 100%;
  }
}
