:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #17252b;
  --muted: #73848c;
  --line: #e4eaed;
  --sidebar: #17242b;
  --sidebar-soft: #203138;
  --teal: #0f9c89;
  --teal-deep: #087467;
  --teal-soft: #e4f6f2;
  --orange: #f06a3f;
  --orange-soft: #fff0ea;
  --blue: #3c7bea;
  --green: #12a06b;
  --red: #dc4a4a;
  --shadow: 0 14px 40px rgba(26, 48, 59, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--teal-deep);
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: auto;
  color: #e8f1f3;
  background:
    radial-gradient(circle at 15% 5%, rgba(25, 157, 137, 0.28), transparent 28%),
    linear-gradient(180deg, #1a2a31 0%, #132027 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: white;
  font-size: 17px;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(145deg, #25bea8, #087e70);
  box-shadow: 0 8px 22px rgba(15, 156, 137, 0.33);
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  font-size: 24px;
  border-radius: 17px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  color: #8da6ae;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.nav {
  padding: 4px 12px 20px;
}

.nav-section {
  margin: 18px 12px 7px;
  color: #69828a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin: 3px 0;
  padding: 11px 12px;
  color: #b4c6cc;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(20, 164, 143, 0.95), rgba(16, 132, 119, 0.82));
  box-shadow: 0 10px 24px rgba(4, 84, 75, 0.24);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 21px;
  color: #6fd8c8;
  font-size: 15px;
}

.nav-item.active .nav-icon {
  color: #fff;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 18px 20px 22px;
  color: #8ca4ac;
  font-size: 11px;
}

.sidebar-footer small {
  margin-left: auto;
  color: #5d747c;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #39d5a2;
  box-shadow: 0 0 0 4px rgba(57, 213, 162, 0.12);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(226, 234, 236, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.breadcrumb,
.user-chip {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 14px;
}

.topbar-right {
  gap: 15px;
}

.breadcrumb {
  gap: 9px;
  color: #8a9aa1;
  font-size: 13px;
}

.breadcrumb b {
  color: #c3ced2;
  font-weight: 400;
}

.breadcrumb strong {
  color: #31444c;
  font-weight: 600;
}

.server-clock {
  padding-right: 14px;
  color: #8a9aa1;
  font-size: 12px;
  border-right: 1px solid var(--line);
}

.user-chip {
  gap: 8px;
  color: #41565f;
  font-weight: 550;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #fff;
  font-size: 13px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2bbda6, #0d766c);
}

.icon-button,
.text-button {
  border: 0;
  background: transparent;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #5d7078;
  border-radius: 9px;
}

.icon-button:hover {
  background: var(--surface-soft);
}

.menu-toggle {
  display: none;
}

.text-button {
  padding: 6px 0;
  color: #7e8e95;
  font-size: 12px;
}

.text-button:hover {
  color: var(--red);
}

.content {
  padding: 26px 28px 46px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 15px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease;
}

.primary-button {
  color: #fff;
  border: 1px solid var(--teal);
  background: var(--teal);
  box-shadow: 0 6px 15px rgba(15, 156, 137, 0.18);
}

.primary-button:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--teal-deep);
  border: 1px solid #c9e6e0;
  background: var(--teal-soft);
}

.secondary-button:hover {
  background: #d9f2ed;
}

.danger-button {
  color: #fff;
  border: 1px solid var(--orange);
  background: var(--orange);
}

.danger-button:hover {
  background: #d95a31;
}

.ghost-button {
  color: #4e626b;
  border: 1px solid var(--line);
  background: #fff;
}

.ghost-button:hover {
  background: var(--surface-soft);
}

.wide {
  width: 100%;
}

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

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px 19px;
  border: 1px solid rgba(226, 234, 236, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(31, 53, 62, 0.035);
}

.metric-card::after {
  position: absolute;
  right: -22px;
  bottom: -34px;
  width: 112px;
  height: 112px;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 156, 137, 0.1), transparent 68%);
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #829299;
  font-size: 12px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--teal);
  font-size: 14px;
  border-radius: 8px;
  background: var(--teal-soft);
}

.metric-value {
  margin-top: 8px;
  font-size: 29px;
  font-weight: 680;
  letter-spacing: -0.04em;
}

