@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

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

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-secondary: #666;
  --accent: #1a1a1a;
  --accent-light: #f0f0f0;
  --success: #2d7d46;
  --danger: #c0392b;
  --warning: #d68910;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

html, body { height: 100%; overflow: hidden; background: var(--bg); }

body {
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  font-size: 13px;
}

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

/* Top Bar */
#top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.company-name {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.top-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
}

.stat-item { white-space: nowrap; }

/* Nav */
#main-nav {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
#main-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 4px;
  border: none;
  background: none;
  font-size: 11px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 700;
}

/* Content */
#content-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

/* Team Grid */
#team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}

.member-card:active { background: var(--accent-light); }

.member-avatar {
  font-size: 28px;
  text-align: center;
  margin-bottom: 4px;
}

.member-name {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
}

.member-role {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 6px;
}

.member-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.stat-bar-label { width: 28px; color: var(--text-secondary); font-size: 9px; }

.stat-bar-bg {
  flex: 1;
  height: 4px;
  background: var(--accent-light);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: width 0.3s;
}

.member-status {
  font-size: 9px;
  text-align: center;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--text-secondary);
}

.member-status.working { background: #e8f5e9; color: var(--success); }
.member-status.idle { background: #fff3e0; color: var(--warning); }

.member-morale {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 12px;
}

/* Candidates */
#candidates-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.candidate-avatar { font-size: 32px; flex-shrink: 0; }

.candidate-info { flex: 1; }
.candidate-name { font-size: 13px; font-weight: 700; }
.candidate-role { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.candidate-traits { font-size: 10px; color: var(--text-secondary); margin-bottom: 6px; }

.hire-btn {
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
}

.hire-btn:active { opacity: 0.8; }

/* Projects */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}

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

.project-title { font-size: 14px; font-weight: 700; }
.project-genre {
  font-size: 10px;
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 20px;
  color: var(--text-secondary);
}

.project-progress-bar {
  height: 6px;
  background: var(--accent-light);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.project-progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: 3px;
  transition: width 0.5s;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.project-assigned {
  font-size: 11px;
  margin-top: 6px;
  color: var(--text-secondary);
}

.quality-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.quality-S { background: #ffd700; color: #5d4200; }
.quality-A { background: #c8e6c9; color: #1b5e20; }
.quality-B { background: #bbdefb; color: #0d47a1; }
.quality-C { background: #ffe0b2; color: #e65100; }
.quality-D { background: #ffcdd2; color: #b71c1c; }

/* Market */
.trend-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}

.trend-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.trend-bar-bg {
  height: 8px;
  background: var(--accent-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.trend-bar-fill {
  height: 100%;
  background: var(--text);
  border-radius: 4px;
}

.trend-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-secondary);
}

/* Releases */
.release-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}

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

.release-title { font-size: 14px; font-weight: 700; }
.release-revenue { font-size: 13px; font-weight: 700; color: var(--success); }
.release-meta { font-size: 11px; color: var(--text-secondary); }

/* Buttons */
.small-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
}

.small-btn:active { background: var(--accent-light); }

/* Event Ticker */
#event-ticker {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 28px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  animation: toastIn 0.2s ease, toastOut 0.3s ease 2.5s forwards;
  text-align: center;
}

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

/* Modal */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal-overlay.hidden { display: none; }

#modal-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}

#modal-close {
  margin-top: 16px;
  width: 100%;
  padding: 10px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
}

/* Assign panel */
.assign-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.assign-member-row:last-child { border-bottom: none; }
.assign-avatar { font-size: 22px; }
.assign-info { flex: 1; }
.assign-name { font-size: 13px; font-weight: 600; }
.assign-role-label { font-size: 11px; color: var(--text-secondary); }
.assign-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.assign-check.checked {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* New Project Form */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  color: var(--text-secondary);
}

.form-input, .form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.form-select { cursor: pointer; }

.confirm-btn {
  width: 100%;
  padding: 11px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  margin-top: 4px;
}

/* Active projects in office */
.active-proj-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.active-proj-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }

.next-week-btn {
  position: fixed;
  bottom: 36px;
  right: 16px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 22px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Scrollbar */
#content-area::-webkit-scrollbar { width: 4px; }
#content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 30px 0;
  font-size: 13px;
}

.fire-btn {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  margin-top: 8px;
}

.release-btn {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

.stars { color: #f5a623; font-size: 12px; }