:root {
  color: #182033;
  background: #f5f7fb;
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  --ink: #182033;
  --muted: #576480;
  --border: #dfe5f1;
  --accent: #3949c8;
  --accent-strong: #2c38a3;
  --white: #ffffff;
  --shadow: 0 8px 28px rgba(36, 48, 87, .06);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-strong); }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 3px solid #566dff;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 5;
  padding: .5rem;
  background: var(--white);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: min(1344px, 100% - 64px);
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 5vw, 4rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: .65rem;
  color: var(--ink);
  font-size: 1.27rem;
  font-weight: 800;
  letter-spacing: -.045em;
  text-decoration: none;
}
.brand-cloud { margin-left: .12em; font-size: .84em; color: var(--accent); }

.brand-mark {
  flex: none;
  position: relative;
  display: inline-block;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #5665ff, #3444be);
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(57, 73, 200, .23);
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 31% 31%;
  border: 2px solid #fff;
  border-radius: 3px;
  transform: translate(-15%, 12%) rotate(-16deg);
}
.brand-mark::after { transform: translate(15%, -12%) rotate(-16deg); }

nav { display: flex; align-items: center; gap: .3rem; }
nav a {
  padding: .55rem .85rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
nav a:hover, nav a[aria-current] { color: var(--accent-strong); background: #eef1ff; }

.user-area {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: .6rem;
  min-width: 0;
}
.user-avatar {
  display: grid;
  place-items: center;
  height: 32px;
  width: 32px;
  flex: none;
  border-radius: 50%;
  background: #e9edfb;
  color: #3c4aaa;
  font-weight: 750;
  font-size: .83rem;
}
.user-name {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page {
  width: min(1344px, 100% - 64px);
  min-height: 65vh;
  margin: 0 auto;
  padding: 38px 0 64px;
}
.page-heading, .section-heading, .section-actions, .plan-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
}
.page-heading { margin-bottom: 25px; }
h1 { font-size: clamp(1.8rem, 3vw, 2.25rem); letter-spacing: -.05em; line-height: 1.15; }
h2 { font-size: 1.1rem; letter-spacing: -.025em; }
.section-heading { min-height: 40px; margin-bottom: 10px; }
.section-actions { justify-content: flex-end; }
#overview, #files, #links { scroll-margin-top: 94px; }
.subtle { color: var(--muted); font-size: .79rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: .45rem .85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  font-size: .83rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 4px #3949c829; }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-secondary { background: var(--white); border-color: #d7deeb; }
.button-secondary:hover:not(:disabled) { background: #f7f8fe; border-color: #aeb9e1; }
.button-quiet { color: var(--muted); padding-inline: .55rem; }
.button-quiet:hover:not(:disabled) { background: #eef1fa; color: var(--ink); }
.button-link { padding-inline: .5rem; color: var(--accent-strong); }
.button-link:hover:not(:disabled) { background: #eef1ff; }

.startup {
  min-height: 25vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  text-align: center;
  color: var(--muted);
}

.signin-shell {
  min-height: max(390px, calc(100dvh - 168px));
  display: grid;
  place-items: center;
}
.signin-panel {
  width: min(100%, 420px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 12px 60px rgba(40, 57, 110, .09);
}
.signin-heading { margin-bottom: 24px; }
.signin-heading p { margin-top: .65rem; font-size: .85rem; color: var(--muted); }
.signin-heading .notice { margin: .9rem 0 0; color: #643f09; }
.signin-mark { margin-bottom: 14px; width: 44px; height: 44px; border-radius: 13px; }
#login-form { display: grid; gap: .85rem; }
#login-button { margin-top: .35rem; min-height: 42px; }

.notice {
  padding: .8rem 1rem;
  margin: 0 0 1rem;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: .84rem;
}
.notice-demo { border-color: #f4daaa; background: #fff7e7; color: #643f09; }
.notice-error { border-color: #f4c6cb; background: #fff1f2; color: #8a2030; }

.plans {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
}
.plan-card {
  min-width: 0;
  min-height: 153px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: .65rem;
  padding: 17px 20px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.plan-primary {
  border-color: transparent;
  background: linear-gradient(122deg, #2c3699, #4354cf);
  color: #fff;
}
.plan-topline, .plan-label, .plan-meta { font-size: .83rem; color: var(--muted); }
.plan-primary .plan-topline, .plan-primary .plan-meta { color: #edf0ff; }
.plan-name {
  padding: .2rem .5rem;
  background: #ffffff24;
  border: 1px solid #ffffff35;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  max-width: 60%;
}
.metric {
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
  line-height: 1.1;
}
.expiry-metric { white-space: nowrap; }

progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  border: 0;
  background: #e6eafb;
  color: var(--accent);
}
progress::-webkit-progress-bar { background: #e6eafb; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.plan-progress { background: #ffffff38; color: #bfc8ff; height: 5px; }
.plan-progress::-webkit-progress-bar { background: #ffffff38; }
.plan-progress::-webkit-progress-value { background: #dce1ff; }
.plan-progress::-moz-progress-bar { background: #dce1ff; }

.data-section { margin-top: 23px; }
.data-panel {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.table-scroll { overflow-x: auto; border-radius: inherit; }
table { border-collapse: collapse; width: 100%; text-align: left; }
#files-table { min-width: 600px; }
#links-table { min-width: 930px; }
th, td { padding: 11px 14px; vertical-align: middle; }
thead th {
  background: #f8f9fd;
  font-size: .77rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
tbody td, tbody th {
  border-top: 1px solid #e9edf5;
  font-size: .82rem;
}
tbody th { font-weight: 650; }
tbody tr:hover { background: #fafbff; }
.row-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: clamp(12rem, 26vw, 26rem);
}
.row-detail {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 400;
}
.link-url { font-family: "IBM Plex Mono", Consolas, monospace; }
.data-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-actions { text-align: right; white-space: nowrap; }
.data-actions .button { min-height: 30px; }
.cell-caption { display: none; }
.empty-state { padding: 24px 16px; text-align: center; color: var(--muted); font-size: .85rem; }
.status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  width: max-content;
  padding: .2rem .5rem;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 650;
  color: #4b586f;
  background: #edf0f6;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ok { color: #145a43; background: #e7f5ee; }
.status-wait { color: #795506; background: #fff3d6; }
.status-error { color: #8b2230; background: #fce9ec; }

dialog {
  width: min(440px, 100% - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 20px 80px rgba(17, 25, 52, .25);
}
dialog::backdrop { background: #1b253d65; }
.modal-form { display: grid; gap: 1rem; padding: 22px; }
.modal-form h2 { font-size: 1.3rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .25rem; }
.field { display: grid; gap: .4rem; color: var(--ink); font-size: .84rem; font-weight: 650; }
.field input, .field select {
  display: block;
  width: 100%;
  min-height: 41px;
  padding: .55rem .65rem;
  border: 1px solid #cbd3e4;
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font-weight: 400;
}
.field input[type="file"] { padding: .42rem; }
.field input::file-selector-button {
  padding: .35rem .55rem;
  border: 0;
  border-radius: 5px;
  background: #eef1ff;
  color: var(--accent-strong);
  font-weight: 650;
}
.field input::placeholder { color: #68738c; }
.form-error { color: #8a2030; font-size: .82rem; }
.feedback:not(:empty) {
  position: fixed;
  z-index: 3;
  right: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  padding: .7rem 1rem;
  border-radius: 8px;
  background: #253354;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: .83rem;
}

@media (max-width: 760px) {
  .topbar-inner, .page { width: calc(100% - 32px); }
  .topbar-inner { flex-wrap: wrap; min-height: 58px; gap: 0 .5rem; padding: .55rem 0; }
  nav { order: 2; width: 100%; margin-top: .35rem; }
  nav a { padding: .4rem .6rem; }
  .user-avatar { display: none; }
  .user-name { max-width: 8rem; }
  .page { padding-top: 25px; }
  .page-heading { margin-bottom: 16px; }
  .plans { grid-template-columns: 1fr 1fr; gap: 9px; }
  .plan-card { padding: 12px; min-height: 100px; }
  .plan-primary { grid-column: span 2; }
  .metric { font-size: 1.5rem; }
  #files-table, #links-table { display: block; min-width: 0; }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  tbody { display: block; }
  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: .65rem 1rem;
    padding: 12px 14px;
  }
  tbody tr + tr { border-top: 1px solid #e9edf5; }
  tbody td, tbody th { border: 0; padding: 0; }
  tbody th, .data-actions { grid-column: 1 / -1; }
  .row-title { max-width: 100%; }
  .data-value { white-space: normal; overflow-wrap: anywhere; }
  .data-actions:empty { display: none; }
  .cell-caption { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .73rem; }
}

@media (max-width: 390px) {
  .plan-card { padding-inline: 10px; }
  .expiry-metric { font-size: 1.2rem; }
  .user-name { max-width: 6rem; }
  .signin-panel { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
