* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; background: #f5f5f5; color: #333; display: flex; flex-direction: column; min-height: 100vh; }
.auth-box {
  width: 360px; margin: 100px auto; background: #fff;
  padding: 32px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.1);
}
.auth-box h2 { text-align: center; margin-bottom: 24px; font-size: 20px; }
.auth-box label { display: block; margin-top: 16px; font-size: 14px; color: #555; }
.auth-box input {
  width: 100%; padding: 8px 10px; margin-top: 4px;
  border: 1px solid #ddd; border-radius: 4px; font-size: 14px;
}
.auth-box button {
  width: 100%; margin-top: 24px; padding: 10px;
  background: #4a90d9; color: #fff; border: none;
  border-radius: 4px; font-size: 15px; cursor: pointer;
}
.auth-box button:hover { background: #357abd; }
.auth-box p { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-box a { color: #4a90d9; text-decoration: none; }
.flash {
  background: #fff3cd; border: 1px solid #ffc107;
  padding: 8px 12px; border-radius: 4px; margin-bottom: 12px;
  font-size: 13px; color: #856404;
}
.admin-wrap { max-width: 700px; margin: 40px auto; padding: 0 16px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-size: 20px; }
.btn-back { color: #4a90d9; text-decoration: none; font-size: 14px; }
.user-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.user-table th, .user-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.user-table th { background: #f8f9fa; font-weight: 600; }
.btn-approve { background: #28a745; color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; margin-right: 6px; }
.btn-reject  { background: #dc3545; color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.no-pending { color: #888; text-align: center; padding: 40px; }

/* Main layout */
.main-layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 52px; background: #2c3e50; color: #fff; flex-shrink: 0;
}
.logo { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar-right .username { color: #ccc; }
.btn-admin, .btn-logout, .btn-provider {
  color: #fff; text-decoration: none; padding: 4px 10px;
  border-radius: 4px; font-size: 13px;
}
.btn-admin { background: #3498db; }
.btn-logout { background: #e74c3c; }
.btn-provider {
  border: none; background: #16a085; cursor: pointer;
  font-family: inherit;
}
.btn-provider:hover { background: #138d75; }
.btn-provider:disabled { background: #7f8c8d; cursor: not-allowed; }
.btn-provider.unconfigured { background: #f39c12; }
.content { display: flex; flex: 1; overflow: hidden; }

/* Chat panel */
.chat-panel {
  width: 400px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid #e0e0e0; background: #fafafa;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 90%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble.user { background: #4a90d9; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.bubble.assistant { background: #fff; border: 1px solid #e5e5e5; align-self: flex-start; border-bottom-left-radius: 3px; }
.bubble.thinking { min-width: 56px; min-height: 32px; color: transparent; position: relative; }
.bubble.thinking::after {
  content: '';
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #bbb;
  box-shadow: 14px 0 0 #bbb, 28px 0 0 #bbb;
  animation: thinking-wave 1.2s infinite ease-in-out;
}
@keyframes thinking-wave {
  0%, 60%, 100% { box-shadow: 14px 0 0 #bbb, 28px 0 0 #bbb; background: #bbb; }
  20%            { background: #888; box-shadow: 14px 0 0 #bbb, 28px 0 0 #bbb; }
  40%            { background: #bbb; box-shadow: 14px 0 0 #888, 28px 0 0 #bbb; }
  60%            { background: #bbb; box-shadow: 14px 0 0 #bbb, 28px 0 0 #888; }
}
.chat-input-area { padding: 12px; border-top: 1px solid #e0e0e0; background: #fff; }
.chat-actions { margin-bottom: 8px; }
.btn-new { background: none; border: 1px solid #ccc; padding: 4px 10px; border-radius: 4px; font-size: 13px; cursor: pointer; color: #555; }
.btn-new:hover { background: #f0f0f0; }
#inputBox {
  width: 100%; resize: none; border: 1px solid #ddd; border-radius: 6px;
  padding: 8px 10px; font-size: 14px; font-family: inherit; outline: none;
}
#inputBox:focus { border-color: #4a90d9; }
.btn-send {
  width: 100%; margin-top: 8px; padding: 9px; background: #4a90d9;
  color: #fff; border: none; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-send:hover { background: #357abd; }
.btn-send:disabled { background: #aaa; cursor: not-allowed; }

/* Calendar/Gantt panel */
.calendar-panel { flex: 1; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.calendar-placeholder { display: flex; align-items: center; justify-content: center; flex: 1; color: #bbb; font-size: 15px; }
.calendar-view { flex: 1; overflow: auto; }

/* Gantt layout */
.gantt-wrap { font-size: 13px; display: inline-block; min-width: 100%; }
.gantt-hdr-row {
  display: flex; position: sticky; top: 0; z-index: 10;
  background: #fff; border-bottom: 2px solid #e0e0e0;
}
.gantt-label-hdr {
  width: 200px; flex-shrink: 0;
  position: sticky; left: 0; z-index: 11;
  background: #f8f9fa; padding: 0 12px;
  font-size: 12px; font-weight: 600; color: #2c3e50;
  border-right: 2px solid #d0d0d0;
  display: flex; align-items: center;
}
.gantt-tl-hdr { position: relative; flex-shrink: 0; }
.g-day-hdr {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #666;
  border-right: 1px solid #eee; background: #f8f9fa;
}
.g-we { background: #f0f0f0; color: #bbb; }
.g-today { background: #3498db; color: #fff; font-weight: 700; border-radius: 4px; }
.gantt-task-row { display: flex; border-bottom: 1px solid #f0f0f0; }
.gantt-task-row:hover .gantt-label-cell { background: #f4f9ff; }
.gantt-label-cell {
  width: 200px; flex-shrink: 0;
  position: sticky; left: 0; z-index: 4;
  background: #fff; border-right: 2px solid #d0d0d0;
  padding: 0 10px; display: flex; align-items: center; gap: 8px;
}
.g-proj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.g-label-text { overflow: hidden; min-width: 0; }
.g-label-text b { display: block; font-size: 12px; font-weight: 600; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-label-text small { display: block; font-size: 11px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-tl-body { position: relative; flex-shrink: 0; }
.g-bg-cell { position: absolute; top: 0; bottom: 0; border-right: 1px solid #f0f0f0; }
.g-we-cell { background: #fafafa; }
.g-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #3498db; pointer-events: none; z-index: 3;
}
.gantt-bar {
  position: absolute; top: 8px; height: 30px;
  border-radius: 5px; border-left: 4px solid;
  overflow: hidden; cursor: default; user-select: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  display: flex; align-items: center;
}
.gantt-bar:active { box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.gantt-bar.grabbing { cursor: grabbing; }
.gantt-bar.selected {
  outline: 2px solid #3498db;
  outline-offset: 2px;
  z-index: 5;
  box-shadow: 0 0 0 3px rgba(52,152,219,.25);
}
.g-bar-lbl {
  position: relative; padding: 0 8px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 100%; pointer-events: none;
}
/* Tooltip */
.gantt-tooltip {
  position: fixed; z-index: 9999;
  background: rgba(25,25,35,.88); color: #f0f0f0;
  padding: 9px 13px; border-radius: 7px;
  font-size: 12px; line-height: 1.75;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.gantt-tooltip b { color: #fff; font-size: 13px; }

/* Gantt toolbar */
.gantt-toolbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 5px 14px; border-bottom: 1px solid #eee;
  background: #fafafa; flex-shrink: 0; min-height: 34px;
}
.gantt-hint { font-size: 11px; color: #bbb; }
.btn-save-gantt {
  display: none;
}

/* Inline name edit */
.g-inline-input {
  border: none; outline: none;
  border-bottom: 2px solid #3498db;
  background: rgba(255,255,255,.95);
  font-size: 11px; font-weight: 600;
  width: 100%; padding: 1px 2px; border-radius: 2px;
}
.g-proj-input { font-size: 13px; font-weight: 600; color: #2c3e50; }
.g-proj-name { cursor: text; }

/* Admin extra */
.action-cell { white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.tag-pending  { background: #fff3cd; color: #856404; }
.tag-approved { background: #d1f5e0; color: #1a7a4a; }
.tag-suspended{ background: #f0e6ff; color: #7b2d8b; }
.tag-rejected { background: #fde8e8; color: #c0392b; }
.btn-suspend { background: #f39c12; color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; margin-right: 6px; }
.btn-delete  { background: #888;    color: #fff; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* Ended projects tabs */
.gantt-tabs { display: flex; gap: 0; border: 1px solid #ddd; border-radius: 5px; overflow: hidden; }
.g-tab { padding: 3px 12px; font-size: 12px; cursor: pointer; color: #888; background: #fff;
  border-right: 1px solid #ddd; user-select: none; }
.g-tab:last-child { border-right: none; }
.g-tab:hover { background: #f0f0f0; }
.g-tab.active { background: #3498db; color: #fff; font-weight: 600; cursor: default; }
.g-tab.disabled { color: #ccc; cursor: default; }
.g-tab.disabled:hover { background: #fff; }
.tab-badge { display: inline-block; border-radius: 8px; padding: 0 5px; font-size: 10px;
  margin-left: 3px; background: rgba(0,0,0,.08); }
.g-tab.active .tab-badge { background: rgba(255,255,255,.25); }
/* Ended projects list */
.ended-list { padding: 16px 20px; overflow-y: auto; flex: 1; }
.ended-proj { margin-bottom: 18px; }
.ended-proj-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ended-proj-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ended-proj-name { font-size: 14px; font-weight: 600; color: #2c3e50; }
.ended-proj-count { font-size: 12px; color: #999; }
.ended-task { display: flex; align-items: center; padding: 4px 0 4px 18px;
  font-size: 13px; border-bottom: 1px solid #f5f5f5; }
.ended-task-name { flex: 1; color: #333; }
.ended-task-date { color: #888; font-size: 12px; }
.ended-task-dur { color: #aaa; font-size: 11px; margin-left: 8px; min-width: 36px; text-align: right; }

/* Footer / 备案号 */
.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 10px 0;
  flex-shrink: 0;
  background: #f5f5f5;
  border-top: 1px solid #e5e5e5;
}
.site-footer a {
  color: #999;
  text-decoration: none;
  font-size: 12px;
}
.site-footer a:hover { color: #666; }
