:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #dfe6ee;
  --text: #17202a;
  --muted: #64748b;
  --blue: #2359c4;
  --blue-dark: #17439a;
  --green: #78c61e;
  --danger: #c73333;
  --shadow: 0 16px 40px rgba(21, 35, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #b8c6d8;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.primary:hover {
  background: var(--blue-dark);
}

.danger {
  border-color: rgba(199, 51, 51, 0.28);
  background: #fff5f5;
  color: var(--danger);
  font-weight: 700;
}

.danger:hover {
  border-color: var(--danger);
  background: #ffe8e8;
}

.ghost {
  background: transparent;
}

.wide {
  width: 100%;
  height: 42px;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(35, 89, 196, 0.12), rgba(120, 198, 30, 0.16)),
    #f8fafc;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-row img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.brand-row h1,
.brand-row p {
  margin: 0;
}

.brand-row h1 {
  font-size: 28px;
}

.brand-row p,
.brand-row span,
.muted {
  color: var(--muted);
}

.login-card label,
.field-grid label {
  display: grid;
  gap: 7px;
  color: #3b4654;
  font-size: 13px;
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.error-text {
  min-height: 20px;
  color: var(--danger);
  margin: 12px 0 0;
}

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

.sidebar {
  background: #0f1f3d;
  color: #fff;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-row.compact {
  align-items: center;
  margin-bottom: 8px;
}

.brand-row.compact img {
  width: 48px;
  height: 48px;
}

.brand-row.compact div {
  display: grid;
  gap: 3px;
}

.brand-row.compact span {
  font-size: 12px;
  color: #b9c6d8;
}

nav {
  display: grid;
  gap: 8px;
}

nav button,
.logout {
  text-align: left;
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e9eef7;
}

nav button.active {
  background: #fff;
  color: #102244;
  border-color: #fff;
  font-weight: 800;
}

.nav-label {
  margin: 12px 0 2px;
  color: #8ea0b8;
  font-size: 12px;
  font-weight: 800;
}

.subject-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.subject-list button {
  min-height: 34px;
  padding: 6px 8px;
  text-align: center;
  font-size: 13px;
  color: #e9eef7;
}

.subject-list button.active {
  border-color: #78c61e;
  background: rgba(120, 198, 30, 0.22);
  color: #fff;
  font-weight: 800;
}

.logout {
  margin-top: auto;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h2,
.topbar p {
  margin: 0;
}

.topbar h2 {
  font-size: 24px;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(21, 35, 58, 0.06);
}

.filters,
.form-panel {
  padding: 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, 170px) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #536273;
  font-size: 13px;
  white-space: nowrap;
}

td {
  font-size: 14px;
}

.title-cell {
  font-weight: 800;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  background: #ecf4ff;
  color: var(--blue);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  padding: 34px;
  color: var(--muted);
}

.recycle-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.recycle-summary strong {
  font-size: 16px;
}

.recycle-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.recycle-summary span,
.recycle-empty span {
  color: var(--muted);
}

.recycle-empty {
  display: grid;
  gap: 8px;
}

.retention-pill {
  display: inline-block;
  min-width: 54px;
  padding: 4px 9px;
  border-radius: 5px;
  background: #fff7ed;
  color: #9a4f13;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

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

.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.upload-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.picker-card {
  min-height: 92px;
  padding: 16px;
  border: 1px dashed #b8c6d8;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.picker-card:hover {
  border-color: var(--blue);
  background: #f1f6ff;
}

.picker-card strong,
.picker-card span {
  display: block;
}

.picker-card strong {
  color: var(--blue);
  font-size: 16px;
}

.picker-card span {
  margin-top: 8px;
  color: var(--muted);
}

.picker-card input {
  display: none;
}

.upload-summary {
  min-height: 36px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.upload-progress-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-bar {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.upload-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.upload-queue {
  display: grid;
  gap: 6px;
}

.upload-file-row,
.upload-file-more {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid #edf1f5;
  border-radius: 6px;
  background: #fff;
  color: #3b4654;
  font-size: 13px;
}

.upload-file-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-row em {
  flex: 0 0 auto;
  color: var(--muted);
  font-style: normal;
}

.upload-file-more {
  color: var(--muted);
}

.home-hero {
  margin-bottom: 26px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(39, 37, 116, 0.98), rgba(39, 37, 116, 0.92) 62%, rgba(36, 86, 63, 0.92)),
    #292574;
  box-shadow: 0 24px 48px rgba(24, 31, 50, 0.2);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.3fr) 180px;
  gap: 18px;
  align-items: center;
}

.home-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}

.profile-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 28px;
  font-weight: 900;
}

