:root {
  --green: #135c3b;
  --blue: #0a2f70;
  --paper: #f8f1e5;
  --line: #e4d3bd;
  --ink: #1d2520;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: linear-gradient(135deg, #f8f1e5, #fffaf1 52%, #eef5ef);
}

button,
input {
  font: inherit;
}

a,
button {
  -webkit-tap-highlight-color: rgba(19, 92, 59, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
}

a[href],
button:not(:disabled) {
  cursor: pointer;
}

a[href]:hover,
button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(19, 92, 59, 0.14);
  filter: brightness(1.03);
}

a[href]:focus-visible,
button:not(:disabled):focus-visible {
  outline: 2px solid rgba(19, 92, 59, 0.42);
  outline-offset: 2px;
}

a[href]:active,
button:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.94);
}

.library-admin {
  width: min(1440px, calc(100% - 36px));
  margin: 28px auto;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.library-header h1 {
  margin: 0;
  color: var(--blue);
}

.library-header p {
  margin: 6px 0 0;
  color: #647066;
}

.header-actions,
.library-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions a,
.header-actions button,
.library-tabs button,
.file-actions button,
.file-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(19, 92, 59, 0.28);
  border-radius: 6px;
  background: white;
  color: var(--green);
  text-decoration: none;
  cursor: pointer;
  padding: 8px 14px;
}

.header-actions button,
.library-tabs button.active {
  background: var(--green);
  color: white;
}

.library-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.9);
  box-shadow: 0 18px 45px rgba(79, 56, 31, 0.09);
  padding: 16px 20px;
}

.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: #526157;
}

.inline-login {
  display: grid;
  grid-template-columns: auto 180px 180px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid rgba(19, 92, 59, 0.18);
  border-radius: 8px;
  background: #f7fbf8;
  padding: 12px;
}

.inline-login.hidden {
  display: none;
}

.inline-login input {
  border: 1px solid #cdbfae;
  border-radius: 6px;
  padding: 8px 10px;
}

.inline-login button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: white;
  cursor: pointer;
  padding: 8px 14px;
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.library-list {
  display: grid;
  gap: 8px;
}

.file-row {
  display: grid;
  grid-template-columns: 32px minmax(220px, 1fr) 90px 100px auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #eee4d7;
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.file-row input[type="text"] {
  width: 100%;
  border: 1px solid #cdbfae;
  border-radius: 6px;
  padding: 8px 10px;
}

.file-type,
.file-size {
  color: #526157;
}

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

.file-actions .danger,
.header-actions #batchDeleteBtn {
  border-color: rgba(178, 67, 55, 0.3);
  background: #b24337;
  color: white;
}

.empty {
  padding: 32px;
  color: #7c7065;
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 6px;
  background: #173a2a;
  color: white;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .library-header,
  .file-row {
    align-items: stretch;
  }

  .library-header {
    flex-direction: column;
  }

  .file-row {
    grid-template-columns: 28px 1fr;
  }

  .file-type,
  .file-size,
  .file-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .inline-login {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .library-admin {
    width: min(100% - 20px, 1440px);
    margin: 12px auto;
  }

  .library-header {
    gap: 12px;
  }

  .library-header h1 {
    font-size: 26px;
  }

  .header-actions,
  .library-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .header-actions a,
  .header-actions button,
  .library-tabs button,
  .file-actions button,
  .file-actions a {
    min-height: 44px;
  }

  .library-panel {
    margin-top: 10px;
    padding: 12px;
  }

  .library-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .file-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  .file-type,
  .file-size,
  .file-actions {
    grid-column: 2;
  }

  .file-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .file-actions a,
  .file-actions button {
    padding: 7px 8px;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-width: 0;
  }
}
