:root {
  font: 15px "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #162234;
  background: #f3f6fb;
  --muted: #53647a;
  --line: #dbe4ef;
  --blue: #1463ce;
  --blue-dark: #084eaa;
  --sidebar: #10243f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .98rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #182c45;
  padding: .58rem .88rem;
  font-weight: 600;
  white-space: nowrap;
}
button:hover { background: #edf4fc; }
button:disabled { opacity: .62; cursor: wait; }
:is(button, a, input, select, textarea):focus-visible { outline: 3px solid #68a4ff; outline-offset: 2px; }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.quiet { border-color: transparent; background: transparent; }
.danger { color: #a2232c; }
.muted { color: var(--muted); }
.svg-assets { position: absolute; overflow: hidden; }

.dashboard { min-height: 100dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  background: var(--sidebar);
  color: #f5f9ff;
  padding: 1.15rem .8rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.15rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { flex: none; }
.sidebar .brand { padding: .18rem .65rem 1.3rem; }
.sidebar nav { display: grid; gap: .34rem; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: #d2def0;
  padding: .73rem .7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.sidebar nav a:hover { background: #1a3354; color: #fff; }
.sidebar nav a[aria-current="page"] {
  color: #fff;
  border-color: #395e8b;
  background: #22466f;
}
.sidebar-download {
  display: block;
  width: fit-content;
  margin: 1.25rem .75rem .4rem;
  color: #c0d8f4;
  font-size: .9rem;
  text-underline-offset: .2rem;
}
.sidebar nav svg, .menu-toggle svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace { min-width: 0; }
.topbar {
  min-height: 68px;
  padding: .7rem clamp(1rem, 2.4vw, 2.2rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .9rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.location, .administrator { min-width: 0; display: flex; align-items: center; gap: .65rem; }
.administrator > span { max-width: min(28vw, 260px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.menu-toggle, .sidebar-scrim { display: none; }
.workspace-content { max-width: 1640px; margin: 0 auto; padding: 1.65rem clamp(1rem, 2.4vw, 2.2rem) 3rem; }
.overview-heading, .section-row, .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
}
.overview-heading { margin-bottom: 1rem; }
.overview-heading span, .section-row p, .setting-row p { color: var(--muted); }
.section-row p, .setting-row p { margin-top: .27rem; font-size: .89rem; }
.setting-row p { overflow-wrap: anywhere; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.summary > *, .panel { border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.summary > * {
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .46rem;
  text-decoration: none;
}
.summary a:hover { border-color: #a9c7ed; background: #f8fbff; }
.summary span { color: var(--muted); }
.summary strong { font-size: 1.85rem; font-variant-numeric: tabular-nums; }
.summary .traffic-today { gap: .28rem; }
.traffic-today-detail { font-size: .8rem; line-height: 1.5; }
.traffic-today-detail b { color: #273d57; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.traffic-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.traffic-layout > .traffic-panel { min-width: 0; margin-bottom: 0; }
.traffic-heading { flex-wrap: wrap; }
#traffic-ranking-period { font-size: .83rem; white-space: nowrap; }
#traffic-ranking td:first-child { white-space: normal; overflow-wrap: anywhere; }
#traffic-ranking th, #traffic-ranking td { padding-inline: .55rem; }

.panel { padding: 1.15rem 1.2rem; margin-bottom: 1rem; }
.panel .section-row { margin-bottom: .9rem; }
.security-page { max-width: 960px; }
.security-page .setting-row { padding: 1rem 0 .2rem; }
.security-page .setting-row + .setting-row { margin-top: .65rem; border-top: 1px solid var(--line); }
.security-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.recovery-summary { color: var(--muted); margin-top: .65rem; }

.login-layout { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; }
.login { width: min(100%, 425px); padding: 1.65rem; margin: 0; }
.login .brand { margin-bottom: 1.15rem; }
.login h1 { margin-bottom: 1rem; }
.login-download { display: inline-block; margin-top: 1.15rem; color: #1757aa; font-size: .92rem; }
form, .fields { display: grid; gap: .8rem; }
label { display: grid; gap: .35rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid #bfcbdb;
  border-radius: 7px;
  padding: .64rem .67rem;
  color: inherit;
  background: #fff;
}
input[type="checkbox"] { width: auto; }
label.check { display: flex; align-items: center; gap: .5rem; }

.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th, td { padding: .72rem .65rem; border-bottom: 1px solid #ebf0f7; }
th { font-weight: 650; color: var(--muted); background: #f7f9fc; font-size: .86rem; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: .4rem; }
.actions button { padding: .43rem .59rem; font-size: .86rem; }
.mono { font-variant-numeric: tabular-nums; font-family: Consolas, monospace; }
.status { display: inline-block; border-radius: 20px; background: #eef2f8; color: #47566a; font-weight: 650; padding: .25rem .55rem; font-size: .83rem; }
.status[data-type="ready"] { background: #dcf7eb; color: #146947; }
.status[data-type="pending"] { background: #fff2cc; color: #765510; }
.status[data-type="error"], .status[data-type="target_down"] { background: #ffe5e6; color: #90262b; }
.detail { display: block; color: var(--muted); margin-top: .28rem; font-size: .84rem; white-space: normal; max-width: 260px; }
.empty { padding: .8rem 0; color: var(--muted); }
.certificate-info { display: grid; gap: .15rem; margin-top: .35rem; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.certificate-info time { font-variant-numeric: tabular-nums; }
.certificate-info [data-validity] { font-weight: 650; }
.certificate-info [data-validity="valid"] { color: #146947; }
.certificate-info [data-validity="expiring"], .certificate-info [data-validity="pending"] { color: #815b12; }
.certificate-info [data-validity="expired"] { color: #a2232c; }

.message { padding: .75rem .9rem; background: #e4effd; border: 1px solid #c6ddfb; color: #164373; border-radius: 8px; margin-bottom: 1rem; }
[role="alert"] { color: #a2232c; }
[role="alert"]:empty { display: none; }
dialog { border: 1px solid var(--line); border-radius: 12px; width: min(510px, calc(100% - 2rem)); padding: 1.2rem; color: inherit; }
dialog::backdrop { background: #10233dbb; }
dialog .section-row { margin-bottom: .25rem; }
.verification-image { display: block; width: min(100%, 220px); height: auto; margin: .1rem auto; border: 1px solid var(--line); border-radius: 6px; }
.recovery-codes { resize: vertical; font-family: Consolas, monospace; line-height: 1.55; }

@media (max-width: 1080px) {
  .traffic-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .dashboard { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(270px, 85vw); z-index: 5; visibility: hidden; transform: translateX(-100%); }
  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 4; width: 100%; border: 0; border-radius: 0; background: #10233d88; }
  .sidebar-scrim:hover { background: #10233d88; }
  .menu-toggle { display: flex; padding: .42rem; }
  .workspace-content { padding: 1rem .75rem 2rem; }
  .topbar { min-height: 59px; padding: .6rem .7rem; }
  .topbar h1 { font-size: 1.17rem; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
  .summary > * { padding: .78rem .56rem; }
  .summary span { font-size: .83rem; }
  .summary strong { font-size: 1.45rem; }
  .panel { padding: .88rem; }
}