.metric-hint {
  margin-top: 2px;
  color: #9aa9af;
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border: 1px solid rgba(226, 234, 236, 0.95);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(31, 53, 62, 0.035);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
  border-bottom: 1px solid #eef2f4;
}

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.panel-head span {
  color: #9caab0;
  font-size: 11px;
}

.panel-body {
  padding: 18px 19px;
}

.chart-wrap {
  min-height: 218px;
}

.trend-chart {
  width: 100%;
  height: 190px;
  overflow: visible;
}

.trend-chart .grid-line {
  stroke: #edf2f3;
  stroke-width: 1;
}

.trend-chart .axis-label {
  fill: #9cabb1;
  font-size: 10px;
}

.trend-chart .bar {
  fill: url("#barGradient");
  rx: 4;
}

.trend-chart .bar-value {
  fill: #6f858d;
  font-size: 10px;
  font-weight: 600;
}

.status-list {
  display: grid;
  gap: 13px;
}

.status-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 11px;
  color: #61757d;
  font-size: 12px;
}

.status-track {
  overflow: hidden;
  height: 7px;
  border-radius: 99px;
  background: #edf2f3;
}

.status-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.status-fill.orange {
  background: #eea345;
}

.status-fill.red {
  background: #df6262;
}

.status-fill.gray {
  background: #9db0b7;
}

.status-value {
  color: #344951;
  font-weight: 650;
  text-align: right;
}

.table-panel {
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 15px 18px;
  border-bottom: 1px solid #edf1f3;
  background: #fff;
}

.toolbar-spacer {
  flex: 1;
}

.input,
.select,
.textarea {
  min-height: 36px;
  padding: 8px 11px;
  color: #2d4149;
  border: 1px solid #dfe8ea;
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition:
    border 0.15s ease,
    box-shadow 0.15s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #75cbbb;
  box-shadow: 0 0 0 3px rgba(15, 156, 137, 0.09);
}

.input::placeholder,
.textarea::placeholder {
  color: #b0bdc2;
}

.input.search {
  width: 210px;
}

.select {
  min-width: 128px;
  cursor: pointer;
}

.textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 12px 13px;
  color: #8b9aa0;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #edf1f3;
  background: #fbfcfc;
}

.data-table td {
  padding: 12px 13px;
  color: #3c5058;
  vertical-align: middle;
  border-bottom: 1px solid #f0f4f5;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfdfd;
}

.cell-main {
  color: #1e343c;
  font-weight: 600;
}

.cell-sub {
  margin-top: 2px;
  color: #9aa8ae;
  font-size: 10px;
}

.mono {
  font-family: "Cascadia Code", "Consolas", monospace;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  border-radius: 99px;
}

.badge::before {
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: currentColor;
}

.badge.active,
.badge.online {
  color: #087d62;
  background: #e5f7f0;
}

.badge.unused {
  color: #456dda;
  background: #edf2ff;
}

.badge.expired,
.badge.disabled {
  color: #a77118;
  background: #fff6df;
}

.badge.revoked,
.badge.offline {
  color: #a85555;
  background: #fdeeee;
}

.badge.used {
  color: #5d7179;
  background: #eef3f4;
}

.badge.neutral {
  color: #5d7179;
  background: #eef3f4;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-action {
  min-height: 27px;
  padding: 4px 8px;
  color: #536970;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #e2eaec;
  background: #fff;
}

.table-action:hover {
  color: var(--teal-deep);
  border-color: #bce4dc;
  background: var(--teal-soft);
}

.table-action.danger {
  color: #b45b3c;
}

.table-action.danger:hover {
  border-color: #f0c5b6;
  background: var(--orange-soft);
}

.table-action.warn {
  color: #a37714;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  color: #8a9aa1;
  font-size: 11px;
  border-top: 1px solid #edf1f3;
}

.pagination button {
  min-width: 29px;
  height: 29px;
  color: #5e727a;
  border: 1px solid #e1e9eb;
  border-radius: 7px;
  background: #fff;
}

.pagination button:disabled {
  color: #c4ced2;
  cursor: not-allowed;
  background: #fafcfc;
}

.pagination strong {
  color: #2d444c;
}

.empty-state {
  padding: 56px 18px;
  color: #9ba9af;
  text-align: center;
}

