:root {
  --rose: #f43f5e;
  --rose-dark: #e11d48;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-900: #0f172a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: var(--slate-700);
}

html {
  scroll-behavior: smooth;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, #f8fafc 0%, #fff1f2 46%, #f1f5f9 100%);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 34px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.login-brand {
  text-align: center;
  margin-bottom: 26px;
}

.login-brand h1 {
  margin: 0;
  color: var(--slate-900);
  font-size: 26px;
}

.login-brand p {
  margin: 8px 0 0;
  color: var(--slate-500);
  font-size: 13px;
}

.login-error {
  margin-top: 14px;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  background: #fff1f2;
  color: #be123c;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.login-error[hidden] {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px 1fr;
  background: #f5f7fb;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: white;
  border-right: 1px solid #f1f5f9;
  padding: 0 16px 16px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.admin-brand {
  height: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: #1e293b;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}

.sidebar-close {
  display: none;
}

.admin-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--rose);
  display: grid;
  place-items: center;
  color: white;
  font-size: 12px;
  line-height: 1;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 14px 0 0;
  border-top: 1px solid #f8fafc;
}

.admin-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  color: #94a3b8;
  text-decoration: none;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  color: currentColor;
  font-size: 16px;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 241, 242, 0.72);
  color: var(--rose);
}

.nav-link-danger {
  color: var(--rose);
}

.front-shell {
  min-height: 100vh;
  background:
    linear-gradient(135deg, #f8fafc 0%, #fff1f2 46%, #f1f5f9 100%);
}

.front-header {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.front-brand {
  color: var(--slate-900);
  font-weight: 900;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--rose);
  display: inline-block;
  box-shadow: 0 8px 18px rgba(244, 63, 94, 0.24);
}

.front-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.front-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
}

.main {
  min-width: 0;
  padding: 0 32px 40px;
  overflow-x: hidden;
}

.admin-header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #f5f7fb;
  position: sticky;
  top: 0;
  z-index: 5;
}

