/* ============================================================
   起点云平台 · 公共样式（所有应用页共用）
   各应用自己的样式放 css/<app>.css，新应用只需引用本文件
   ============================================================ */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e5e9f0;
  --line-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ---------- 登录卡片（门户弹窗 / 独立登录页共用） ---------- */

.auth-view {
  position: relative;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 12% -10%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%),
    radial-gradient(700px 420px at 100% 0%, #e0e7ff 0%, rgba(224, 231, 255, 0) 55%),
    linear-gradient(180deg, #f7faff 0%, #eef3fb 100%);
}

.auth-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0) 70%);
  bottom: -140px;
  right: -80px;
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.logo-mark .icon {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.auth-sub {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.18s ease;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.auth-tip {
  margin: 18px 0 0;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

/* ---------- 表单与按钮 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field > span {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input:focus,
.field select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-error {
  margin: -4px 0 14px;
  color: var(--danger);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: #d5dbe6;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-block {
  width: 100%;
  height: 42px;
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- 应用页框架（顶栏 + 内容区） ---------- */

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text);
  text-decoration: none;
}

.brand-home {
  cursor: pointer;
  user-select: none;
}

.brand-sub {
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.quota-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.quota-track {
  width: 110px;
  height: 6px;
  border-radius: 99px;
  background: #e8edf5;
  overflow: hidden;
}

.quota-track > div {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.35s ease;
}

.quota-track.warn > div {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
}

.quota-track.danger > div {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 26px 40px;
  position: relative;
}

/* ---------- 通用表格 / 面板 ---------- */

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

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.file-table th {
  height: 42px;
  padding: 0 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.file-table td {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--text);
}

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

.file-table tbody tr:hover {
  background: #f9fbff;
}

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

.file-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.file-thumb.dir {
  background: #fff7ed;
  color: #d97706;
}

.file-thumb .icon {
  width: 19px;
  height: 19px;
}

.file-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name.link {
  cursor: pointer;
}

.file-name.link:hover {
  color: var(--primary);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.72;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.row-action:hover {
  background: var(--primary-soft);
  color: var(--primary);
  opacity: 1;
}

.row-action.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.row-action .icon {
  width: 17px;
  height: 17px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

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

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 72px 20px;
  color: var(--muted);
  font-size: 13px;
}

.empty p {
  margin: 0;
}

.empty-icon {
  width: 42px;
  height: 42px;
  color: #cbd5e1;
  stroke-width: 1.4;
}

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  animation: fade-in 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 430px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.18s ease;
  overflow: hidden;
}

.modal-wide {
  max-width: 480px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 4px 20px 8px;
  overflow: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line-soft);
  margin-top: 8px;
}

.confirm-text {
  margin: 6px 0 12px;
  color: var(--muted);
  line-height: 1.8;
}

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

.copy-row input {
  flex: 1;
  min-width: 0;
}

.copy-row .btn {
  flex: none;
}

/* ---------- 提示 ---------- */

.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: 9px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
  max-width: 80vw;
}

.toast.error {
  background: #b91c1c;
}

.toast.success {
  background: #047857;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
  }

  .quota-mini {
    display: none;
  }

  .app-content {
    padding: 14px 14px 32px;
  }

  .file-table td,
  .file-table th {
    padding: 0 10px;
  }

  .row-action {
    width: 28px;
  }
}
