/* Mill-Box WF — MUI Design Tokens ベース */
/* MUI v5 デフォルトテーマ準拠: Primary=#1976d2, Error=#d32f2f, Warning=#ed6c02, Success=#2e7d32 */

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

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Roboto', 'Noto Sans JP', sans-serif; font-size: 14px; background: #fafafa; color: rgba(0,0,0,0.87); line-height: 1.5; letter-spacing: 0.00938em; }

/* Layout */
.page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* IA Overview */
.ia-overview { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.12); }
.ia-toggle { padding: 10px 20px; font-size: 13px; color: #1976d2; cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.ia-body { display: none; padding: 0 20px 16px; }
.ia-body.open { display: block; }
.ia-principle { background: #1a237e; color: #fff; border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; font-size: 14px; line-height: 1.7; }
.ia-principle strong { color: #ffb74d; }
.ia-nav-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.ia-nav-table th { background: #1a237e; color: #fff; padding: 8px 12px; text-align: left; font-size: 12px; font-weight: 500; }
.ia-nav-table td { padding: 8px 12px; border-bottom: 1px solid rgba(0,0,0,0.08); background: #fff; }
.ia-roles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.ia-role-card { border-radius: 8px; padding: 16px; background: #fff; border: 1px solid rgba(0,0,0,0.12); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.ia-role-card h4 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.ia-role-card .sub { font-size: 12px; color: rgba(0,0,0,0.6); margin-bottom: 8px; }
.ia-role-card p { font-size: 13px; color: rgba(0,0,0,0.6); line-height: 1.6; }

/* Actor tabs */
.actor-bar { background: #1a237e; display: flex; align-items: center; padding: 0 20px; flex-shrink: 0; }
.actor-tab { padding: 10px 20px; font-size: 14px; color: rgba(255,255,255,0.5); cursor: pointer; border-bottom: 3px solid transparent; font-weight: 500; }
.actor-tab:hover { color: rgba(255,255,255,0.8); }
.actor-tab.active { color: #fff; border-color: #90caf9; }
.actor-tab .actor-icon { margin-right: 4px; }

/* Flow steps */
.flow-bar { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.12); display: flex; padding: 0; flex-shrink: 0; overflow-x: auto; }
.flow-step { flex: 1; padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; text-align: center; transition: background 0.15s; position: relative; }
.flow-step:hover { background: rgba(25,118,210,0.04); }
.flow-step.active { background: rgba(25,118,210,0.08); border-color: #1976d2; }
.flow-step .fs-num { font-size: 11px; color: rgba(0,0,0,0.38); }
.flow-step .fs-label { font-size: 13px; font-weight: 500; margin-top: 2px; color: rgba(0,0,0,0.87); }
.flow-step .fs-desc { font-size: 11px; color: rgba(0,0,0,0.54); margin-top: 2px; }

/* Main area */
.main-area { flex: 1; display: flex; overflow: hidden; }

/* Sidebar — SND環境準拠（白背景・フラットデザイン） */
.sidebar { width: 220px; min-width: 220px; background: #fff; color: rgba(0,0,0,0.87); display: flex; flex-direction: column; border-right: 1px solid rgba(0,0,0,0.12); }
.sb-logo { padding: 14px 16px; font-weight: 500; font-size: 16px; color: #1976d2; border-bottom: 1px solid rgba(0,0,0,0.08); letter-spacing: 0.5px; }
.sb-section { padding: 8px 0 4px; }
.sb-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(0,0,0,0.38); padding: 0 16px 8px; font-weight: 500; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: rgba(0,0,0,0.6); font-size: 14px; cursor: pointer; position: relative; transition: background 0.15s, color 0.15s; border-radius: 0; }
.sb-item:hover { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.87); }
.sb-item.hl { background: rgba(25,118,210,0.08); color: #1976d2; font-weight: 500; }
.sb-item.hl::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#1976d2; }
.sb-badge { background: #1976d2; color: #fff; font-size: 11px; padding: 0 6px; border-radius: 10px; margin-left: auto; min-width: 20px; text-align: center; height: 20px; line-height: 20px; font-weight: 500; }
.sb-badge.red { background: #d32f2f; }
.sb-bottom { margin-top: auto; border-top: 1px solid rgba(0,0,0,0.08); padding: 8px 0; }
.group-selector { padding: 8px 16px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.group-selector select { width: 100%; background: #fff; color: rgba(0,0,0,0.87); border: 1px solid rgba(0,0,0,0.23); border-radius: 4px; padding: 8px 10px; font-size: 13px; cursor: pointer; font-family: inherit; }
.group-selector select:focus { outline: none; border-color: #1976d2; }
.sb-sub { display: none; }
.sb-sub.open { display: block; }
.sb-sub .sb-item { padding-left: 32px; font-size: 13px; }

/* Screen area */
.screen-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.screen { display: none; flex: 1; overflow: hidden; position: absolute; top:0; left:0; right:0; bottom:0; }
.screen.active { display: flex; }

/* Topbar */
.topbar { height: 48px; background: #fff; border-bottom: 1px solid rgba(0,0,0,0.12); display: flex; align-items: center; padding: 0 16px; gap: 12px; flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 500; flex: 1; color: rgba(0,0,0,0.87); }
.btn { padding: 6px 16px; border-radius: 4px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit; text-transform: none; letter-spacing: 0.02857em; transition: background 0.15s, box-shadow 0.15s; }
.btn-primary { background: #1976d2; color: #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.12), 0 2px 2px rgba(0,0,0,0.14); }
.btn-primary:hover { background: #1565c0; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.btn-secondary { background: transparent; color: rgba(0,0,0,0.87); border: 1px solid rgba(0,0,0,0.23); }
.btn-secondary:hover { background: rgba(0,0,0,0.04); }

/* Tabs */
.tabs { display: flex; background: #fff; border-bottom: 1px solid rgba(0,0,0,0.12); padding: 0 16px; flex-shrink: 0; }
.tab { padding: 12px 16px; font-size: 14px; color: rgba(0,0,0,0.6); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font-weight: 500; transition: color 0.15s; }
.tab:hover { color: rgba(0,0,0,0.87); }
.tab.active { color: #1976d2; border-color: #1976d2; }
.tab .cnt { font-size: 11px; background: rgba(25,118,210,0.08); color: #1976d2; padding: 2px 6px; border-radius: 10px; margin-left: 4px; font-weight: 500; }

/* Content */
.content { flex: 1; overflow-y: auto; background: #fafafa; }
.body { padding: 16px; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 1px -1px rgba(0,0,0,0.2), 0 1px 1px 0 rgba(0,0,0,0.14), 0 1px 3px 0 rgba(0,0,0,0.12); }
.tbl th { text-align: left; padding: 10px 16px; font-size: 12px; color: rgba(0,0,0,0.6); font-weight: 500; background: #fafafa; border-bottom: 1px solid rgba(0,0,0,0.12); white-space: nowrap; }
.tbl td { padding: 8px 16px; border-bottom: 1px solid rgba(0,0,0,0.08); font-size: 13px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.hl td { background: rgba(25,118,210,0.04); }
.tbl tr.warn td { background: rgba(237,108,2,0.04); }

/* Badge — MUI Chip風 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 16px; font-size: 12px; font-weight: 500; }
.b-ng { background: #fce4ec; color: #c62828; }
.b-warn { background: #fff3e0; color: #e65100; }
.b-done { background: #e8f5e9; color: #2e7d32; }
.b-auto { background: #ede7f6; color: #4527a0; }
.b-group { background: #e3f2fd; color: #1565c0; }
.b-draft { background: rgba(0,0,0,0.08); color: rgba(0,0,0,0.6); }

/* Callout — MUI Alert風 */
.callout { background: #e3f2fd; border: none; border-left: 4px solid #1976d2; border-radius: 4px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: rgba(0,0,0,0.87); display: flex; gap: 12px; align-items: flex-start; }
.callout .ci { font-size: 18px; flex-shrink: 0; }

/* Detail panel (drawer) — MUI Paper風 */
.drawer { width: 400px; min-width: 400px; background: #fff; border-left: none; display: flex; flex-direction: column; overflow: hidden; position: absolute; right: 0; top: 0; bottom: 0; box-shadow: -2px 0 8px rgba(0,0,0,0.15), -8px 0 24px rgba(0,0,0,0.08); z-index: 10; }
.drawer-header { padding: 16px; border-bottom: 1px solid rgba(0,0,0,0.12); }
.drawer-header h3 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.drawer-meta { font-size: 13px; color: rgba(0,0,0,0.54); }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-section { padding: 16px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.drawer-section-title { font-size: 12px; color: rgba(0,0,0,0.54); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; display: flex; justify-content: space-between; font-weight: 500; }
.drawer-section-title span { color: #1976d2; text-transform: none; letter-spacing: 0; cursor: pointer; font-weight: 500; }
.ms-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.12); margin-bottom: 6px; background: #fafafa; transition: background 0.1s; }
.ms-row:hover { background: rgba(0,0,0,0.04); }
.ms-row .mnum { font-size: 13px; font-weight: 500; flex: 1; }
.ms-row .mmeta { font-size: 12px; color: rgba(0,0,0,0.38); }
.ms-row.missing { border-style: dashed; opacity: 0.5; }
.drawer-footer { padding: 16px; border-top: 1px solid rgba(0,0,0,0.12); display: flex; gap: 8px; flex-wrap: wrap; }

/* Action link — MUI TextButton風 */
.action { font-size: 13px; font-weight: 500; cursor: pointer; }
.action-blue { color: #1976d2; }
.action-blue:hover { text-decoration: underline; }
.action-orange { color: #ed6c02; }
.action-orange:hover { text-decoration: underline; }

/* Card grid — MUI Card風 */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: #fff; border-radius: 8px; border: none; padding: 16px; box-shadow: 0 2px 1px -1px rgba(0,0,0,0.2), 0 1px 1px 0 rgba(0,0,0,0.14), 0 1px 3px 0 rgba(0,0,0,0.12); transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 4px 5px -2px rgba(0,0,0,0.2), 0 3px 4px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12); }
.card-selected { background: rgba(25,118,210,0.04); box-shadow: 0 0 0 2px #1976d2; }
.card-dim { opacity: 0.5; }
.card-title { font-size: 16px; font-weight: 500; color: rgba(0,0,0,0.87); margin-bottom: 4px; }
.card-sub { font-size: 13px; color: rgba(0,0,0,0.54); margin-bottom: 12px; }
.card-bar { display: flex; gap: 4px; margin-bottom: 8px; }
.bar-fill { width: 24px; height: 6px; border-radius: 3px; background: #2e7d32; }
.bar-empty { width: 24px; height: 6px; border-radius: 3px; background: rgba(0,0,0,0.12); }
.card-count { font-size: 14px; color: rgba(0,0,0,0.6); }
.card-count.done { color: #2e7d32; font-weight: 500; }
.card-add { border: 2px dashed rgba(0,0,0,0.12); box-shadow: none; display: flex; align-items: center; justify-content: center; opacity: 0.6; cursor: pointer; }
.card-add:hover { border-color: #1976d2; opacity: 1; }
.card-add span { font-size: 14px; color: rgba(0,0,0,0.38); }
.card-done { border-left: 4px solid #2e7d32; }
.card-progress { border-left: 4px solid #ed6c02; }
.card-danger { border-left: 4px solid #d32f2f; }
.card-highlight { background: #e8f5e9; box-shadow: 0 0 0 2px #2e7d32; }
@keyframes pulse-green { 0%,100%{box-shadow:0 0 0 0 rgba(46,125,50,0.3);} 50%{box-shadow:0 0 0 8px rgba(46,125,50,0);} }
.card-pulse { animation: pulse-green 1.5s ease-in-out 3; }

/* Settings table — MUI Table風 */
.stbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 1px -1px rgba(0,0,0,0.2), 0 1px 1px 0 rgba(0,0,0,0.14), 0 1px 3px 0 rgba(0,0,0,0.12); font-size: 13px; }
.stbl th { text-align: left; padding: 10px 16px; font-size: 12px; color: rgba(0,0,0,0.6); background: #fafafa; border-bottom: 1px solid rgba(0,0,0,0.12); white-space: nowrap; font-weight: 500; }
.stbl td { padding: 10px 16px; border-bottom: 1px solid rgba(0,0,0,0.08); vertical-align: middle; }
.stbl tr:last-child td { border-bottom: none; }
.stbl tr:hover td { background: rgba(0,0,0,0.02); }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search { border: 1px solid rgba(0,0,0,0.23); border-radius: 4px; padding: 8px 12px; font-size: 13px; width: 220px; background: #fff; font-family: inherit; transition: border-color 0.15s; }
.search:focus { outline: none; border-color: #1976d2; box-shadow: 0 0 0 1px #1976d2; }
.filter { border: 1px solid rgba(0,0,0,0.23); border-radius: 4px; padding: 8px 12px; font-size: 13px; background: #fff; color: rgba(0,0,0,0.87); cursor: pointer; font-family: inherit; transition: background 0.15s; }
.filter:hover { background: rgba(0,0,0,0.04); }
.spacer { flex: 1; }

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

/* Hidden elements */
.hide { display: none !important; }

/* 画面遷移アニメーション */
.screen { opacity: 0; transition: opacity 0.2s ease; pointer-events: none; }
.screen.active { opacity: 1; pointer-events: auto; }
.drawer { transform: translateX(100%); transition: transform 0.25s cubic-bezier(0,0,0.2,1); }
.drawer.visible { transform: translateX(0); }
