:root {
  --mf-sidebar-width: 244px;
  --mf-ink: #17233c;
  --mf-muted: #6c7890;
  --mf-canvas: #f3f6fb;
  --mf-panel: #ffffff;
  --mf-line: #dfe5ee;
  --mf-navy: #13213b;
  --mf-blue: #2267d8;
  --mf-blue-soft: #e9f1ff;
  --mf-green: #148568;
  --mf-orange: #b8660b;
  --mf-red: #c43d4b;
  --mf-radius: 14px;
  --mf-shadow: 0 12px 32px rgba(30, 51, 84, .08);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--mf-canvas); }

body.mf-body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--mf-ink);
  background:
    radial-gradient(circle at 86% -12%, rgba(34, 103, 216, .10), transparent 28rem),
    var(--mf-canvas);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

button, input, select { font: inherit; }

[hidden], .mf-view[hidden] { display: none !important; }

.mf-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(140deg, rgba(19, 33, 59, .98), rgba(26, 60, 112, .94)),
    var(--mf-navy);
}

.mf-login-card {
  width: min(100%, 460px);
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 22px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 28px 70px rgba(4, 14, 32, .36);
}

.mf-login-card h1 { margin: 12px 0 8px; font-size: clamp(1.65rem, 5vw, 2.15rem); letter-spacing: -.04em; }
.mf-login-form { margin-top: 28px; }

.mf-brand-mark {
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #2379e9, #2056be);
  box-shadow: 0 8px 24px rgba(34, 103, 216, .26);
  font-weight: 800;
  letter-spacing: -.03em;
}

