:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f9fbfe;
  --border: #cbd7e6;
  --border-soft: #dbe4ef;
  --text: #071426;
  --muted: #52657a;
  --muted-2: #7a8a9e;
  --active: #111111;
  --active-text: #ffffff;
  --blue: #0284c7;
  --red: #cf2e1f;
  --orange: #f05a12;
  --purple: #7c3cff;
  --success: #0c7a43;
  --warning: #9a5b00;
  --danger: #b42318;
  --radius: 8px;
  --sidebar-width: 236px;
  --sidebar-collapsed-width: 68px;
  --sidebar-current-width: var(--sidebar-width);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #244c7e;
  outline-offset: 2px;
}

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-current-width) minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-icon {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  gap: 3px;
  width: 36px;
  height: 36px;
  align-content: center;
  justify-content: center;
  border: 1px solid #d8e0ea;
  border-radius: 9px;
  background: #f3f6fa;
}

.brand-icon span {
  border: 1.5px solid #243245;
  border-radius: 3px;
}

.brand-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 500;
}

.sidebar-toggle {
  display: inline-flex;
  flex: 0 0 32px;
  width: 100%;
  height: 32px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #cbd7e6;
  border-radius: 8px;
  background: #ffffff;
  color: #243245;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 8px;
  border-top: 1px solid var(--border-soft);
}

.sidebar-toggle-label {
  font-size: 12px;
  white-space: nowrap;
}

.sidebar-toggle:hover {
  background: #eef3f8;
}

.sidebar-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 180ms ease;
}

.app-frame.is-sidebar-collapsed {
  --sidebar-current-width: var(--sidebar-collapsed-width);
}

.app-frame.is-sidebar-collapsed .brand-row {
  justify-content: center;
  padding-right: 8px;
  padding-left: 8px;
}

.app-frame.is-sidebar-collapsed .brand-row strong,
.app-frame.is-sidebar-collapsed .nav-section-title,
.app-frame.is-sidebar-collapsed .nav-label {
  display: none;
}

.app-frame.is-sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.app-frame.is-sidebar-collapsed .sidebar-toggle {
  justify-content: center;
  padding-right: 0;
  padding-left: 0;
}

.app-frame.is-sidebar-collapsed .side-nav {
  padding-right: 8px;
  padding-left: 8px;
}

.app-frame.is-sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding-right: 0;
  padding-left: 0;
}

.app-frame.is-sidebar-collapsed .nav-glyph {
  width: 22px;
  min-width: 22px;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px 14px;
}

.nav-section-title {
  margin: 12px 2px 7px;
  color: #1c3655;
  font-size: 12px;
  line-height: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  margin-bottom: 5px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #16263a;
  text-align: left;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.nav-item:hover {
  background: #eef3f8;
}

.nav-item.active {
  background: var(--active);
  color: var(--active-text);
}

.nav-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  color: currentColor;
  line-height: 1;
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: opacity 160ms ease;
}

.nav-item:hover .nav-icon {
  opacity: 0.82;
}

.app-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.topbar > .action-strip {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.topbar > .action-strip > div {
  min-width: 0;
}

.topbar > .action-strip h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar > .action-strip .primary-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar-spacer {
  min-width: 1px;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.log-button,
.primary-action,
.button,
.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
}

.log-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.log-button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--active);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
}

.admin-avatar {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

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

.admin-avatar:hover {
  border-color: #9eb2ca;
  box-shadow: 0 0 0 3px rgb(2 132 199 / 10%);
}

.log-button:hover {
  border-color: #9eb2ca;
  background: var(--surface-soft);
}

.content {
  flex: 1;
  overflow: auto;
  padding: 10px 20px 24px;
}

.action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
}

.action-strip[hidden] {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.action-strip p,
.panel-head p {
  margin-top: 3px;
  color: #06152a;
  font-size: 13px;
}

.primary-action,
.button.primary,
.button-like.primary {
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  padding: 0 14px;
}

.button.secondary,
.button-like.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: #071426;
  padding: 0 12px;
}

.button.danger {
  border: 1px solid #efb5ad;
  background: #fff7f5;
  color: var(--danger);
  padding: 0 12px;
}

.button:disabled,
.button-like:disabled,
.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
