:root {
  color-scheme: light;
  --page: #f6f7fb;
  --header: #dfe7f3;
  --panel: #ffffff;
  --text: #333333;
  --muted: #808695;
  --line: #e8eaec;
  --blue: #2d8cf0;
  --blue-dark: #1f6ec8;
  --green: #19be6b;
  --orange: #ff9900;
  --red: #ed4014;
  --shadow: 0 8px 22px rgba(45, 140, 240, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 "Helvetica Neue", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  height: 132px;
  background: var(--header);
  border-bottom: 1px solid #d5deec;
}

.site-header-inner {
  height: 100%;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  font-size: 26px;
  font-weight: 800;
  white-space: nowrap;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  flex: 1;
}

.site-nav a {
  min-width: 36px;
  color: #1f2937;
  font-size: 16px;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.user-area {
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f8fafc;
  border: 3px solid #ffffff;
  color: var(--blue);
  font-weight: 800;
}

.user-name {
  color: var(--blue);
  font-weight: 700;
}

.logout-btn,
.plain-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
}

.auth-main {
  width: min(980px, calc(100% - 32px));
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 42px;
  align-items: center;
}

.auth-title h1 {
  margin: 0 0 12px;
  font-size: 38px;
  letter-spacing: 0;
}

.auth-title p {
  margin: 0;
  color: var(--muted);
}

.portal-app {
  min-height: calc(100vh - 132px);
}

.portal-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 132px);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 32px 24px;
}

.menu-group {
  margin-bottom: 24px;
}

.menu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 10px 0 18px;
  color: #555;
  font-size: 16px;
}

.menu-title::before {
  content: "";
  width: 4px;
  height: 22px;
  background: var(--blue);
  border-radius: 2px;
  opacity: 0;
}

.menu-title.has-bar::before {
  opacity: 1;
}

.menu-link {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  text-align: left;
  padding: 0 6px 0 28px;
  font-size: 16px;
}

.menu-link:hover,
.menu-link.active {
  color: var(--blue);
}

.menu-icon {
  width: 18px;
  color: #777;
  font-size: 15px;
}

.menu-link.active .menu-icon {
  color: var(--blue);
}

.content {
  padding: 28px 28px 56px;
  background: var(--page);
  overflow-x: auto;
}

.content-inner {
  min-width: 760px;
}

.page-head {
  min-height: 52px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d9dde3;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
}

.pre-line {
  white-space: pre-line;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.panel {
  padding: 22px;
  margin-bottom: 22px;
}

.soft-card {
  background: #fff;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  min-height: 136px;
  padding: 22px;
  display: grid;
  gap: 10px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.trend {
  color: var(--green);
  font-weight: 700;
}

.info-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px 18px;
  align-items: center;
}

.info-list dt {
  color: var(--muted);
  text-align: right;
}

.info-list dd {
  margin: 0;
}

.form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #dcdee2;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 7px 10px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.tabs {
  display: inline-flex;
  border: 1px solid #dcdee2;
  border-radius: 4px;
  overflow: hidden;
}

.tabs button {
  border: 0;
  border-right: 1px solid #dcdee2;
  background: #fff;
  color: var(--text);
  min-height: 34px;
  padding: 0 18px;
  cursor: pointer;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  background: var(--blue);
  color: #fff;
}

.btn,
button.primary,
button.secondary,
button.warning,
.button {
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  cursor: pointer;
}

button.primary,
.button.primary {
  background: var(--blue);
  color: #fff;
}

button.secondary,
.button.secondary {
  background: #fff;
  border-color: #dcdee2;
  color: #515a6e;
}

button.compact {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  margin-top: 8px;
}

.compact-input,
.compact-select {
  width: 150px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

button.warning {
  background: var(--orange);
  color: #fff;
}

button.danger {
  background: var(--red);
  color: #fff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8f8f9;
  color: #515a6e;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: #f0faff;
  color: var(--blue);
  font-size: 12px;
}

.status.ok {
  background: #e8f9f0;
  color: var(--green);
}

.status.warn {
  background: #fff7e6;
  color: var(--orange);
}

.status.bad {
  background: #fff1f0;
  color: var(--red);
}

.notice {
  padding: 11px 14px;
  border: 1px solid #dcdee2;
  background: #fff;
  color: var(--muted);
  border-radius: 4px;
}

.notice.error {
  border-color: #ffd1c7;
  color: var(--red);
  background: #fff7f5;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.plan-card {
  padding: 20px;
  min-height: 220px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.plan-card h3 {
  margin: 0;
  font-size: 18px;
}

.price {
  color: var(--red);
  font-size: 26px;
  font-weight: 800;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .site-header {
    height: auto;
  }

  .site-header-inner {
    min-height: 86px;
    flex-wrap: wrap;
    padding: 16px 0;
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 14px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .site-nav a {
    writing-mode: horizontal-tb;
    min-width: max-content;
  }

  .auth-main,
  .portal-body,
  .grid.two,
  .grid.three,
  .grid.four,
  .plan-grid,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content-inner {
    min-width: 0;
  }
}