.home-profile strong,
.home-profile span {
  display: block;
}

.home-profile strong {
  font-size: 24px;
}

.home-profile span {
  margin-top: 4px;
  color: rgba(255,255,255,0.72);
}

.home-search {
  min-height: 52px;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 16px;
}

.home-search::placeholder {
  color: rgba(255,255,255,0.68);
}

.home-upload {
  min-height: 52px;
  border-color: #fff;
  background: #fff;
  color: #292574;
  font-size: 16px;
  font-weight: 900;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 10px 0 12px;
}

.section-head h3,
.section-head p {
  margin: 0;
}

.section-head h3 {
  font-size: 22px;
}

.section-head p {
  margin-top: 4px;
  color: var(--muted);
}

.compact-head {
  margin-top: 0;
  align-items: start;
}

.password-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.account-panel {
  max-width: 920px;
}

.form-message {
  min-height: 22px;
  margin-top: 6px;
  color: var(--danger);
  font-size: 13px;
}

.form-message.success {
  color: #207a3b;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.subject-card {
  min-height: 96px;
  padding: 18px;
  text-align: left;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(21, 35, 58, 0.06);
}

.subject-card strong,
.subject-card span {
  display: block;
}

.subject-card strong {
  color: #292574;
  font-size: 20px;
}

.subject-card span {
  margin-top: 10px;
  color: var(--green);
  font-weight: 900;
}

.recent-head {
  margin-top: 6px;
}

.version-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -10px 0 24px;
  padding: 14px 16px;
}

.version-banner strong,
.version-banner span {
  display: block;
}

.version-banner strong {
  font-size: 16px;
}

.version-banner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.announcement-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -10px 0 24px;
  padding: 14px 16px;
  border-left: 4px solid var(--blue);
}

.announcement-banner strong,
.announcement-banner span {
  display: block;
}

.announcement-banner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.announcement-list {
  display: grid;
  gap: 12px;
  max-width: 980px;
}

.announcement-card {
  padding: 18px;
}

.announcement-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.announcement-card-head strong,
.announcement-card-head span {
  display: block;
}

.announcement-card-head strong {
  color: #102244;
  font-size: 18px;
}

.announcement-card-head span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.announcement-card-head em {
  padding: 4px 9px;
  border-radius: 5px;
  background: #edf6e8;
  color: #34740f;
  font-style: normal;
  font-weight: 900;
  font-size: 12px;
}

.announcement-card p {
  margin: 0;
  color: #3b4654;
  line-height: 1.8;
  white-space: pre-wrap;
}

.announcement-empty {
  display: grid;
  gap: 8px;
}

.ranking-panel {
  max-width: 980px;
  padding: 18px;
}

.ranking-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ranking-head h3,
.ranking-head p {
  margin: 0;
}

.ranking-head h3 {
  color: #102244;
  font-size: 22px;
}

.ranking-head p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.ranking-head > strong {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 6px;
  background: #edf6e8;
  color: #2f7410;
  font-size: 14px;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e4ebf3;
  border-radius: 8px;
  background: #fff;
}

.ranking-row.current {
  border-color: #b8d2ff;
  background: #f4f8ff;
}

.ranking-rank {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #292574;
  color: #fff;
  font-weight: 900;
}

.ranking-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.ranking-name strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-name span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 5px;
  background: #e4f4db;
  color: #34740f;
  font-size: 12px;
  font-weight: 900;
}

.ranking-info small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ranking-bar {
  height: 7px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.ranking-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.ranking-count {
  text-align: right;
}

.ranking-count strong,
.ranking-count span {
  display: block;
}

.ranking-count strong {
  color: #102244;
  font-size: 24px;
  line-height: 1.1;
}

.ranking-count span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ranking-empty {
  display: grid;
  gap: 8px;
}

.version-panel {
  max-width: 980px;
  padding: 22px;
}

.version-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.version-title span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.version-title h3 {
  margin: 4px 0 0;
  font-size: 24px;
}

.version-note-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.version-note-list section {
  padding: 16px;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  background: #fbfcfe;
}

.version-note-list strong {
  display: block;
  margin-bottom: 8px;
  color: #102244;
  font-size: 16px;
}

.version-note-list p {
  margin: 0;
  color: #465566;
  line-height: 1.72;
}

.version-note-list code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #edf6e8;
  color: #34740f;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-weight: 800;
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.recent-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(21, 35, 58, 0.06);
}

