/* ===========================================================
   合益资产 · 公告管理后台
   =========================================================== */

:root {
  --red: #d8232a;
  --red-dark: #b81b21;
  --ink: #1c1f23;
  --ink-2: #47505a;
  --ink-3: #8a929c;
  --line: #e5e8ec;
  --soft: #f6f7f9;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--red);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.topbar-brand img {
  height: 34px;
  width: auto;
  display: block;
}

.topbar-brand span {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

.topnav a {
  color: var(--ink-2);
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
}

.topnav-form {
  display: inline;
  margin: 0;
}

.topnav-form button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.topnav-form button:hover {
  color: var(--red);
}

/* ---------- 主体 ---------- */

.admin-main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.page-desc {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  border-color: #ccd2da;
  background: var(--soft);
  color: var(--ink);
}

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

.btn-primary:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
  color: #fff;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.btn-danger {
  border-color: #f0d5d6;
  color: #b81b21;
}

.btn-danger:hover {
  border-color: #e8b9bb;
  background: #fdf3f3;
  color: #b81b21;
}

.btn-block {
  width: 100%;
}

/* ---------- 表格 ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
}

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

.table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: #fcfcfd;
}

.cell-title {
  line-height: 1.55;
}

.col-date {
  width: 112px;
}

.col-file {
  width: 72px;
}

.col-size {
  width: 92px;
}

.col-actions {
  width: 172px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nowrap {
  white-space: nowrap;
}

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

.inline {
  display: inline;
  margin: 0;
}

/* ---------- 表单 ---------- */

.form-card {
  max-width: 720px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form-narrow {
  max-width: 460px;
}

.field {
  display: block;
  margin-bottom: 20px;
}

.field > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 14px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="date"],
.field input[type="file"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.field input[type="file"] {
  padding: 7px 10px;
  background: var(--soft);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.field input.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field input:focus {
  outline: none;
  border-color: #c3cad3;
  box-shadow: 0 0 0 3px rgba(216, 35, 42, 0.08);
}

.hint {
  display: block;
  margin-top: 7px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

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

.alert {
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
}

.alert-ok {
  border-color: #d6ecd9;
  background: #f2f9f3;
  color: #1f6b33;
}

.alert-error {
  border-color: #f2d6d7;
  background: #fdf3f3;
  color: #a52026;
}

.alert-info {
  border-color: #dde6f0;
  background: #f4f7fb;
  color: #365b86;
}

.blank {
  padding: 56px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}

/* ---------- 登录页 ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--soft);
}

.login-wrap {
  width: 100%;
  max-width: 380px;
}

.login-card {
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(20, 25, 33, 0.06);
}

.login-logo {
  display: block;
  height: 46px;
  width: auto;
  margin: 0 auto 18px;
}

.login-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.login-sub {
  margin: 0 0 20px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-foot {
  margin: 18px 0 0;
  font-size: 13px;
  text-align: center;
}

.login-foot a {
  color: var(--ink-3);
  text-decoration: none;
}

.login-foot a:hover {
  color: var(--ink-2);
}

/* ---------- 页脚 ---------- */

.admin-foot {
  padding: 20px;
  color: #a2a9b3;
  font-size: 12px;
  text-align: center;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 720px) {
  .topbar-inner {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
  }

  .topbar-brand span {
    display: none;
  }

  .topnav {
    gap: 14px;
    font-size: 13px;
  }

  .admin-main {
    padding: 20px 16px 32px;
  }

  .page-head {
    align-items: flex-start;
  }

  .form-card {
    padding: 18px;
  }

  /* 避免 iOS 聚焦输入框时自动放大页面 */
  .field input[type="text"],
  .field input[type="password"],
  .field input[type="date"],
  .login-form input {
    font-size: 16px;
  }
}