.mf-eyebrow {
  margin: 0 0 4px;
  color: var(--mf-blue);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.mf-muted, .mf-section-heading p, .mf-privacy-note { color: var(--mf-muted); }
.mf-form-error { margin: 12px 0 0; color: var(--mf-red); font-size: .875rem; }

.mf-shell { min-height: 100vh; }

.mf-sidebar {
  position: fixed;
  z-index: 1035;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--mf-sidebar-width);
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #f5f8ff;
  background: linear-gradient(180deg, #101d35 0%, #152747 62%, #11203a 100%);
  box-shadow: 8px 0 24px rgba(13, 28, 54, .10);
}

.mf-sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.mf-sidebar-brand strong, .mf-sidebar-brand small { display: block; }
.mf-sidebar-brand strong { font-size: 1rem; letter-spacing: .04em; }
.mf-sidebar-brand small { margin-top: 2px; color: rgba(236, 243, 255, .58); font-size: .75rem; }
.mf-nav { display: grid; gap: 7px; }

.mf-nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(241, 246, 255, .72);
  background: transparent;
  text-align: left;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.mf-nav-item span { color: rgba(190, 208, 238, .42); font-size: .67rem; font-weight: 800; letter-spacing: .08em; }
.mf-nav-item:hover { color: #fff; background: rgba(255, 255, 255, .075); }
.mf-nav-item.is-active { border-color: rgba(124, 171, 255, .18); color: #fff; background: rgba(53, 116, 222, .26); }
.mf-nav-item.is-active span { color: #8eb8ff; }

.mf-sidebar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 11px;
  color: rgba(241, 246, 255, .65);
  background: rgba(255, 255, 255, .035);
  font-size: .78rem;
}

.mf-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #36c99b; box-shadow: 0 0 0 4px rgba(54, 201, 155, .13); }

.mf-workspace { min-height: 100vh; margin-left: var(--mf-sidebar-width); }

.mf-topbar {
  position: sticky;
  z-index: 1020;
  top: 0;
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 3.2vw, 44px);
  border-bottom: 1px solid rgba(210, 219, 232, .85);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 12px rgba(33, 53, 84, .035);
}

.mf-topbar-title { display: flex; min-width: 0; align-items: center; gap: 13px; }
.mf-topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.mf-topbar-actions { display: flex; align-items: center; gap: 9px; }
.mf-mobile-nav-button { display: none; }

.mf-clock {
  display: grid;
  min-width: 192px;
  margin-right: 10px;
  grid-template-columns: auto 1fr;
  column-gap: 9px;
  color: var(--mf-muted);
  font-size: .68rem;
  line-height: 1.25;
}

.mf-clock span { grid-row: 1 / 3; align-self: center; padding-right: 9px; border-right: 1px solid var(--mf-line); }
.mf-clock strong { color: var(--mf-ink); font-size: .8rem; font-variant-numeric: tabular-nums; }
.mf-clock small { font-size: .68rem; }

.mf-content { width: min(100%, 1600px); margin: 0 auto; padding: clamp(22px, 3vw, 42px); }
.mf-view.is-active { animation: mf-view-in .18s ease-out both; }

@keyframes mf-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.mf-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.mf-section-heading h2 { margin: 0; font-size: clamp(1.45rem, 2.8vw, 2rem); letter-spacing: -.045em; }
.mf-section-heading p:not(.mf-eyebrow) { max-width: 740px; margin: 7px 0 0; line-height: 1.7; }

.mf-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.mf-stat-card {
  position: relative;
  min-height: 150px;
  padding: 23px 24px;
  overflow: hidden;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: var(--mf-panel);
  box-shadow: var(--mf-shadow);
}

.mf-stat-card::after {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ba7b9;
  content: "";
}

.mf-stat-card span, .mf-stat-card small, .mf-stat-card strong { display: block; }
.mf-stat-card span { color: #536078; font-size: .84rem; font-weight: 700; }
.mf-stat-card strong { margin: 14px 0 7px; font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.mf-stat-card small { color: var(--mf-muted); }
.mf-stat-primary { border-color: #bdd3f8; background: linear-gradient(145deg, #f9fbff, #edf4ff); }
.mf-stat-primary::after { background: var(--mf-blue); }
.mf-stat-warning::after { background: var(--mf-orange); }
.mf-stat-danger::after { background: var(--mf-red); }
.mf-stat-muted::after { background: #8490a4; }

.mf-two-column { display: grid; grid-template-columns: minmax(380px, .9fr) minmax(420px, 1.1fr); gap: 18px; align-items: start; }
.mf-panel, .mf-table-card { border-color: var(--mf-line); border-radius: var(--mf-radius); box-shadow: var(--mf-shadow); }
.mf-panel .card-body { padding: clamp(20px, 3vw, 30px); }
.mf-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 18px; }
.mf-form-span { grid-column: 1 / -1; }
.mf-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 24px; }

.mf-result-panel .card-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 16px 22px; }
.mf-result-panel .card-title { margin: 0; }
.mf-single-result { display: flex; align-items: stretch; gap: 10px; }
.mf-single-result code {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  padding: 13px 15px;
  overflow-wrap: anywhere;
  border: 1px solid #bdd3f8;
  border-radius: 10px;
  color: #164b9f;
  background: var(--mf-blue-soft);
  font-size: 1rem;
  font-weight: 700;
}

.mf-batch-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.mf-issued-list { display: grid; max-height: 350px; gap: 7px; overflow: auto; }
.mf-issued-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--mf-line); border-radius: 9px; }
.mf-issued-row code { overflow-wrap: anywhere; color: var(--mf-ink); font-weight: 700; }
.mf-issued-row small { color: var(--mf-muted); }
.mf-issued-index { color: #96a0b2; font-size: .7rem; font-weight: 800; }
.mf-privacy-note { margin: 18px 0 0; font-size: .78rem; line-height: 1.65; }

.mf-filter-bar {
  display: grid;
  grid-template-columns: minmax(130px, .85fr) minmax(125px, .75fr) minmax(140px, .85fr) minmax(180px, 1.4fr) 112px auto auto;
  gap: 9px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: var(--mf-panel);
  box-shadow: 0 7px 22px rgba(30, 51, 84, .05);
}

.mf-filter-search { min-width: 260px; }

.mf-selection-toolbar {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  overflow-x: auto;
  border: 1px solid #bcd3f3;
  border-radius: 8px;
  background: #eef5ff;
  white-space: nowrap;
}

.mf-select-page { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: .78rem; }
.mf-select-page input, .mf-license-checkbox { width: 16px; height: 16px; accent-color: var(--mf-blue); }
.mf-selection-toolbar strong { color: #174f9e; font-size: .8rem; }
.mf-selection-actions { display: flex; gap: 6px; }
.mf-check-column { width: 42px; }
.mf-expand-column { width: 42px; }

.mf-page-size { width: auto; min-width: 112px; }
.mf-table-card { overflow: hidden; }
.mf-data-table { min-width: 1030px; margin: 0; }
.mf-license-table { min-width: 1450px; table-layout: fixed; }
.mf-license-table th:nth-child(3) { width: 290px; }
.mf-data-table thead th { padding: 14px 16px; border-bottom-color: var(--mf-line); color: #637087; background: #f8fafd; font-size: .72rem; letter-spacing: .02em; white-space: nowrap; }
.mf-data-table tbody td { padding: 15px 16px; vertical-align: middle; border-bottom-color: #e9edf3; }
.mf-data-table tbody tr:last-child td { border-bottom: 0; }
.mf-product, .mf-secondary-line { display: block; }
.mf-secondary-line { max-width: 270px; margin-top: 4px; overflow-wrap: anywhere; color: var(--mf-muted); font-size: .73rem; line-height: 1.5; }
.mf-id-summary { display: block; margin-top: 3px; color: #71809a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .7rem; }
.mf-time { white-space: nowrap; font-size: .77rem; font-variant-numeric: tabular-nums; }
.mf-device-hint { color: #4f5d73; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .75rem; }

.mf-card-code {
  display: block;
  max-width: none;
  overflow-wrap: normal;
  color: #174f9e;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
}

.mf-card-code.is-legacy { color: var(--mf-muted); font-weight: 600; }
.mf-code-actions { display: flex; align-items: flex-start; gap: 6px; }
.mf-expand-button { width: 30px; height: 30px; padding: 0; }
.mf-remaining { white-space: nowrap; color: #38475d; font-size: .78rem; font-weight: 700; }

.mf-usage-row td { padding: 0 !important; background: #f8fafc; }
.mf-usage-detail { padding: 14px 52px 17px; border-bottom: 1px solid var(--mf-line); }
.mf-usage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.mf-usage-heading strong { font-size: .82rem; }
.mf-usage-grid { display: grid; }
.mf-usage-entry { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(110px, .7fr); gap: 12px; padding: 9px 0; border-top: 1px solid #e3e8ef; }
.mf-usage-entry span { color: #536078; font-size: .75rem; font-variant-numeric: tabular-nums; }
.mf-usage-entry strong { color: var(--mf-ink); font-size: .76rem; }
.mf-usage-message { padding: 12px 0; color: var(--mf-muted); font-size: .78rem; }
.mf-usage-message.is-error { color: var(--mf-red); }

.mf-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 700;
  white-space: nowrap;
}

.mf-status-badge::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-active, .status-unactivated { color: var(--mf-green); background: #e6f6f1; }
.status-suspended { color: var(--mf-orange); background: #fff1df; }
.status-expired, .status-archived { color: #667286; background: #edf0f4; }
.status-revoked { color: var(--mf-red); background: #fdecef; }

.mf-license-actions { display: flex; min-width: 230px; flex-wrap: wrap; gap: 6px; }
.mf-license-actions .btn { padding: .31rem .5rem; font-size: .71rem; }
.mf-table-message { height: 126px; color: var(--mf-muted); text-align: center; }
.mf-table-message.is-error, .mf-mobile-message.is-error { color: var(--mf-red); }
.mf-inline-status { min-height: 22px; margin: 7px 1px 10px; color: var(--mf-muted); font-size: .78rem; }
.mf-inline-status.is-success { color: var(--mf-green); }
.mf-inline-status.is-error { color: var(--mf-red); }
.mf-inline-status.is-loading { color: var(--mf-blue); }

.mf-pagination { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 2px 0; }
.mf-page-summary { color: var(--mf-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.mf-mobile-list { display: none; }

.mf-toast {
  position: fixed;
  z-index: 1080;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #b9e1d4;
  border-radius: 11px;
  color: #0f654e;
  background: #edf9f5;
  box-shadow: 0 14px 38px rgba(25, 48, 78, .18);
  font-size: .86rem;
}

.mf-toast.is-error { border-color: #f3c6cc; color: #9f2836; background: #fff2f4; }
.mf-copy-fallback { position: fixed; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mf-sidebar-scrim { display: none; }

@media (max-width: 1199.98px) {
  .mf-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf-two-column { grid-template-columns: 1fr; }
  .mf-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mf-filter-bar input[name="q"] { grid-column: span 2; }
  .mf-usage-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
  :root { --mf-sidebar-width: 264px; }
  .mf-sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .mf-sidebar.is-open { transform: translateX(0); }
  .mf-workspace { margin-left: 0; }
  .mf-mobile-nav-button { display: inline-flex; }
  .mf-sidebar-scrim { position: fixed; z-index: 1030; inset: 0; display: block; width: 100%; border: 0; background: rgba(8, 18, 35, .44); }
  .mf-table-card > .table-responsive { display: none; }
  .mf-mobile-list { display: grid; gap: 12px; padding: 14px; }
  .mf-mobile-card { padding: 16px; border: 1px solid var(--mf-line); border-radius: 12px; background: #fff; }
  .mf-mobile-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; padding-bottom: 11px; border-bottom: 1px solid #e9edf3; }
  .mf-mobile-card-header strong, .mf-mobile-card-header small { display: block; }
  .mf-mobile-card-header small { max-width: 240px; margin-top: 4px; overflow-wrap: anywhere; color: var(--mf-muted); }
  .mf-mobile-field { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .5rem; padding: 5px 0; }
  .mf-mobile-field > span { color: var(--mf-muted); font-size: .76rem; }
  .mf-mobile-field > strong { overflow-wrap: anywhere; font-size: .8rem; font-weight: 600; }
  .mf-mobile-card .mf-license-actions { min-width: 0; margin-top: 13px; padding-top: 13px; border-top: 1px solid #e9edf3; }
  .mf-mobile-card .mf-card-code { white-space: normal; }
  .mf-mobile-selection { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
  .mf-mobile-card .mf-usage-detail { margin-top: 12px; padding: 12px 0 0; border-top: 1px solid #e9edf3; border-bottom: 0; }
  .mf-mobile-message { padding: 32px 16px; color: var(--mf-muted); text-align: center; }
}

@media (max-width: 767.98px) {
  .mf-topbar { align-items: flex-start; }
  .mf-topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .mf-clock { display: none; }
  .mf-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf-filter-bar input[name="q"] { grid-column: 1 / -1; }
  .mf-filter-bar .btn { width: 100%; }
  .mf-selection-toolbar { align-items: flex-start; }
}

@media (max-width: 575px) {
  .mf-login { padding: 14px; }
  .mf-login-card { padding: 28px 22px; border-radius: 17px; }
  .mf-login-form .input-group { display: grid; gap: 9px; }
  .mf-login-form .input-group > * { width: 100%; border-radius: var(--tblr-border-radius) !important; }
  .mf-topbar { min-height: 74px; padding: 12px 15px; }
  .mf-topbar-actions { gap: 6px; }
  .mf-topbar-actions .btn { padding-right: .58rem; padding-left: .58rem; font-size: .75rem; }
  .mf-topbar h1 { font-size: 1.05rem; }
  .mf-topbar .mf-eyebrow { display: none; }
  .mf-content { padding: 20px 14px 32px; }
  .mf-section-heading { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .mf-section-heading h2 { font-size: 1.45rem; }
  .mf-section-heading .btn { width: 100%; }
  .mf-stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .mf-stat-card { min-height: 124px; padding: 19px; }
  .mf-stat-card strong { margin: 10px 0 4px; font-size: 1.75rem; }
  .mf-form-grid, .mf-filter-bar { grid-template-columns: 1fr; }
  .mf-form-span, .mf-filter-bar input[name="q"] { grid-column: auto; }
  .mf-form-actions, .mf-single-result { align-items: stretch; flex-direction: column; }
  .mf-form-actions .btn, .mf-single-result .btn, .mf-batch-actions .btn { width: 100%; }
  .mf-issued-row { grid-template-columns: 28px minmax(0, 1fr); }
  .mf-issued-row small { grid-column: 2; }
  .mf-pagination { align-items: stretch; flex-direction: column; }
  .mf-pagination .btn-list { display: grid; grid-template-columns: 1fr 1fr; }
  .mf-mobile-list { padding: 10px; }
  .mf-mobile-field { grid-template-columns: 5.7rem minmax(0, 1fr); }
  .mf-usage-entry { grid-template-columns: 1fr; gap: 4px; }
  .mf-toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
