:root {
  /* GitHub Color System */
  --color-canvas-default: #ffffff;
  --color-canvas-subtle: #f6f8fa;
  --color-border-default: #d0d7de;
  --color-border-muted: #d8dee4;
  --color-fg-default: #24292f;
  --color-fg-muted: #57606a;
  --color-fg-subtle: #6e7781;
  --color-accent-fg: #0969da;
  --color-accent-emphasis: #0969da;
  --color-success-fg: #1a7f37;
  --color-success-emphasis: #2da44e;
  --color-danger-fg: #cf222e;
  --color-danger-emphasis: #cf222e;
  --color-header-bg: #24292f;
  --color-header-text: #ffffff;
  
  /* App Mappings */
  --app-bg: var(--color-canvas-default);
  --app-card-bg: var(--color-canvas-default);
  --app-text: var(--color-fg-default);
  --app-text-secondary: var(--color-fg-muted);
  --app-border: var(--color-border-default);
  --app-primary: var(--color-accent-fg);
  --app-primary-hover: #0a56ad;
  --app-danger: var(--color-danger-fg);
  --app-success: var(--color-success-emphasis);
  --app-radius: 6px;
  
  /* GitHub style border & shadow */
  --app-card-border: 1px solid var(--color-border-default);
  --app-box-shadow: none;
  
  --header-height: 48px;
}

body {
  background: var(--app-bg);
  color: var(--app-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 14px;
  line-height: 1.5;
}

/* 导航栏 - GitHub Header */
.app-navbar {
  background: var(--color-header-bg) !important;
  padding: 0 32px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: none;
}

.app-navbar .navbar-brand {
  font-weight: 600;
  font-size: 16px;
  color: #fff !important;
  margin-right: 24px;
  display: flex;
  align-items: center;
}

/* Custom Logo SVG */
.app-navbar .navbar-brand::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  background-color: #fff;
  margin-right: 24px;
  mask: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M854.4 512V256a83.2 83.2 0 0 0-25.28-61.12A83.2 83.2 0 0 0 768 169.6H256a83.2 83.2 0 0 0-61.12 25.28A83.2 83.2 0 0 0 169.6 256v512c0 23.872 8.448 44.224 25.28 61.12A83.2 83.2 0 0 0 256 854.4h256a41.6 41.6 0 1 1 0 83.2H256a163.392 163.392 0 0 1-119.936-49.664A163.392 163.392 0 0 1 86.4 768V256c0-46.848 16.576-86.784 49.664-119.936A163.392 163.392 0 0 1 256 86.4h512c46.848 0 86.784 16.576 119.936 49.664 33.088 33.152 49.664 73.088 49.664 119.936v256a41.6 41.6 0 1 1-83.2 0z'/%3E%3Cpath d='M278.4 896V320h83.2v576h-83.2z'/%3E%3Cpath d='M128 278.4h768v83.2H128v-83.2z'/%3E%3Cpath d='M794.432 669.952a12.8 12.8 0 0 0 7.616 7.616l125.504 46.4a12.8 12.8 0 0 1 0 24.064l-125.504 46.4a12.8 12.8 0 0 0-7.616 7.616l-46.4 125.504a12.8 12.8 0 0 1-24.064 0l-46.4-125.504a12.8 12.8 0 0 0-7.616-7.616l-125.504-46.4a12.8 12.8 0 0 1 0-24.064l125.504-46.4a12.8 12.8 0 0 0 7.616-7.616l46.4-125.504a12.8 12.8 0 0 1 24.064 0l46.4 125.504z'/%3E%3C/svg%3E") no-repeat center/contain;
  -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M854.4 512V256a83.2 83.2 0 0 0-25.28-61.12A83.2 83.2 0 0 0 768 169.6H256a83.2 83.2 0 0 0-61.12 25.28A83.2 83.2 0 0 0 169.6 256v512c0 23.872 8.448 44.224 25.28 61.12A83.2 83.2 0 0 0 256 854.4h256a41.6 41.6 0 1 1 0 83.2H256a163.392 163.392 0 0 1-119.936-49.664A163.392 163.392 0 0 1 86.4 768V256c0-46.848 16.576-86.784 49.664-119.936A163.392 163.392 0 0 1 256 86.4h512c46.848 0 86.784 16.576 119.936 49.664 33.088 33.152 49.664 73.088 49.664 119.936v256a41.6 41.6 0 1 1-83.2 0z'/%3E%3Cpath d='M278.4 896V320h83.2v576h-83.2z'/%3E%3Cpath d='M128 278.4h768v83.2H128v-83.2z'/%3E%3Cpath d='M794.432 669.952a12.8 12.8 0 0 0 7.616 7.616l125.504 46.4a12.8 12.8 0 0 1 0 24.064l-125.504 46.4a12.8 12.8 0 0 0-7.616 7.616l-46.4 125.504a12.8 12.8 0 0 1-24.064 0l-46.4-125.504a12.8 12.8 0 0 0-7.616-7.616l-125.504-46.4a12.8 12.8 0 0 1 0-24.064l125.504-46.4a12.8 12.8 0 0 0 7.616-7.616l46.4-125.504a12.8 12.8 0 0 1 24.064 0l46.4 125.504z'/%3E%3C/svg%3E") no-repeat center/contain;
}

