/* OPC Agent - 创业模拟手游风格 */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #5B6AF0;
  --primary-light: #8B95F5;
  --success: #4ADE80;
  --warning: #FBBF24;
  --danger: #F87171;
  --gold: #FFD700;
  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-surface: #334155;
  --text: #F8FAFC;
  --text-dim: #94A3B8;
  --border: #475569;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* 顶部状态栏 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-frame {
  position: relative;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--gold);
}

.level-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
}

.player-name {
  font-weight: 600;
  font-size: 16px;
}

.player-stage {
  font-size: 12px;
  color: var(--warning);
  font-weight: 500;
}

.bar-right {
  display: flex;
  gap: 8px;
}

.resource-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.resource-pill.cash {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
}

.resource-pill.income {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

/* 财务仪表盘 */
.finance-dashboard {
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.dash-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dash-item {
  text-align: center;
  flex: 1;
}

.dash-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.dash-value {
  font-size: 15px;
  font-weight: 600;
}

.dash-value.negative { color: var(--danger); }
.dash-value.positive { color: var(--success); }

.progress-bar {
  position: relative;
  height: 20px;
  background: var(--bg-surface);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.progress-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* 主内容区 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page {
  display: none;
  padding: 16px;
}

.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

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

.section-title h2 {
  font-size: 20px;
  font-weight: 700;
}

.day-counter {
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-surface);
  padding: 4px 12px;
  border-radius: 12px;
}

.add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 办公室地图 */
.office-map {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.map-room {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.map-room::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.map-room:active {
  transform: scale(0.96);
}

.map-room:hover::before,
.map-room.active::before {
  opacity: 1;
}

.map-room.meeting {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--bg-card), rgba(91, 106, 240, 0.1));
}

.room-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.room-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.room-status {
  font-size: 11px;
  color: var(--text-dim);
}

.room-status.working { color: var(--success); }
.room-status.meeting { color: var(--warning); }

/* 事件列表 */
.events-section {
  margin-bottom: 20px;
}

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

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  border-left: 3px solid var(--primary);
}

.event-item.income { border-left-color: var(--success); }
.event-item.expense { border-left-color: var(--danger); }
.event-item.warning { border-left-color: var(--warning); }

.event-icon {
  font-size: 20px;
}

.event-text {
  flex: 1;
  font-size: 13px;
}

.event-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* 快速操作 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:active {
  transform: scale(0.95);
  background: var(--bg-surface);
}

.btn-icon {
  font-size: 22px;
}

.action-btn span:last-child {
  font-size: 11px;
  font-weight: 500;
}

/* 任务列表 */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

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

.task-name {
  font-weight: 600;
  font-size: 14px;
}

.task-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.task-badge.pending { background: rgba(148, 163, 184, 0.2); color: var(--text-dim); }
.task-badge.running { background: rgba(74, 222, 128, 0.2); color: var(--success); }
.task-badge.completed { background: rgba(91, 106, 240, 0.2); color: var(--primary-light); }

.task-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.task-progress {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.task-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.3s;
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-complete {
  background: var(--success);
  color: #000;
}

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

.btn-reject {
  background: var(--bg-surface);
  color: var(--text-dim);
}

/* 财务页 */
.finance-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.finance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.col-title {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.finance-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.finance-row.total {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 600;
}

.finance-summary {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.summary-row.highlight {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 15px;
}

/* 交易列表 */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.transaction-item:last-child { border-bottom: none; }

.trans-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trans-name {
  font-size: 13px;
  font-weight: 500;
}

.trans-time {
  font-size: 11px;
  color: var(--text-dim);
}

.trans-amount {
  font-size: 14px;
  font-weight: 600;
}

.trans-amount.income { color: var(--success); }
.trans-amount.expense { color: var(--danger); }

/* 投资列表 */
.invest-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invest-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.invest-card:active {
  transform: scale(0.98);
}

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

.invest-name {
  font-weight: 600;
  font-size: 15px;
}

.invest-type {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(91, 106, 240, 0.2);
  color: var(--primary-light);
}

.invest-details {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

.invest-return {
  color: var(--success);
  font-weight: 500;
}

/* 会议列表 */
.meeting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meeting-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

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

.meeting-topic {
  font-weight: 600;
  font-size: 15px;
}

.meeting-time {
  font-size: 12px;
  color: var(--text-dim);
}

.minutes-section, .actions-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.minute-item {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.minute-speaker {
  font-weight: 600;
  color: var(--primary-light);
  min-width: 40px;
}

.action-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.action-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* 底部导航 */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-btn span {
  font-size: 10px;
  font-weight: 500;
}

.nav-btn.active {
  color: var(--primary);
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.btn-cancel, .btn-confirm {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel {
  background: var(--bg-surface);
  color: var(--text-dim);
}

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

/* 表单 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 15px;
}

.type-selector {
  display: flex;
  gap: 8px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}

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

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

.budget-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.budget-input input {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

/* 滚动条 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 响应式 */
@media (min-width: 480px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* 自动化卡片 */
.auto-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auto-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.auto-card:active {
  transform: scale(0.98);
}

.auto-card.owned {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

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

.auto-name {
  font-weight: 600;
  font-size: 14px;
}

.auto-status {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
}

.auto-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.auto-benefit {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
}

/* 外包卡片 */
.outsource-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.outsource-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.outsource-card:active {
  transform: scale(0.98);
}

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

.outsource-name {
  font-weight: 600;
  font-size: 14px;
}

.outsource-cost {
  font-size: 14px;
  color: var(--warning);
  font-weight: 600;
}

.outsource-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* 投资分类标签 */
.invest-category {
  margin-top: 8px;
  font-size: 11px;
  color: var(--primary-light);
  background: rgba(91, 106, 240, 0.15);
  padding: 3px 10px;
  border-radius: 10px;
  display: inline-block;
}

/* 快速操作按钮扩展 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* 聊天区域 */
.chat-section {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.chat-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-section .section-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.voice-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.voice-toggle svg {
  width: 18px;
  height: 18px;
}

.voice-toggle.active {
  background: var(--primary);
  color: #fff;
}

.chat-area {
  height: 200px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 14px;
}

.send-btn, .mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.send-btn:active, .mic-btn:active {
  transform: scale(0.95);
}

.send-btn svg, .mic-btn svg {
  width: 18px;
  height: 18px;
}

.mic-btn {
  background: var(--bg-surface);
  color: var(--text-dim);
}

.mic-btn.recording {
  background: var(--danger);
  color: #fff;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
