* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #f3f5f7;
  color: #222;
}

a {
  color: #1677ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 顶部栏 */
.topbar {
  min-height: 64px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #ddd;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

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

/* 页面主体 */
main {
  padding: 22px;
}

/* 通用卡片 */
.card {
  margin-bottom: 20px;
  padding: 20px;

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

/* 表单区域 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-grid label {
  font-weight: 600;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

/* 输入控件 */
input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px;

  border: 1px solid #c8ced6;
  border-radius: 5px;

  font: inherit;
  color: #222;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}

textarea {
  resize: vertical;
}

/* 通用按钮 */
button {
  padding: 10px 18px;

  border: 0;
  border-radius: 5px;

  background: #1677ff;
  color: #fff;

  cursor: pointer;
  font: inherit;
}

button:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: #6c757d;
}

button.success {
  background: #178a3d;
}

button.warning {
  background: #d58512;
}

button.danger {
  background: #c0392b;
}

/* 快捷期限按钮 */
.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;

  margin: 18px 0;
}

/* 激活码显示区域 */
.code-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.code-row textarea {
  width: 50%;
  min-height: 100px;
  resize: vertical;
}

.code-row button {
  width: 150px;
  flex: 0 0 150px;
}

/* 状态提示 */
.message {
  min-height: 24px;
  margin-top: 10px;

  color: #067d21;
}

/* 授权记录标题、导出按钮、搜索栏 */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  margin-bottom: 12px;
}

.table-toolbar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-toolbar input {
  width: 360px;
  min-width: 360px;
  height: 40px;
  margin: 0;
}

.table-toolbar button {
  min-width: 64px;
  white-space: nowrap;
}

/* 标题区域 */
.record-title-area {
  min-width: 360px;
}

.record-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.record-title-row h2 {
  margin: 0;
}

.record-title-row button {
  white-space: nowrap;
}

.list-hint {
  margin-top: 5px;

  color: #6b7280;
  font-size: 13px;
}

/* 表格容器 */
.table-wrap {
  overflow-x: auto;
}

/* 表格 */
table {
  width: 100%;
  min-width: 1800px;

  border-collapse: collapse;
}

.audit-table {
  min-width: 1000px;
}

th,
td {
  padding: 8px;

  border: 1px solid #ddd;

  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f6f7f8;
  white-space: nowrap;
}

/* 激活码列 */
.code-cell {
  min-width: 360px;
  max-width: 500px;

  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* 备注列，第9列 */
table th:nth-child(9),
table td:nth-child(9) {
  width: 400px;
  min-width: 400px;
  max-width: 600px;

  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 操作列 */
.actions {
  min-width: 460px;

  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.actions button {
  min-width: 62px;
  min-height: 36px;
  padding: 8px 14px;

  border-radius: 6px;

  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* 备注输入框 */
.notes-input {
  min-height: 120px;

  line-height: 1.6;
  resize: vertical;
}

.notes-input::placeholder {
  color: #9aa1aa;
}

/* 空数据提示 */
.empty-row {
  padding: 28px !important;

  color: #777;
  text-align: center;
}

/* 登录页 */
.login-page {
  min-height: 100vh;

  display: grid;
  place-items: center;
}

.login-card {
  width: 360px;
  padding: 28px;

  background: #fff;
  border-radius: 10px;

  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.login-card h1 {
  margin: 0;
}

.login-card p {
  color: #666;
}

.login-card button {
  width: 100%;
  margin-top: 12px;
}

.error {
  min-height: 24px;
  margin-top: 10px;

  color: #c00;
}

/* 小屏适配 */
@media (max-width: 800px) {
  main {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .form-grid .wide {
    grid-column: auto;
  }

  .code-row {
    flex-direction: column;
  }

  .code-row textarea {
    width: 100%;
  }

  .code-row button {
    width: 100%;
    flex-basis: auto;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar > div {
    width: 100%;
    flex-wrap: wrap;
  }

  .table-toolbar input {
    width: 100%;
    min-width: 0;
  }

  .record-title-area {
    min-width: 0;
  }

  .record-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    min-width: 360px;
  }

  .login-card {
    width: calc(100% - 24px);
  }
}

/* 授权记录分页：默认位于右下角 */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.pagination-summary {
  color: #5f6670;
  font-size: 13px;
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5f6670;
  font-size: 13px;
  white-space: nowrap;
}

.pagination-controls select {
  width: auto;
  min-width: 78px;
  margin: 0;
  padding: 8px;
}

.pagination-controls button {
  min-width: 64px;
  padding: 8px 12px;
  white-space: nowrap;
}

.pagination-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 800px) {
  .pagination-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-summary,
  .pagination-controls {
    justify-content: flex-end;
  }
}


/* 审计日志IP列 */
.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
  min-width: 150px;
  white-space: nowrap;
  font-family: Consolas, "Courier New", monospace;
}