.app-navbar .nav-link {
  color: #fff !important;
  font-weight: 600;
  font-size: 14px;
  padding: 0 8px !important;
  margin-right: 8px;
  opacity: 0.75;
  transition: opacity 0.2s;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  opacity: 1;
  background: transparent;
}

/* 主容器 */
.app-main {
  padding: 32px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 0;
  border-bottom: none;
}

.page-title {
  font-size: 24px;
  font-weight: 400;
  color: var(--app-text);
  margin: 24px 0px 0px 0px;
}

.page-back {
  color: var(--app-primary);
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
}

.page-back:hover {
  text-decoration: underline;
}

.justify-content-center {
  margin-top: 10%;
}

/* 卡片样式 - Boxed Style */
.app-card {
  background: var(--app-card-bg);
  border: var(--app-card-border);
  border-radius: var(--app-radius);
  box-shadow: none;
  padding: 0;
  margin-bottom: 24px;
  padding-bottom: 4px;
  overflow: hidden;
}

/* 内容区域 padding */
.app-card > .card-body,
.app-card > *:not(table):not(.table-responsive):not(.table) {
  padding: 24px 24px 0px 24px;
}

.app-card-public-password {
  background: var(--app-card-bg);
  border: var(--app-card-border);
  border-radius: var(--app-radius);
  box-shadow: none;
  margin-bottom: 24px;
  padding-bottom: 24px !important;
  overflow: hidden;
  padding: 0px 24px 0px 24px;
}

.app-card-login-card {
  background: var(--app-card-bg);
  border: var(--app-card-border);
  border-radius: var(--app-radius);
  box-shadow: none;
  margin-bottom: 24px;
  padding-bottom: 24px !important;
  overflow: hidden;
  padding: 0px 24px 0px 24px;
}

/* 表格优化 - Boxed Table */
.table-modern {
  width: 100%;
  margin-bottom: 0;
  color: var(--app-text);
  border-collapse: collapse;
}

.table-modern thead th {
  background: var(--color-canvas-subtle);
  border-bottom: 1px solid var(--app-border);
  color: var(--app-text);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.table-modern td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--app-border);
  border-top: none;
  color: var(--color-fg-muted);
  font-size: 14px;
  vertical-align: middle;
  white-space: nowrap;
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-modern tbody tr:hover td {
  background: var(--color-canvas-subtle);
}