.admin-title-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-title {
  margin: 0;
  color: #1e293b;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.admin-edition {
  display: inline-flex;
  align-items: center;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #fecdd3;
  background: #ffe4e6;
  color: var(--rose);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.admin-breadcrumb {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.admin-front-link {
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.admin-front-link:hover {
  color: var(--rose);
}

.admin-profile {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffe4e6;
  color: var(--rose);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.admin-hero {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.14);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}

.admin-hero h2 {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 24px;
  font-weight: 900;
}

.admin-hero p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.admin-hero-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-hero-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border-radius: 14px;
  padding: 20px;
  color: white;
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.2);
}

.admin-hero-card.rose {
  background: linear-gradient(90deg, #fb7185, #fda4af);
}

.admin-hero-card.blue {
  background: linear-gradient(90deg, #60a5fa, #93c5fd);
}

.admin-hero-card.emerald {
  background: linear-gradient(90deg, #34d399, #6ee7b7);
}

.admin-hero-card span {
  display: block;
  font-size: 13px;
  opacity: 0.82;
  margin-top: 4px;
}

.admin-hero-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.dashboard-link-card {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-link-card:hover,
.dashboard-link-card:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(148, 163, 184, 0.24);
  outline: none;
}

.section-title {
  color: #1e293b;
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 16px;
}

.settings-title {
  position: relative;
  margin-bottom: 18px;
}

.settings-card {
  margin-bottom: 24px;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.12);
}

.settings-card-title {
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  font-size: 18px;
  font-weight: 900;
}

.settings-stack {
  display: grid;
  gap: 18px;
}

.form-field {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.form-field > label,
.modal-form label,
.settings-cookie-label label {
  display: block;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.form-field .muted {
  margin: 0;
}

.share-settings-row {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.share-settings-row > label:not(.share-random-row) {
  display: inline-flex;
  align-items: center;
  min-height: 43px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.share-expiry-select {
  flex: 0 0 142px;
}

.share-password-input {
  flex: 0 0 168px;
}

.share-random-row {
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 4px;
  line-height: 1.45;
  white-space: nowrap;
}

.anti-risk-stack {
  max-width: 560px;
}

.admin-mini-link {
  position: absolute;
  right: 0;
  top: 4px;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: var(--rose);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.admin-mini-link:hover {
  background: #ffe4e6;
}

.settings-cookie {
  min-height: 112px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.check-row,
.radio-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

.check-row {
  gap: 8px;
}

.check-row input,
.radio-row input {
  accent-color: var(--rose);
}

.preview-box {
  min-height: 43px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  padding: 11px 13px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.preview-success {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.inline-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-inputs .input {
  max-width: 132px;
}

.settings-save-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 24px;
}

.settings-cookie-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.cookie-account {
  color: var(--rose);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.settings-cookie-actions {
  align-items: center;
}

.settings-cookie-action-btn {
  min-width: 116px;
}

.admin-account-card {
  margin-bottom: 18px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
}

.modal-mask[hidden] {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.action-modal-panel {
  width: min(520px, calc(100vw - 28px));
}

.action-modal-body {
  display: grid;
  gap: 12px;
}

.action-modal-text {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.65;
}

.action-modal-detail {
  border: 1px solid #ffe4e6;
  border-radius: 10px;
  background: #fff1f2;
  color: #be123c;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
}

.admin-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: min(420px, calc(100vw - 28px));
  border: 1px solid #bbf7d0;
  border-left: 4px solid #10b981;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
  padding: 13px 14px;
}

.admin-toast[hidden] {
  display: none;
}

.admin-toast-title {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.admin-toast-message {
  margin-top: 5px;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.admin-toast.toast-error {
  border-color: #fecdd3;
  border-left-color: var(--rose);
}

.admin-toast.toast-info {
  border-color: #bfdbfe;
  border-left-color: #60a5fa;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.modal-readonly {
  background: #f8fafc;
  color: #64748b;
}

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

.modal-head .section-title {
  margin: 0;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.modal-actions .btn {
  min-width: 96px;
  height: 40px;
  font-size: 14px;
}

.scope-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
}

.scope-btn {
  height: 38px;
  border: 0;
  border-right: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.scope-btn:last-child {
  border-right: 0;
}

.scope-btn.active {
  background: var(--rose);
  color: #fff;
}

.path-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: #94a3b8;
  font-size: 13px;
}

.path-crumbs button,
.file-link {
  border: 0;
  background: transparent;
  color: var(--rose);
  padding: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.path-crumbs button:hover,
.file-link:hover {
  text-decoration: underline;
}

.muted-link {
  color: #64748b;
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
}

.mini-copy {
  border: 0;
  background: transparent;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 4px;
}

.card {
  background: white;
  border: 0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.14);
}

.page-title {
  margin: 0 0 18px;
  font-size: 24px;
  color: var(--slate-900);
}

.textarea,
.input,
.select {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  background: #f8fafc;
  color: var(--slate-700);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.textarea:focus,
.input:focus,
.select:focus {
  background: white;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

.textarea {
  min-height: 180px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--rose);
  color: white;
}

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

.btn-secondary {
  background: white;
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
}

.btn-secondary:hover {
  border-color: #fecdd3;
  color: var(--rose);
  background: #fff1f2;
}

.btn-danger {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: var(--rose);
  box-shadow: 0 8px 18px rgba(244, 63, 94, 0.08);
}

.btn-danger:hover {
  background: var(--rose);
  border-color: var(--rose);
  color: white;
  box-shadow: 0 10px 22px rgba(244, 63, 94, 0.18);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.status-box {
  margin-top: 18px;
  background: var(--slate-100);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.status-error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.status-success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.14);
  min-height: 100px;
}

.log-panel,
.result-panel {
  margin-top: 18px;
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px;
}

.result-head,
.share-line {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.result-item {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 12px;
}

.result-title {
  color: var(--slate-900);
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 6px;
  word-break: break-all;
}

.stat-label {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.stat-value {
  margin-top: 8px;
  color: #1e293b;
  font-size: 28px;
  font-weight: 900;
}

.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--slate-500) 50%),
    linear-gradient(135deg, var(--slate-500) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f8fafc;
  text-align: left;
}

.table th {
  color: #64748b;
  font-size: 12px;
  background: rgba(248, 250, 252, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
}

.table th[onclick] {
  cursor: pointer;
}

.table td {
  color: #334155;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.record-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 168px;
}

.record-actions .btn {
  width: 100%;
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.record-row td {
  vertical-align: middle;
}

.record-link-cell {
  width: 22%;
  min-width: 150px;
  max-width: 220px;
}

.record-path-cell {
  width: 26%;
  min-width: 180px;
  max-width: 260px;
}

.record-main {
  display: block;
  max-width: 100%;
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-link {
  color: var(--rose);
  text-decoration: none;
}

.record-link:hover {
  text-decoration: underline;
}

.record-sub {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-empty {
  color: #94a3b8;
  font-size: 13px;
}

.record-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.user-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.user-state-active {
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.user-state-disabled {
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -24px -24px;
}

.table-wrap .table {
  min-width: 720px;
}

.table-wrap .user-table {
  min-width: 920px;
  table-layout: fixed;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 72px;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  width: 18%;
}

.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 100px;
}

.user-table th:nth-child(4),
.user-table td:nth-child(4) {
  width: 120px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 110px;
}

.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 250px;
}

.user-table td:nth-child(2),
.user-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap .operation-log-table {
  min-width: 920px;
  table-layout: fixed;
}

.operation-log-table th:nth-child(1),
.operation-log-table td:nth-child(1) {
  width: 170px;
}

.operation-log-table th:nth-child(2),
.operation-log-table td:nth-child(2) {
  width: 110px;
}

.operation-log-table th:nth-child(3),
.operation-log-table td:nth-child(3) {
  width: 130px;
}

.operation-log-table th:nth-child(4),
.operation-log-table td:nth-child(4) {
  width: 120px;
}

.operation-log-table th:nth-child(5),
.operation-log-table td:nth-child(5) {
  width: auto;
}

.operation-log-table td:nth-child(2),
.operation-log-table td:nth-child(3),
.operation-log-table td:nth-child(4),
.operation-log-table .ellipsis-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap .record-table {
  min-width: 920px;
  table-layout: fixed;
}

.record-table th:nth-child(2),
.record-table td:nth-child(2),
.record-table th:nth-child(4),
.record-table td:nth-child(4) {
  width: 18%;
}

.record-table th:nth-child(3),
.record-table td:nth-child(3) {
  width: 16%;
}

.record-table th:nth-child(5),
.record-table td:nth-child(5) {
  width: 96px;
}

.record-table th:nth-child(6),
.record-table td:nth-child(6) {
  width: 132px;
}

.record-table th:nth-child(7),
.record-table td:nth-child(7) {
  width: 184px;
}

.record-batchbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
}

.record-check-col,
.record-check-cell {
  width: 46px !important;
  text-align: center;
}

.record-check,
#checkAllRecords {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

@media (min-width: 641px) and (max-width: 1180px) {
  .table-wrap .user-table,
  .table-wrap .operation-log-table {
    min-width: 860px;
  }

  .user-table th:nth-child(6),
  .user-table td:nth-child(6) {
    width: 230px;
  }

  .operation-log-table th:nth-child(1),
  .operation-log-table td:nth-child(1) {
    width: 158px;
  }

  .operation-log-table th:nth-child(2),
  .operation-log-table td:nth-child(2) {
    width: 96px;
  }

  .operation-log-table th:nth-child(3),
  .operation-log-table td:nth-child(3) {
    width: 116px;
  }

  .operation-log-table th:nth-child(4),
  .operation-log-table td:nth-child(4) {
    width: 104px;
  }

  .table-wrap .record-table {
    min-width: 820px;
  }

  .record-table th:nth-child(5),
  .record-table td:nth-child(5) {
    width: 86px;
  }

  .record-table th:nth-child(6),
  .record-table td:nth-child(6) {
    width: 118px;
  }

  .record-table th:nth-child(7),
  .record-table td:nth-child(7) {
    width: 176px;
  }

  .record-actions {
    min-width: 160px;
  }
}

.file-table-wrap {
  overflow-x: visible;
}

.table-wrap .file-table {
  min-width: 0;
  table-layout: fixed;
}

.file-table th:nth-child(1),
.file-table td:nth-child(1) {
  width: auto;
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) {
  width: 82px;
}

.file-table th:nth-child(3),
.file-table td:nth-child(3) {
  width: 96px;
}

.file-table th:nth-child(4),
.file-table td:nth-child(4) {
  width: 214px;
}

.file-name-cell {
  min-width: 0;
}

.file-name-link,
.file-name-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 800;
}

.file-name-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--rose);
  cursor: pointer;
  text-align: left;
}

.file-name-link:hover {
  text-decoration: underline;
}

.file-path-sub {
  margin-top: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #94a3b8;
  font-size: 12px;
}

.file-type-cell,
.file-size-cell {
  color: #64748b;
  white-space: nowrap;
}

.file-actions-cell {
  text-align: right;
}

.file-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.file-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  background: #fff1f2;
  color: #be123c;
  padding: 12px 14px;
}

.file-guide strong {
  color: #9f1239;
  font-size: 14px;
}

.file-guide span {
  min-width: 0;
  color: #be123c;
  font-size: 13px;
  line-height: 1.5;
}

.file-guide .btn {
  grid-row: 1 / span 2;
  grid-column: 2;
  white-space: nowrap;
}

.file-toolbar {
  align-items: center;
}

.file-toolbar .btn {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .file-table thead {
    display: none;
  }

  .file-table,
  .file-table tbody,
  .file-table tr,
  .file-table td {
    display: block;
    width: 100% !important;
  }

  .file-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
  }

  .file-table td {
    border-bottom: 0;
    padding: 0;
  }

  .file-name-cell {
    min-width: 0;
  }

  .file-type-cell,
  .file-size-cell {
    display: inline-block !important;
    width: auto !important;
    margin-top: 8px;
    margin-right: 12px;
    font-size: 12px;
  }

  .file-actions-cell {
    margin-top: 10px;
    text-align: left;
  }

  .file-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .file-actions .btn-sm {
    flex: 1 1 0;
    min-width: 0;
  }

  .file-guide {
    grid-template-columns: 1fr;
  }

  .file-guide .btn {
    grid-row: auto;
    grid-column: auto;
    width: 100%;
  }
}

.empty-cell {
  text-align: center !important;
  color: var(--slate-500);
  padding: 28px 12px !important;
}

.tool-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc 0%, rgba(255, 241, 242, 0.72) 46%, #f1f5f9 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding: 16px;
}

.tool-wrap {
  width: min(672px, 100%);
  margin: 0 auto;
}

.tool-userbar {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--slate-200);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.18);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.tool-user-left,
.tool-user-line,
.tool-user-actions,
.tool-share-settings,
.tool-label-row,
.tool-text-actions,
.tool-status,
.tool-result-head,
.tool-copy-row {
  display: flex;
  align-items: center;
}

.tool-user-left {
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.tool-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff1f2;
  color: var(--rose);
  font-weight: 800;
  flex: 0 0 auto;
}

.tool-user-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.tool-user-line {
  gap: 8px;
  flex-wrap: nowrap;
}

.tool-username {
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-role {
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1f2;
  color: var(--rose);
  font-size: 11px;
  font-weight: 700;
}

.tool-user-sub {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-pan-name {
  color: var(--rose);
  margin-left: 6px;
}

.tool-user-actions {
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tool-mini-btn {
  border: 1px solid var(--slate-200);
  background: white;
  color: var(--slate-700);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.tool-alert {
  margin-bottom: 14px;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13px;
}

.tool-alert a {
  color: #be123c;
  font-weight: 800;
  margin-left: 8px;
}

.tool-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--slate-200);
  border-radius: 16px;
  box-shadow: 0 22px 48px rgba(148, 163, 184, 0.28);
  overflow: hidden;
}

.tool-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--slate-100);
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff1f2;
  color: var(--rose);
  font-size: 24px;
}

.tool-card h1 {
  margin: 0;
  color: var(--slate-900);
  font-size: 18px;
  line-height: 1.25;
}

.tool-card p {
  margin: 4px 0 0;
}

.tool-card-head p,
.tool-help,
.tool-result-path {
  color: #94a3b8;
  font-size: 12px;
}

.tool-card-body {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.tool-field {
  display: grid;
  gap: 6px;
}

.tool-label-row {
  justify-content: space-between;
  gap: 10px;
}

.tool-label-row label {
  color: var(--slate-700);
  font-size: 14px;
  font-weight: 700;
  flex: 0 0 auto;
}

.tool-root-hint {
  min-width: 0;
  color: var(--slate-500);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-root-hint code {
  color: var(--rose);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin-left: 2px;
}

.tool-input,
.tool-select,
.tool-code-input,
.tool-textarea {
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-700);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tool-input:focus,
.tool-select:focus,
.tool-code-input:focus,
.tool-textarea:focus {
  background: white;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

.tool-input {
  width: 100%;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 14px;
}

.tool-share-settings {
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-share-settings::-webkit-scrollbar {
  display: none;
}

.tool-share-settings span,
.tool-check {
  color: var(--slate-500);
  font-size: 12px;
  line-height: 28px;
}

.tool-select {
  appearance: none;
  flex: 0 0 auto;
  border-radius: 7px;
  padding: 6px 26px 6px 10px;
  font-size: 12px;
  min-width: 78px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--slate-500) 50%),
    linear-gradient(135deg, var(--slate-500) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.tool-code-input {
  flex: 0 0 auto;
  width: 64px;
  border-radius: 7px;
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
}

.tool-code-input:disabled {
  opacity: 0.55;
}

.tool-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.tool-check input {
  accent-color: var(--rose);
}

.tool-text-actions {
  gap: 14px;
}

.tool-text-actions button {
  border: 0;
  background: transparent;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.tool-text-actions button + button {
  color: #94a3b8;
}

.tool-textarea {
  width: 100%;
  min-height: 144px;
  border-radius: 10px;
  resize: none;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.tool-help {
  margin: 0;
}

.tool-status {
  gap: 9px;
  border-radius: 10px;
  background: var(--slate-50);
  padding: 10px 14px;
  color: var(--slate-700);
  font-size: 14px;
}

#statusDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rose);
  flex: 0 0 auto;
}

#statusDot.ok {
  background: #10b981;
}

#statusDot.bad {
  background: var(--rose);
}

#statusText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.45;
}

.tool-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-progress {
  display: grid;
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
}

.tool-progress-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe4e6;
}

.tool-progress-line span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--rose);
  transition: width 0.18s ease;
}

.tool-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.tool-progress-meta button {
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: var(--rose);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tool-progress-meta button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tool-preview {
  display: grid;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
}

.tool-preview-title {
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 900;
}

.tool-preview-list {
  display: grid;
  gap: 6px;
  max-height: 120px;
  overflow: auto;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.tool-preview-list span {
  color: var(--rose);
  font-weight: 800;
}

.tool-main-btn {
  height: 48px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid #fecdd3;
}

.tool-main-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tool-main-primary {
  border-color: var(--rose);
  background: var(--rose);
  color: white;
  box-shadow: 0 8px 18px rgba(244, 63, 94, 0.2);
}

.tool-main-secondary {
  background: white;
  color: var(--rose);
}

.tool-result {
  display: grid;
  gap: 10px;
}

.tool-result-head {
  justify-content: space-between;
  gap: 10px;
  color: var(--slate-900);
  font-size: 14px;
}

.tool-result-head button,
.tool-copy-row button {
  border: 0;
  border-radius: 7px;
  background: #10b981;
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  cursor: pointer;
}

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

.tool-result-item {
  border: 1px solid #bbf7d0;
  background: rgba(236, 253, 245, 0.72);
  border-radius: 10px;
  padding: 10px;
}

.tool-result-title {
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 800;
  word-break: break-all;
}

.tool-copy-row {
  gap: 8px;
  margin-top: 8px;
}

.tool-copy-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--slate-700);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tool-foot {
  margin: 14px 0 0;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

.tool-toast {
  position: fixed;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  bottom: auto;
  transform: translateX(-50%);
  z-index: 120;
  border-radius: 10px;
  background: #1e293b;
  color: white;
  padding: 9px 14px;
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}

.tool-task-mask {
  position: fixed;
  inset: 0;
  z-index: 68;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tool-task-mask[hidden] {
  display: none;
}

.tool-task-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.tool-task-panel {
  position: relative;
  width: min(600px, calc(100vw - 24px));
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.tool-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex: 0 0 auto;
}

.tool-task-head h2 {
  margin: 0;
  color: var(--slate-900);
  font-size: 17px;
  font-weight: 900;
}

.tool-task-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
}

.tool-task-progress {
  display: grid;
  gap: 9px;
  padding: 12px 20px;
  border-bottom: 1px solid #f8fafc;
  background: #fff;
  flex: 0 0 auto;
}

.tool-task-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.record-status-failed {
  background: #fff1f2;
  color: #be123c;
}

.record-status-success {
  background: #ecfdf5;
  color: #047857;
}

.record-status-running {
  background: #eff6ff;
  color: #2563eb;
}

.tool-task-status span:last-child {
  min-width: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-task-list {
  display: grid;
  gap: 10px;
  padding: 12px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  background: #f8fafc;
}

.tool-task-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.tool-task-index {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.tool-task-main {
  min-width: 0;
}

.tool-task-url {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-task-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.35;
  flex-wrap: wrap;
}

.tool-task-meta span:not(.tool-task-badge) {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-task-badge {
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  padding: 3px 8px;
  font-weight: 900;
}

.tool-task-btn {
  border: 0;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.tool-task-copy,
.tool-task-done {
  background: #10b981;
  color: #fff;
}

.tool-task-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.tool-task-link-row a {
  min-width: 0;
  color: #059669;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-task-link-row button {
  min-width: 46px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: #10b981;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 0 9px;
  cursor: pointer;
}

.tool-task-stop {
  background: #fff1f2;
  color: var(--rose);
  border: 1px solid #fecdd3;
}

.tool-task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  background: rgba(255, 255, 255, 0.96);
  flex: 0 0 auto;
}

.tool-task-actions .tool-task-stop {
  grid-column: 1 / -1;
}

.tool-task-actions.is-done .tool-task-stop {
  display: none;
}

.tool-task-actions.is-done .tool-task-done {
  grid-column: auto;
}

.tool-task-actions.is-done .tool-task-copy[hidden] + .tool-task-stop + .tool-task-done {
  grid-column: 1 / -1;
}

.tool-task-running {
  border-color: #fecdd3;
  background: #fff1f2;
}

.tool-task-running .tool-task-index,
.tool-task-running .tool-task-badge {
  background: #ffe4e6;
  color: var(--rose);
}

.tool-task-success {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.tool-task-success .tool-task-index,
.tool-task-success .tool-task-badge {
  background: #d1fae5;
  color: #047857;
}

.tool-task-failed {
  border-color: #fecdd3;
  background: #fff1f2;
}

.tool-task-failed .tool-task-index,
.tool-task-failed .tool-task-badge,
.tool-task-error {
  color: #be123c;
}

.tool-dup-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tool-dup-mask[hidden] {
  display: none;
}

.tool-dup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.tool-dup-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.tool-dup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex: 0 0 auto;
}

.tool-dup-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tool-dup-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #fffbeb;
  color: #f59e0b;
  font-weight: 900;
}

.tool-dup-title h2 {
  margin: 0;
  color: var(--slate-900);
  font-size: 17px;
  font-weight: 900;
}

.tool-dup-title p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.tool-dup-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.tool-dup-close:hover {
  background: #f8fafc;
  color: #475569;
}

.tool-dup-list {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.tool-dup-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
}

.tool-dup-source {
  margin-bottom: 10px;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  word-break: break-all;
}

.tool-dup-records {
  display: grid;
  gap: 8px;
}

.tool-dup-record {
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.tool-dup-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  color: #64748b;
  font-size: 12px;
}

.tool-dup-row + .tool-dup-row {
  margin-top: 6px;
}

.tool-dup-row span {
  color: #94a3b8;
  white-space: nowrap;
}

.tool-dup-row code {
  min-width: 0;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  word-break: break-all;
}

.tool-dup-row .tool-dup-share {
  color: #059669;
}

.tool-dup-row button {
  border: 0;
  border-radius: 7px;
  background: #10b981;
  color: #fff;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.tool-dup-empty {
  color: #94a3b8;
  font-size: 12px;
}

.tool-dup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  background: rgba(248, 250, 252, 0.72);
  flex: 0 0 auto;
}

.tool-dup-btn {
  min-width: 96px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.tool-dup-cancel {
  background: transparent;
  color: #64748b;
}

.tool-dup-cancel:hover {
  background: #f1f5f9;
}

.tool-dup-ok {
  background: var(--rose);
  color: #fff;
  box-shadow: 0 8px 18px rgba(244, 63, 94, 0.18);
}

.tool-dup-ok:hover {
  background: var(--rose-dark);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.muted {
  color: var(--slate-500);
  font-size: 13px;
}

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

.records-searchbar {
  max-width: 460px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
  margin-top: 0;
  margin-bottom: 10px;
}

.records-searchbar .input {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
}

.records-searchbar .btn {
  flex: 0 0 auto;
  min-width: 76px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff1f2;
  color: var(--rose);
  font-size: 12px;
  font-weight: 700;
}

/* 中等宽度下侧栏仍显示，仪表盘首屏需要更紧凑，避免三张概况卡被挤压变形。 */
@media (min-width: 821px) and (max-width: 1280px) {
  .admin-hero {
    grid-template-columns: minmax(150px, 0.78fr) minmax(0, 2.35fr);
    gap: 18px;
    padding: 22px;
  }

  .admin-hero h2 {
    margin-bottom: 6px;
    font-size: 22px;
    line-height: 1.18;
  }

  .admin-hero p {
    max-width: 260px;
    font-size: 13px;
    line-height: 1.45;
    white-space: normal;
  }

  .admin-hero-cards {
    gap: 12px;
  }

  .admin-hero-card {
    min-height: 100px;
    border-radius: 13px;
    padding: 16px 14px;
  }

  .admin-hero-card div {
    font-size: 18px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .admin-hero-card span {
    display: none;
  }

  .admin-hero-card strong {
    margin-top: 12px;
    font-size: 28px;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--slate-200);
    padding: 0 14px 12px;
  }

  .admin-brand {
    height: 62px;
  }

  .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 0 12px;
  }

  .nav-link {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 13px;
  }

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

  .front-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .front-main,
  .main {
    padding: 18px;
  }

  .admin-header {
    height: auto;
    position: static;
    padding: 0 0 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-title-group {
    flex-wrap: wrap;
  }

  .admin-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .admin-hero-cards {
    grid-template-columns: 1fr;
  }

  .topbar,
  .result-head,
  .share-line {
    align-items: stretch;
    flex-direction: column;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* 后台移动端适配: 侧栏改抽屉, 表格改信息卡片。 */
.mobile-menu-button,
.mobile-menu-overlay {
  display: none;
}

.ellipsis-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ellipsis-cell a {
  color: var(--rose);
  text-decoration: none;
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 60;
    border-right: 1px solid #f1f5f9;
    border-bottom: 0;
    padding: 0 14px max(16px, env(safe-area-inset-bottom));
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(15, 23, 42, 0.42);
  }

  .mobile-menu-overlay[hidden] {
    display: none !important;
  }

  .mobile-menu-button {
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #475569;
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    flex: 0 0 auto;
  }

  .admin-brand {
    height: 68px;
    justify-content: space-between;
  }

  .sidebar-close {
    width: 34px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    display: inline-grid;
    place-items: center;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .admin-nav,
  .sidebar-bottom {
    display: block;
  }

  .nav-link {
    min-height: 44px;
    margin-bottom: 4px;
    padding: 12px 14px;
    font-size: 14px;
  }

  .main {
    padding: 0 14px 28px;
  }

  .admin-header {
    position: sticky;
    top: 0;
    min-height: 64px;
    padding: 12px 0;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    z-index: 20;
  }

  .admin-title-group {
    flex: 1;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .admin-title {
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-edition {
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
  }

  .admin-breadcrumb {
    display: none;
  }

  .admin-actions {
    gap: 8px;
  }

  .admin-front-link {
    font-size: 13px;
  }

  .admin-profile {
    width: 32px;
    height: 32px;
  }

  .front-header,
  .topbar,
  .result-head,
  .share-line {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .toolbar {
    width: 100%;
    gap: 8px;
  }

  .toolbar .input,
  .toolbar .select {
    max-width: none !important;
    flex: 1 1 100%;
  }

  .toolbar .btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 42px;
  }

  .records-topbar {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 4px;
  }

  .records-topbar .page-title {
    margin-bottom: 0;
    font-size: 18px;
    line-height: 1.25;
  }

  .records-card {
    padding-top: 12px;
  }

  .records-searchbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    width: 100%;
    max-width: none;
    margin: 0 0 8px;
    align-items: center;
  }

  .records-searchbar .input {
    max-width: none !important;
    width: 100%;
  }

  .records-searchbar .btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
  }

  .file-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .file-toolbar .scope-toggle,
  .file-toolbar .input {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none !important;
  }

  .file-toolbar .btn {
    min-width: 0;
    min-height: 40px;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 13px;
  }

  .admin-hero {
    gap: 16px;
    border-radius: 12px;
    padding: 18px;
  }

  .admin-hero h2 {
    font-size: 20px;
  }

  .admin-hero-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .admin-hero-card {
    min-height: 82px;
    padding: 14px 12px;
  }

  .admin-hero-card span {
    display: none;
  }

  .admin-hero-card div {
    font-size: 17px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .admin-hero-card strong {
    margin-top: 10px;
    font-size: 24px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-card {
    min-height: 84px;
    padding: 14px;
  }

  .card {
    border-radius: 12px;
    padding: 16px;
  }

  .settings-card {
    margin-bottom: 16px;
    padding: 18px;
  }

  .settings-title {
    padding-right: 0;
  }

  .admin-mini-link {
    position: static;
    width: fit-content;
    margin-top: 10px;
  }

  .settings-cookie-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .inline-inputs {
    width: 100%;
  }

  .inline-inputs .input {
    max-width: none;
  }

  .settings-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-save-row .btn {
    min-height: 44px;
  }

  .share-random-row {
    min-height: 43px;
    align-items: center;
    gap: 10px;
  }

  .modal-mask {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    border-radius: 14px;
    padding: 18px;
  }

  .modal-actions {
    flex-direction: row;
  }

  .modal-actions .btn {
    flex: 1 1 0;
  }

  .file-modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #actionModal .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .file-modal-actions .btn,
  #actionModal .modal-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .admin-toast {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
  }

  .tool-dup-mask {
    align-items: flex-end;
    padding: 10px;
  }

  .tool-task-mask {
    align-items: center;
    padding: 12px;
  }

  .tool-task-panel {
    width: calc(100vw - 24px);
    max-height: calc(92dvh - 24px);
    border-radius: 16px;
  }

  .tool-task-head,
  .tool-task-progress,
  .tool-task-list,
  .tool-task-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .tool-task-item {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
  }

  .tool-task-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-task-btn {
    width: 100%;
    min-height: 42px;
  }

  .tool-dup-panel {
    max-height: calc(100dvh - 20px);
    border-radius: 16px;
  }

  .tool-dup-head,
  .tool-dup-list,
  .tool-dup-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .tool-dup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-dup-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page-title {
    margin-bottom: 12px;
    font-size: 20px;
  }

  .section-title,
  .settings-card-title {
    font-size: 16px;
  }

  .table-wrap,
  .file-table-wrap {
    overflow: visible;
    margin: 0 -16px -16px;
  }

  .table-wrap .table,
  .table-wrap .record-table,
  .table-wrap .file-table {
    min-width: 0;
  }

  .table thead,
  .file-table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100% !important;
  }

  .table tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #f8fafc;
  }

  .table tr {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  }

  .table td {
    min-height: 40px;
    padding: 10px 12px !important;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
  }

  .table td:last-child {
    border-bottom: 0;
  }

  .table td[data-label] {
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .table td[data-label]::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.7;
  }

  .table td[data-label=""] {
    display: block !important;
  }

  .table td[data-label=""]::before,
  .table td[colspan]::before {
    content: none;
  }

  .table td[colspan] {
    display: block !important;
    text-align: center;
    border-bottom: 0;
  }

  .record-batchbar {
    align-items: center;
    flex-direction: row;
    gap: 6px;
    padding-bottom: 8px;
  }

  .record-batchbar .muted {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .record-batchbar .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
  }

  .record-batchbar .btn {
    min-height: 34px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .record-check-cell {
    min-height: 34px !important;
    padding-bottom: 6px !important;
  }

  .record-check-cell[data-label] {
    grid-template-columns: 76px auto !important;
    align-items: center;
  }

  .record-main,
  .ellipsis-cell,
  .file-name-link,
  .file-name-text {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .file-path-sub {
    grid-column: 2;
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
  }

  .ellipsis-cell {
    overflow: visible;
  }

  .record-link-cell,
  .record-path-cell {
    min-width: 0;
    max-width: none;
  }

  .table-actions,
  .file-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .table-actions .btn,
  .file-actions .btn {
    width: 100%;
    min-height: 38px;
  }

  .file-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .file-actions .btn {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    white-space: nowrap;
  }

  .file-type-cell,
  .file-size-cell {
    margin: 0;
    font-size: 13px;
  }

  .file-actions-cell {
    margin-top: 0;
  }

  .path-crumbs {
    max-height: 74px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    background: #f8fafc;
  }

  .scope-toggle {
    width: 100%;
  }

  .scope-btn {
    flex: 1 1 0;
  }

  .pager {
    justify-content: space-between;
  }

  .pager .btn {
    min-width: 82px;
  }

  .tool-dup-row {
    grid-template-columns: 1fr auto;
  }

  .tool-dup-row span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .tool-userbar {
    gap: 8px;
    padding: 10px;
  }

  .tool-user-left {
    gap: 8px;
  }

  .tool-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .tool-user-line {
    gap: 5px;
  }

  .tool-username {
    max-width: 78px;
    font-size: 13px;
  }

  .tool-role {
    padding: 2px 6px;
    font-size: 10px;
  }

  .tool-user-sub {
    max-width: 145px;
    font-size: 10px;
  }

  .tool-user-actions {
    gap: 5px;
  }

  .tool-mini-btn {
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 8px;
  }

  .tool-share-settings {
    gap: 5px;
    margin-right: -2px;
    padding-bottom: 1px;
  }

  .tool-share-settings span,
  .tool-check {
    font-size: 11px;
  }

  .tool-select {
    min-width: 60px;
    padding: 5px 18px 5px 7px;
    font-size: 11px;
    background-position:
      calc(100% - 10px) 50%,
      calc(100% - 6px) 50%;
    background-size: 4px 4px, 4px 4px;
  }

  .tool-code-input {
    width: 48px;
    padding: 5px 5px;
    font-size: 11px;
  }

  .tool-check {
    gap: 3px;
  }

  .tool-check input {
    width: 13px;
    height: 13px;
    margin: 0;
  }

  .admin-hero-cards,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .toolbar .btn {
    flex-basis: 100%;
  }

  .records-searchbar .btn {
    flex-basis: auto;
  }

  .share-random-row {
    min-height: 42px;
    font-size: 12px;
  }

  .table-actions,
  .file-actions {
    grid-template-columns: 1fr;
  }

  .file-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .file-toolbar .btn {
    min-height: 38px;
    padding-left: 4px;
    padding-right: 4px;
    font-size: 12px;
  }

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

  .file-actions .btn {
    min-height: 36px;
    padding-left: 4px;
    padding-right: 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .file-modal-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #actionModal .modal-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  #actionModal .modal-actions .btn {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  /* 转存分享列表在窄屏下也保持三个操作按钮同一行，避免每条记录被按钮拉得过高。 */
  .table td.record-actions[data-label=""],
  .record-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* 仪表盘移动端紧凑布局：统计信息横向展示，减少首屏占用。 */
@media (max-width: 640px) {
  .admin-hero {
    display: grid;
    gap: 12px;
    padding: 14px;
    margin-bottom: 16px;
  }

  .admin-hero h2 {
    margin-bottom: 4px;
    font-size: 18px;
  }

  .admin-hero p,
  .admin-hero-card span {
    display: none;
  }

  .admin-hero-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .admin-hero-card {
    min-height: 68px;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
  }

  .admin-hero-card div {
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
  }

  .admin-hero-card strong {
    margin-top: 8px;
    font-size: 22px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
    margin-bottom: 16px;
  }

  .stat-card {
    min-height: 64px;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-value {
    margin-top: 0;
    font-size: 22px;
  }

  .record-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100%;
    gap: 8px;
  }

  .table td.record-actions[data-label=""] {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .record-actions .btn {
    width: 100%;
    min-height: 36px;
    padding-left: 6px;
    padding-right: 6px;
  }
}
