/* MDShare 用户中心. No inline styles anywhere (CSP style-src 'self'); no external fonts. */
:root {
  color-scheme: dark;
  --bg: #070a0d;
  --surface: rgba(16, 21, 26, 0.9);
  --surface-strong: #11171c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f7f8;
  --muted: #89959e;
  --subtle: #84919a;       /* footnotes, security note, empty states, meta: >= 5.7:1 on panels */
  --accent: #35e0b5;
  --accent-strong: #1fc99f;
  --accent-soft: rgba(53, 224, 181, 0.11);
  --danger: #ff646d;
  --danger-strong: #c23e48; /* white on it: 5.15:1 */
  --danger-soft: rgba(255, 100, 109, 0.1);
  --warning: #ffbd59;
  --warning-text: #ffd08a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(38, 174, 143, 0.08), transparent 34%),
    radial-gradient(circle at 92% 82%, rgba(45, 107, 168, 0.09), transparent 35%),
    var(--bg);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: none; }

[hidden] { display: none !important; }

.noscript-banner {
  position: relative;
  z-index: 5;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 189, 89, 0.3);
  color: var(--warning-text);
  background: rgba(255, 189, 89, 0.1);
  text-align: center;
  font-size: 14px;
}

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.11;
  pointer-events: none;
}
.ambient-one { top: -220px; left: -120px; background: var(--accent); }
.ambient-two { right: -250px; bottom: -170px; background: #317ec2; }

.page-shell {
  position: relative;
  width: min(1440px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* The client's logo (web/logo.jpg, 128x128 downscale of qt/resources/branding/logo.jpg). */
.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(53, 224, 181, 0.42);
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-strong);
  box-shadow: 0 0 32px rgba(53, 224, 181, 0.14);
}

/* ------------------------------------------------------------------ login */
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(410px, 0.85fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.brand-panel {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px clamp(42px, 7vw, 106px);
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
}

.hero-copy { max-width: 680px; padding: 80px 0; }
.eyebrow, .panel-kicker, .dialog-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.hero-copy h1 {
  margin: 20px 0 24px;
  font-size: clamp(48px, 6vw, 86px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}
.hero-copy h1 span { color: var(--accent); }
.hero-copy p {
  max-width: 560px;
  margin: 0;
  color: #a9b3ba;
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.8;
}

.feature-row {
  display: flex;
  margin: 0;
  padding: 0;
  gap: 12px 24px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}
.feature-row li::before {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 9px 2px 0;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.login-panel {
  display: grid;
  padding: 42px;
  place-items: center;
}

.login-card {
  width: min(440px, 100%);
  padding: clamp(30px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(21, 28, 34, 0.96), rgba(12, 16, 20, 0.96));
  box-shadow: var(--shadow);
}

.login-heading, .sync-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #aab5bc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.status-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(53, 224, 181, 0.65);
}

.login-card h2 {
  margin: 34px 0 10px;
  font-size: 30px;
  letter-spacing: -0.04em;
}
.muted { margin: 0 0 34px; color: var(--muted); line-height: 1.7; }
.field-label {
  display: block;
  margin-bottom: 9px;
  color: #cbd2d6;
  font-size: 13px;
  font-weight: 650;
}
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  height: 54px;
  padding: 0 62px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: rgba(5, 8, 10, 0.64);
  font-size: 16px; /* >= 16px: no iOS zoom on focus */
  letter-spacing: 0.05em;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input-wrap input:focus {
  border-color: rgba(53, 224, 181, 0.65);
  box-shadow: 0 0 0 4px rgba(53, 224, 181, 0.08);
}
.input-wrap input:read-only { color: #b9c3c9; }
.input-wrap input::placeholder { color: #737f88; letter-spacing: 0.01em; opacity: 1; }
.icon-button {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 46px;
  min-height: 38px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
  font-size: 13px;
}
.icon-button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.icon-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.form-error { min-height: 20px; margin: 9px 0 5px; color: var(--danger); font-size: 13px; line-height: 1.5; }

.primary-button, .secondary-button, .danger-button, .small-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}
.primary-button {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  color: #06110d;
  background: linear-gradient(135deg, #65f2ce, var(--accent-strong));
  box-shadow: 0 12px 34px rgba(31, 201, 159, 0.16);
  font-size: 15px;
}
.primary-button span:last-child { margin-left: auto; font-size: 20px; }
.primary-button:hover:not(:disabled),
.danger-button:hover:not(:disabled),
.small-button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.48; transform: none; }
.security-note { margin: 24px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.65; }

/* ------------------------------------------------------------------ dashboard */
.dashboard { padding: 0 clamp(22px, 5vw, 72px) 72px; }
.topbar {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.account-actions { display: flex; min-width: 0; align-items: center; gap: 18px; }
.account-copy { display: grid; min-width: 0; gap: 3px; text-align: right; }
.account-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-copy span { color: var(--muted); font-size: 12px; }
.secondary-button {
  flex: 0 0 auto;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  color: #cbd3d8;
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
}
.secondary-button:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.05); }

.dashboard-heading {
  display: flex;
  padding: 58px 0 34px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.dashboard-heading h1 { margin: 10px 0 8px; font-size: clamp(34px, 5vw, 54px); letter-spacing: -0.055em; }
.dashboard-heading p { margin: 0; color: var(--muted); }
.sync-status { padding-bottom: 7px; color: var(--muted); white-space: nowrap; }
.sync-status .status-dot { background: #6b7780; box-shadow: none; }
.sync-status.online .status-dot { background: var(--accent); box-shadow: 0 0 12px rgba(53, 224, 181, 0.65); }
.sync-status.offline { color: #ff9aa0; }
.sync-status.offline .status-dot { background: var(--danger); box-shadow: 0 0 12px rgba(255, 100, 109, 0.5); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric-card {
  display: grid;
  min-width: 0;
  min-height: 148px;
  padding: 22px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(18, 24, 29, 0.92), rgba(12, 16, 19, 0.86));
}
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.metric-card strong {
  margin: 18px 0 5px;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.metric-detail { color: var(--subtle); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.live-metric.is-live {
  border-color: rgba(53, 224, 181, 0.28);
  background: linear-gradient(145deg, rgba(25, 54, 46, 0.72), rgba(12, 20, 19, 0.9));
}

.content-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 18px; }

/* Viewer cards: no live panel / live metric; devices span the full width. */
.dashboard.is-viewer .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard.is-viewer .content-grid { grid-template-columns: minmax(0, 1fr); }

.panel {
  min-width: 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 7px 0 0; font-size: 22px; letter-spacing: -0.035em; }
.badge {
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #9ba6ad;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
  font-weight: 700;
}
.badge-live { border-color: rgba(53, 224, 181, 0.3); color: var(--accent); background: var(--accent-soft); }
.badge-stopping { border-color: rgba(255, 189, 89, 0.3); color: var(--warning); background: rgba(255, 189, 89, 0.08); }

.item-list { display: grid; gap: 10px; margin-top: 24px; align-content: start; }
.list-empty {
  display: grid;
  min-height: 126px;
  padding: 16px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  color: var(--subtle);
  text-align: center;
  font-size: 13px;
}
.list-item {
  display: flex;
  min-width: 0;
  padding: 15px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 7, 9, 0.34);
}
.list-item.is-live { border-color: rgba(53, 224, 181, 0.2); }
.live-item.is-stopping { border-color: rgba(255, 189, 89, 0.24); }
.item-main { display: grid; min-width: 0; flex: 1 1 auto; gap: 6px; }
.item-title { display: flex; min-width: 0; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-title strong { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.live-item.is-stopping .item-title strong { color: var(--warning-text); }
.item-meta { display: flex; gap: 4px 14px; flex-wrap: wrap; color: var(--subtle); font-size: 12px; line-height: 1.5; }
.item-meta span, .item-meta code { overflow-wrap: anywhere; }
.item-meta code { color: #9aa6ad; font-family: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12px; }
.meta-warn { color: var(--warning); font-weight: 700; }
.item-actions {
  display: grid;
  max-width: 46%;
  flex: 0 0 auto;
  justify-items: end;
  gap: 6px;
}
.item-reason { color: var(--subtle); font-size: 12px; line-height: 1.45; text-align: right; }
.item-warning {
  margin: 4px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 189, 89, 0.28);
  border-radius: 9px;
  color: var(--warning-text);
  background: rgba(255, 189, 89, 0.07);
  font-size: 12px;
  line-height: 1.6;
}
.tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}
.tag-live { border: 1px solid rgba(53, 224, 181, 0.3); color: var(--accent); background: var(--accent-soft); }
.live-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(53, 224, 181, 0.5);
  animation: live-pulse 1.8s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 224, 181, 0.5); }
  100% { box-shadow: 0 0 0 9px rgba(53, 224, 181, 0); }
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
  white-space: nowrap;
}
.small-button.danger { border-color: rgba(255, 100, 109, 0.28); color: #ff8b92; background: var(--danger-soft); }
.small-button.danger:hover:not(:disabled) { border-color: rgba(255, 100, 109, 0.52); }
.panel-footnote { margin: 20px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.65; }
.warning-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid rgba(255, 189, 89, 0.17);
  border-radius: 12px;
  color: #b3a07f;
  background: rgba(255, 189, 89, 0.045);
  font-size: 12px;
  line-height: 1.6;
}
.warning-strip strong { color: var(--warning); }

/* ------------------------------------------------------------------ dialog */
.confirm-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(5px); }
.dialog-inner { padding: 28px; }
.confirm-dialog h2 { margin: 10px 0 12px; font-size: 22px; letter-spacing: -0.03em; }
.dialog-kicker { color: var(--danger); }
.dialog-body { display: grid; gap: 10px; color: #a3aeb5; font-size: 14px; line-height: 1.7; }
.dialog-body p { margin: 0; overflow-wrap: anywhere; }
.dialog-body .dialog-emphasis {
  padding: 10px 12px;
  border: 1px solid rgba(255, 189, 89, 0.22);
  border-radius: 10px;
  color: var(--warning-text);
  background: rgba(255, 189, 89, 0.07);
}
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.danger-button {
  padding: 0 14px;
  border: 1px solid rgba(255, 100, 109, 0.35);
  color: #fff;
  background: var(--danger-strong);
  font-size: 14px;
}
.danger-button:hover:not(:disabled) { background: #b3363f; }

/* ------------------------------------------------------------------ toast (always in the a11y tree) */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(380px, calc(100% - 48px));
  padding: 14px 17px;
  border: 1px solid rgba(53, 224, 181, 0.25);
  border-radius: 12px;
  color: #d8fff5;
  background: rgba(16, 37, 32, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast:empty { padding: 0; border-width: 0; }
.toast.error { border-color: rgba(255, 100, 109, 0.3); color: #ffdce0; background: rgba(52, 20, 24, 0.97); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .dashboard.is-viewer .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  /* auto 1fr: the leftover height goes to the login panel, not into a gap above the hero. */
  .login-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand-panel {
    min-height: auto;
    padding: 28px 28px 22px;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .hero-copy { padding: 44px 0 30px; }
  .hero-copy h1 { font-size: clamp(40px, 7vw, 56px); }
  .feature-row { display: none; }
  .login-panel { padding: 32px 22px 52px; place-items: start center; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  /* Compact hero so the key field and submit button are on the first screen. */
  .brand-panel { padding: 16px 18px 14px; }
  .brand { font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .hero-copy { padding: 16px 0 2px; }
  .hero-copy .eyebrow { display: none; }
  .hero-copy h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; letter-spacing: -0.03em; }
  .hero-copy h1 br { display: none; }
  .hero-copy p { font-size: 14px; line-height: 1.6; }
  .login-panel { padding: 16px 14px 32px; }
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-card h2 { margin: 16px 0 6px; font-size: 24px; }
  .muted { margin-bottom: 18px; }
  .input-wrap input { padding-right: 58px; letter-spacing: 0; }
  .security-note { margin-top: 16px; }

  .dashboard { padding: 0 14px 42px; }
  .topbar { min-height: 68px; }
  .account-copy { display: none; }
  .dashboard-heading { padding: 30px 2px 20px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .sync-status { padding: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dashboard.is-viewer .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard.is-viewer .metric-card:nth-child(3) { grid-column: 1 / -1; }
  .metric-card { min-height: 120px; padding: 15px; }
  .metric-card strong { margin-top: 12px; font-size: 19px; }
  .panel { padding: 20px 15px; }
  .list-item { align-items: stretch; flex-direction: column; }
  .item-actions { max-width: none; justify-items: stretch; }
  .item-reason { text-align: left; }
  .small-button { width: 100%; min-height: 42px; }
  .warning-strip { grid-template-columns: 1fr; }
  .dialog-inner { padding: 22px 18px; }
  .toast { right: 14px; bottom: 14px; left: 14px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