.empty-state .empty-icon {
  display: block;
  margin-bottom: 8px;
  color: #c7d3d7;
  font-size: 31px;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 260px;
  color: #8c9ca2;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dce8e6;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.recent-list {
  display: grid;
  gap: 0;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f4f5;
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.recent-main {
  min-width: 0;
  flex: 1;
}

.recent-main strong {
  display: block;
  overflow: hidden;
  color: #334951;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-main span,
.recent-time {
  color: #9aa8ae;
  font-size: 10px;
}

.recent-time {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: #5b6f77;
  font-size: 11px;
  font-weight: 600;
}

.form-field label em {
  color: var(--orange);
  font-style: normal;
}

.form-field .hint {
  color: #9caab0;
  font-size: 10px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #536970;
  font-size: 12px;
}

.checkbox-line input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(11, 23, 28, 0.52);
  backdrop-filter: blur(4px);
  animation: fade-in 0.15s ease both;
}

.modal {
  width: min(660px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(4, 23, 28, 0.3);
  animation: modal-in 0.18s ease both;
}

.modal.wide {
  width: min(840px, 100%);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #edf1f3;
  background: #fff;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.modal-head p {
  margin: 3px 0 0;
  color: #8b9aa1;
  font-size: 11px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #87979d;
  border: 0;
  border-radius: 8px;
  background: #f5f8f8;
}

.modal-close:hover {
  color: #42575f;
  background: #edf2f3;
}

.modal-body {
  padding: 20px 22px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 22px 20px;
  border-top: 1px solid #edf1f3;
}

.key-output {
  width: 100%;
  min-height: 250px;
  padding: 13px;
  color: #223c44;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.75;
  border: 1px solid #dbe6e8;
  border-radius: 10px;
  background: #f8fbfb;
  resize: vertical;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  color: #7c6526;
  font-size: 11px;
  border: 1px solid #f0dfaf;
  border-radius: 9px;
  background: #fffaf0;
}

.notice strong {
  flex: 0 0 auto;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: grid;
  gap: 9px;
}

.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 12px 15px;
  color: #eaf4f3;
  font-size: 12px;
  border-radius: 10px;
  background: #1d373d;
  box-shadow: 0 14px 34px rgba(8, 28, 34, 0.22);
  animation: toast-in 0.18s ease both;
}

.toast.error {
  background: #8f3e32;
}

.toast.success {
  background: #116d5e;
}

.mono-break {
  overflow-wrap: anywhere;
  word-break: break-all;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.985);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}

.login-page {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(29, 188, 163, 0.28), transparent 26%),
    radial-gradient(circle at 16% 82%, rgba(25, 120, 140, 0.25), transparent 30%),
    linear-gradient(135deg, #13252c 0%, #1a343b 48%, #153038 100%);
}

.login-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 34px));
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.965);
  box-shadow: 0 34px 90px rgba(3, 18, 23, 0.42);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 27px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #4b9b8c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.login-subtitle {
  margin: 2px 0 0;
  color: #83939a;
  font-size: 11px;
}

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

.login-form label {
  display: grid;
  gap: 6px;
  color: #4e626a;
  font-size: 11px;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  height: 43px;
  padding: 0 13px;
  color: #243a42;
  border: 1px solid #dce6e8;
  border-radius: 9px;
  outline: none;
  background: #fbfcfc;
}

.login-form input:focus {
  border-color: #79cabb;
  box-shadow: 0 0 0 3px rgba(15, 156, 137, 0.1);
}

.login-form .primary-button {
  height: 43px;
  margin-top: 4px;
  font-size: 13px;
}

.form-error {
  min-height: 18px;
  margin: -2px 0 -4px;
  color: #c25a42;
  font-size: 11px;
}

.login-note {
  margin: 18px 0 0;
  color: #a1afb4;
  font-size: 10px;
  text-align: center;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: 232px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main {
    grid-column: 1;
  }

  .menu-toggle {
    display: grid;
  }

  .server-clock {
    display: none;
  }

  .content {
    padding: 20px 16px 36px;
  }

  .topbar {
    padding: 0 16px;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    padding: 15px;
  }

  .metric-value {
    font-size: 24px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-field.full {
    grid-column: auto;
  }

  .input.search {
    width: 100%;
  }

  .toolbar .input,
  .toolbar .select {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .user-chip span:last-child {
    display: none;
  }

  .breadcrumb span,
  .breadcrumb b {
    display: none;
  }
}