.recent-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 17px;
}

.recent-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.recent-tags span {
  padding: 4px 9px;
  border-radius: 5px;
  background: #edf6e8;
  color: #4f9b18;
  font-size: 12px;
  font-weight: 800;
}

.folder-card {
  min-height: 158px;
  padding-bottom: 58px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.folder-card.expanded {
  grid-column: 1 / -1;
}

.folder-card-actions {
  position: absolute;
  right: 62px;
  bottom: 16px;
  display: flex;
  gap: 8px;
}

.folder-card-actions button,
.append-file-button {
  height: 34px;
  padding: 0 12px;
  border-color: #d9e4f0;
  border: 1px solid #d9e4f0;
  border-radius: 6px;
  background: #fff;
  color: #292574;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(21, 35, 58, 0.08);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.append-file-button input {
  display: none;
}

.append-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d9e4f0;
  border-radius: 8px;
  background: #f8fbff;
}

.append-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.append-panel-head strong,
.append-panel-head span {
  display: block;
}

.append-panel-head strong {
  color: #102244;
  font-size: 15px;
}

.append-panel-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.append-picker {
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 1px dashed #b8c6d8;
  border-radius: 8px;
  background: #fff;
  color: #292574;
  font-weight: 900;
  cursor: pointer;
}

.append-picker input {
  display: none;
}

.append-file-list {
  display: grid;
  gap: 7px;
}

.append-file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  background: #fff;
  color: #3b4654;
}

.append-file-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.append-file-row em {
  flex: 0 0 auto;
  color: var(--muted);
  font-style: normal;
}

.append-empty,
.append-message {
  color: var(--muted);
  font-size: 13px;
}

.append-message.success {
  color: #207a3b;
  font-weight: 800;
}

.append-message.warn {
  color: #9a4f13;
  font-weight: 800;
}

.append-message.error {
  color: var(--danger);
  font-weight: 800;
}

.append-actions {
  display: flex;
  justify-content: flex-end;
}

.folder-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.folder-icon {
  position: relative;
  width: 48px;
  height: 38px;
  flex: 0 0 48px;
  border-radius: 7px;
  background: linear-gradient(135deg, #292574 0%, #3d57a8 100%);
  box-shadow: 0 12px 24px rgba(41, 37, 116, 0.18);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -7px;
  width: 24px;
  height: 12px;
  border-radius: 6px 6px 0 0;
  background: #75c935;
}

.folder-icon::after {
  content: "";
  position: absolute;
  inset: 8px 7px;
  border-top: 2px solid rgba(255, 255, 255, 0.64);
}

.folder-sub {
  display: block;
  margin-top: -6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.material-owner,
.folder-file-owner {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.folder-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #d9e4f0;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 35, 58, 0.08);
}

.folder-toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2px solid #292574;
  border-bottom: 2px solid #292574;
  transform: rotate(45deg);
}

.folder-toggle.expanded::before {
  margin-top: 4px;
  transform: rotate(225deg);
}

.folder-files {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.folder-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(242, 246, 250, 0.78);
}

.folder-file-main {
  min-width: 0;
}

.folder-file-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.folder-file-actions button {
  padding: 7px 10px;
}

.append-progress {
  margin-bottom: 12px;
  padding: 12px 14px;
  color: var(--blue);
  font-weight: 800;
}

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

  .sidebar {
    position: static;
  }

  .filters,
  .field-grid,
  .upload-picker,
  .home-hero,
  .version-banner,
  .subject-grid,
  .recent-list {
    grid-template-columns: 1fr;
  }

  .version-banner,
  .version-title {
    align-items: stretch;
    flex-direction: column;
  }

  .ranking-head {
    flex-direction: column;
  }

  .ranking-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .ranking-count {
    grid-column: 2;
    text-align: left;
  }

  .folder-file-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .folder-card-actions {
    position: static;
    margin-top: 12px;
  }

  .folder-file-actions {
    justify-content: flex-start;
  }
}
