* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #303133;
}

.hidden {
  display: none !important;
}

/* Login Page */
#login-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h2 {
  color: #409eff;
  font-size: 24px;
}

.login-form .form-item {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 8px;
  color: #606266;
  font-size: 14px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
}

.login-form input:focus {
  outline: none;
  border-color: #409eff;
}

.login-form .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-form .checkbox input {
  width: auto;
}

.login-form .checkbox label {
  margin-bottom: 0;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background-color: #409eff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-primary:hover {
  background-color: #66b1ff;
}

.login-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #ebeef5;
  text-align: center;
  color: #909399;
  font-size: 14px;
}

/* Main App */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Bar: Title + Nav + User */
.top-bar {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 0 20px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.logo a {
  font-size: 18px;
  font-weight: bold;
  color: #409eff;
  text-decoration: none;
}

.top-nav {
  flex: 1;
  margin: 0 20px;
}

.nav-menu {
  list-style: none;
  display: flex;
  height: 50px;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  height: 100%;
}

.nav-item > a {
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: #606266;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
  height: 100%;
  border-bottom: 2px solid transparent;
}

.nav-item:hover > a,
.nav-item.active > a {
  color: #409eff;
  border-bottom-color: #409eff;
}

.nav-item.has-submenu > a::after {
  content: '▼';
  margin-left: 6px;
  font-size: 10px;
  transition: transform 0.3s;
}

.nav-item.has-submenu:hover > a::after {
  transform: rotate(180deg);
}

/* Submenu - dropdown style */
.submenu {
  list-style: none;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  z-index: 100;
  padding: 5px 0;
}

.nav-item.has-submenu:hover > .submenu {
  display: block;
}

.submenu li {
  position: relative;
}

/* Hide third-level menus by default */
.submenu li.has-submenu .submenu {
  display: none;
}

/* Show third-level menu only when hovering the parent li */
.submenu li.has-submenu:hover > .submenu {
  display: block;
}

.submenu li a {
  display: block;
  padding: 10px 20px;
  color: #606266;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
}

.submenu li a:hover {
  color: #409eff;
  background-color: #ecf5ff;
}

/* Third level submenu */
.submenu li.has-submenu > a::after {
  content: '▶';
  float: right;
  font-size: 10px;
  margin-left: 10px;
}

.submenu li .submenu {
  top: 0;
  left: 100%;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #606266;
}

/* Tabs Bar */
.tabs-bar {
  background-color: #f5f7fa;
  border-bottom: 1px solid #e4e7ed;
  padding: 6px 10px 0;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  z-index: 98;
  display: flex;
  align-items: flex-start;
}

.tabs-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  width: 100%;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  color: #606266;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.tab-item.active {
  color: #409eff;
  font-weight: 500;
  border-color: #e4e7ed;
  border-bottom: 1px solid #f5f7fa;
  margin-bottom: -1px;
}

.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: #909399;
  transition: all 0.2s;
}

.tab-close:hover {
  background-color: #409eff;
  color: #fff;
}

.nav-menu {
  list-style: none;
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  height: 100%;
}

.nav-item > a {
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: #bfcbd9;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
  height: 100%;
  border-right: 1px solid #3a4a5e;
}

.nav-item:hover > a,
.nav-item.active > a {
  color: #409eff;
  background-color: #263445;
}

.nav-item.has-submenu > a::after {
  content: '▼';
  margin-left: 8px;
  font-size: 10px;
  transition: transform 0.3s;
}

.nav-item.has-submenu:hover > a::after {
  transform: rotate(180deg);
}

/* Submenu - dropdown style */
.submenu {
  list-style: none;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  z-index: 100;
  padding: 5px 0;
}

.nav-item.has-submenu:hover > .submenu {
  display: block;
}

.submenu li {
  position: relative;
}

/* Hide third-level menus by default */
.submenu li.has-submenu .submenu {
  display: none;
}

/* Show third-level menu only when hovering the parent li */
.submenu li.has-submenu:hover > .submenu {
  display: block;
}

.submenu li a {
  display: block;
  padding: 10px 20px;
  color: #606266;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
}

.submenu li a:hover {
  color: #409eff;
  background-color: #ecf5ff;
}

/* Third level submenu */
.submenu li.has-submenu > a::after {
  content: '▶';
  float: right;
  font-size: 10px;
  margin-left: 10px;
}

.submenu li .submenu {
  top: 0;
  left: 100%;
}

.submenu li.has-submenu:hover .submenu {
  display: block;
}

/* Content Area */
.app-content {
  margin-left: 0;
  margin-top: 130px;
  padding: 20px;
  flex: 1;
}

.content-page {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 24px;
  color: #303133;
}

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.stat-title {
  font-size: 14px;
  color: #909399;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 10px;
}

.stat-detail {
  font-size: 13px;
  color: #909399;
  margin-top: 5px;
}

/* Dashboard Sections */
.dashboard-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.section {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.section h3 {
  font-size: 16px;
  color: #303133;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ebeef5;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.stat-item {
  text-align: center;
  padding: 10px;
}

.stat-number {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #409eff;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: #909399;
  margin-top: 5px;
}

.reports {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: #f5f7fa;
  border-radius: 4px;
}

.report-item input[type="month"] {
  padding: 6px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
}

/* Table */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
}

.data-table th {
  background-color: #f5f7fa;
  font-weight: 600;
  color: #606266;
  font-size: 14px;
}

.data-table td {
  font-size: 14px;
  color: #606266;
}

.data-table tbody tr:hover {
  background-color: #f5f7fa;
}

.placeholder {
  text-align: center;
  padding: 60px 20px;
  color: #909399;
  font-size: 16px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background: white;
  padding: 30px;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #909399;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #606266;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #409eff;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-secondary {
  padding: 10px 20px;
  background-color: #fff;
  border: 1px solid #dcdfe6;
  color: #606266;
  border-radius: 4px;
  cursor: pointer;
}

.btn-primary {
  padding: 10px 20px;
  background-color: #409eff;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #66b1ff;
}

.btn-edit {
  padding: 6px 12px;
  background-color: #409eff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 6px;
  font-size: 12px;
}

.btn-delete {
  padding: 6px 12px;
  background-color: #f56c6c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .app-nav {
    width: 100%;
    position: relative;
    padding-top: 0;
  }
  
  .app-content {
    margin-left: 0;
  }
  
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
}