/* 卡片网格布局 */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* 项目卡片 */
.project-card {
  background: var(--app-card-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  transition: all 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  border-color: var(--color-border-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.project-card-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border-muted);
  background-color: var(--color-canvas-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--app-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title a {
  color: inherit;
  text-decoration: none;
}

.project-title a:hover {
  color: var(--app-primary);
  text-decoration: underline;
}

.project-card-body {
  padding: 16px;
  flex: 1;
}

.project-meta {
  font-size: 13px;
  color: var(--color-fg-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.project-meta i {
  width: 16px;
  margin-right: 8px;
  text-align: center;
}

.project-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-muted);
  background-color: #fff;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 空状态卡片 */
.empty-state-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  background: var(--app-card-bg);
  border: 1px dashed var(--app-border);
  border-radius: var(--app-radius);
  color: var(--color-fg-muted);
}

/* 按钮样式 - GitHub Buttons */
.btn {
  border-radius: 6px;
  padding: 5px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  border: 1px solid;
  transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  box-shadow: 0 1px 0 rgba(27,31,36,0.04), inset 0 1px 0 rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Primary Button (Green) */
.btn-primary {
  color: #ffffff;
  background-color: #2da44e;
  border-color: rgba(27,31,36,0.15);
  box-shadow: 0 1px 0 rgba(27,31,36,0.1);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #2c974b;
  border-color: rgba(27,31,36,0.15);
  color: #ffffff;
}

/* Secondary Button (Gray) */
.btn-secondary, .btn-default {
  color: #24292f;
  background-color: #f6f8fa;
  border-color: rgba(27,31,36,0.15);
  margin-right: 12px;
}

.btn-secondary:hover, .btn-default:hover {
  color: #24292f; /* Ensure text color stays dark */
  background-color: #f3f4f6;
  border-color: rgba(27,31,36,0.15);
}

/* Text Button (Link style) */
.text-btn {
  color: var(--app-text-secondary);
  background: transparent;
  border: none;
  /* padding: 4px 8px; */
  padding: 4px 8px 4px 0px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  border-radius: 4px;
  font-weight: 500;
  box-shadow: none;
}

.text-btn:hover {
  color: var(--app-primary);
  background: transparent;
  text-decoration: none;
}

.text-btn-danger {
  color: var(--app-danger);
}

.text-btn-danger:hover {
  color: #a40e26;
  background: transparent;
  text-decoration: underline;
}

.table-actions form {
  margin: 0;
  display: inline-block;
}

.table-actions form button.text-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  box-shadow: none;
}

/* Drawer 抽屉组件 - Refined */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4); /* Darker overlay for focus */
  opacity: 0;
  transition: opacity 0.25s;
  backdrop-filter: blur(1px); /* Slight blur */
}

.drawer.open .drawer-overlay {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 960px;
  max-width: 90vw;
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12); /* More depth */
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth easing */
  display: flex;
  flex-direction: column;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 32px; /* More breathing room */
  background-color: #fff; /* Clean white header */
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title {
  margin: 0;
  font-size: 18px; /* Larger title */
  font-weight: 600;
  color: var(--app-text);
  line-height: 1.2;
}

.drawer-close {
  background: transparent;
  border: 1px solid transparent;
  font-size: 24px;
  color: var(--app-text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
  outline: none;
}

.drawer-close:hover {
  background-color: var(--color-canvas-subtle);
  color: var(--app-text);
}

.drawer-body {
  flex: 1;
  padding: 0;
  overflow-y: auto;
  background-color: #fff;
}

/* 抽屉内内容适配 */
.drawer-body .app-card,
.modal-body .app-card {
  border: none;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
}

/* Modal 内的内容适配 */
.modal-body .app-card > .card-body,
.modal-body .app-card > form {
    padding: 0 !important;
}

/* 抽屉内表格样式微调 */
.drawer-body .table-modern {
  border: none;
}

.drawer-body .table-modern thead th {
  background: #fff; /* White header inside drawer */
  border-bottom: 2px solid var(--app-border); /* Stronger separator */
  padding-left: 32px; /* Align with drawer padding */
}

/* 优化：原型名称左移 */
.drawer-body .table-modern thead th:first-child,
.drawer-body .table-modern td:first-child {
  padding-left: 20px !important;
}

/* 优化：操作列表头对齐按钮文本 (32px + 8px btn padding) */
.drawer-body .table-modern thead th:last-child {
  padding-left: 40px !important;
}

.drawer-body .table-modern td {
  padding-left: 32px;
  border-bottom: 1px solid var(--color-border-muted);
}

.drawer-body .table-modern th:last-child,
.drawer-body .table-modern td:last-child {
  padding-right: 32px;
}

/* 抽屉内的操作栏 */
.drawer-body > .d-flex.justify-content-end {
    padding: 24px 32px 8px; /* Match header padding */
}

/* 表单样式优化 (GitHub Style) */
.form-group, .mb-3 {
  margin-bottom: 16px !important;
}

label, .form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--app-text);
}

.form-control {
  display: block;
  width: 100%;
  padding: 5px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--app-text);
  background-color: var(--color-canvas-default);
  background-clip: padding-box;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--app-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

.form-text, .text-muted, .help-block {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-fg-muted) !important;
}

/* Checkbox & Radio alignment */
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.form-check-input {
  margin-top: 0;
  margin-right: 8px;
  cursor: pointer;
}

.form-check-label {
  margin-bottom: 0;
  font-weight: 400;
  cursor: pointer;
}

/* Drop Zone Refined - 覆盖原生 Input */
.drop-zone {
  position: relative; /* 关键：用于绝对定位 input */
  border: 1px dashed var(--app-border);
  border-radius: 6px;
  background: var(--color-canvas-subtle);
  transition: all 0.2s;
  padding: 40px 0;
  margin: 16px 0;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone--over {
  border-color: var(--app-primary);
  background: #f0f6fc;
}

/* 隐藏原生 Input 但覆盖整个区域以捕获点击 */
.drop-zone__input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-zone__prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--app-text-secondary);
  font-weight: 500;
  z-index: 1;
}

/* 添加上传图标 */
.drop-zone__prompt::before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  background-color: var(--color-fg-muted);
  mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z'/%3E%3C/svg%3E") no-repeat center/contain;
  -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z'/%3E%3C/svg%3E") no-repeat center/contain;
  opacity: 0.5;
}

.drop-zone:hover .drop-zone__prompt::before {
  background-color: var(--app-primary);
  opacity: 1;
}

.drop-zone__filename {
  font-weight: 600;
  color: var(--app-text);
  margin-top: 8px;
}

/* Helper utility */
.pointer-events-none {
  pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-muted);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-fg-muted);
}
::-webkit-scrollbar-track {
  background: transparent;
}

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