:root {
  color-scheme: dark;
  --bg: #11161d;
  --panel: #18212d;
  --panel-2: #1c2430;
  --panel-3: #0e141c;
  --line: #2a3f57;
  --text: #e7f2ff;
  --muted: #a5b7cb;
  --green: #4fb071;
  --green-2: #6aca88;
  --blue: #3a74c9;
  --blue-2: #598ee0;
  --red: #8a3d47;
  --red-2: #b95c6a;
  --purple: #6a5acd;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #121820 0%, #0e1319 100%);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}

body {
  padding: 18px 20px 16px;
}

button,
input,
a {
  font: inherit;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 34px);
}

.top-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-link,
.link-btn,
.upload-btn,
.danger-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  color: #f3f8ff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-link:hover,
.link-btn:hover,
.upload-btn:hover,
.danger-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-primary {
  min-height: 46px;
  min-width: 220px;
  padding: 0 18px;
  border-color: #7aa5f0;
  background: linear-gradient(180deg, #4679cf 0%, #2f62b4 100%);
  box-shadow: var(--shadow);
}

.btn-secondary {
  min-height: 40px;
  padding: 0 14px;
  border-color: #4f739f;
  background: linear-gradient(180deg, #2f465e 0%, #24364b 100%);
}

.btn-link {
  min-height: 46px;
  padding: 12px 16px;
  border-color: #3c5b80;
  background: linear-gradient(180deg, #23364b 0%, #182637 100%);
}

.hint {
  color: #88a8c9;
  font-size: 13px;
  padding: 0 8px;
}

.card {
  background: linear-gradient(180deg, rgba(25, 35, 48, 0.98) 0%, rgba(18, 26, 36, 0.98) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 14px 16px;
}

.auth-panel-head,
.panel-head,
.pager,
.auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-panel-head {
  margin-bottom: 12px;
}

.auth-title,
.panel-title,
.card-title {
  color: #d7e8fb;
  font-weight: 700;
}

.auth-title {
  font-size: 15px;
}

.runtime-status {
  font-size: 12px;
  color: #9fb9d4;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-block span,
.filter-label,
.stat-label {
  font-size: 12px;
  color: #a9bed4;
}

.field-block input,
.field-input {
  height: 36px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid #27405c;
  background: #0f1822;
  color: #dfeeff;
  padding: 0 10px;
}

.auth-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 62px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #24415f;
  background: linear-gradient(180deg, #101a25 0%, #0f1821 100%);
}

.auth-summary-main {
  color: #f0f7ff;
  font-size: 14px;
  font-weight: 700;
}

.auth-summary-sub {
  color: #93abca;
  font-size: 12px;
  line-height: 1.55;
}

.auth-panel.logged-in .auth-summary {
  border-color: #2e6a4b;
  background: linear-gradient(180deg, #13241b 0%, #101d16 100%);
}

.quota-meta,
.identity-meta {
  display: flex;
  gap: 20px;
  padding: 0 8px;
  flex-wrap: wrap;
}

.quota-meta {
  color: #dbe7f5;
  font-size: 14px;
  font-weight: 600;
}

.identity-meta {
  color: #9fb8d3;
  font-size: 13px;
}

.body {
  flex: 1;
  display: grid;
  grid-template-columns: 332px 1fr;
  gap: 14px;
  min-height: 0;
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-card {
  padding: 14px;
  min-height: 112px;
}

.metric-card {
  padding: 12px 14px;
  min-height: 118px;
}

.metric-card.free {
  border-color: #2f7054;
}

.metric-card.paid {
  border-color: #5740aa;
}

.card-title {
  font-size: 13px;
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #f4f9ff;
  white-space: nowrap;
}

.progress {
  height: 16px;
  border: 1px solid #35506c;
  border-radius: 999px;
  overflow: hidden;
  background: #0d1520;
  position: relative;
}

.progress > span {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #4aa86d 0%, #6bd48e 100%);
}

.progress-text {
  margin-top: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #eff6ff;
}

.big-spacer {
  flex: 1;
  min-height: 280px;
  padding: 12px;
  background: radial-gradient(circle at 20% 20%, rgba(20, 47, 90, 0.35), rgba(4, 10, 18, 0.96));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.info-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  line-height: 1.5;
  font-size: 12px;
}

.danger-btn {
  align-self: flex-start;
  min-height: 30px;
  padding: 0 12px;
  border-color: #915961;
  background: linear-gradient(180deg, #653339 0%, #51282d 100%);
  color: #ffd8de;
}

.right-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
}

.panel-title {
  font-size: 15px;
}

.spacer {
  flex: 1;
}

.upload-btn {
  min-height: 40px;
  min-width: 170px;
  padding: 10px 16px;
  border-color: #58a477;
  background: linear-gradient(180deg, #4cae71 0%, #398858 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-btn.disabled,
.upload-btn:disabled,
.btn-secondary:disabled,
.link-btn:disabled,
.danger-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.filters {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.filters .field-input {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.link-btn {
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid #27405c;
  background: #0f1822;
  color: #dfeeff;
  padding: 0 9px;
  font-size: 12px;
}

.keyword-input {
  width: 240px;
  max-width: 240px;
}

.field-block span,
.stat-label {
  font-size: 11px;
}

.link-btn {
  background: #162232;
  color: #bdd7f1;
}

.link-btn.subtle {
  min-width: 56px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.danger-soft {
  border-color: #6a3941;
  color: #ffcdd5;
  background: #352028;
}

.message-bar {
  min-height: 36px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #29405a;
  background: #111c27;
  color: #d3e6fb;
  font-size: 13px;
  line-height: 1.4;
}

.message-bar.error {
  border-color: #6a3941;
  background: #28161b;
  color: #ffd0d7;
}

.message-bar.success {
  border-color: #37684a;
  background: #15251c;
  color: #d5ffe2;
}

.table-wrap {
  flex: 1;
  min-height: 420px;
  border: 1px solid #27384a;
  border-radius: 12px;
  background: linear-gradient(180deg, #1b2330 0%, #171d27 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  height: 42px;
  padding: 0 8px;
  font-size: 12px;
  color: #d2e0ee;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid #2b3b4b;
  font-weight: 700;
}

tbody td {
  height: 46px;
  padding: 0 8px;
  font-size: 12px;
  color: #99aec4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: center;
}

tbody tr.empty td {
  height: 360px;
  color: #647a91;
  vertical-align: top;
  padding-top: 26px;
  background: linear-gradient(180deg, rgba(8, 14, 22, 0.16), rgba(8, 14, 22, 0.02));
}

.table-wrap thead th:first-child,
.table-wrap tbody td:first-child {
  font-size: 14px;
  font-weight: 700;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 4px;
}

.table-actions button,
.table-actions a {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #35506c;
  background: #132131;
  color: #dbeeff;
  text-decoration: none;
  cursor: pointer;
}

.table-actions .open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  position: relative;
}

.table-actions .open-link::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.2 4.2h-2A2.2 2.2 0 0 0 2 6.4v5.4A2.2 2.2 0 0 0 4.2 14h5.4a2.2 2.2 0 0 0 2.2-2.2v-2' fill='none' stroke='%23dbeeff' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M8.3 2H14v5.7' fill='none' stroke='%23dbeeff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 2L7.1 8.9' fill='none' stroke='%23dbeeff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sync-btn::before,
.upload-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

.sync-btn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M13.6 8a5.6 5.6 0 1 1-1.3-3.6' fill='none' stroke='%23eff6ff' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M10.7 1.8h2.9v2.9' fill='none' stroke='%23eff6ff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.upload-btn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.8V3.4' fill='none' stroke='%23eff6ff' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M5 6.3L8 3.3l3 3' fill='none' stroke='%23eff6ff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M3 12.7h10' fill='none' stroke='%23eff6ff' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.table-actions .delete {
  border-color: #73424a;
  background: #2a181d;
  color: #ffd4db;
}

.pager {
  margin-top: 8px;
  justify-content: flex-end;
  gap: 6px;
}

.pager-info {
  font-size: 12px;
  font-weight: 700;
  color: #dbe8f5;
}

.pager-btn {
  font-size: 12px;
}

.pager-danger {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  align-self: auto;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1360px) {
  .filters {
    justify-content: flex-end;
  }
}

@media (max-width: 1100px) {
  .body {
    grid-template-columns: 1fr;
  }

  .filters {
    justify-content: flex-start;
  }

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

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  .filters {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
